+16
-3
@@ -6,2 +6,15 @@ Change Log | ||
| ethers/v6.16.0 (2025-12-02 19:47) | ||
| --------------------------------- | ||
| - Added utility method to split EIP-7594 BLOb proofs into its cells ([88dfe96](https://github.com/ethers-io/ethers.js/commit/88dfe96cf56ad41d0a18b1ef8cac4209aa80905e)). | ||
| - Update Alchemy URL endpoint for mainnet ([#5052](https://github.com/ethers-io/ethers.js/issues/5052); [719b01d](https://github.com/ethers-io/ethers.js/commit/719b01d72dad7525d3837a561fa1c803a773b44e)). | ||
| - Fail on unsupported Etherscan networks immediately to better support the default provider ([94b333b](https://github.com/ethers-io/ethers.js/commit/94b333b982a5c4ecb74d10c2bdf0ff23584c37fa)). | ||
| - Added Filecoin network and Ankr endpoints ([#5038](https://github.com/ethers-io/ethers.js/issues/5038); [986e827](https://github.com/ethers-io/ethers.js/commit/986e8272270fa7394a0acd0c15b3bf407dbc1fc4)). | ||
| - Moved to better API for EIP-7594 PeerDAS ([#5062](https://github.com/ethers-io/ethers.js/issues/5062); [452b422](https://github.com/ethers-io/ethers.js/commit/452b4227a4587a514ff83dc8a591eb02a0ba2d56)). | ||
| - Added initial EIP-7594 PeerDAS support ([#5054](https://github.com/ethers-io/ethers.js/issues/5054), [#5062](https://github.com/ethers-io/ethers.js/issues/5062); [6d64889](https://github.com/ethers-io/ethers.js/commit/6d64889388824823369cd95193fbc857bc0ee15c)). | ||
| - Support RegExp engines with string length limitations ([#4967](https://github.com/ethers-io/ethers.js/issues/4967); [f0dfbe1](https://github.com/ethers-io/ethers.js/commit/f0dfbe1c35128d581d95cbf81637c438d7bee00a)). | ||
| - Added Transaction and Signature support for non-canonical S values ([#4223](https://github.com/ethers-io/ethers.js/issues/4223), [#5013](https://github.com/ethers-io/ethers.js/issues/5013); [855d727](https://github.com/ethers-io/ethers.js/commit/855d72728aaa1cc0ec427f56ab7929daead0b253)). | ||
| - Allow zero-width big-endian data for toBeHex and allow widths fo toBeArray ([#5025](https://github.com/ethers-io/ethers.js/issues/5025); [540f30c](https://github.com/ethers-io/ethers.js/commit/540f30cbec0e745df1a38d51286f2c6326829581)). | ||
| ethers/v6.15.0 (2025-07-01 11:24) | ||
@@ -67,3 +80,3 @@ --------------------------------- | ||
| - tests: fix assert call for browser assert ([1806bbd](https://github.com/ethers-io/ethers.js/commit/1806bbde27523933fb140ad985426f94e0286faf)). | ||
| - tests: inlcude more node tests in the browser tests ([92fd5d1](https://github.com/ethers-io/ethers.js/commit/92fd5d1f47c640caa7100bcccf0b133e866989e6)). | ||
| - tests: include more node tests in the browser tests ([92fd5d1](https://github.com/ethers-io/ethers.js/commit/92fd5d1f47c640caa7100bcccf0b133e866989e6)). | ||
| - tests: move more tests to dev network ([996f30c](https://github.com/ethers-io/ethers.js/commit/996f30c674002cea316fa7aa3929f43409f934bc)). | ||
@@ -321,3 +334,3 @@ - tests: debugging CI browser failure ([ce7212d](https://github.com/ethers-io/ethers.js/commit/ce7212d03d6867081603794f0480f31d053823c4)). | ||
| - Fix stray promises when a node returns invalid results ([#4118](https://github.com/ethers-io/ethers.js/issues/4118); [3c1bad2](https://github.com/ethers-io/ethers.js/commit/3c1bad2fb7ad4a6ff90ff11f3e382fd18e41c800)). | ||
| - Added support to detect and stop providers spinning on intitial network detection ([#4015](https://github.com/ethers-io/ethers.js/issues/4015); [f37a52d](https://github.com/ethers-io/ethers.js/commit/f37a52da28ac130b7f4de52901618320994ea87a)). | ||
| - Added support to detect and stop providers spinning on initial network detection ([#4015](https://github.com/ethers-io/ethers.js/issues/4015); [f37a52d](https://github.com/ethers-io/ethers.js/commit/f37a52da28ac130b7f4de52901618320994ea87a)). | ||
@@ -350,3 +363,3 @@ ethers/v6.4.2 (2023-06-05 22:41) | ||
| - Removed superfluous parameters for internal transaction functions ([e848978](https://github.com/ethers-io/ethers.js/commit/e8489787585c2e69a23f6cdec6901f22b096aebe)). | ||
| - More aggresive tree-shaking ([076edad](https://github.com/ethers-io/ethers.js/commit/076edad81ef62474f48f2b4c8af0edc6e4fd64f2)). | ||
| - More aggressive tree-shaking ([076edad](https://github.com/ethers-io/ethers.js/commit/076edad81ef62474f48f2b4c8af0edc6e4fd64f2)). | ||
| - More flexible static network checking ([#3834](https://github.com/ethers-io/ethers.js/issues/3834); [7c0465c](https://github.com/ethers-io/ethers.js/commit/7c0465c5fb834eba18d4e5535072685bdc1029f0)). | ||
@@ -353,0 +366,0 @@ - Support transitive dependants that use non-node16 moduleResolution ([#3920](https://github.com/ethers-io/ethers.js/issues/3920); [df685b1](https://github.com/ethers-io/ethers.js/commit/df685b1bd9ad346ee7863beb6c3ca3f4e94932a2)). |
@@ -8,3 +8,3 @@ "use strict"; | ||
| */ | ||
| exports.version = "6.15.0"; | ||
| exports.version = "6.16.0"; | ||
| //# sourceMappingURL=_version.js.map |
@@ -23,3 +23,3 @@ import { Interface } from "../abi/index.js"; | ||
| * This can be an address, ENS name or any [[Addressable]], such as | ||
| * another contract. To get the resovled address, use the ``getAddress`` | ||
| * another contract. To get the resolved address, use the ``getAddress`` | ||
| * method. | ||
@@ -91,3 +91,3 @@ */ | ||
| * method name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -98,3 +98,3 @@ getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T; | ||
| * event name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -101,0 +101,0 @@ getEvent(key: string | EventFragment): ContractEvent; |
@@ -512,3 +512,3 @@ "use strict"; | ||
| * This can be an address, ENS name or any [[Addressable]], such as | ||
| * another contract. To get the resovled address, use the ``getAddress`` | ||
| * another contract. To get the resolved address, use the ``getAddress`` | ||
| * method. | ||
@@ -688,3 +688,3 @@ */ | ||
| async waitForDeployment() { | ||
| // We have the deployement transaction; just use that (throws if deployement fails) | ||
| // We have the deployment transaction; just use that (throws if deployment fails) | ||
| const deployTx = this.deploymentTransaction(); | ||
@@ -731,3 +731,3 @@ if (deployTx) { | ||
| * method name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -744,3 +744,3 @@ getFunction(key) { | ||
| * event name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -747,0 +747,0 @@ getEvent(key) { |
| import type { BigNumberish, BytesLike } from "../utils/index.js"; | ||
| declare const inspect: unique symbol; | ||
| /** | ||
@@ -106,2 +107,10 @@ * A SignatureLike | ||
| /** | ||
| * Returns the canonical signature. | ||
| * | ||
| * This is only necessary when dealing with legacy transaction which | ||
| * did not enforce canonical S values (i.e. [[link-eip-2]]. Most | ||
| * developers should never require this. | ||
| */ | ||
| getCanonical(): Signature; | ||
| /** | ||
| * Returns a new identical [[Signature]]. | ||
@@ -114,2 +123,4 @@ */ | ||
| toJSON(): any; | ||
| [inspect](): string; | ||
| toString(): string; | ||
| /** | ||
@@ -173,2 +184,3 @@ * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. | ||
| } | ||
| export {}; | ||
| //# sourceMappingURL=signature.d.ts.map |
@@ -13,2 +13,5 @@ "use strict"; | ||
| const BN_35 = BigInt(35); | ||
| const BN_N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); | ||
| const BN_N_2 = BN_N / BN_2; // Must be integer (floor) division; do NOT shifts | ||
| const inspect = Symbol.for("nodejs.util.inspect.custom"); | ||
| const _guard = {}; | ||
@@ -64,3 +67,4 @@ function toUint256(value) { | ||
| isValid() { | ||
| return (parseInt(this.#s.substring(0, 3)) < 8); | ||
| const s = BigInt(this.#s); | ||
| return (s <= BN_N_2); | ||
| } | ||
@@ -141,4 +145,22 @@ /** | ||
| } | ||
| [Symbol.for('nodejs.util.inspect.custom')]() { | ||
| return `Signature { r: "${this.r}", s: "${this._s}"${this.isValid() ? "" : ', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`; | ||
| /** | ||
| * Returns the canonical signature. | ||
| * | ||
| * This is only necessary when dealing with legacy transaction which | ||
| * did not enforce canonical S values (i.e. [[link-eip-2]]. Most | ||
| * developers should never require this. | ||
| */ | ||
| getCanonical() { | ||
| if (this.isValid()) { | ||
| return this; | ||
| } | ||
| // Compute the canonical signature; s' = N - s, v = !v | ||
| const s = BN_N - BigInt(this._s); | ||
| const v = (55 - this.v); | ||
| const result = new Signature(_guard, this.r, toUint256(s), v); | ||
| // Populate the networkV if necessary | ||
| if (this.networkV) { | ||
| result.#networkV = this.networkV; | ||
| } | ||
| return result; | ||
| } | ||
@@ -166,2 +188,11 @@ /** | ||
| } | ||
| [inspect]() { | ||
| return this.toString(); | ||
| } | ||
| toString() { | ||
| if (this.isValid()) { | ||
| return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`; | ||
| } | ||
| return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`; | ||
| } | ||
| /** | ||
@@ -168,0 +199,0 @@ * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. |
@@ -45,3 +45,3 @@ import type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "../hash/index.js"; | ||
| /** | ||
| * A **VoidSigner** is a class deisgned to allow an address to be used | ||
| * A **VoidSigner** is a class designed to allow an address to be used | ||
| * in any API which accepts a Signer, but for which there are no | ||
@@ -48,0 +48,0 @@ * credentials available to perform any actual signing. |
@@ -6,3 +6,3 @@ "use strict"; | ||
| * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes | ||
| * are sufficent for most developers, but this is provided to | ||
| * are sufficient for most developers, but this is provided to | ||
| * fascilitate more complex Signers. | ||
@@ -212,3 +212,3 @@ * | ||
| /** | ||
| * A **VoidSigner** is a class deisgned to allow an address to be used | ||
| * A **VoidSigner** is a class designed to allow an address to be used | ||
| * in any API which accepts a Signer, but for which there are no | ||
@@ -215,0 +215,0 @@ * credentials available to perform any actual signing. |
@@ -187,3 +187,3 @@ /** | ||
| /** | ||
| * The amount of gas consumed executing this transaciton. | ||
| * The amount of gas consumed executing this transaction. | ||
| */ | ||
@@ -190,0 +190,0 @@ gasUsed: bigint; |
@@ -343,2 +343,4 @@ "use strict"; | ||
| registerEth("bnbt", 97, {}); | ||
| registerEth("filecoin", 314, {}); | ||
| registerEth("filecoin-calibration", 314159, {}); | ||
| registerEth("linea", 59144, { ensNetwork: 1 }); | ||
@@ -345,0 +347,0 @@ registerEth("linea-goerli", 59140, {}); |
@@ -36,3 +36,3 @@ "use strict"; | ||
| case "mainnet": | ||
| return "eth-mainnet.alchemyapi.io"; | ||
| return "eth-mainnet.g.alchemy.com"; | ||
| case "goerli": | ||
@@ -39,0 +39,0 @@ return "eth-goerli.g.alchemy.com"; |
@@ -16,2 +16,4 @@ /** | ||
| * - BNB Testnet (``bnbt``) | ||
| * - Filecoin (``filecoin``) | ||
| * - Filecoin Calibration Testnet (``filecoin-calibration``) | ||
| * - Optimism (``optimism``) | ||
@@ -18,0 +20,0 @@ * - Optimism Goerli Testnet (``optimism-goerli``) |
@@ -19,2 +19,4 @@ "use strict"; | ||
| * - BNB Testnet (``bnbt``) | ||
| * - Filecoin (``filecoin``) | ||
| * - Filecoin Calibration Testnet (``filecoin-calibration``) | ||
| * - Optimism (``optimism``) | ||
@@ -53,2 +55,6 @@ * - Optimism Goerli Testnet (``optimism-goerli``) | ||
| return "rpc.ankr.com/bsc_testnet_chapel"; | ||
| case "filecoin": | ||
| return "rpc.ankr.com/filecoin"; | ||
| case "filecoin-calibration": | ||
| return "rpc.ankr.com/filecoin_testnet"; | ||
| case "matic": | ||
@@ -55,0 +61,0 @@ return "rpc.ankr.com/polygon"; |
@@ -37,2 +37,9 @@ "use strict"; | ||
| const community_js_1 = require("./community.js"); | ||
| // See: https://docs.etherscan.io/supported-chains | ||
| const Supported = ("1 11155111 17000 560048 2741 11124 33111 33139 42170 " + | ||
| "42161 421614 43114 43113 8453 84532 80069 80094 199 1029 81457 " + | ||
| "168587773 56 97 42220 11142220 252 2523 100 999 737373 747474 " + | ||
| "59144 59141 5000 5003 43521 143 10143 1287 1284 1285 10 " + | ||
| "11155420 204 5611 80002 137 534352 534351 1329 1328 146 14601 " + | ||
| "988 2201 1923 1924 167013 167000 130 1301 480 4801 51 50 324 300").split(/ /g); | ||
| const THROTTLE = 2000; | ||
@@ -96,2 +103,3 @@ function isPromise(value) { | ||
| const network = network_js_1.Network.from(_network); | ||
| (0, index_js_4.assertArgument)(Supported.indexOf(`${network.chainId}`) >= 0, "unsupported network", "network", network); | ||
| this.#plugin = network.getPlugin(EtherscanPluginId); | ||
@@ -98,0 +106,0 @@ (0, index_js_4.defineProperties)(this, { apiKey, network }); |
@@ -168,2 +168,9 @@ import type { AddressLike, NameResolver } from "../address/index.js"; | ||
| /** | ||
| * The [[link-eip-7594]] BLOb Wrapper Version used for PeerDAS. | ||
| * | ||
| * For networks that use EIP-7594, this property is required to | ||
| * serialize the sidecar correctly. | ||
| */ | ||
| blobWrapperVersion?: null | number; | ||
| /** | ||
| * The [[link-eip-7702]] authorizations (if any). | ||
@@ -170,0 +177,0 @@ */ |
@@ -131,2 +131,5 @@ "use strict"; | ||
| } | ||
| if ("blobWrapperVersion" in req) { | ||
| result.blobWrapperVersion = req.blobWrapperVersion; | ||
| } | ||
| if ("blobs" in req && req.blobs) { | ||
@@ -133,0 +136,0 @@ result.blobs = req.blobs.map((b) => { |
@@ -5,3 +5,10 @@ import { Signature } from "../crypto/index.js"; | ||
| import type { AccessList, AccessListish, Authorization, AuthorizationLike } from "./index.js"; | ||
| declare const inspect: unique symbol; | ||
| /** | ||
| * Returns a BLOb proof as its cells for [[link-eip-7594]] BLOb. | ||
| * | ||
| * The default %%cellCount%% is 128. | ||
| */ | ||
| export declare function splitBlobCells(_proof: BytesLike, cellCount?: number): Array<string>; | ||
| /** | ||
| * A **TransactionLike** is an object which is appropriate as a loose | ||
@@ -89,2 +96,9 @@ * input for many operations which will populate missing properties of | ||
| /** | ||
| * The [[link-eip-7594]] BLOb Wrapper Version used for PeerDAS. | ||
| * | ||
| * For networks that use EIP-7594, this property is required to | ||
| * serialize the sidecar correctly. | ||
| */ | ||
| blobWrapperVersion?: null | number; | ||
| /** | ||
| * The [[link-eip-7702]] authorizations (if any). | ||
@@ -101,4 +115,14 @@ */ | ||
| export interface Blob { | ||
| /** | ||
| * The blob data. | ||
| */ | ||
| data: string; | ||
| /** | ||
| * A EIP-4844 BLOb uses a string proof, while EIP-7594 use an | ||
| * array of strings representing the cells of the proof. | ||
| */ | ||
| proof: string; | ||
| /** | ||
| * The BLOb commitment. | ||
| */ | ||
| commitment: string; | ||
@@ -226,2 +250,3 @@ } | ||
| set signature(value: null | SignatureLike); | ||
| isValid(): boolean; | ||
| /** | ||
@@ -279,2 +304,4 @@ * The access list. | ||
| set kzg(kzg: null | KzgLibraryLike); | ||
| get blobWrapperVersion(): null | number; | ||
| set blobWrapperVersion(value: null | number); | ||
| /** | ||
@@ -399,2 +426,4 @@ * Creates a new Transaction with default values. | ||
| toJSON(): any; | ||
| [inspect](): string; | ||
| toString(): string; | ||
| /** | ||
@@ -406,2 +435,3 @@ * Create a **Transaction** from a serialized transaction or a | ||
| } | ||
| export {}; | ||
| //# sourceMappingURL=transaction.d.ts.map |
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.Transaction = void 0; | ||
| exports.Transaction = exports.splitBlobCells = void 0; | ||
| const index_js_1 = require("../address/index.js"); | ||
@@ -17,3 +17,23 @@ const addresses_js_1 = require("../constants/addresses.js"); | ||
| const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); | ||
| const inspect = Symbol.for("nodejs.util.inspect.custom"); | ||
| const BLOB_SIZE = 4096 * 32; | ||
| const CELL_COUNT = 128; | ||
| /** | ||
| * Returns a BLOb proof as its cells for [[link-eip-7594]] BLOb. | ||
| * | ||
| * The default %%cellCount%% is 128. | ||
| */ | ||
| function splitBlobCells(_proof, cellCount) { | ||
| if (cellCount == null) { | ||
| cellCount = CELL_COUNT; | ||
| } | ||
| const cellProofs = []; | ||
| const proof = (0, index_js_3.getBytes)(_proof); | ||
| const cellSize = proof.length / cellCount; | ||
| for (let i = 0; i < proof.length; i += cellSize) { | ||
| cellProofs.push((0, index_js_3.hexlify)(proof.subarray(i, i + cellSize))); | ||
| } | ||
| return cellProofs; | ||
| } | ||
| exports.splitBlobCells = splitBlobCells; | ||
| function getKzgLibrary(kzg) { | ||
@@ -142,3 +162,3 @@ const blobToKzgCommitment = (blob) => { | ||
| (0, index_js_3.toBeArray)(a.signature.r), | ||
| (0, index_js_3.toBeArray)(a.signature.s) | ||
| (0, index_js_3.toBeArray)(a.signature._s) | ||
| ]; | ||
@@ -244,3 +264,3 @@ }); | ||
| fields.push((0, index_js_3.toBeArray)(sig.r)); | ||
| fields.push((0, index_js_3.toBeArray)(sig.s)); | ||
| fields.push((0, index_js_3.toBeArray)(sig._s)); | ||
| return (0, index_js_3.encodeRlp)(fields); | ||
@@ -350,5 +370,7 @@ } | ||
| let typeName = "3"; | ||
| let blobWrapperVersion = null; | ||
| let blobs = null; | ||
| // Parse the network format | ||
| if (fields.length === 4 && Array.isArray(fields[0])) { | ||
| // EIP-4844 format with sidecar | ||
| typeName = "3 (network format)"; | ||
@@ -371,2 +393,27 @@ const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3]; | ||
| } | ||
| else if (fields.length === 5 && Array.isArray(fields[0])) { | ||
| // EIP-7594 format with sidecar | ||
| typeName = "3 (EIP-7594 network format)"; | ||
| blobWrapperVersion = (0, index_js_3.getNumber)(fields[1]); | ||
| const fBlobs = fields[2], fCommits = fields[3], fProofs = fields[4]; | ||
| (0, index_js_3.assertArgument)(blobWrapperVersion === 1, `unsupported EIP-7594 network format version: ${blobWrapperVersion}`, "fields[1]", blobWrapperVersion); | ||
| (0, index_js_3.assertArgument)(Array.isArray(fBlobs), "invalid EIP-7594 network format: blobs not an array", "fields[2]", fBlobs); | ||
| (0, index_js_3.assertArgument)(Array.isArray(fCommits), "invalid EIP-7594 network format: commitments not an array", "fields[3]", fCommits); | ||
| (0, index_js_3.assertArgument)(Array.isArray(fProofs), "invalid EIP-7594 network format: proofs not an array", "fields[4]", fProofs); | ||
| (0, index_js_3.assertArgument)(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields); | ||
| (0, index_js_3.assertArgument)(fBlobs.length * CELL_COUNT === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields); | ||
| blobs = []; | ||
| for (let i = 0; i < fBlobs.length; i++) { | ||
| const proof = []; | ||
| for (let j = 0; j < CELL_COUNT; j++) { | ||
| proof.push(fProofs[(i * CELL_COUNT) + j]); | ||
| } | ||
| blobs.push({ | ||
| data: fBlobs[i], | ||
| commitment: fCommits[i], | ||
| proof: (0, index_js_3.concat)(proof) | ||
| }); | ||
| } | ||
| fields = fields[0]; | ||
| } | ||
| (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, "data", (0, index_js_3.hexlify)(data)); | ||
@@ -386,3 +433,4 @@ const tx = { | ||
| maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), | ||
| blobVersionedHashes: fields[10] | ||
| blobVersionedHashes: fields[10], | ||
| blobWrapperVersion | ||
| }; | ||
@@ -427,2 +475,25 @@ if (blobs) { | ||
| if (blobs) { | ||
| // Use EIP-7594 | ||
| if (tx.blobWrapperVersion != null) { | ||
| const wrapperVersion = (0, index_js_3.toBeArray)(tx.blobWrapperVersion); | ||
| const cellProofs = []; | ||
| for (const { proof } of blobs) { | ||
| const p = (0, index_js_3.getBytes)(proof); | ||
| const cellSize = p.length / CELL_COUNT; | ||
| for (let i = 0; i < p.length; i += cellSize) { | ||
| cellProofs.push(p.subarray(i, i + cellSize)); | ||
| } | ||
| } | ||
| return (0, index_js_3.concat)([ | ||
| "0x03", | ||
| (0, index_js_3.encodeRlp)([ | ||
| fields, | ||
| wrapperVersion, | ||
| blobs.map((b) => b.data), | ||
| blobs.map((b) => b.commitment), | ||
| cellProofs | ||
| ]) | ||
| ]); | ||
| } | ||
| // Fall back onto classic EIP-4844 behavior | ||
| return (0, index_js_3.concat)([ | ||
@@ -516,2 +587,3 @@ "0x03", | ||
| #auths; | ||
| #blobWrapperVersion; | ||
| /** | ||
@@ -669,2 +741,17 @@ * The transaction type. | ||
| } | ||
| isValid() { | ||
| const sig = this.signature; | ||
| if (sig && !sig.isValid()) { | ||
| return false; | ||
| } | ||
| const auths = this.authorizationList; | ||
| if (auths) { | ||
| for (const auth of auths) { | ||
| if (!auth.signature.isValid()) { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
| /** | ||
@@ -805,9 +892,7 @@ * The access list. | ||
| else { | ||
| const commit = (0, index_js_3.hexlify)(blob.commitment); | ||
| blobs.push({ | ||
| data: (0, index_js_3.hexlify)(blob.data), | ||
| commitment: commit, | ||
| proof: (0, index_js_3.hexlify)(blob.proof) | ||
| }); | ||
| versionedHashes.push(getVersionedHash(1, commit)); | ||
| const data = (0, index_js_3.hexlify)(blob.data); | ||
| const commitment = (0, index_js_3.hexlify)(blob.commitment); | ||
| const proof = (0, index_js_3.hexlify)(blob.proof); | ||
| blobs.push({ data, commitment, proof }); | ||
| versionedHashes.push(getVersionedHash(1, commitment)); | ||
| } | ||
@@ -827,2 +912,8 @@ } | ||
| } | ||
| get blobWrapperVersion() { | ||
| return this.#blobWrapperVersion; | ||
| } | ||
| set blobWrapperVersion(value) { | ||
| this.#blobWrapperVersion = value; | ||
| } | ||
| /** | ||
@@ -849,2 +940,3 @@ * Creates a new Transaction with default values. | ||
| this.#auths = null; | ||
| this.#blobWrapperVersion = null; | ||
| } | ||
@@ -876,3 +968,3 @@ /** | ||
| } | ||
| return (0, address_js_1.recoverAddress)(this.unsignedHash, this.signature); | ||
| return (0, address_js_1.recoverAddress)(this.unsignedHash, this.signature.getCanonical()); | ||
| } | ||
@@ -886,3 +978,3 @@ /** | ||
| } | ||
| return index_js_2.SigningKey.recoverPublicKey(this.unsignedHash, this.signature); | ||
| return index_js_2.SigningKey.recoverPublicKey(this.unsignedHash, this.signature.getCanonical()); | ||
| } | ||
@@ -1074,2 +1166,52 @@ /** | ||
| } | ||
| [inspect]() { | ||
| return this.toString(); | ||
| } | ||
| toString() { | ||
| const output = []; | ||
| const add = (key) => { | ||
| let value = this[key]; | ||
| if (typeof (value) === "string") { | ||
| value = JSON.stringify(value); | ||
| } | ||
| output.push(`${key}: ${value}`); | ||
| }; | ||
| if (this.type) { | ||
| add("type"); | ||
| } | ||
| add("to"); | ||
| add("data"); | ||
| add("nonce"); | ||
| add("gasLimit"); | ||
| add("value"); | ||
| if (this.chainId != null) { | ||
| add("chainId"); | ||
| } | ||
| if (this.signature) { | ||
| add("from"); | ||
| output.push(`signature: ${this.signature.toString()}`); | ||
| } | ||
| // @TODO: accessList | ||
| // @TODO: blobs (might make output huge; maybe just include a flag?) | ||
| const auths = this.authorizationList; | ||
| if (auths) { | ||
| const outputAuths = []; | ||
| for (const auth of auths) { | ||
| const o = []; | ||
| o.push(`address: ${JSON.stringify(auth.address)}`); | ||
| if (auth.nonce != null) { | ||
| o.push(`nonce: ${auth.nonce}`); | ||
| } | ||
| if (auth.chainId != null) { | ||
| o.push(`chainId: ${auth.chainId}`); | ||
| } | ||
| if (auth.signature) { | ||
| o.push(`signature: ${auth.signature.toString()}`); | ||
| } | ||
| outputAuths.push(`Authorization { ${o.join(", ")} }`); | ||
| } | ||
| output.push(`authorizations: [ ${outputAuths.join(", ")} ]`); | ||
| } | ||
| return `Transaction { ${output.join(", ")} }`; | ||
| } | ||
| /** | ||
@@ -1148,2 +1290,5 @@ * Create a **Transaction** from a serialized transaction or a | ||
| } | ||
| if (tx.blobWrapperVersion != null) { | ||
| result.blobWrapperVersion = tx.blobWrapperVersion; | ||
| } | ||
| if (tx.blobs != null) { | ||
@@ -1150,0 +1295,0 @@ result.blobs = tx.blobs; |
@@ -18,3 +18,4 @@ "use strict"; | ||
| } | ||
| if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { | ||
| if (typeof (value) === "string" && (value.length % 2) === 0 && | ||
| value.match(/^0x[0-9a-f]*$/i)) { | ||
| const result = new Uint8Array((value.length - 2) / 2); | ||
@@ -21,0 +22,0 @@ let offset = 2; |
@@ -57,3 +57,3 @@ import type { BytesLike } from "./data.js"; | ||
| */ | ||
| export declare function toBeArray(_value: BigNumberish): Uint8Array; | ||
| export declare function toBeArray(_value: BigNumberish, _width?: Numeric): Uint8Array; | ||
| /** | ||
@@ -60,0 +60,0 @@ * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. |
@@ -178,2 +178,6 @@ "use strict"; | ||
| const width = getNumber(_width, "width"); | ||
| // Special case when both value and width are 0 (see: #5025) | ||
| if (width === 0 && value === BN_0) { | ||
| return "0x"; | ||
| } | ||
| (0, errors_js_1.assert)(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { | ||
@@ -195,6 +199,7 @@ operation: "toBeHex", | ||
| */ | ||
| function toBeArray(_value) { | ||
| function toBeArray(_value, _width) { | ||
| const value = getUint(_value, "value"); | ||
| if (value === BN_0) { | ||
| return new Uint8Array([]); | ||
| const width = (_width != null) ? getNumber(_width, "width") : 0; | ||
| return new Uint8Array(width); | ||
| } | ||
@@ -205,2 +210,13 @@ let hex = value.toString(16); | ||
| } | ||
| if (_width != null) { | ||
| const width = getNumber(_width, "width"); | ||
| while (hex.length < (width * 2)) { | ||
| hex = "00" + hex; | ||
| } | ||
| (0, errors_js_1.assert)((width * 2) === hex.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { | ||
| operation: "toBeArray", | ||
| fault: "overflow", | ||
| value: _value | ||
| }); | ||
| } | ||
| const result = new Uint8Array(hex.length / 2); | ||
@@ -207,0 +223,0 @@ for (let i = 0; i < result.length; i++) { |
@@ -19,3 +19,3 @@ "use strict"; | ||
| // The fold operation can be repeated for large sets as even within | ||
| // each folded set, there is substatial overlap in prefix. With the | ||
| // each folded set, there is substantial overlap in prefix. With the | ||
| // second special symbol ";", we get: | ||
@@ -35,3 +35,3 @@ // [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] | ||
| // printable characters (except " and \, which require 2 bytes to represent | ||
| // in string) to substiture for the most common 2-letter pairs of letters | ||
| // in string) to substitute for the most common 2-letter pairs of letters | ||
| // in the string. | ||
@@ -60,3 +60,3 @@ // | ||
| // The base-64 set used has all number replaced with their | ||
| // shifted-counterparts to prevent comflicting with the numbers used in | ||
| // shifted-counterparts to prevent conflicting with the numbers used in | ||
| // the fold operation to indicate the number of ";". | ||
@@ -63,0 +63,0 @@ Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -5,3 +5,3 @@ /* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ | ||
| */ | ||
| export const version = "6.15.0"; | ||
| export const version = "6.16.0"; | ||
| //# sourceMappingURL=_version.js.map |
@@ -23,3 +23,3 @@ import { Interface } from "../abi/index.js"; | ||
| * This can be an address, ENS name or any [[Addressable]], such as | ||
| * another contract. To get the resovled address, use the ``getAddress`` | ||
| * another contract. To get the resolved address, use the ``getAddress`` | ||
| * method. | ||
@@ -91,3 +91,3 @@ */ | ||
| * method name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -98,3 +98,3 @@ getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T; | ||
| * event name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -101,0 +101,0 @@ getEvent(key: string | EventFragment): ContractEvent; |
@@ -507,3 +507,3 @@ import { Interface, Typed } from "../abi/index.js"; | ||
| * This can be an address, ENS name or any [[Addressable]], such as | ||
| * another contract. To get the resovled address, use the ``getAddress`` | ||
| * another contract. To get the resolved address, use the ``getAddress`` | ||
| * method. | ||
@@ -683,3 +683,3 @@ */ | ||
| async waitForDeployment() { | ||
| // We have the deployement transaction; just use that (throws if deployement fails) | ||
| // We have the deployment transaction; just use that (throws if deployment fails) | ||
| const deployTx = this.deploymentTransaction(); | ||
@@ -726,3 +726,3 @@ if (deployTx) { | ||
| * method name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -739,3 +739,3 @@ getFunction(key) { | ||
| * event name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -742,0 +742,0 @@ getEvent(key) { |
| import type { BigNumberish, BytesLike } from "../utils/index.js"; | ||
| declare const inspect: unique symbol; | ||
| /** | ||
@@ -106,2 +107,10 @@ * A SignatureLike | ||
| /** | ||
| * Returns the canonical signature. | ||
| * | ||
| * This is only necessary when dealing with legacy transaction which | ||
| * did not enforce canonical S values (i.e. [[link-eip-2]]. Most | ||
| * developers should never require this. | ||
| */ | ||
| getCanonical(): Signature; | ||
| /** | ||
| * Returns a new identical [[Signature]]. | ||
@@ -114,2 +123,4 @@ */ | ||
| toJSON(): any; | ||
| [inspect](): string; | ||
| toString(): string; | ||
| /** | ||
@@ -173,2 +184,3 @@ * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. | ||
| } | ||
| export {}; | ||
| //# sourceMappingURL=signature.d.ts.map |
@@ -10,2 +10,5 @@ import { ZeroHash } from "../constants/index.js"; | ||
| const BN_35 = BigInt(35); | ||
| const BN_N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); | ||
| const BN_N_2 = BN_N / BN_2; // Must be integer (floor) division; do NOT shifts | ||
| const inspect = Symbol.for("nodejs.util.inspect.custom"); | ||
| const _guard = {}; | ||
@@ -61,3 +64,4 @@ function toUint256(value) { | ||
| isValid() { | ||
| return (parseInt(this.#s.substring(0, 3)) < 8); | ||
| const s = BigInt(this.#s); | ||
| return (s <= BN_N_2); | ||
| } | ||
@@ -138,4 +142,22 @@ /** | ||
| } | ||
| [Symbol.for('nodejs.util.inspect.custom')]() { | ||
| return `Signature { r: "${this.r}", s: "${this._s}"${this.isValid() ? "" : ', valid: "false"'}, yParity: ${this.yParity}, networkV: ${this.networkV} }`; | ||
| /** | ||
| * Returns the canonical signature. | ||
| * | ||
| * This is only necessary when dealing with legacy transaction which | ||
| * did not enforce canonical S values (i.e. [[link-eip-2]]. Most | ||
| * developers should never require this. | ||
| */ | ||
| getCanonical() { | ||
| if (this.isValid()) { | ||
| return this; | ||
| } | ||
| // Compute the canonical signature; s' = N - s, v = !v | ||
| const s = BN_N - BigInt(this._s); | ||
| const v = (55 - this.v); | ||
| const result = new Signature(_guard, this.r, toUint256(s), v); | ||
| // Populate the networkV if necessary | ||
| if (this.networkV) { | ||
| result.#networkV = this.networkV; | ||
| } | ||
| return result; | ||
| } | ||
@@ -163,2 +185,11 @@ /** | ||
| } | ||
| [inspect]() { | ||
| return this.toString(); | ||
| } | ||
| toString() { | ||
| if (this.isValid()) { | ||
| return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`; | ||
| } | ||
| return `Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`; | ||
| } | ||
| /** | ||
@@ -165,0 +196,0 @@ * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. |
@@ -45,3 +45,3 @@ import type { AuthorizationRequest, TypedDataDomain, TypedDataField } from "../hash/index.js"; | ||
| /** | ||
| * A **VoidSigner** is a class deisgned to allow an address to be used | ||
| * A **VoidSigner** is a class designed to allow an address to be used | ||
| * in any API which accepts a Signer, but for which there are no | ||
@@ -48,0 +48,0 @@ * credentials available to perform any actual signing. |
| /** | ||
| * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes | ||
| * are sufficent for most developers, but this is provided to | ||
| * are sufficient for most developers, but this is provided to | ||
| * fascilitate more complex Signers. | ||
@@ -207,3 +207,3 @@ * | ||
| /** | ||
| * A **VoidSigner** is a class deisgned to allow an address to be used | ||
| * A **VoidSigner** is a class designed to allow an address to be used | ||
| * in any API which accepts a Signer, but for which there are no | ||
@@ -210,0 +210,0 @@ * credentials available to perform any actual signing. |
@@ -187,3 +187,3 @@ /** | ||
| /** | ||
| * The amount of gas consumed executing this transaciton. | ||
| * The amount of gas consumed executing this transaction. | ||
| */ | ||
@@ -190,0 +190,0 @@ gasUsed: bigint; |
@@ -339,2 +339,4 @@ /** | ||
| registerEth("bnbt", 97, {}); | ||
| registerEth("filecoin", 314, {}); | ||
| registerEth("filecoin-calibration", 314159, {}); | ||
| registerEth("linea", 59144, { ensNetwork: 1 }); | ||
@@ -341,0 +343,0 @@ registerEth("linea-goerli", 59140, {}); |
@@ -33,3 +33,3 @@ /** | ||
| case "mainnet": | ||
| return "eth-mainnet.alchemyapi.io"; | ||
| return "eth-mainnet.g.alchemy.com"; | ||
| case "goerli": | ||
@@ -36,0 +36,0 @@ return "eth-goerli.g.alchemy.com"; |
@@ -16,2 +16,4 @@ /** | ||
| * - BNB Testnet (``bnbt``) | ||
| * - Filecoin (``filecoin``) | ||
| * - Filecoin Calibration Testnet (``filecoin-calibration``) | ||
| * - Optimism (``optimism``) | ||
@@ -18,0 +20,0 @@ * - Optimism Goerli Testnet (``optimism-goerli``) |
@@ -16,2 +16,4 @@ /** | ||
| * - BNB Testnet (``bnbt``) | ||
| * - Filecoin (``filecoin``) | ||
| * - Filecoin Calibration Testnet (``filecoin-calibration``) | ||
| * - Optimism (``optimism``) | ||
@@ -50,2 +52,6 @@ * - Optimism Goerli Testnet (``optimism-goerli``) | ||
| return "rpc.ankr.com/bsc_testnet_chapel"; | ||
| case "filecoin": | ||
| return "rpc.ankr.com/filecoin"; | ||
| case "filecoin-calibration": | ||
| return "rpc.ankr.com/filecoin_testnet"; | ||
| case "matic": | ||
@@ -52,0 +58,0 @@ return "rpc.ankr.com/polygon"; |
@@ -36,2 +36,9 @@ /** | ||
| import { showThrottleMessage } from "./community.js"; | ||
| // See: https://docs.etherscan.io/supported-chains | ||
| const Supported = ("1 11155111 17000 560048 2741 11124 33111 33139 42170 " + | ||
| "42161 421614 43114 43113 8453 84532 80069 80094 199 1029 81457 " + | ||
| "168587773 56 97 42220 11142220 252 2523 100 999 737373 747474 " + | ||
| "59144 59141 5000 5003 43521 143 10143 1287 1284 1285 10 " + | ||
| "11155420 204 5611 80002 137 534352 534351 1329 1328 146 14601 " + | ||
| "988 2201 1923 1924 167013 167000 130 1301 480 4801 51 50 324 300").split(/ /g); | ||
| const THROTTLE = 2000; | ||
@@ -94,2 +101,3 @@ function isPromise(value) { | ||
| const network = Network.from(_network); | ||
| assertArgument(Supported.indexOf(`${network.chainId}`) >= 0, "unsupported network", "network", network); | ||
| this.#plugin = network.getPlugin(EtherscanPluginId); | ||
@@ -96,0 +104,0 @@ defineProperties(this, { apiKey, network }); |
@@ -168,2 +168,9 @@ import type { AddressLike, NameResolver } from "../address/index.js"; | ||
| /** | ||
| * The [[link-eip-7594]] BLOb Wrapper Version used for PeerDAS. | ||
| * | ||
| * For networks that use EIP-7594, this property is required to | ||
| * serialize the sidecar correctly. | ||
| */ | ||
| blobWrapperVersion?: null | number; | ||
| /** | ||
| * The [[link-eip-7702]] authorizations (if any). | ||
@@ -170,0 +177,0 @@ */ |
@@ -127,2 +127,5 @@ //import { resolveAddress } from "@ethersproject/address"; | ||
| } | ||
| if ("blobWrapperVersion" in req) { | ||
| result.blobWrapperVersion = req.blobWrapperVersion; | ||
| } | ||
| if ("blobs" in req && req.blobs) { | ||
@@ -129,0 +132,0 @@ result.blobs = req.blobs.map((b) => { |
@@ -5,3 +5,10 @@ import { Signature } from "../crypto/index.js"; | ||
| import type { AccessList, AccessListish, Authorization, AuthorizationLike } from "./index.js"; | ||
| declare const inspect: unique symbol; | ||
| /** | ||
| * Returns a BLOb proof as its cells for [[link-eip-7594]] BLOb. | ||
| * | ||
| * The default %%cellCount%% is 128. | ||
| */ | ||
| export declare function splitBlobCells(_proof: BytesLike, cellCount?: number): Array<string>; | ||
| /** | ||
| * A **TransactionLike** is an object which is appropriate as a loose | ||
@@ -89,2 +96,9 @@ * input for many operations which will populate missing properties of | ||
| /** | ||
| * The [[link-eip-7594]] BLOb Wrapper Version used for PeerDAS. | ||
| * | ||
| * For networks that use EIP-7594, this property is required to | ||
| * serialize the sidecar correctly. | ||
| */ | ||
| blobWrapperVersion?: null | number; | ||
| /** | ||
| * The [[link-eip-7702]] authorizations (if any). | ||
@@ -101,4 +115,14 @@ */ | ||
| export interface Blob { | ||
| /** | ||
| * The blob data. | ||
| */ | ||
| data: string; | ||
| /** | ||
| * A EIP-4844 BLOb uses a string proof, while EIP-7594 use an | ||
| * array of strings representing the cells of the proof. | ||
| */ | ||
| proof: string; | ||
| /** | ||
| * The BLOb commitment. | ||
| */ | ||
| commitment: string; | ||
@@ -226,2 +250,3 @@ } | ||
| set signature(value: null | SignatureLike); | ||
| isValid(): boolean; | ||
| /** | ||
@@ -279,2 +304,4 @@ * The access list. | ||
| set kzg(kzg: null | KzgLibraryLike); | ||
| get blobWrapperVersion(): null | number; | ||
| set blobWrapperVersion(value: null | number); | ||
| /** | ||
@@ -399,2 +426,4 @@ * Creates a new Transaction with default values. | ||
| toJSON(): any; | ||
| [inspect](): string; | ||
| toString(): string; | ||
| /** | ||
@@ -406,2 +435,3 @@ * Create a **Transaction** from a serialized transaction or a | ||
| } | ||
| export {}; | ||
| //# sourceMappingURL=transaction.d.ts.map |
@@ -14,3 +14,22 @@ import { getAddress } from "../address/index.js"; | ||
| const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); | ||
| const inspect = Symbol.for("nodejs.util.inspect.custom"); | ||
| const BLOB_SIZE = 4096 * 32; | ||
| const CELL_COUNT = 128; | ||
| /** | ||
| * Returns a BLOb proof as its cells for [[link-eip-7594]] BLOb. | ||
| * | ||
| * The default %%cellCount%% is 128. | ||
| */ | ||
| export function splitBlobCells(_proof, cellCount) { | ||
| if (cellCount == null) { | ||
| cellCount = CELL_COUNT; | ||
| } | ||
| const cellProofs = []; | ||
| const proof = getBytes(_proof); | ||
| const cellSize = proof.length / cellCount; | ||
| for (let i = 0; i < proof.length; i += cellSize) { | ||
| cellProofs.push(hexlify(proof.subarray(i, i + cellSize))); | ||
| } | ||
| return cellProofs; | ||
| } | ||
| function getKzgLibrary(kzg) { | ||
@@ -139,3 +158,3 @@ const blobToKzgCommitment = (blob) => { | ||
| toBeArray(a.signature.r), | ||
| toBeArray(a.signature.s) | ||
| toBeArray(a.signature._s) | ||
| ]; | ||
@@ -241,3 +260,3 @@ }); | ||
| fields.push(toBeArray(sig.r)); | ||
| fields.push(toBeArray(sig.s)); | ||
| fields.push(toBeArray(sig._s)); | ||
| return encodeRlp(fields); | ||
@@ -347,5 +366,7 @@ } | ||
| let typeName = "3"; | ||
| let blobWrapperVersion = null; | ||
| let blobs = null; | ||
| // Parse the network format | ||
| if (fields.length === 4 && Array.isArray(fields[0])) { | ||
| // EIP-4844 format with sidecar | ||
| typeName = "3 (network format)"; | ||
@@ -368,2 +389,27 @@ const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3]; | ||
| } | ||
| else if (fields.length === 5 && Array.isArray(fields[0])) { | ||
| // EIP-7594 format with sidecar | ||
| typeName = "3 (EIP-7594 network format)"; | ||
| blobWrapperVersion = getNumber(fields[1]); | ||
| const fBlobs = fields[2], fCommits = fields[3], fProofs = fields[4]; | ||
| assertArgument(blobWrapperVersion === 1, `unsupported EIP-7594 network format version: ${blobWrapperVersion}`, "fields[1]", blobWrapperVersion); | ||
| assertArgument(Array.isArray(fBlobs), "invalid EIP-7594 network format: blobs not an array", "fields[2]", fBlobs); | ||
| assertArgument(Array.isArray(fCommits), "invalid EIP-7594 network format: commitments not an array", "fields[3]", fCommits); | ||
| assertArgument(Array.isArray(fProofs), "invalid EIP-7594 network format: proofs not an array", "fields[4]", fProofs); | ||
| assertArgument(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields); | ||
| assertArgument(fBlobs.length * CELL_COUNT === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields); | ||
| blobs = []; | ||
| for (let i = 0; i < fBlobs.length; i++) { | ||
| const proof = []; | ||
| for (let j = 0; j < CELL_COUNT; j++) { | ||
| proof.push(fProofs[(i * CELL_COUNT) + j]); | ||
| } | ||
| blobs.push({ | ||
| data: fBlobs[i], | ||
| commitment: fCommits[i], | ||
| proof: concat(proof) | ||
| }); | ||
| } | ||
| fields = fields[0]; | ||
| } | ||
| assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), `invalid field count for transaction type: ${typeName}`, "data", hexlify(data)); | ||
@@ -383,3 +429,4 @@ const tx = { | ||
| maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), | ||
| blobVersionedHashes: fields[10] | ||
| blobVersionedHashes: fields[10], | ||
| blobWrapperVersion | ||
| }; | ||
@@ -424,2 +471,25 @@ if (blobs) { | ||
| if (blobs) { | ||
| // Use EIP-7594 | ||
| if (tx.blobWrapperVersion != null) { | ||
| const wrapperVersion = toBeArray(tx.blobWrapperVersion); | ||
| const cellProofs = []; | ||
| for (const { proof } of blobs) { | ||
| const p = getBytes(proof); | ||
| const cellSize = p.length / CELL_COUNT; | ||
| for (let i = 0; i < p.length; i += cellSize) { | ||
| cellProofs.push(p.subarray(i, i + cellSize)); | ||
| } | ||
| } | ||
| return concat([ | ||
| "0x03", | ||
| encodeRlp([ | ||
| fields, | ||
| wrapperVersion, | ||
| blobs.map((b) => b.data), | ||
| blobs.map((b) => b.commitment), | ||
| cellProofs | ||
| ]) | ||
| ]); | ||
| } | ||
| // Fall back onto classic EIP-4844 behavior | ||
| return concat([ | ||
@@ -513,2 +583,3 @@ "0x03", | ||
| #auths; | ||
| #blobWrapperVersion; | ||
| /** | ||
@@ -666,2 +737,17 @@ * The transaction type. | ||
| } | ||
| isValid() { | ||
| const sig = this.signature; | ||
| if (sig && !sig.isValid()) { | ||
| return false; | ||
| } | ||
| const auths = this.authorizationList; | ||
| if (auths) { | ||
| for (const auth of auths) { | ||
| if (!auth.signature.isValid()) { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
| /** | ||
@@ -802,9 +888,7 @@ * The access list. | ||
| else { | ||
| const commit = hexlify(blob.commitment); | ||
| blobs.push({ | ||
| data: hexlify(blob.data), | ||
| commitment: commit, | ||
| proof: hexlify(blob.proof) | ||
| }); | ||
| versionedHashes.push(getVersionedHash(1, commit)); | ||
| const data = hexlify(blob.data); | ||
| const commitment = hexlify(blob.commitment); | ||
| const proof = hexlify(blob.proof); | ||
| blobs.push({ data, commitment, proof }); | ||
| versionedHashes.push(getVersionedHash(1, commitment)); | ||
| } | ||
@@ -824,2 +908,8 @@ } | ||
| } | ||
| get blobWrapperVersion() { | ||
| return this.#blobWrapperVersion; | ||
| } | ||
| set blobWrapperVersion(value) { | ||
| this.#blobWrapperVersion = value; | ||
| } | ||
| /** | ||
@@ -846,2 +936,3 @@ * Creates a new Transaction with default values. | ||
| this.#auths = null; | ||
| this.#blobWrapperVersion = null; | ||
| } | ||
@@ -873,3 +964,3 @@ /** | ||
| } | ||
| return recoverAddress(this.unsignedHash, this.signature); | ||
| return recoverAddress(this.unsignedHash, this.signature.getCanonical()); | ||
| } | ||
@@ -883,3 +974,3 @@ /** | ||
| } | ||
| return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); | ||
| return SigningKey.recoverPublicKey(this.unsignedHash, this.signature.getCanonical()); | ||
| } | ||
@@ -1071,2 +1162,52 @@ /** | ||
| } | ||
| [inspect]() { | ||
| return this.toString(); | ||
| } | ||
| toString() { | ||
| const output = []; | ||
| const add = (key) => { | ||
| let value = this[key]; | ||
| if (typeof (value) === "string") { | ||
| value = JSON.stringify(value); | ||
| } | ||
| output.push(`${key}: ${value}`); | ||
| }; | ||
| if (this.type) { | ||
| add("type"); | ||
| } | ||
| add("to"); | ||
| add("data"); | ||
| add("nonce"); | ||
| add("gasLimit"); | ||
| add("value"); | ||
| if (this.chainId != null) { | ||
| add("chainId"); | ||
| } | ||
| if (this.signature) { | ||
| add("from"); | ||
| output.push(`signature: ${this.signature.toString()}`); | ||
| } | ||
| // @TODO: accessList | ||
| // @TODO: blobs (might make output huge; maybe just include a flag?) | ||
| const auths = this.authorizationList; | ||
| if (auths) { | ||
| const outputAuths = []; | ||
| for (const auth of auths) { | ||
| const o = []; | ||
| o.push(`address: ${JSON.stringify(auth.address)}`); | ||
| if (auth.nonce != null) { | ||
| o.push(`nonce: ${auth.nonce}`); | ||
| } | ||
| if (auth.chainId != null) { | ||
| o.push(`chainId: ${auth.chainId}`); | ||
| } | ||
| if (auth.signature) { | ||
| o.push(`signature: ${auth.signature.toString()}`); | ||
| } | ||
| outputAuths.push(`Authorization { ${o.join(", ")} }`); | ||
| } | ||
| output.push(`authorizations: [ ${outputAuths.join(", ")} ]`); | ||
| } | ||
| return `Transaction { ${output.join(", ")} }`; | ||
| } | ||
| /** | ||
@@ -1145,2 +1286,5 @@ * Create a **Transaction** from a serialized transaction or a | ||
| } | ||
| if (tx.blobWrapperVersion != null) { | ||
| result.blobWrapperVersion = tx.blobWrapperVersion; | ||
| } | ||
| if (tx.blobs != null) { | ||
@@ -1147,0 +1291,0 @@ result.blobs = tx.blobs; |
@@ -15,3 +15,4 @@ /** | ||
| } | ||
| if (typeof (value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { | ||
| if (typeof (value) === "string" && (value.length % 2) === 0 && | ||
| value.match(/^0x[0-9a-f]*$/i)) { | ||
| const result = new Uint8Array((value.length - 2) / 2); | ||
@@ -18,0 +19,0 @@ let offset = 2; |
@@ -57,3 +57,3 @@ import type { BytesLike } from "./data.js"; | ||
| */ | ||
| export declare function toBeArray(_value: BigNumberish): Uint8Array; | ||
| export declare function toBeArray(_value: BigNumberish, _width?: Numeric): Uint8Array; | ||
| /** | ||
@@ -60,0 +60,0 @@ * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. |
@@ -167,2 +167,6 @@ /** | ||
| const width = getNumber(_width, "width"); | ||
| // Special case when both value and width are 0 (see: #5025) | ||
| if (width === 0 && value === BN_0) { | ||
| return "0x"; | ||
| } | ||
| assert(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { | ||
@@ -183,6 +187,7 @@ operation: "toBeHex", | ||
| */ | ||
| export function toBeArray(_value) { | ||
| export function toBeArray(_value, _width) { | ||
| const value = getUint(_value, "value"); | ||
| if (value === BN_0) { | ||
| return new Uint8Array([]); | ||
| const width = (_width != null) ? getNumber(_width, "width") : 0; | ||
| return new Uint8Array(width); | ||
| } | ||
@@ -193,2 +198,13 @@ let hex = value.toString(16); | ||
| } | ||
| if (_width != null) { | ||
| const width = getNumber(_width, "width"); | ||
| while (hex.length < (width * 2)) { | ||
| hex = "00" + hex; | ||
| } | ||
| assert((width * 2) === hex.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { | ||
| operation: "toBeArray", | ||
| fault: "overflow", | ||
| value: _value | ||
| }); | ||
| } | ||
| const result = new Uint8Array(hex.length / 2); | ||
@@ -195,0 +211,0 @@ for (let i = 0; i < result.length; i++) { |
@@ -18,3 +18,3 @@ // OWL Data Format | ||
| // The fold operation can be repeated for large sets as even within | ||
| // each folded set, there is substatial overlap in prefix. With the | ||
| // each folded set, there is substantial overlap in prefix. With the | ||
| // second special symbol ";", we get: | ||
@@ -34,3 +34,3 @@ // [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] | ||
| // printable characters (except " and \, which require 2 bytes to represent | ||
| // in string) to substiture for the most common 2-letter pairs of letters | ||
| // in string) to substitute for the most common 2-letter pairs of letters | ||
| // in the string. | ||
@@ -59,3 +59,3 @@ // | ||
| // The base-64 set used has all number replaced with their | ||
| // shifted-counterparts to prevent comflicting with the numbers used in | ||
| // shifted-counterparts to prevent conflicting with the numbers used in | ||
| // the fold operation to indicate the number of ";". | ||
@@ -62,0 +62,0 @@ import fs from "fs"; |
+2
-2
@@ -96,3 +96,3 @@ { | ||
| ], | ||
| "gitHead": "9944ec94b154b4f8fdfeefb81a1e47b28fd907bc", | ||
| "gitHead": "88dfe96cf56ad41d0a18b1ef8cac4209aa80905e", | ||
| "homepage": "https://ethers.org", | ||
@@ -135,3 +135,3 @@ "keywords": [ | ||
| "sideEffects": false, | ||
| "version": "6.15.0" | ||
| "version": "6.16.0" | ||
| } |
+1
-1
@@ -22,3 +22,3 @@ The Ethers Project | ||
| - Meta-classes create JavaScript objects from any contract ABI, including **ABIv2** and **Human-Readable ABI** | ||
| - Connect to Ethereum nodes over [JSON-RPC](https://github.com/ethereum/wiki/wiki/JSON-RPC), [INFURA](https://infura.io), [Etherscan](https://etherscan.io), [Alchemy](https://alchemyapi.io), [Ankr](https://ankr.com) or [MetaMask](https://metamask.io) | ||
| - Connect to Ethereum nodes over [JSON-RPC](https://ethereum.org/en/developers/docs/apis/json-rpc/), [INFURA](https://infura.io), [Etherscan](https://etherscan.io), [Alchemy](https://alchemyapi.io), [Ankr](https://ankr.com) or [MetaMask](https://metamask.io) | ||
| - **ENS names** are first-class citizens; they can be used anywhere an Ethereum addresses can be used | ||
@@ -25,0 +25,0 @@ - **Small** (~144kb compressed; 460kb uncompressed) |
@@ -6,2 +6,2 @@ /* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ | ||
| */ | ||
| export const version: string = "6.15.0"; | ||
| export const version: string = "6.16.0"; |
@@ -646,3 +646,3 @@ import { Interface, Typed } from "../abi/index.js"; | ||
| * This can be an address, ENS name or any [[Addressable]], such as | ||
| * another contract. To get the resovled address, use the ``getAddress`` | ||
| * another contract. To get the resolved address, use the ``getAddress`` | ||
| * method. | ||
@@ -845,3 +845,3 @@ */ | ||
| async waitForDeployment(): Promise<this> { | ||
| // We have the deployement transaction; just use that (throws if deployement fails) | ||
| // We have the deployment transaction; just use that (throws if deployment fails) | ||
| const deployTx = this.deploymentTransaction(); | ||
@@ -889,3 +889,3 @@ if (deployTx) { | ||
| * method name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -901,3 +901,3 @@ getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T { | ||
| * event name conflicts with a JavaScript name such as ``prototype`` or | ||
| * when using a Contract programatically. | ||
| * when using a Contract programmatically. | ||
| */ | ||
@@ -904,0 +904,0 @@ getEvent(key: string | EventFragment): ContractEvent { |
@@ -21,3 +21,6 @@ | ||
| const BN_35 = BigInt(35); | ||
| const BN_N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); | ||
| const BN_N_2 = BN_N / BN_2; // Must be integer (floor) division; do NOT shifts | ||
| const inspect = Symbol.for("nodejs.util.inspect.custom"); | ||
@@ -107,3 +110,4 @@ const _guard = { }; | ||
| isValid(): boolean { | ||
| return (parseInt(this.#s.substring(0, 3)) < 8); | ||
| const s = BigInt(this.#s); | ||
| return (s <= BN_N_2); | ||
| } | ||
@@ -189,4 +193,21 @@ | ||
| [Symbol.for('nodejs.util.inspect.custom')](): string { | ||
| return `Signature { r: "${ this.r }", s: "${ this._s }"${ this.isValid() ? "": ', valid: "false"'}, yParity: ${ this.yParity }, networkV: ${ this.networkV } }`; | ||
| /** | ||
| * Returns the canonical signature. | ||
| * | ||
| * This is only necessary when dealing with legacy transaction which | ||
| * did not enforce canonical S values (i.e. [[link-eip-2]]. Most | ||
| * developers should never require this. | ||
| */ | ||
| getCanonical(): Signature { | ||
| if (this.isValid()) { return this; } | ||
| // Compute the canonical signature; s' = N - s, v = !v | ||
| const s = BN_N - BigInt(this._s); | ||
| const v = <27 | 28>(55 - this.v); | ||
| const result = new Signature(_guard, this.r, toUint256(s), v); | ||
| // Populate the networkV if necessary | ||
| if (this.networkV) { result.#networkV = this.networkV; } | ||
| return result; | ||
| } | ||
@@ -215,2 +236,13 @@ | ||
| [inspect](): string { | ||
| return this.toString(); | ||
| } | ||
| toString(): string { | ||
| if (this.isValid()) { | ||
| return `Signature { r: ${ this.r }, s: ${ this._s }, v: ${ this.v } }`; | ||
| } | ||
| return `Signature { r: ${ this.r }, s: ${ this._s }, v: ${ this.v }, valid: false }`; | ||
| } | ||
| /** | ||
@@ -217,0 +249,0 @@ * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. |
| /** | ||
| * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes | ||
| * are sufficent for most developers, but this is provided to | ||
| * are sufficient for most developers, but this is provided to | ||
| * fascilitate more complex Signers. | ||
@@ -270,3 +270,3 @@ * | ||
| /** | ||
| * A **VoidSigner** is a class deisgned to allow an address to be used | ||
| * A **VoidSigner** is a class designed to allow an address to be used | ||
| * in any API which accepts a Signer, but for which there are no | ||
@@ -273,0 +273,0 @@ * credentials available to perform any actual signing. |
@@ -237,3 +237,3 @@ /** | ||
| /** | ||
| * The amount of gas consumed executing this transaciton. | ||
| * The amount of gas consumed executing this transaction. | ||
| */ | ||
@@ -240,0 +240,0 @@ gasUsed: bigint; |
@@ -409,2 +409,5 @@ /** | ||
| registerEth("filecoin", 314, { }); | ||
| registerEth("filecoin-calibration", 314159, { }); | ||
| registerEth("linea", 59144, { ensNetwork: 1 }); | ||
@@ -411,0 +414,0 @@ registerEth("linea-goerli", 59140, { }); |
@@ -45,3 +45,3 @@ /** | ||
| case "mainnet": | ||
| return "eth-mainnet.alchemyapi.io"; | ||
| return "eth-mainnet.g.alchemy.com"; | ||
| case "goerli": | ||
@@ -48,0 +48,0 @@ return "eth-goerli.g.alchemy.com"; |
@@ -16,2 +16,4 @@ /** | ||
| * - BNB Testnet (``bnbt``) | ||
| * - Filecoin (``filecoin``) | ||
| * - Filecoin Calibration Testnet (``filecoin-calibration``) | ||
| * - Optimism (``optimism``) | ||
@@ -62,2 +64,6 @@ * - Optimism Goerli Testnet (``optimism-goerli``) | ||
| return "rpc.ankr.com/bsc_testnet_chapel"; | ||
| case "filecoin": | ||
| return "rpc.ankr.com/filecoin"; | ||
| case "filecoin-calibration": | ||
| return "rpc.ankr.com/filecoin_testnet"; | ||
| case "matic": | ||
@@ -64,0 +70,0 @@ return "rpc.ankr.com/polygon"; |
@@ -49,2 +49,12 @@ /** | ||
| // See: https://docs.etherscan.io/supported-chains | ||
| const Supported = ( | ||
| "1 11155111 17000 560048 2741 11124 33111 33139 42170 " + | ||
| "42161 421614 43114 43113 8453 84532 80069 80094 199 1029 81457 " + | ||
| "168587773 56 97 42220 11142220 252 2523 100 999 737373 747474 " + | ||
| "59144 59141 5000 5003 43521 143 10143 1287 1284 1285 10 " + | ||
| "11155420 204 5611 80002 137 534352 534351 1329 1328 146 14601 " + | ||
| "988 2201 1923 1924 167013 167000 130 1301 480 4801 51 50 324 300" | ||
| ).split(/ /g); | ||
| const THROTTLE = 2000; | ||
@@ -139,2 +149,3 @@ | ||
| constructor(_network?: Networkish, _apiKey?: string) { | ||
| const apiKey = (_apiKey != null) ? _apiKey: null; | ||
@@ -146,2 +157,5 @@ | ||
| assertArgument(Supported.indexOf(`${ network.chainId }`) >= 0, | ||
| "unsupported network", "network", network); | ||
| this.#plugin = network.getPlugin<EtherscanPlugin>(EtherscanPluginId); | ||
@@ -148,0 +162,0 @@ |
@@ -23,3 +23,2 @@ | ||
| const BN_0 = BigInt(0); | ||
@@ -32,4 +31,27 @@ const BN_2 = BigInt(2); | ||
| const inspect = Symbol.for("nodejs.util.inspect.custom"); | ||
| const BLOB_SIZE = 4096 * 32; | ||
| const CELL_COUNT = 128; | ||
| /** | ||
| * Returns a BLOb proof as its cells for [[link-eip-7594]] BLOb. | ||
| * | ||
| * The default %%cellCount%% is 128. | ||
| */ | ||
| export function splitBlobCells(_proof: BytesLike, cellCount?: number): Array<string> { | ||
| if (cellCount == null) { cellCount = CELL_COUNT; } | ||
| const cellProofs: Array<string> = [ ]; | ||
| const proof = getBytes(_proof); | ||
| const cellSize = proof.length / cellCount; | ||
| for (let i = 0; i < proof.length; i += cellSize) { | ||
| cellProofs.push(hexlify(proof.subarray(i, i + cellSize))); | ||
| } | ||
| return cellProofs; | ||
| } | ||
| // The BLS Modulo; each field within a BLOb must be less than this | ||
@@ -139,2 +161,10 @@ //const BLOB_BLS_MODULO = BigInt("0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"); | ||
| /** | ||
| * The [[link-eip-7594]] BLOb Wrapper Version used for PeerDAS. | ||
| * | ||
| * For networks that use EIP-7594, this property is required to | ||
| * serialize the sidecar correctly. | ||
| */ | ||
| blobWrapperVersion?: null | number; | ||
| /** | ||
| * The [[link-eip-7702]] authorizations (if any). | ||
@@ -152,4 +182,16 @@ */ | ||
| export interface Blob { | ||
| /** | ||
| * The blob data. | ||
| */ | ||
| data: string; | ||
| /** | ||
| * A EIP-4844 BLOb uses a string proof, while EIP-7594 use an | ||
| * array of strings representing the cells of the proof. | ||
| */ | ||
| proof: string; | ||
| /** | ||
| * The BLOb commitment. | ||
| */ | ||
| commitment: string; | ||
@@ -325,3 +367,3 @@ } | ||
| toBeArray(a.signature.r), | ||
| toBeArray(a.signature.s) | ||
| toBeArray(a.signature._s) | ||
| ]; | ||
@@ -442,3 +484,3 @@ }); | ||
| fields.push(toBeArray(sig.r)); | ||
| fields.push(toBeArray(sig.s)); | ||
| fields.push(toBeArray(sig._s)); | ||
@@ -570,2 +612,4 @@ return encodeRlp(fields); | ||
| let blobWrapperVersion: null | number = null; | ||
| let blobs: null | Array<Blob> = null; | ||
@@ -575,3 +619,6 @@ | ||
| if (fields.length === 4 && Array.isArray(fields[0])) { | ||
| // EIP-4844 format with sidecar | ||
| typeName = "3 (network format)"; | ||
| const fBlobs = fields[1], fCommits = fields[2], fProofs = fields[3]; | ||
@@ -594,2 +641,33 @@ assertArgument(Array.isArray(fBlobs), "invalid network format: blobs not an array", "fields[1]", fBlobs); | ||
| fields = fields[0]; | ||
| } else if (fields.length === 5 && Array.isArray(fields[0])) { | ||
| // EIP-7594 format with sidecar | ||
| typeName = "3 (EIP-7594 network format)"; | ||
| blobWrapperVersion = getNumber(fields[1]); | ||
| const fBlobs = fields[2], fCommits = fields[3], fProofs = fields[4]; | ||
| assertArgument(blobWrapperVersion === 1, `unsupported EIP-7594 network format version: ${ blobWrapperVersion }`, "fields[1]", blobWrapperVersion); | ||
| assertArgument(Array.isArray(fBlobs), "invalid EIP-7594 network format: blobs not an array", "fields[2]", fBlobs); | ||
| assertArgument(Array.isArray(fCommits), "invalid EIP-7594 network format: commitments not an array", "fields[3]", fCommits); | ||
| assertArgument(Array.isArray(fProofs), "invalid EIP-7594 network format: proofs not an array", "fields[4]", fProofs); | ||
| assertArgument(fBlobs.length === fCommits.length, "invalid network format: blobs/commitments length mismatch", "fields", fields); | ||
| assertArgument(fBlobs.length * CELL_COUNT === fProofs.length, "invalid network format: blobs/proofs length mismatch", "fields", fields); | ||
| blobs = [ ]; | ||
| for (let i = 0; i < fBlobs.length; i++) { | ||
| const proof = [ ]; | ||
| for (let j = 0; j < CELL_COUNT; j++) { | ||
| proof.push(fProofs[(i * CELL_COUNT) + j]); | ||
| } | ||
| blobs.push({ | ||
| data: fBlobs[i], | ||
| commitment: fCommits[i], | ||
| proof: concat(proof) | ||
| }); | ||
| } | ||
| fields = fields[0]; | ||
| } | ||
@@ -613,3 +691,4 @@ | ||
| maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"), | ||
| blobVersionedHashes: fields[10] | ||
| blobVersionedHashes: fields[10], | ||
| blobWrapperVersion | ||
| }; | ||
@@ -660,2 +739,29 @@ | ||
| if (blobs) { | ||
| // Use EIP-7594 | ||
| if (tx.blobWrapperVersion != null) { | ||
| const wrapperVersion = toBeArray(tx.blobWrapperVersion); | ||
| const cellProofs: Array<Uint8Array> = [ ]; | ||
| for (const { proof } of blobs) { | ||
| const p = getBytes(proof); | ||
| const cellSize = p.length / CELL_COUNT; | ||
| for (let i = 0; i < p.length; i += cellSize) { | ||
| cellProofs.push(p.subarray(i, i + cellSize)); | ||
| } | ||
| } | ||
| return concat([ | ||
| "0x03", | ||
| encodeRlp([ | ||
| fields, | ||
| wrapperVersion, | ||
| blobs.map((b) => b.data), | ||
| blobs.map((b) => b.commitment), | ||
| cellProofs | ||
| ]) | ||
| ]); | ||
| } | ||
| // Fall back onto classic EIP-4844 behavior | ||
| return concat([ | ||
@@ -670,2 +776,3 @@ "0x03", | ||
| ]); | ||
| } | ||
@@ -761,2 +868,3 @@ | ||
| #auths: null | Array<Authorization>; | ||
| #blobWrapperVersion: null | number; | ||
@@ -911,2 +1019,16 @@ /** | ||
| isValid(): boolean { | ||
| const sig = this.signature; | ||
| if (sig && !sig.isValid()) { return false; } | ||
| const auths = this.authorizationList; | ||
| if (auths) { | ||
| for (const auth of auths) { | ||
| if (!auth.signature.isValid()) { return false; } | ||
| } | ||
| } | ||
| return true; | ||
| } | ||
| /** | ||
@@ -1052,9 +1174,8 @@ * The access list. | ||
| } else { | ||
| const commit = hexlify(blob.commitment); | ||
| blobs.push({ | ||
| data: hexlify(blob.data), | ||
| commitment: commit, | ||
| proof: hexlify(blob.proof) | ||
| }); | ||
| versionedHashes.push(getVersionedHash(1, commit)); | ||
| const data = hexlify(blob.data); | ||
| const commitment = hexlify(blob.commitment); | ||
| const proof = hexlify(blob.proof); | ||
| blobs.push({ data, commitment, proof }); | ||
| versionedHashes.push(getVersionedHash(1, commitment)); | ||
| } | ||
@@ -1076,2 +1197,9 @@ } | ||
| get blobWrapperVersion(): null | number { | ||
| return this.#blobWrapperVersion; | ||
| } | ||
| set blobWrapperVersion(value: null | number) { | ||
| this.#blobWrapperVersion = value; | ||
| } | ||
| /** | ||
@@ -1098,2 +1226,3 @@ * Creates a new Transaction with default values. | ||
| this.#auths = null; | ||
| this.#blobWrapperVersion = null; | ||
| } | ||
@@ -1124,3 +1253,3 @@ | ||
| if (this.signature == null) { return null; } | ||
| return recoverAddress(this.unsignedHash, this.signature); | ||
| return recoverAddress(this.unsignedHash, this.signature.getCanonical()); | ||
| } | ||
@@ -1133,3 +1262,3 @@ | ||
| if (this.signature == null) { return null; } | ||
| return SigningKey.recoverPublicKey(this.unsignedHash, this.signature); | ||
| return SigningKey.recoverPublicKey(this.unsignedHash, this.signature.getCanonical()); | ||
| } | ||
@@ -1337,2 +1466,49 @@ | ||
| [inspect](): string { | ||
| return this.toString(); | ||
| } | ||
| toString(): string { | ||
| const output: Array<string> = [ ]; | ||
| const add = (key: string) => { | ||
| let value = (<any>this)[key]; | ||
| if (typeof(value) === "string") { value = JSON.stringify(value); } | ||
| output.push(`${ key }: ${ value }`); | ||
| }; | ||
| if (this.type) { add("type"); } | ||
| add("to"); | ||
| add("data"); | ||
| add("nonce"); | ||
| add("gasLimit"); | ||
| add("value"); | ||
| if (this.chainId != null) { add("chainId"); } | ||
| if (this.signature) { | ||
| add("from"); | ||
| output.push(`signature: ${ this.signature.toString() }`); | ||
| } | ||
| // @TODO: accessList | ||
| // @TODO: blobs (might make output huge; maybe just include a flag?) | ||
| const auths = this.authorizationList; | ||
| if (auths) { | ||
| const outputAuths: Array<string> = [ ]; | ||
| for (const auth of auths) { | ||
| const o: Array<string> = [ ]; | ||
| o.push(`address: ${ JSON.stringify(auth.address) }`); | ||
| if (auth.nonce != null) { o.push(`nonce: ${ auth.nonce }`); } | ||
| if (auth.chainId != null) { o.push(`chainId: ${ auth.chainId }`); } | ||
| if (auth.signature) { | ||
| o.push(`signature: ${ auth.signature.toString() }`); | ||
| } | ||
| outputAuths.push(`Authorization { ${ o.join(", ") } }`); | ||
| } | ||
| output.push(`authorizations: [ ${ outputAuths.join(", ") } ]`); | ||
| } | ||
| return `Transaction { ${ output.join(", ") } }`; | ||
| } | ||
| /** | ||
@@ -1385,2 +1561,3 @@ * Create a **Transaction** from a serialized transaction or a | ||
| if (tx.kzg != null) { result.kzg = tx.kzg; } | ||
| if (tx.blobWrapperVersion != null) { result.blobWrapperVersion = tx.blobWrapperVersion; } | ||
| if (tx.blobs != null) { result.blobs = tx.blobs; } | ||
@@ -1387,0 +1564,0 @@ |
@@ -34,3 +34,4 @@ /** | ||
| if (typeof(value) === "string" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) { | ||
| if (typeof(value) === "string" && (value.length % 2) === 0 && | ||
| value.match(/^0x[0-9a-f]*$/i)) { | ||
| const result = new Uint8Array((value.length - 2) / 2); | ||
@@ -37,0 +38,0 @@ let offset = 2; |
@@ -194,2 +194,6 @@ /** | ||
| const width = getNumber(_width, "width"); | ||
| // Special case when both value and width are 0 (see: #5025) | ||
| if (width === 0 && value === BN_0) { return "0x"; } | ||
| assert(width * 2 >= result.length, `value exceeds width (${ width } bytes)`, "NUMERIC_FAULT", { | ||
@@ -212,6 +216,9 @@ operation: "toBeHex", | ||
| */ | ||
| export function toBeArray(_value: BigNumberish): Uint8Array { | ||
| export function toBeArray(_value: BigNumberish, _width?: Numeric): Uint8Array { | ||
| const value = getUint(_value, "value"); | ||
| if (value === BN_0) { return new Uint8Array([ ]); } | ||
| if (value === BN_0) { | ||
| const width = (_width != null) ? getNumber(_width, "width"): 0; | ||
| return new Uint8Array(width); | ||
| } | ||
@@ -221,2 +228,14 @@ let hex = value.toString(16); | ||
| if (_width != null) { | ||
| const width = getNumber(_width, "width"); | ||
| while (hex.length < (width * 2)) { hex = "00" + hex; } | ||
| assert((width * 2) === hex.length, `value exceeds width (${ width } bytes)`, "NUMERIC_FAULT", { | ||
| operation: "toBeArray", | ||
| fault: "overflow", | ||
| value: _value | ||
| }); | ||
| } | ||
| const result = new Uint8Array(hex.length / 2); | ||
@@ -223,0 +242,0 @@ for (let i = 0; i < result.length; i++) { |
@@ -19,3 +19,3 @@ | ||
| // The fold operation can be repeated for large sets as even within | ||
| // each folded set, there is substatial overlap in prefix. With the | ||
| // each folded set, there is substantial overlap in prefix. With the | ||
| // second special symbol ";", we get: | ||
@@ -35,3 +35,3 @@ // [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] | ||
| // printable characters (except " and \, which require 2 bytes to represent | ||
| // in string) to substiture for the most common 2-letter pairs of letters | ||
| // in string) to substitute for the most common 2-letter pairs of letters | ||
| // in the string. | ||
@@ -60,3 +60,3 @@ // | ||
| // The base-64 set used has all number replaced with their | ||
| // shifted-counterparts to prevent comflicting with the numbers used in | ||
| // shifted-counterparts to prevent conflicting with the numbers used in | ||
| // the fold operation to indicate the number of ";". | ||
@@ -63,0 +63,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 4 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
13035928
0.8%152205
0.74%443
0.68%