From ef0d41c2ad10e8124a6754adbd606a566aed2563 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Wed, 13 Sep 2023 10:24:40 -0700 Subject: [PATCH] use .utf8 instead of hex-encoding and .decodeHex() --- templates/cadence/add-contract.cdc | 2 +- templates/cadence/create-account-simple.cdc | 2 +- templates/cadence/create-account.cdc | 5 ++--- templates/cadence/create-and-fund-account.cdc | 2 +- templates/cadence/update-contract.cdc | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/templates/cadence/add-contract.cdc b/templates/cadence/add-contract.cdc index d2cdd82..2c4f6eb 100644 --- a/templates/cadence/add-contract.cdc +++ b/templates/cadence/add-contract.cdc @@ -1,5 +1,5 @@ transaction(name: String, code: String) { prepare(signer: AuthAccount) { - signer.contracts.add(name: name, code: code.decodeHex()) + signer.contracts.add(name: name, code: code.utf8) } } diff --git a/templates/cadence/create-account-simple.cdc b/templates/cadence/create-account-simple.cdc index 5a1b5cb..58f6176 100644 --- a/templates/cadence/create-account-simple.cdc +++ b/templates/cadence/create-account-simple.cdc @@ -20,7 +20,7 @@ transaction(publicKeys: [String], sigAlgos: [SignatureAlgorithm], hashAlgos: [Ha } for contract in contracts.keys { - acct.contracts.add(name: contract, code: contracts[contract]!.decodeHex()) + acct.contracts.add(name: contract, code: contracts[contract]!.utf8) } } } diff --git a/templates/cadence/create-account.cdc b/templates/cadence/create-account.cdc index 8ba25b6..b53e69f 100644 --- a/templates/cadence/create-account.cdc +++ b/templates/cadence/create-account.cdc @@ -8,11 +8,10 @@ transaction(publicKeys: [Crypto.KeyListEntry], contracts: {String: String}) { for key in publicKeys { account.keys.add(publicKey: key.publicKey, hashAlgorithm: key.hashAlgorithm, weight: key.weight) } - + // add contracts if provided for contract in contracts.keys { - account.contracts.add(name: contract, code: contracts[contract]!.decodeHex()) + account.contracts.add(name: contract, code: contracts[contract]!.utf8) } } } - \ No newline at end of file diff --git a/templates/cadence/create-and-fund-account.cdc b/templates/cadence/create-and-fund-account.cdc index 1cdbc30..fc27802 100644 --- a/templates/cadence/create-and-fund-account.cdc +++ b/templates/cadence/create-and-fund-account.cdc @@ -16,7 +16,7 @@ transaction(publicKeys: [Crypto.KeyListEntry], contracts: {String: String}, fund // add contracts if provided for contract in contracts.keys { - account.contracts.add(name: contract, code: contracts[contract]!.decodeHex()) + account.contracts.add(name: contract, code: contracts[contract]!.utf8) } self.tokenReceiver = account diff --git a/templates/cadence/update-contract.cdc b/templates/cadence/update-contract.cdc index fdac36f..d2764be 100644 --- a/templates/cadence/update-contract.cdc +++ b/templates/cadence/update-contract.cdc @@ -1,5 +1,5 @@ transaction(name: String, code: String) { prepare(signer: AuthAccount) { - signer.contracts.update__experimental(name: name, code: code.decodeHex()) + signer.contracts.update__experimental(name: name, code: code.utf8) } }