|
| 1 | +diff --git a/dist/cjs/util.js b/dist/cjs/util.js |
| 2 | +index d60cf924ee8144ee49dd07e8e910d87a2c4bfb6a..ea5494530c05f4c831e301b88fef7855c89f2885 100644 |
| 3 | +--- a/dist/cjs/util.js |
| 4 | ++++ b/dist/cjs/util.js |
| 5 | +@@ -119,14 +119,11 @@ class AuthorizationLists { |
| 6 | + } |
| 7 | + const chainId = (0, util_1.hexToBytes)(item.chainId); |
| 8 | + const addressBytes = (0, util_1.hexToBytes)(item.address); |
| 9 | +- const nonceList = []; |
| 10 | +- for (let j = 0; j < item.nonce.length; j++) { |
| 11 | +- nonceList.push((0, util_1.hexToBytes)(item.nonce[j])); |
| 12 | +- } |
| 13 | ++ const nonce = (0, util_1.hexToBytes)(item.nonce); |
| 14 | + const yParity = (0, util_1.hexToBytes)(item.yParity); |
| 15 | + const r = (0, util_1.hexToBytes)(item.r); |
| 16 | + const s = (0, util_1.hexToBytes)(item.s); |
| 17 | +- newAuthorizationList.push([chainId, addressBytes, nonceList, yParity, r, s]); |
| 18 | ++ newAuthorizationList.push([chainId, addressBytes, nonce, yParity, r, s]); |
| 19 | + } |
| 20 | + bufferAuthorizationList = newAuthorizationList; |
| 21 | + } |
| 22 | +@@ -138,18 +135,14 @@ class AuthorizationLists { |
| 23 | + const data = bufferAuthorizationList[i]; |
| 24 | + const chainId = (0, util_1.bytesToHex)(data[0]); |
| 25 | + const address = (0, util_1.bytesToHex)(data[1]); |
| 26 | +- const nonces = data[2]; |
| 27 | +- const nonceList = []; |
| 28 | +- for (let j = 0; j < nonces.length; j++) { |
| 29 | +- nonceList.push((0, util_1.bytesToHex)(nonces[j])); |
| 30 | +- } |
| 31 | ++ const nonce = (0, util_1.bytesToHex)(data[2]); |
| 32 | + const yParity = (0, util_1.bytesToHex)(data[3]); |
| 33 | + const r = (0, util_1.bytesToHex)(data[4]); |
| 34 | + const s = (0, util_1.bytesToHex)(data[5]); |
| 35 | + const jsonItem = { |
| 36 | + chainId, |
| 37 | + address, |
| 38 | +- nonce: nonceList, |
| 39 | ++ nonce, |
| 40 | + yParity, |
| 41 | + r, |
| 42 | + s, |
| 43 | +@@ -167,20 +160,14 @@ class AuthorizationLists { |
| 44 | + for (let key = 0; key < authorizationList.length; key++) { |
| 45 | + const authorizationListItem = authorizationList[key]; |
| 46 | + const address = authorizationListItem[1]; |
| 47 | +- const nonceList = authorizationListItem[2]; |
| 48 | ++ const nonce = authorizationListItem[2]; |
| 49 | + const yParity = authorizationListItem[3]; |
| 50 | + const r = authorizationListItem[4]; |
| 51 | + const s = authorizationListItem[5]; |
| 52 | +- (0, util_1.validateNoLeadingZeroes)({ yParity, r, s }); |
| 53 | ++ (0, util_1.validateNoLeadingZeroes)({ yParity, r, s, nonce }); |
| 54 | + if (address.length !== 20) { |
| 55 | + throw new Error('Invalid EIP-7702 transaction: address length should be 20 bytes'); |
| 56 | + } |
| 57 | +- if (nonceList.length > 1) { |
| 58 | +- throw new Error('Invalid EIP-7702 transaction: nonce list should consist of at most 1 item'); |
| 59 | +- } |
| 60 | +- else if (nonceList.length === 1) { |
| 61 | +- (0, util_1.validateNoLeadingZeroes)({ nonce: nonceList[0] }); |
| 62 | +- } |
| 63 | + } |
| 64 | + } |
| 65 | + static getDataFeeEIP7702(authorityList, common) { |
| 66 | +diff --git a/dist/esm/util.js b/dist/esm/util.js |
| 67 | +index 36fa7e9917f72b042efc753ba5d1c9cd0d5572db..de454fa2f09a98b2a8716e173d1cd1f87101a490 100644 |
| 68 | +--- a/dist/esm/util.js |
| 69 | ++++ b/dist/esm/util.js |
| 70 | +@@ -114,14 +114,11 @@ export class AuthorizationLists { |
| 71 | + } |
| 72 | + const chainId = hexToBytes(item.chainId); |
| 73 | + const addressBytes = hexToBytes(item.address); |
| 74 | +- const nonceList = []; |
| 75 | +- for (let j = 0; j < item.nonce.length; j++) { |
| 76 | +- nonceList.push(hexToBytes(item.nonce[j])); |
| 77 | +- } |
| 78 | ++ const nonce = hexToBytes(item.nonce); |
| 79 | + const yParity = hexToBytes(item.yParity); |
| 80 | + const r = hexToBytes(item.r); |
| 81 | + const s = hexToBytes(item.s); |
| 82 | +- newAuthorizationList.push([chainId, addressBytes, nonceList, yParity, r, s]); |
| 83 | ++ newAuthorizationList.push([chainId, addressBytes, nonce, yParity, r, s]); |
| 84 | + } |
| 85 | + bufferAuthorizationList = newAuthorizationList; |
| 86 | + } |
| 87 | +@@ -133,18 +130,14 @@ export class AuthorizationLists { |
| 88 | + const data = bufferAuthorizationList[i]; |
| 89 | + const chainId = bytesToHex(data[0]); |
| 90 | + const address = bytesToHex(data[1]); |
| 91 | +- const nonces = data[2]; |
| 92 | +- const nonceList = []; |
| 93 | +- for (let j = 0; j < nonces.length; j++) { |
| 94 | +- nonceList.push(bytesToHex(nonces[j])); |
| 95 | +- } |
| 96 | ++ const nonce = bytesToHex(data[2]); |
| 97 | + const yParity = bytesToHex(data[3]); |
| 98 | + const r = bytesToHex(data[4]); |
| 99 | + const s = bytesToHex(data[5]); |
| 100 | + const jsonItem = { |
| 101 | + chainId, |
| 102 | + address, |
| 103 | +- nonce: nonceList, |
| 104 | ++ nonce, |
| 105 | + yParity, |
| 106 | + r, |
| 107 | + s, |
| 108 | +@@ -162,20 +155,14 @@ export class AuthorizationLists { |
| 109 | + for (let key = 0; key < authorizationList.length; key++) { |
| 110 | + const authorizationListItem = authorizationList[key]; |
| 111 | + const address = authorizationListItem[1]; |
| 112 | +- const nonceList = authorizationListItem[2]; |
| 113 | ++ const nonce = authorizationListItem[2]; |
| 114 | + const yParity = authorizationListItem[3]; |
| 115 | + const r = authorizationListItem[4]; |
| 116 | + const s = authorizationListItem[5]; |
| 117 | +- validateNoLeadingZeroes({ yParity, r, s }); |
| 118 | ++ validateNoLeadingZeroes({ yParity, r, s, nonce }); |
| 119 | + if (address.length !== 20) { |
| 120 | + throw new Error('Invalid EIP-7702 transaction: address length should be 20 bytes'); |
| 121 | + } |
| 122 | +- if (nonceList.length > 1) { |
| 123 | +- throw new Error('Invalid EIP-7702 transaction: nonce list should consist of at most 1 item'); |
| 124 | +- } |
| 125 | +- else if (nonceList.length === 1) { |
| 126 | +- validateNoLeadingZeroes({ nonce: nonceList[0] }); |
| 127 | +- } |
| 128 | + } |
| 129 | + } |
| 130 | + static getDataFeeEIP7702(authorityList, common) { |
0 commit comments