-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cadence breaking changes #2
Comments
Hi @sidenijia I have updated the new way to add the public key. |
@lmcmz I think I found out why this isn't working. Cadence I'm not sure it's feasible for this to be fixed in Cadence at this point, but I'll see. Maybe the Swift SDK could have a function Have you run into this problem before @sideninja? |
@psiemens Gotcha, in swift SDK, there is one for
Yep, it works now after switching to index. Let me finish the rest of the change. :) |
Hi @psiemens and @sideninja Is there a way to pass https://github.com/onflow/sdks/blob/main/templates/cadence/add-account-key.cdc#L3 |
This is what {
"type": "Struct",
"value": {
"id": "I.Crypto.Crypto.KeyListEntry",
"fields": [
{
"name": "keyIndex",
"value": {
"type": "Int",
"value": "1000"
}
},
{
"name": "publicKey",
"value": {
"type": "Struct",
"value": {
"id": "PublicKey",
"fields": [
{
"name": "publicKey",
"value": {
"type": "Array",
"value": [
{
"type": "UInt8",
"value": "141"
},
{
"type": "UInt8",
"value": "166"
},
{
"type": "UInt8",
"value": "11"
},
{
"type": "UInt8",
"value": "217"
},
{
"type": "UInt8",
"value": "138"
},
{
"type": "UInt8",
"value": "130"
},
{
"type": "UInt8",
"value": "124"
},
{
"type": "UInt8",
"value": "135"
},
{
"type": "UInt8",
"value": "226"
},
{
"type": "UInt8",
"value": "22"
},
{
"type": "UInt8",
"value": "34"
},
{
"type": "UInt8",
"value": "197"
},
{
"type": "UInt8",
"value": "7"
},
{
"type": "UInt8",
"value": "10"
},
{
"type": "UInt8",
"value": "227"
},
{
"type": "UInt8",
"value": "238"
},
{
"type": "UInt8",
"value": "68"
},
{
"type": "UInt8",
"value": "10"
},
{
"type": "UInt8",
"value": "191"
},
{
"type": "UInt8",
"value": "9"
},
{
"type": "UInt8",
"value": "39"
},
{
"type": "UInt8",
"value": "213"
},
{
"type": "UInt8",
"value": "219"
},
{
"type": "UInt8",
"value": "51"
},
{
"type": "UInt8",
"value": "249"
},
{
"type": "UInt8",
"value": "101"
},
{
"type": "UInt8",
"value": "44"
},
{
"type": "UInt8",
"value": "177"
},
{
"type": "UInt8",
"value": "48"
},
{
"type": "UInt8",
"value": "62"
},
{
"type": "UInt8",
"value": "184"
},
{
"type": "UInt8",
"value": "160"
},
{
"type": "UInt8",
"value": "77"
},
{
"type": "UInt8",
"value": "254"
},
{
"type": "UInt8",
"value": "65"
},
{
"type": "UInt8",
"value": "222"
},
{
"type": "UInt8",
"value": "162"
},
{
"type": "UInt8",
"value": "201"
},
{
"type": "UInt8",
"value": "234"
},
{
"type": "UInt8",
"value": "100"
},
{
"type": "UInt8",
"value": "238"
},
{
"type": "UInt8",
"value": "131"
},
{
"type": "UInt8",
"value": "238"
},
{
"type": "UInt8",
"value": "141"
},
{
"type": "UInt8",
"value": "124"
},
{
"type": "UInt8",
"value": "141"
},
{
"type": "UInt8",
"value": "6"
},
{
"type": "UInt8",
"value": "141"
},
{
"type": "UInt8",
"value": "184"
},
{
"type": "UInt8",
"value": "56"
},
{
"type": "UInt8",
"value": "108"
},
{
"type": "UInt8",
"value": "123"
},
{
"type": "UInt8",
"value": "171"
},
{
"type": "UInt8",
"value": "152"
},
{
"type": "UInt8",
"value": "105"
},
{
"type": "UInt8",
"value": "74"
},
{
"type": "UInt8",
"value": "249"
},
{
"type": "UInt8",
"value": "86"
},
{
"type": "UInt8",
"value": "224"
},
{
"type": "UInt8",
"value": "253"
},
{
"type": "UInt8",
"value": "174"
},
{
"type": "UInt8",
"value": "55"
},
{
"type": "UInt8",
"value": "24"
},
{
"type": "UInt8",
"value": "78"
}
]
}
},
{
"name": "signatureAlgorithm",
"value": {
"type": "Enum",
"value": {
"id": "SignatureAlgorithm",
"fields": [
{
"name": "rawValue",
"value": {
"type": "UInt8",
"value": "1"
}
}
]
}
}
}
]
}
}
},
{
"name": "hashAlgorithm",
"value": {
"type": "Enum",
"value": {
"id": "HashAlgorithm",
"fields": [
{
"name": "rawValue",
"value": {
"type": "UInt8",
"value": "3"
}
}
]
}
}
},
{
"name": "weight",
"value": {
"type": "UFix64",
"value": "1000.00000000"
}
},
{
"name": "isRevoked",
"value": {
"type": "Bool",
"value": false
}
}
]
}
} Here's how the Go SDK creates it: https://github.com/onflow/flow-go-sdk/blob/1790a76727094d755ff2a2a2007be36500216421/templates/accounts.go#L102-L131 If this is too much code, you can split a key list entry into pieces (e.g. public key, hash algo, sig algo) and then reassemble it in the Cadence transaction. |
[Transfer from: https://github.com/zed-io/flow-swift/issues/7]
Overview
A new version of Cadence will cause some breaking changes in this SDK. It's important that those changes are addressed in a timely manner (by the end of the month) or else it will break the software using the SDK.
Breaking Change
This SDK is using a deprecated API for adding keys to the account.
DEPRECATED
account.addPublicKey()
NEW
account.keys.add()
Refactor
The cadence templates should be changed according to the account key documentation found here. We have already prepared those templates for you and they can be found here.
If you need any help implementing the changes you can always reach out to me directly on discord or here (both places with sideninja nick).
The text was updated successfully, but these errors were encountered: