Ethers Version
6.14.3
Search Terms
No response
Describe the Problem
Hi Ethers.js team,
I'm encountering an issue when trying to create an EIP-7702 (type 4) transaction using ethers.Transaction.from() with a plain JavaScript object. Even when the authorizationList and its entries (authority, contract addresses) are correctly defined in the input POJO, the internal authorizationify function seems to receive an undefined value for an address, leading to an "invalid address (argument='address', value=null)" error.
Environment:
- Ethers.js version: 6.14.3
- Node.js versions tested: v20.19.1 (Windows), v23.11.0 (Ubuntu)
- Operating Systems tested: Windows 10, Ubuntu (latest via Docker)
Code Snippet
**Minimal Reproducible Example (`test-eip7702-auth-list.js`):**
// test-eip7702-auth-list.js
const { ethers } = require("ethers");
async function main() {
console.log("Ethers version:", ethers.version);
const dummyChainId = 11155111n; // Sepolia
const dummyAuthority = ethers.getAddress("0xBCeF6DfD9388ED216eFFe0078093Cc753744e0cF");
const dummyContract = ethers.getAddress("0x3D52997A42e2e4f49Ed8F6f85442c53949979C99");
const dummyNonce = 0n;
const dummySignature = "0x1bb32b619472560e22645c588d48b8632a0ffd1666cdcb7a879b9567304d3d0e6c19aa84cff016d2335cd1a6c67f917a83b36123c05dd4d96130268e539f65e01c";
const minimalAuthEntry = {
chainId: dummyChainId,
authority: dummyAuthority,
contract: dummyContract,
nonce: dummyNonce,
signature: dummySignature,
};
console.log("Minimal Auth Entry to be used:", JSON.stringify(minimalAuthEntry, (k,v) => typeof v === 'bigint' ? v.toString() : v, 2));
const minimalTxPojo = {
to: ethers.getAddress("0x0000000000000000000000000000000000000000"),
value: ethers.parseEther("0.001"),
data: "0x",
gasLimit: 21000n,
nonce: 0,
chainId: dummyChainId,
type: 4,
authorizationList: [minimalAuthEntry],
maxFeePerGas: ethers.parseUnits("20", "gwei"),
maxPriorityFeePerGas: ethers.parseUnits("1", "gwei"),
};
console.log("\nMinimal Transaction POJO:", JSON.stringify(minimalTxPojo, (k,v) => typeof v === 'bigint' ? v.toString() : v, 2));
try {
console.log("\nAttempting ethers.Transaction.from(minimalTxPojo)...");
const txObject = ethers.Transaction.from(minimalTxPojo);
console.log("SUCCESS: ethers.Transaction.from() created an object.");
console.log("Transaction Object:", txObject);
} catch (error) {
console.error("\nERROR during ethers.Transaction.from():", error.message);
console.error("Error code:", error.code);
console.error("Error argument:", error.argument);
console.error("Error value passed to function:", error.value);
console.error("Full error object:", error);
}
}
main();
Contract ABI
Errors
Ethers version: 6.14.3
Minimal Auth Entry to be used: {
"chainId": "11155111",
"authority": "0xBCeF6DfD9388ED216eFFe0078093Cc753744e0cF",
"contract": "0x3D52997A42e2e4f49Ed8F6f85442c53949979C99",
"nonce": "0",
"signature": "0x1bb32b619472560e22645c588d48b8632a0ffd1666cdcb7a879b9567304d3d0e6c19aa84cff016d2335cd1a6c67f917a83b36123c05dd4d96130268e539f65e01c"
}
Minimal Transaction POJO: {
"to": "0x0000000000000000000000000000000000000000",
"value": "1000000000000000",
"data": "0x",
"gasLimit": "21000",
"nonce": 0,
"chainId": "11155111",
"type": 4,
"authorizationList": [
{
"chainId": "11155111",
"authority": "0xBCeF6DfD9388ED216eFFe0078093Cc753744e0cF",
"contract": "0x3D52997A42e2e4f49Ed8F6f85442c53949979C99",
"nonce": "0",
"signature": "0x1bb32b619472560e22645c588d48b8632a0ffd1666cdcb7a879b9567304d3d0e6c19aa84cff016d2335cd1a6c67f917a83b36123c05dd4d96130268e539f65e01c"
}
],
"maxFeePerGas": "20000000000",
"maxPriorityFeePerGas": "1000000000"
}
Attempting ethers.Transaction.from(minimalTxPojo)...
ERROR during ethers.Transaction.from(): invalid address (argument="address", value=null, code=INVALID_ARGUMENT, version=6.14.3)
Error code: INVALID_ARGUMENT
Error argument: address
Error value passed to function: undefined
Full error object: TypeError: invalid address (argument="address", value=null, code=INVALID_ARGUMENT, version=6.14.3)
at makeError (...omitted for brevity...)
at getAddress (...omitted for brevity...)
at authorizationify (...omitted for brevity...)
at ...
at set authorizationList [as authorizationList] (...omitted for brevity...)
at Transaction.from (...omitted for brevity...)
at main (...omitted for brevity...) {
code: 'INVALID_ARGUMENT',
argument: 'address',
value: undefined,
shortMessage: 'invalid address'
}
Environment
No response
Environment (Other)
No response
Ethers Version
6.14.3
Search Terms
No response
Describe the Problem
Hi Ethers.js team,
I'm encountering an issue when trying to create an EIP-7702 (type 4) transaction using
ethers.Transaction.from()with a plain JavaScript object. Even when theauthorizationListand its entries (authority,contractaddresses) are correctly defined in the input POJO, the internalauthorizationifyfunction seems to receive anundefinedvalue for an address, leading to an "invalid address (argument='address', value=null)" error.Environment:
Code Snippet
Contract ABI
Errors
Ethers version: 6.14.3 Minimal Auth Entry to be used: { "chainId": "11155111", "authority": "0xBCeF6DfD9388ED216eFFe0078093Cc753744e0cF", "contract": "0x3D52997A42e2e4f49Ed8F6f85442c53949979C99", "nonce": "0", "signature": "0x1bb32b619472560e22645c588d48b8632a0ffd1666cdcb7a879b9567304d3d0e6c19aa84cff016d2335cd1a6c67f917a83b36123c05dd4d96130268e539f65e01c" } Minimal Transaction POJO: { "to": "0x0000000000000000000000000000000000000000", "value": "1000000000000000", "data": "0x", "gasLimit": "21000", "nonce": 0, "chainId": "11155111", "type": 4, "authorizationList": [ { "chainId": "11155111", "authority": "0xBCeF6DfD9388ED216eFFe0078093Cc753744e0cF", "contract": "0x3D52997A42e2e4f49Ed8F6f85442c53949979C99", "nonce": "0", "signature": "0x1bb32b619472560e22645c588d48b8632a0ffd1666cdcb7a879b9567304d3d0e6c19aa84cff016d2335cd1a6c67f917a83b36123c05dd4d96130268e539f65e01c" } ], "maxFeePerGas": "20000000000", "maxPriorityFeePerGas": "1000000000" } Attempting ethers.Transaction.from(minimalTxPojo)... ERROR during ethers.Transaction.from(): invalid address (argument="address", value=null, code=INVALID_ARGUMENT, version=6.14.3) Error code: INVALID_ARGUMENT Error argument: address Error value passed to function: undefined Full error object: TypeError: invalid address (argument="address", value=null, code=INVALID_ARGUMENT, version=6.14.3) at makeError (...omitted for brevity...) at getAddress (...omitted for brevity...) at authorizationify (...omitted for brevity...) at ... at set authorizationList [as authorizationList] (...omitted for brevity...) at Transaction.from (...omitted for brevity...) at main (...omitted for brevity...) { code: 'INVALID_ARGUMENT', argument: 'address', value: undefined, shortMessage: 'invalid address' }Environment
No response
Environment (Other)
No response