Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

transactionBuilder.js对address[][]参数编码有问题 #433

Closed
qfengthree opened this issue Oct 12, 2023 · 2 comments
Closed

transactionBuilder.js对address[][]参数编码有问题 #433

qfengthree opened this issue Oct 12, 2023 · 2 comments

Comments

@qfengthree
Copy link

src/lib/transactionBuilder.js中对address[][]参数编码有问题,导致返回params为空。
let params = [
{
type: 'string[][]',
value: poolVersion,
},
{
type: 'uint256[][]',
value: versionLen,
},
{
type: 'address[][]',
value: path,
},
{
type: 'uint256[]',
value: amountIn,
},
];
tronWeb.transactionBuilder.triggerConstantContract(contractAddress, methodId, options, params, issuerAddress)方式构建的params参数有问题。

建议修改方案(增加address[][]判断):

if (type === 'address')
value = toHex(value).replace(ADDRESS_PREFIX_REGEX, '0x');
else if (type == 'address[]')
value = value.map((v) => v.replace(ADDRESS_PREFIX_REGEX, '0x'));
else if (type == 'address[][]') {
value = value.map((v1) => v1 = v1.map((v) => v.replace(ADDRESS_PREFIX_REGEX, '0x')));
}

@start940315
Copy link
Contributor

It is now not support multi-dimension address array but we'll record it and will fix it in the next version.

@start940315
Copy link
Contributor

Fixed in TronWeb v6.0.0-beta.0. Welcome to try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants