F
Flow3mo ago
NiAlexSan

Alex Ni | Flow 4D (2024-08-23)

is there any example of how to pass account keys to a transaction in go? previously the was something like
flow.NewTransaction().
SetScript(script).
AddAuthorizer(creatorAddress).
AddRawArgument(jsoncdc.MustEncode(bytesToCadenceArray(a.partialAdminAccountKey.Encode())))
flow.NewTransaction().
SetScript(script).
AddAuthorizer(creatorAddress).
AddRawArgument(jsoncdc.MustEncode(bytesToCadenceArray(a.partialAdminAccountKey.Encode())))
but not it doesn't seem to work correctly
3 Replies
Needle
Needle3mo ago
I've created a thread for your message. Please continue any relevant discussion in this thread. You can rename this thread using /title <new title> If this is a technical question that others may benefit from, considering also asking it on Stackoverflow: https://stackoverflow.com/questions/ask?tags=onflow-cadence
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
NiAlexSan
NiAlexSan3mo ago
for the future reference, this code works:
sdktemplates "github.com/onflow/flow-go-sdk/templates"
...
pAdminKey, err := sdktemplates.AccountKeyToCadenceCryptoKey(a.partialAdminAccountKey)
if err != nil {
panic("could not convert partialAdminAccountKey")
}
...

AddRawArgument(jsoncdc.MustEncode(pAdminKey)).
sdktemplates "github.com/onflow/flow-go-sdk/templates"
...
pAdminKey, err := sdktemplates.AccountKeyToCadenceCryptoKey(a.partialAdminAccountKey)
if err != nil {
panic("could not convert partialAdminAccountKey")
}
...

AddRawArgument(jsoncdc.MustEncode(pAdminKey)).
Want results from more Discord servers?
Add your server