| 123456789101112131415161718192021 |
- import abiDecoder from "abi-decoder";
- import SyncSwapRouterAbi from "./SyncSwapRouter.json" assert { type: "json" };
- import Web3, { eth } from "web3";
- import { Wallet, Provider } from "zksync-web3";
- const rpc = "https://zksync2-testnet.zksync.dev/";
- const walletAddress = "0x93626e5d46772652a8100a3ffc34d7bad8b29e00";
- const privateKey = "0xd768b0b3f8dedcb465ad680268453391f7da6ec4e1942a13fdfcdea8773aab3e";
- const data =
- "0x94ec6d78000000000000000000000000cfa3d5c02d827c0d1a48b4241700aebf751458fa00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000001fb50b56e2e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000faf6df7054946141266420b43783387a78d82a90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000093626e5d46772652a8100a3ffc34d7bad8b29e000000000000000000000000000000000000000000000000000000000000000000";
- const provider = new Provider(rpc);
- const wallet = new Wallet(privateKey).connect(provider);
- console.log("rpc: ", rpc);
- const web3 = new Web3(new Web3.providers.HttpProvider(rpc));
- const account = web3.eth.accounts.privateKeyToAccount(privateKey);
- console.log("address: ", account.address);
- const abi = SyncSwapRouterAbi.find((i) => i.name === "addLiquidity2");
- console.log("abi: ", abi.inputs);
- const params = web3.eth.abi.decodeParameters(abi.inputs, data);
- console.log("params: ", params);
|