From 2f58177697b1f7a2b5e86728185cfb4bed5cd77d Mon Sep 17 00:00:00 2001 From: Muhammad-Altabba <24407834+Muhammad-Altabba@users.noreply.github.com> Date: Tue, 3 Sep 2024 15:13:05 +0200 Subject: [PATCH] fix encoding issue at `getERC20DefaultBridgeData` --- src/utils.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/utils.ts b/src/utils.ts index 539d68b..4b8b58d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -631,9 +631,14 @@ export async function getERC20DefaultBridgeData( ? 18 : await token.methods.decimals().call(); + + const nameBytes = web3Abi.encodeParameters(['string'], [name]); + const symbolBytes = web3Abi.encodeParameters(['string'], [symbol]); + const decimalsBytes = web3Abi.encodeParameters(['uint256'], [decimals]); + return web3Abi.encodeParameters( - ['string', 'string', 'uint256'], - [name, symbol, Number(decimals)], + ['bytes', 'bytes', 'bytes'], + [nameBytes, symbolBytes, decimalsBytes], ); }