这个是我手动兑换的结果
let path = ethers.utils.arrayify("0x31eeb2d0f9b6fd8642914ab10f4dd473677d80df000bb8d0a1e359811322d97991e03f863a0c30c2cf029c0001f41f9840a85d5af5bf1d1762f925bdaddc4201f984") console.log(path); let recipient = "0x43CbB7b02f2b373474dc87568C976bA4a5C4485B"; let deadline = 1635793948; let amountIn = 100000; let amountOutMinimum= 130726914869254; var abiCoder =new ethers.utils.AbiCoder()
var abi=abiCoder.encode([ 'bytes', 'address', 'uint256', 'uint256','uint256'], [ path ,recipient, deadline ,amountIn ,amountOutMinimum])
console.log(abi.toString() );
返回结果0000000000000000000000000000000000000000000000000000000000000a000000000000000000000000043cbb7b02f2b373474dc87568c976ba4a5c4485b0000000000000000000000000000000000000000000000000000000061803c1c00000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000076e53b52c806000000000000000000000000000000000000000000000000000000000000004231eeb2d0f9b6fd8642914ab10f4dd473677d80df000bb8d0a1e359811322d97991e03f863a0c30c2cf029c0001f41f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000
手动兑换结果是:000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000043cbb7b02f2b373474dc87568c976ba4a5c4485b0000000000000000000000000000000000000000000000000000000061803c1c00000000000000000000000000000000000000000000000000000000000186a0000000000000000000000000000000000000000000000000000076e53b52c806000000000000000000000000000000000000000000000000000000000000004231eeb2d0f9b6fd8642914ab10f4dd473677d80df000bb8d0a1e359811322d97991e03f863a0c30c2cf029c0001f41f9840a85d5af5bf1d1762f925bdaddc4201f984000000000000000000000000000000000000000000000000000000000000