From a5d9f6e3f5bada210a05c0d1f5c57d7917bf869c Mon Sep 17 00:00:00 2001 From: RanGojo Date: Wed, 12 Jun 2024 09:04:05 +0000 Subject: [PATCH] fix: fix tx data for evm signers when transfering native tokens --- signers/signer-evm/src/signer.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/signers/signer-evm/src/signer.ts b/signers/signer-evm/src/signer.ts index 2df5cc05f9..a8e4becf64 100644 --- a/signers/signer-evm/src/signer.ts +++ b/signers/signer-evm/src/signer.ts @@ -63,15 +63,19 @@ export class DefaultEvmSigner implements GenericSigner { static buildTx(evmTx: EvmTransaction, disableV2 = false): TransactionRequest { const TO_STRING_BASE = 16; let tx: TransactionRequest = {}; + /* + * it's better to pass 0x instead of undefined, otherwise some wallets could face issue + * https://github.com/WalletConnect/web3modal/issues/1082#issuecomment-1637793242 + */ + tx = { + data: evmTx.data || '0x', + }; if (evmTx.from) { tx = { ...tx, from: evmTx.from }; } if (evmTx.to) { tx = { ...tx, to: evmTx.to }; } - if (evmTx.data) { - tx = { ...tx, data: evmTx.data }; - } if (evmTx.value) { tx = { ...tx, value: evmTx.value }; }