Skip to content

Commit

Permalink
Merge pull request #1220 from nozim/contract-hex2utf8
Browse files Browse the repository at this point in the history
Replace contract body encoding from hex to utf8
  • Loading branch information
chasefleming authored Sep 28, 2023
2 parents 166d65a + f2f9fb9 commit 24caae4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions flowkit/flowkit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ func TestProject(t *testing.T) {

argCode := tx.Arguments[1]
decodeCode, _ := jsoncdc.Decode(nil, argCode)
code, _ := hex.DecodeString(decodeCode.ToGoValue().(string))
code := decodeCode.ToGoValue().(string)

argName := tx.Arguments[0]
decodeName, _ := jsoncdc.Decode(nil, argName)
Expand Down Expand Up @@ -1135,7 +1135,7 @@ func TestProject(t *testing.T) {

argCode := tx.Arguments[1]
decodeCode, _ := jsoncdc.Decode(nil, argCode)
code, _ := hex.DecodeString(decodeCode.ToGoValue().(string))
code, _ := decodeCode.ToGoValue().(string)

argName := tx.Arguments[0]
decodeName, _ := jsoncdc.Decode(nil, argName)
Expand Down
4 changes: 2 additions & 2 deletions flowkit/transactions/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ func addAccountContractWithArgs(
const addAccountContractTemplate = `
transaction(name: String, code: String %s) {
prepare(signer: AuthAccount) {
signer.contracts.add(name: name, code: code.decodeHex() %s)
signer.contracts.add(name: name, code: code.utf8 %s)
}
}`

cadenceName := cadence.String(contract.Name)
cadenceCode := cadence.String(contract.SourceHex())
cadenceCode := cadence.String(contract.Source)

tx := flow.NewTransaction().
AddRawArgument(jsoncdc.MustEncode(cadenceName)).
Expand Down

0 comments on commit 24caae4

Please sign in to comment.