Created
February 1, 2023 05:11
-
-
Save swkim109/c068e9edd54f44827cf43175ebbfde82 to your computer and use it in GitHub Desktop.
AccessList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const abi = [ | |
"function get()", | |
"function set(uint256)" | |
]; | |
const interface = new ethers.utils.Interface(abi); | |
const calldata = interface.encodeFunctionData("set", [10]); | |
const from = "0xAd36301E8C66bB2Af80c63DA5a99BdF2c202c9a1"; | |
const to = "0x35F61C2b5815426cBA1b1B0385624118391B9C49"; | |
const gasLimit = "0x6715"; | |
const maxFeePerGas = 20000000000 //20 gwei | |
const maxPriorityFeePerGas = 1000000000 //1 gwei | |
const nonce = "0x60"; | |
const privateKey = ""; | |
const wallet = new ethers.Wallet(privateKey); | |
const tx = { | |
nonce, | |
from, | |
to, | |
gasLimit: "0xea60", | |
maxFeePerGas, | |
maxPriorityFeePerGas, | |
data: calldata, | |
"accessList": [ | |
[ | |
"0x35F61C2b5815426cBA1b1B0385624118391B9C49", | |
[ | |
"0x0000000000000000000000000000000000000000000000000000000000000000" | |
] | |
] | |
], | |
'type': 2, | |
'chainId': 5 | |
} | |
wallet.signTransaction(tx).then((rawTx) => console.log(rawTx)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment