Closed qfengthree closed 10 months ago
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'))); }
It is now not support multi-dimension address array but we'll record it and will fix it in the next version.
Fixed in TronWeb v6.0.0-beta.0. Welcome to try.
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'))); }