From 87e736daccba3827edeb8cd3524bfe25bf98e61f Mon Sep 17 00:00:00 2001 From: ElasticBottle Date: Wed, 6 Nov 2024 00:58:34 +0000 Subject: [PATCH] [js] fix enclave wallet signing (#5315) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://linear.app/thirdweb/issue/CNCT-2099/enclaves-malform-contract-call-transactions --- ## PR-Codex overview This PR focuses on fixing an error related to ecosystem signing with data in the `thirdweb` wallet implementation. It adjusts how transaction details are processed, particularly the `to` and `data` fields. ### Detailed summary - Updated the `to` field in the transaction object to use `getAddress(tx.to)` instead of a fallback to `undefined`. - Changed the `data` field assignment to directly use `tx.data` without transformation. - The rest of the transaction fields remain unchanged. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .changeset/forty-turtles-do.md | 5 +++++ .../src/wallets/in-app/core/wallet/enclave-wallet.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/forty-turtles-do.md diff --git a/.changeset/forty-turtles-do.md b/.changeset/forty-turtles-do.md new file mode 100644 index 00000000000..548f58b8424 --- /dev/null +++ b/.changeset/forty-turtles-do.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +fix ecosystem signing with data error diff --git a/packages/thirdweb/src/wallets/in-app/core/wallet/enclave-wallet.ts b/packages/thirdweb/src/wallets/in-app/core/wallet/enclave-wallet.ts index 8f764c68c3e..ebfa8519a2c 100644 --- a/packages/thirdweb/src/wallets/in-app/core/wallet/enclave-wallet.ts +++ b/packages/thirdweb/src/wallets/in-app/core/wallet/enclave-wallet.ts @@ -139,8 +139,8 @@ export class EnclaveWallet implements IWebWallet { chain: getCachedChain(tx.chainId), }); const transaction: Record = { - to: (tx.to as Hex) ?? undefined, - data: tx.data ? toHex(tx.data) : undefined, + to: tx.to ? getAddress(tx.to) : undefined, + data: tx.data, value: tx.value ? toHex(tx.value) : undefined, gas: tx.gas ? toHex(tx.gas + tx.gas / BigInt(10)) : undefined, // Add a 10% buffer to gas nonce: tx.nonce