Closed Neronjust2017 closed 1 year ago
Hi, you are free to use universal-router-sdk for encoding, but this also means using v2/v3 sdks for forming trade routes which could take some learning...
You can also use these test helpers here we use to encode: https://github.com/Uniswap/universal-router/blob/main/test/integration-tests/shared/planner.ts and here's an example using this library: https://github.com/Uniswap/universal-router/blob/main/test/integration-tests/Uniswap.test.ts#L92
Thanks! That helps a lot. I found these test helpers use the defaultAbiCoder for encoding, just like I do. But by browsing the code you gave, I found the reason for the first error "INVALID_ARGUMENT" is that "0x0000000000000000000000000000000000000000000000000000000000000001" is not a 42-character hexadecimal address.
thanks, closing for now
Hi, because transactions to the UniversalRouter all go through the UniversalRouter.execute functions, the transaction data should be encoded using the ABI of function UniversalRouter.execute. My transaction is a swap from 0.005 WETH to some USDC, and its method bytecode is "0x0b08". I have two problems: 1) when I encode the first command (0b) inputs, using the following code:
there is an error:
2) When I encode the second command (08), I encode "address" and ["uint256", "uint256", "address[]", "bool"] respectively and put them together:
There is another problem that it can not be decoded back:
The decoded addresses are empty:
I need your help. and what's the right way to encode these data? Thanks a lot!