Socket
Socket
Sign inDemoInstall

ethers

Package Overview
Dependencies
Maintainers
1
Versions
319
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethers - npm Package Compare versions

Comparing version 6.10.0 to 6.11.0

25

CHANGELOG.md

@@ -6,2 +6,27 @@ Change Log

ethers/v6.11.0 (2024-02-08 20:26)
---------------------------------
- Allow transaction encoding for inferred type transactions ([f02211d](https://github.com/ethers-io/ethers.js/commit/f02211d055567b51373b5faa2c3dc6efe0523618)).
- Added EIP-4788, receipts root and state root fields to Block ([#4570](https://github.com/ethers-io/ethers.js/issues/4570); [c5f126f](https://github.com/ethers-io/ethers.js/commit/c5f126faf7d826b6a99df0ee578ff3d0ef409381)).
- Added EIP-4844 fields to Provider classes and formatter ([#4570](https://github.com/ethers-io/ethers.js/issues/4570); [7b4f2c1](https://github.com/ethers-io/ethers.js/commit/7b4f2c1a74db411829b5e8ef758bfa2ee21e5890)).
- Assert BrowserProvider receives an EIP-1193 provider to fail early when passing undefined ethereum object ([b69f43b](https://github.com/ethers-io/ethers.js/commit/b69f43bc6f35da881ca7a0c8ccc5fda92edd076d)).
- Add timeout to ContractTransactionResponse wait ([#4497](https://github.com/ethers-io/ethers.js/issues/4497); [095de51](https://github.com/ethers-io/ethers.js/commit/095de51e605a9b88576e5e34fd55a6e32befa4eb)).
- Allow override keyword in human-readable ABI and improve error messages ([#4514](https://github.com/ethers-io/ethers.js/issues/4514), [#4548](https://github.com/ethers-io/ethers.js/issues/4548); [be5ec2d](https://github.com/ethers-io/ethers.js/commit/be5ec2d327a503b2e5fc0f37c47eee9e828f8e23)).
- Expand Contract sub-class to accept BaseContract super-class constructor arguments ([#4538](https://github.com/ethers-io/ethers.js/issues/4538); [98496bc](https://github.com/ethers-io/ethers.js/commit/98496bc48ec23ce0d9c21d3c6c87e5b1b796a610)).
- Allow network for default provider to be null to select mainnet ([#4501](https://github.com/ethers-io/ethers.js/issues/4501); [b6bf7ab](https://github.com/ethers-io/ethers.js/commit/b6bf7aba62fb38839cd01858432b801cc5c28a11)).
- Allow long dnsEncode names with optional length parameter ([#4543](https://github.com/ethers-io/ethers.js/issues/4543); [a136348](https://github.com/ethers-io/ethers.js/commit/a1363483a56b0dee342595c8f44ed8fcce7ecca9)).
- Fix parseLog signature when receiving read-only array for topics ([#4029](https://github.com/ethers-io/ethers.js/issues/4029), [#4459](https://github.com/ethers-io/ethers.js/issues/4459); [20cd8a2](https://github.com/ethers-io/ethers.js/commit/20cd8a23eaf8e8a14e2b51f7f64da4cb3e32fccb)).
- Use Secure endpoints for BNB on Etherscan ([#4525](https://github.com/ethers-io/ethers.js/issues/4525); [1f6e188](https://github.com/ethers-io/ethers.js/commit/1f6e1882515195bd67f0bce9fe347ec05107324b)).
- Added holesky network and related end-points for supporting providers ([c6e6c43](https://github.com/ethers-io/ethers.js/commit/c6e6c432574a0b7e55c300ab3e470aafdace28b3)).
- Added EIP-4844 BLOb transactions ([#4554](https://github.com/ethers-io/ethers.js/issues/4554); [9c1e82e](https://github.com/ethers-io/ethers.js/commit/9c1e82e1230526ebcd62902890c4f24b1f7f7d79)).
- Normalize EIP-712 types before computing the payload ([#4541](https://github.com/ethers-io/ethers.js/issues/4541); [56c1361](https://github.com/ethers-io/ethers.js/commit/56c1361ee83db8b68859caf0850c95ff70e7e306)).
- Updated thrid-part provider URLs for QuickNode ([2b4891d](https://github.com/ethers-io/ethers.js/commit/2b4891d86e72e849079cb1dc98b18e158b0c0620)).
- Fixed normalization and abstracted EIP-712 Array parsing ([#4541](https://github.com/ethers-io/ethers.js/issues/4541); [8f99601](https://github.com/ethers-io/ethers.js/commit/8f99601df1f26a8ba4d6d9dea5e033e7f688107e)).
- Updated third-party provider network URLs ([#4542](https://github.com/ethers-io/ethers.js/issues/4542); [84ca14f](https://github.com/ethers-io/ethers.js/commit/84ca14f1ffc5afbdd7f4c26a9b734ec5951eee3c)).
- Added additional sepolia testnets ([4efef76](https://github.com/ethers-io/ethers.js/commit/4efef76e8cab0acaf1b2ba231a0148f9381bb1ee)).
- Fix EIP-712 type aliases for uint and int ([#4541](https://github.com/ethers-io/ethers.js/issues/4541); [43fb9c2](https://github.com/ethers-io/ethers.js/commit/43fb9c233696aeaa80b1c2b0e5fafce90e0ad508)).
- Fixed typo in Error string ([#4539](https://github.com/ethers-io/ethers.js/issues/4539); [7882905](https://github.com/ethers-io/ethers.js/commit/78829050853093bc5291ae78fc5a904044759aa0)).
- Better debugging output on fetch errors ([bee07a0](https://github.com/ethers-io/ethers.js/commit/bee07a0750b448a9d13c2d57014bcf27f43e2ed7)).
ethers/v6.10.0 (2024-01-12 19:46)

@@ -8,0 +33,0 @@ ---------------------------------

2

lib.commonjs/_version.js

@@ -8,3 +8,3 @@ "use strict";

*/
exports.version = "6.10.0";
exports.version = "6.11.0";
//# sourceMappingURL=_version.js.map

@@ -24,6 +24,6 @@ "use strict";

}
const _kwVisibDeploy = "external public payable";
const _kwVisibDeploy = "external public payable override";
const KwVisibDeploy = setify(_kwVisibDeploy.split(" "));
// Visibility Keywords
const _kwVisib = "constant external internal payable private public pure view";
const _kwVisib = "constant external internal payable private public pure view override";
const KwVisib = setify(_kwVisib.split(" "));

@@ -82,3 +82,4 @@ const _kwTypes = "constructor error event fallback function receive struct";

if (this.peek().type !== type) {
throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`);
const top = this.peek();
throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`);
}

@@ -315,3 +316,3 @@ return this.pop().text;

if (tokens.length) {
throw new Error(`unexpected tokens: ${tokens.toString()}`);
throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`);
}

@@ -318,0 +319,0 @@ }

@@ -364,3 +364,3 @@ /**

parseLog(log: {
topics: Array<string>;
topics: ReadonlyArray<string>;
data: string;

@@ -367,0 +367,0 @@ }): null | LogDescription;

@@ -256,3 +256,3 @@ "use strict";

catch (error) {
console.log("EE", error);
console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message);
}

@@ -259,0 +259,0 @@ }

@@ -161,3 +161,3 @@ import { Interface } from "../abi/index.js";

}
declare const Contract_base: new (target: string, abi: Interface | InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit<ContractInterface, keyof BaseContract>;
declare const Contract_base: new (target: string | Addressable, abi: Interface | InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit<ContractInterface, keyof BaseContract>;
/**

@@ -164,0 +164,0 @@ * A [[BaseContract]] with no type guards on its methods or events.

@@ -45,3 +45,3 @@ import { Interface } from "../abi/index.js";

*
* This will resovle to the Contract before it has been deployed to the
* This will resolve to the Contract before it has been deployed to the
* network, so the [[BaseContract-waitForDeployment]] should be used before

@@ -48,0 +48,0 @@ * sending any transactions to it.

@@ -76,3 +76,3 @@ "use strict";

*
* This will resovle to the Contract before it has been deployed to the
* This will resolve to the Contract before it has been deployed to the
* network, so the [[BaseContract-waitForDeployment]] should be used before

@@ -79,0 +79,0 @@ * sending any transactions to it.

@@ -85,3 +85,3 @@ import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js";

*/
wait(confirms?: number): Promise<null | ContractTransactionReceipt>;
wait(confirms?: number, timeout?: number): Promise<null | ContractTransactionReceipt>;
}

@@ -88,0 +88,0 @@ /**

@@ -114,4 +114,4 @@ "use strict";

*/
async wait(confirms) {
const receipt = await super.wait(confirms);
async wait(confirms, timeout) {
const receipt = await super.wait(confirms, timeout);
if (receipt == null) {

@@ -118,0 +118,0 @@ return null;

@@ -19,3 +19,3 @@ /**

*/
export declare function dnsEncode(name: string): string;
export declare function dnsEncode(name: string, _maxLength?: number): string;
//# sourceMappingURL=namehash.d.ts.map

@@ -79,8 +79,7 @@ "use strict";

*/
function dnsEncode(name) {
function dnsEncode(name, _maxLength) {
const length = (_maxLength != null) ? _maxLength : 63;
(0, index_js_2.assertArgument)(length <= 255, "DNS encoded label cannot exceed 255", "length", length);
return (0, index_js_2.hexlify)((0, index_js_2.concat)(ensNameSplit(name).map((comp) => {
// DNS does not allow components over 63 bytes in length
if (comp.length > 63) {
throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");
}
(0, index_js_2.assertArgument)(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name);
const bytes = new Uint8Array(comp.length + 1);

@@ -87,0 +86,0 @@ bytes.set(comp, 1);

@@ -71,3 +71,3 @@ import type { SignatureLike } from "../crypto/index.js";

*/
constructor(types: Record<string, Array<TypedDataField>>);
constructor(_types: Record<string, Array<TypedDataField>>);
/**

@@ -74,0 +74,0 @@ * Returnthe encoder for the specific %%type%%.

@@ -71,7 +71,7 @@ "use strict";

{
const match = type.match(/^(u?)int(\d*)$/);
const match = type.match(/^(u?)int(\d+)$/);
if (match) {
const signed = (match[1] === "");
const width = parseInt(match[2] || "256");
(0, index_js_4.assertArgument)(width % 8 === 0 && width !== 0 && width <= 256 && (match[2] == null || match[2] === String(width)), "invalid numeric width", "type", type);
const width = parseInt(match[2]);
(0, index_js_4.assertArgument)(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type);
const boundsUpper = (0, index_js_4.mask)(BN_MAX_UINT256, signed ? (width - 1) : width);

@@ -118,2 +118,19 @@ const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0;

}
// foo[][3] => { base: "foo", index: "[][3]", array: {
// base: "foo", prefix: "foo[]", count: 3 } }
function splitArray(type) {
const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);
if (match) {
return {
base: match[1],
index: (match[2] + match[4]),
array: {
base: match[1],
prefix: (match[1] + match[2]),
count: (match[5] ? parseInt(match[5]) : -1),
}
};
}
return { base: type };
}
/**

@@ -153,4 +170,3 @@ * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads

*/
constructor(types) {
this.#types = JSON.stringify(types);
constructor(_types) {
this.#fullTypes = new Map();

@@ -164,3 +180,15 @@ this.#encoderCache = new Map();

const subtypes = new Map();
Object.keys(types).forEach((type) => {
const types = {};
Object.keys(_types).forEach((type) => {
types[type] = _types[type].map(({ name, type }) => {
// Normalize the base type (unless name conflict)
let { base, index } = splitArray(type);
if (base === "int" && !_types["int"]) {
base = "int256";
}
if (base === "uint" && !_types["uint"]) {
base = "uint256";
}
return { name, type: (base + (index || "")) };
});
links.set(type, new Set());

@@ -170,2 +198,3 @@ parents.set(type, []);

});
this.#types = JSON.stringify(types);
for (const name in types) {

@@ -175,7 +204,7 @@ const uniqueNames = new Set();

// Check each field has a unique name
(0, index_js_4.assertArgument)(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types);
(0, index_js_4.assertArgument)(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types);
uniqueNames.add(field.name);
// Get the base type (drop any array specifiers)
const baseType = (field.type.match(/^([^\x5b]*)(\x5b|$)/))[1] || null;
(0, index_js_4.assertArgument)(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", types);
const baseType = splitArray(field.type).base;
(0, index_js_4.assertArgument)(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types);
// Is this a base encoding type?

@@ -186,3 +215,3 @@ const encoder = getBaseEncoder(baseType);

}
(0, index_js_4.assertArgument)(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", types);
(0, index_js_4.assertArgument)(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types);
// Add linkage

@@ -195,8 +224,8 @@ parents.get(baseType).push(name);

const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0));
(0, index_js_4.assertArgument)(primaryTypes.length !== 0, "missing primary type", "types", types);
(0, index_js_4.assertArgument)(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types);
(0, index_js_4.assertArgument)(primaryTypes.length !== 0, "missing primary type", "types", _types);
(0, index_js_4.assertArgument)(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", _types);
(0, index_js_4.defineProperties)(this, { primaryType: primaryTypes[0] });
// Check for circular type references
function checkCircular(type, found) {
(0, index_js_4.assertArgument)(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", types);
(0, index_js_4.assertArgument)(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types);
found.add(type);

@@ -244,8 +273,8 @@ for (const child of links.get(type)) {

// Array
const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
const subtype = match[1];
const array = splitArray(type).array;
if (array) {
const subtype = array.prefix;
const subEncoder = this.getEncoder(subtype);
return (value) => {
(0, index_js_4.assertArgument)(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value);
(0, index_js_4.assertArgument)(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value);
let result = value.map(subEncoder);

@@ -320,6 +349,6 @@ if (this.#fullTypes.has(subtype)) {

// Array
const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
(0, index_js_4.assertArgument)(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value);
return value.map((v) => this._visit(match[1], v, callback));
const array = splitArray(type).array;
if (array) {
(0, index_js_4.assertArgument)(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value);
return value.map((v) => this._visit(array.prefix, v, callback));
}

@@ -463,2 +492,4 @@ // Struct

const encoder = TypedDataEncoder.from(types);
// Get the normalized types
types = encoder.types;
const typesWithDomain = Object.assign({}, types);

@@ -465,0 +496,0 @@ (0, index_js_4.assertArgument)(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types);

@@ -47,3 +47,3 @@ import type { AbstractProvider } from "./abstract-provider.js";

*/
export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider;
export declare function getDefaultProvider(network?: string | Networkish | WebSocketLike, options?: any): AbstractProvider;
//# sourceMappingURL=default-provider.d.ts.map
import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js";
export type FormatFunc = (value: any) => any;
export declare function allowNull(format: FormatFunc, nullValue?: any): FormatFunc;
export declare function arrayOf(format: FormatFunc): FormatFunc;
export declare function arrayOf(format: FormatFunc, allowNull?: boolean): FormatFunc;
export declare function object(format: Record<string, FormatFunc>, altNames?: Record<string, Array<string>>): FormatFunc;

@@ -6,0 +6,0 @@ export declare function formatBoolean(value: any): boolean;

@@ -21,4 +21,7 @@ "use strict";

exports.allowNull = allowNull;
function arrayOf(format) {
function arrayOf(format, allowNull) {
return ((array) => {
if (allowNull && array == null) {
return null;
}
if (!Array.isArray(array)) {

@@ -111,2 +114,3 @@ throw new Error("not an array");

parentHash: formatHash,
parentBeaconBlockRoot: allowNull(formatHash, null),
number: index_js_4.getNumber,

@@ -118,2 +122,6 @@ timestamp: index_js_4.getNumber,

gasUsed: index_js_4.getBigInt,
stateRoot: allowNull(formatHash, null),
receiptsRoot: allowNull(formatHash, null),
blobGasUsed: allowNull(index_js_4.getBigInt, null),
excessBlobGas: allowNull(index_js_4.getBigInt, null),
miner: allowNull(index_js_1.getAddress),

@@ -158,2 +166,3 @@ extraData: formatData,

gasUsed: index_js_4.getBigInt,
blobGasUsed: allowNull(index_js_4.getBigInt, null),
logsBloom: allowNull(formatData),

@@ -167,2 +176,3 @@ blockHash: formatHash,

effectiveGasPrice: allowNull(index_js_4.getBigInt),
blobGasPrice: allowNull(index_js_4.getBigInt, null),
status: allowNull(index_js_4.getNumber),

@@ -194,2 +204,3 @@ type: allowNull(index_js_4.getNumber, 0)

accessList: allowNull(index_js_3.accessListify, null),
blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),
blockHash: allowNull(formatHash, null),

@@ -204,2 +215,3 @@ blockNumber: allowNull(index_js_4.getNumber, null),

maxFeePerGas: allowNull(index_js_4.getBigInt),
maxFeePerBlobGas: allowNull(index_js_4.getBigInt, null),
gasLimit: index_js_4.getBigInt,

@@ -206,0 +218,0 @@ to: allowNull(index_js_1.getAddress, null),

@@ -32,2 +32,7 @@ /**

/**
* The hash tree root of the parent beacon block for the given
* execution block. See [[link-eip-4788]].
*/
parentBeaconBlockRoot?: null | string;
/**
* A random sequence provided during the mining process for

@@ -51,2 +56,12 @@ * proof-of-work networks.

/**
* The total amount of BLOb gas consumed by transactions within
* the block. See [[link-eip4844].
*/
blobGasUsed?: null | bigint;
/**
* The running total of BLOb gas consumed in excess of the target
* prior to the block. See [[link-eip-4844]].
*/
excessBlobGas?: null | bigint;
/**
* The miner (or author) of a block.

@@ -65,2 +80,11 @@ */

/**
* The root hash for the global state after applying changes
* in this block.
*/
stateRoot?: null | string;
/**
* The hash of the transaction receipts trie.
*/
receiptsRoot?: null | string;
/**
* The list of transactions in the block.

@@ -165,2 +189,6 @@ */

/**
* The amount of BLOb gas used. See [[link-eip-4844]].
*/
blobGasUsed?: null | bigint;
/**
* The total amount of gas consumed during the entire block up to

@@ -175,2 +203,6 @@ * and including this transaction.

/**
* The actual BLOb gas price that was charged. See [[link-eip-4844]].
*/
blobGasPrice?: null | bigint;
/**
* The actual gas price per gas charged for this transaction.

@@ -253,2 +285,7 @@ */

/**
* For [[link-eip-4844]] transactions, this is the maximum fee that
* will be paid per BLOb.
*/
maxFeePerBlobGas?: null | bigint;
/**
* The transaction data.

@@ -273,3 +310,7 @@ */

accessList: null | AccessList;
/**
* The [[link-eip-4844]] BLOb versioned hashes.
*/
blobVersionedHashes?: null | Array<string>;
}
//# sourceMappingURL=formatting.d.ts.map

@@ -330,2 +330,3 @@ "use strict";

registerEth("sepolia", 11155111, { ensNetwork: 11155111 });
registerEth("holesky", 17000, { ensNetwork: 17000 });
registerEth("classic", 61, {});

@@ -337,2 +338,3 @@ registerEth("classicKotti", 6, {});

registerEth("arbitrum-goerli", 421613, {});
registerEth("arbitrum-sepolia", 421614, {});
registerEth("base", 8453, { ensNetwork: 1 });

@@ -362,4 +364,5 @@ registerEth("base-goerli", 84531, {});

registerEth("optimism-goerli", 420, {});
registerEth("optimism-sepolia", 11155420, {});
registerEth("xdai", 100, { ensNetwork: 1 });
}
//# sourceMappingURL=network.js.map
/**
* About Alchemy
* [[link-alchemy]] provides a third-party service for connecting to
* various blockchains over JSON-RPC.
*
* **Supported Networks**
*
* - Ethereum Mainnet (``mainnet``)
* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*
* @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]

@@ -5,0 +23,0 @@ */

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AlchemyProvider = void 0;
/**
* About Alchemy
* [[link-alchemy]] provides a third-party service for connecting to
* various blockchains over JSON-RPC.
*
* **Supported Networks**
*
* - Ethereum Mainnet (``mainnet``)
* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*
* @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.AlchemyProvider = void 0;
const index_js_1 = require("../utils/index.js");

@@ -26,2 +44,4 @@ const community_js_1 = require("./community.js");

return "arb-goerli.g.alchemy.com";
case "arbitrum-sepolia":
return "arb-sepolia.g.alchemy.com";
case "base":

@@ -31,2 +51,4 @@ return "base-mainnet.g.alchemy.com";

return "base-goerli.g.alchemy.com";
case "base-sepolia":
return "base-sepolia.g.alchemy.com";
case "matic":

@@ -40,2 +62,4 @@ return "polygon-mainnet.g.alchemy.com";

return "opt-goerli.g.alchemy.com";
case "optimism-sepolia":
return "opt-sepolia.g.alchemy.com";
}

@@ -42,0 +66,0 @@ (0, index_js_1.assertArgument)(false, "unsupported network", "network", name);

@@ -9,4 +9,14 @@ /**

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB (``bnb``)
* - BNB Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Arbitrum (``arbitrum``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*

@@ -13,0 +23,0 @@ * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]

@@ -12,4 +12,14 @@ "use strict";

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB (``bnb``)
* - BNB Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Arbitrum (``arbitrum``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*

@@ -29,6 +39,26 @@ * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]

return "rpc.ankr.com/eth_goerli";
case "sepolia":
return "rpc.ankr.com/eth_sepolia";
case "arbitrum":
return "rpc.ankr.com/arbitrum";
case "base":
return "rpc.ankr.com/base";
case "base-goerli":
return "rpc.ankr.com/base_goerli";
case "base-sepolia":
return "rpc.ankr.com/base_sepolia";
case "bnb":
return "rpc.ankr.com/bsc";
case "bnbt":
return "rpc.ankr.com/bsc_testnet_chapel";
case "matic":
return "rpc.ankr.com/polygon";
case "arbitrum":
return "rpc.ankr.com/arbitrum";
case "matic-mumbai":
return "rpc.ankr.com/polygon_mumbai";
case "optimism":
return "rpc.ankr.com/optimism";
case "optimism-goerli":
return "rpc.ankr.com/optimism_testnet";
case "optimism-sepolia":
return "rpc.ankr.com/optimism_sepolia";
}

@@ -35,0 +65,0 @@ (0, index_js_1.assertArgument)(false, "unsupported network", "network", name);

@@ -19,2 +19,3 @@ "use strict";

constructor(ethereum, network) {
(0, index_js_1.assertArgument)(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum);
super(network, { batchMaxCount: 1 });

@@ -21,0 +22,0 @@ this.#request = async (method, params) => {

@@ -11,4 +11,7 @@ /**

* - Sepolia Testnet (``sepolia``)
* - Sepolia Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)

@@ -15,0 +18,0 @@ * - Optimism Goerli Testnet (``optimism-goerli``)

@@ -12,4 +12,7 @@ "use strict";

* - Sepolia Testnet (``sepolia``)
* - Sepolia Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)

@@ -113,2 +116,4 @@ * - Optimism Goerli Testnet (``optimism-goerli``)

return "https:/\/api-sepolia.etherscan.io";
case "holesky":
return "https:/\/api-holesky.etherscan.io";
case "arbitrum":

@@ -118,2 +123,6 @@ return "https:/\/api.arbiscan.io";

return "https:/\/api-goerli.arbiscan.io";
case "bnb":
return "https:/\/api.bscscan.com";
case "bnbt":
return "https:/\/api-testnet.bscscan.com";
case "matic":

@@ -127,6 +136,2 @@ return "https:/\/api.polygonscan.com";

return "https:/\/api-goerli-optimistic.etherscan.io";
case "bnb":
return "http:/\/api.bscscan.com";
case "bnbt":
return "http:/\/api-testnet.bscscan.com";
default:

@@ -133,0 +138,0 @@ }

@@ -78,3 +78,3 @@ import { AbstractProvider } from "./abstract-provider.js";

* A **FallbackProvider** manages several [[Providers]] providing
* resiliance by switching between slow or misbehaving nodes, security
* resilience by switching between slow or misbehaving nodes, security
* by requiring multiple backends to aggree and performance by allowing

@@ -81,0 +81,0 @@ * faster backends to respond earlier.

@@ -5,3 +5,3 @@ "use strict";

/**
* A **FallbackProvider** providers resiliance, security and performatnce
* A **FallbackProvider** provides resilience, security and performance
* in a way that is customizable and configurable.

@@ -208,3 +208,3 @@ *

* A **FallbackProvider** manages several [[Providers]] providing
* resiliance by switching between slow or misbehaving nodes, security
* resilience by switching between slow or misbehaving nodes, security
* by requiring multiple backends to aggree and performance by allowing

@@ -211,0 +211,0 @@ * faster backends to respond earlier.

@@ -12,4 +12,13 @@ /**

* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Linea (``linea``)
* - Linea Goerlia Testnet (``linea-goerli``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -16,0 +25,0 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

@@ -15,4 +15,13 @@ "use strict";

* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Linea (``linea``)
* - Linea Goerlia Testnet (``linea-goerli``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -41,2 +50,14 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

return "arbitrum-goerli.infura.io";
case "arbitrum-sepolia":
return "arbitrum-sepolia.infura.io";
case "base":
return "base-mainnet.infura.io";
case "base-goerlia":
return "base-goerli.infura.io";
case "base-sepolia":
return "base-sepolia.infura.io";
case "bnb":
return "bnbsmartchain-mainnet.infura.io";
case "bnbt":
return "bnbsmartchain-testnet.infura.io";
case "linea":

@@ -54,2 +75,4 @@ return "linea-mainnet.infura.io";

return "optimism-goerli.infura.io";
case "optimism-sepolia":
return "optimism-sepolia.infura.io";
}

@@ -56,0 +79,0 @@ (0, index_js_1.assertArgument)(false, "unsupported network", "network", name);

@@ -103,3 +103,3 @@ /**

* can have tragic consequences. For example, this **CANNOT** be used
* with MetaMask, since the used can select a new network from the
* with MetaMask, since the user can select a new network from the
* drop-down at any time.

@@ -106,0 +106,0 @@ *

@@ -9,6 +9,15 @@ /**

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Holesky Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base Mainnet (``base``);
* - Base Goerli Testnet (``base-goerli``);
* - Base Sepolia Testnet (``base-sepolia``);
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -15,0 +24,0 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

@@ -10,6 +10,15 @@ "use strict";

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Holesky Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base Mainnet (``base``);
* - Base Goerli Testnet (``base-goerli``);
* - Base Sepolia Testnet (``base-sepolia``);
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -33,4 +42,6 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

return "ethers.ethereum-goerli.quiknode.pro";
//case "sepolia":
// return "sepolia.infura.io";
case "sepolia":
return "ethers.ethereum-sepolia.quiknode.pro";
case "holesky":
return "ethers.ethereum-holesky.quiknode.pro";
case "arbitrum":

@@ -40,2 +51,14 @@ return "ethers.arbitrum-mainnet.quiknode.pro";

return "ethers.arbitrum-goerli.quiknode.pro";
case "arbitrum-sepolia":
return "ethers.arbitrum-sepolia.quiknode.pro";
case "base":
return "ethers.base-mainnet.quiknode.pro";
case "base-goerli":
return "ethers.base-goerli.quiknode.pro";
case "base-spolia":
return "ethers.base-sepolia.quiknode.pro";
case "bnb":
return "ethers.bsc.quiknode.pro";
case "bnbt":
return "ethers.bsc-testnet.quiknode.pro";
case "matic":

@@ -49,5 +72,36 @@ return "ethers.matic.quiknode.pro";

return "ethers.optimism-goerli.quiknode.pro";
case "optimism-sepolia":
return "ethers.optimism-sepolia.quiknode.pro";
case "xdai":
return "ethers.xdai.quiknode.pro";
}
(0, index_js_1.assertArgument)(false, "unsupported network", "network", name);
}
/*
@TODO:
These networks are not currently present in the Network
default included networks. Research them and ensure they
are EVM compatible and work with ethers
http://ethers.matic-amoy.quiknode.pro
http://ethers.avalanche-mainnet.quiknode.pro
http://ethers.avalanche-testnet.quiknode.pro
http://ethers.blast-sepolia.quiknode.pro
http://ethers.celo-mainnet.quiknode.pro
http://ethers.fantom.quiknode.pro
http://ethers.imx-demo.quiknode.pro
http://ethers.imx-mainnet.quiknode.pro
http://ethers.imx-testnet.quiknode.pro
http://ethers.near-mainnet.quiknode.pro
http://ethers.near-testnet.quiknode.pro
http://ethers.nova-mainnet.quiknode.pro
http://ethers.scroll-mainnet.quiknode.pro
http://ethers.scroll-testnet.quiknode.pro
http://ethers.tron-mainnet.quiknode.pro
http://ethers.zkevm-mainnet.quiknode.pro
http://ethers.zkevm-testnet.quiknode.pro
http://ethers.zksync-mainnet.quiknode.pro
http://ethers.zksync-testnet.quiknode.pro
*/
/**

@@ -54,0 +108,0 @@ * The **QuickNodeProvider** connects to the [[link-quicknode]]

@@ -89,3 +89,3 @@ import type { AddressLike, NameResolver } from "../address/index.js";

/**
* The maximum amount of gas to allow this transaction to consime.
* The maximum amount of gas to allow this transaction to consume.
*/

@@ -298,2 +298,7 @@ gasLimit?: null | BigNumberish;

/**
* The hash tree root of the parent beacon block for the given
* execution block. See [[link-eip-4788]].
*/
parentBeaconBlockRoot: null | string;
/**
* The nonce.

@@ -324,2 +329,21 @@ *

/**
* The root hash for the global state after applying changes
* in this block.
*/
readonly stateRoot: null | string;
/**
* The hash of the transaction receipts trie.
*/
readonly receiptsRoot: null | string;
/**
* The total amount of blob gas consumed by the transactions
* within the block. See [[link-eip-4844]].
*/
readonly blobGasUsed: null | bigint;
/**
* The running total of blob gas consumed in excess of the
* target, prior to the block. See [[link-eip-4844]].
*/
readonly excessBlobGas: null | bigint;
/**
* The miner coinbase address, wihch receives any subsidies for

@@ -546,2 +570,6 @@ * including this block.

/**
* The gas used for BLObs. See [[link-eip-4844]].
*/
readonly blobGasUsed: null | bigint;
/**
* The amount of gas used by all transactions within the block for this

@@ -563,2 +591,6 @@ * and all transactions with a lower ``index``.

/**
* The price paid per BLOB in gas. See [[link-eip-4844]].
*/
readonly blobGasPrice: null | bigint;
/**
* The [[link-eip-2718]] transaction type.

@@ -746,2 +778,6 @@ */

/**
* The [[link-eip-4844]] max fee per BLOb gas.
*/
readonly maxFeePerBlobGas: null | bigint;
/**
* The data.

@@ -769,2 +805,6 @@ */

/**
* The [[link-eip-4844]] BLOb versioned hashes.
*/
readonly blobVersionedHashes: null | Array<string>;
/**
* @_ignore:

@@ -852,2 +892,13 @@ */

/**
* Returns true if hte transaction is a Cancun (i.e. ``type == 3``)
* transaction. See [[link-eip-4844]].
*/
isCancun(): this is (TransactionResponse & {
accessList: AccessList;
maxFeePerGas: bigint;
maxPriorityFeePerGas: bigint;
maxFeePerBlobGas: bigint;
blobVersionedHashes: Array<string>;
});
/**
* Returns a filter which can be used to listen for orphan events

@@ -854,0 +905,0 @@ * that evict this transaction.

@@ -157,2 +157,7 @@ "use strict";

/**
* The hash tree root of the parent beacon block for the given
* execution block. See [[link-eip-4788]].
*/
parentBeaconBlockRoot;
/**
* The nonce.

@@ -183,2 +188,21 @@ *

/**
* The root hash for the global state after applying changes
* in this block.
*/
stateRoot;
/**
* The hash of the transaction receipts trie.
*/
receiptsRoot;
/**
* The total amount of blob gas consumed by the transactions
* within the block. See [[link-eip-4844]].
*/
blobGasUsed;
/**
* The running total of blob gas consumed in excess of the
* target, prior to the block. See [[link-eip-4844]].
*/
excessBlobGas;
/**
* The miner coinbase address, wihch receives any subsidies for

@@ -220,2 +244,3 @@ * including this block.

parentHash: block.parentHash,
parentBeaconBlockRoot: block.parentBeaconBlockRoot,
nonce: block.nonce,

@@ -225,5 +250,9 @@ difficulty: block.difficulty,

gasUsed: block.gasUsed,
blobGasUsed: block.blobGasUsed,
excessBlobGas: block.excessBlobGas,
miner: block.miner,
extraData: block.extraData,
baseFeePerGas: getValue(block.baseFeePerGas)
baseFeePerGas: getValue(block.baseFeePerGas),
stateRoot: block.stateRoot,
receiptsRoot: block.receiptsRoot,
});

@@ -267,3 +296,3 @@ }

toJSON() {
const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, nonce, number, parentHash, timestamp, transactions } = this;
const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this;
return {

@@ -276,3 +305,6 @@ _type: "Block",

gasUsed: toJson(gasUsed),
blobGasUsed: toJson(this.blobGasUsed),
excessBlobGas: toJson(this.excessBlobGas),
hash, miner, nonce, number, parentHash, timestamp,
parentBeaconBlockRoot, stateRoot, receiptsRoot,
transactions,

@@ -583,2 +615,6 @@ };

/**
* The gas used for BLObs. See [[link-eip-4844]].
*/
blobGasUsed;
/**
* The amount of gas used by all transactions within the block for this

@@ -600,2 +636,6 @@ * and all transactions with a lower ``index``.

/**
* The price paid per BLOB in gas. See [[link-eip-4844]].
*/
blobGasPrice;
/**
* The [[link-eip-2718]] transaction type.

@@ -647,3 +687,5 @@ */

cumulativeGasUsed: tx.cumulativeGasUsed,
blobGasUsed: tx.blobGasUsed,
gasPrice,
blobGasPrice: tx.blobGasPrice,
type: tx.type,

@@ -673,2 +715,4 @@ //byzantium: tx.byzantium,

gasPrice: toJson(this.gasPrice),
blobGasUsed: toJson(this.blobGasUsed),
blobGasPrice: toJson(this.blobGasPrice),
gasUsed: toJson(this.gasUsed),

@@ -844,2 +888,6 @@ hash, index, logs, logsBloom, root, status, to

/**
* The [[link-eip-4844]] max fee per BLOb gas.
*/
maxFeePerBlobGas;
/**
* The data.

@@ -866,2 +914,6 @@ */

accessList;
/**
* The [[link-eip-4844]] BLOb versioned hashes.
*/
blobVersionedHashes;
#startBlock;

@@ -887,5 +939,7 @@ /**

this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null;
this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null;
this.chainId = tx.chainId;
this.signature = tx.signature;
this.accessList = (tx.accessList != null) ? tx.accessList : null;
this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null;
this.#startBlock = -1;

@@ -897,6 +951,7 @@ }

toJSON() {
const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList } = this;
const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this;
return {
_type: "TransactionReceipt",
_type: "TransactionResponse",
accessList, blockNumber, blockHash,
blobVersionedHashes,
chainId: toJson(this.chainId),

@@ -909,2 +964,3 @@ data, from,

maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas),
maxFeePerBlobGas: toJson(this.maxFeePerBlobGas),
nonce, signature, to, index, type,

@@ -1192,2 +1248,9 @@ value: toJson(this.value),

/**
* Returns true if hte transaction is a Cancun (i.e. ``type == 3``)
* transaction. See [[link-eip-4844]].
*/
isCancun() {
return (this.type === 3);
}
/**
* Returns a filter which can be used to listen for orphan events

@@ -1194,0 +1257,0 @@ * that evict this transaction.

@@ -67,2 +67,10 @@ import { Signature } from "../crypto/index.js";

accessList?: null | AccessListish;
/**
* The maximum fee per blob gas (see [[link-eip-4844]]).
*/
maxFeePerBlobGas?: null | BigNumberish;
/**
* The versioned hashes (see [[link-eip-4844]]).
*/
blobVersionedHashes?: null | Array<string>;
}

@@ -162,2 +170,12 @@ /**

/**
* The max fee per blob gas for Cancun transactions.
*/
get maxFeePerBlobGas(): null | bigint;
set maxFeePerBlobGas(value: null | BigNumberish);
/**
* The BLOB versioned hashes for Cancun transactions.
*/
get blobVersionedHashes(): null | Array<string>;
set blobVersionedHashes(value: null | Array<string>);
/**
* Creates a new Transaction with default values.

@@ -258,2 +276,18 @@ */

/**
* Returns true if this transaction is an [[link-eip-4844]] BLOB
* transaction.
*
* This provides a Type Guard that the related properties are
* non-null.
*/
isCancun(): this is (Transaction & {
type: 3;
to: string;
accessList: AccessList;
maxFeePerGas: bigint;
maxPriorityFeePerGas: bigint;
maxFeePerBlobGas: bigint;
blobVersionedHashes: Array<string>;
});
/**
* Create a copy of this transaciton.

@@ -260,0 +294,0 @@ */

@@ -5,2 +5,3 @@ "use strict";

const index_js_1 = require("../address/index.js");
const addresses_js_1 = require("../constants/addresses.js");
const index_js_2 = require("../crypto/index.js");

@@ -53,2 +54,9 @@ const index_js_3 = require("../utils/index.js");

}
function formatHashes(value, param) {
(0, index_js_3.assertArgument)(Array.isArray(value), `invalid ${param}`, "value", value);
for (let i = 0; i < value.length; i++) {
(0, index_js_3.assertArgument)((0, index_js_3.isHexString)(value[i], 32), "invalid ${ param } hash", `value[${i}]`, value[i]);
}
return value;
}
function _parseLegacy(data) {

@@ -98,8 +106,8 @@ const fields = (0, index_js_3.decodeRlp)(data);

const fields = [
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.gasPrice || 0, "gasPrice"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? (0, index_js_1.getAddress)(tx.to) : "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
];

@@ -167,4 +175,2 @@ let chainId = BN_0;

(0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), "invalid field count for transaction type: 2", "data", (0, index_js_3.hexlify)(data));
const maxPriorityFeePerGas = handleUint(fields[2], "maxPriorityFeePerGas");
const maxFeePerGas = handleUint(fields[3], "maxFeePerGas");
const tx = {

@@ -174,4 +180,4 @@ type: 2,

nonce: handleNumber(fields[1], "nonce"),
maxPriorityFeePerGas: maxPriorityFeePerGas,
maxFeePerGas: maxFeePerGas,
maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"),
maxFeePerGas: handleUint(fields[3], "maxFeePerGas"),
gasPrice: null,

@@ -194,11 +200,11 @@ gasLimit: handleUint(fields[4], "gasLimit"),

const fields = [
formatNumber(tx.chainId || 0, "chainId"),
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? (0, index_js_1.getAddress)(tx.to) : "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
(formatAccessList(tx.accessList || []))
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || [])
];

@@ -236,10 +242,10 @@ if (sig) {

const fields = [
formatNumber(tx.chainId || 0, "chainId"),
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.gasPrice || 0, "gasPrice"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? (0, index_js_1.getAddress)(tx.to) : "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
(formatAccessList(tx.accessList || []))
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || [])
];

@@ -253,2 +259,54 @@ if (sig) {

}
function _parseEip4844(data) {
const fields = (0, index_js_3.decodeRlp)((0, index_js_3.getBytes)(data).slice(1));
(0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), "invalid field count for transaction type: 3", "data", (0, index_js_3.hexlify)(data));
const tx = {
type: 3,
chainId: handleUint(fields[0], "chainId"),
nonce: handleNumber(fields[1], "nonce"),
maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"),
maxFeePerGas: handleUint(fields[3], "maxFeePerGas"),
gasPrice: null,
gasLimit: handleUint(fields[4], "gasLimit"),
to: handleAddress(fields[5]),
value: handleUint(fields[6], "value"),
data: (0, index_js_3.hexlify)(fields[7]),
accessList: handleAccessList(fields[8], "accessList"),
maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"),
blobVersionedHashes: fields[10]
};
(0, index_js_3.assertArgument)(tx.to != null, "invalid address for transaction type: 3", "data", data);
(0, index_js_3.assertArgument)(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data);
for (let i = 0; i < tx.blobVersionedHashes.length; i++) {
(0, index_js_3.assertArgument)((0, index_js_3.isHexString)(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, "data", data);
}
// Unsigned EIP-4844 Transaction
if (fields.length === 11) {
return tx;
}
tx.hash = (0, index_js_2.keccak256)(data);
_parseEipSignature(tx, fields.slice(11));
return tx;
}
function _serializeEip4844(tx, sig) {
const fields = [
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"),
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || addresses_js_1.ZeroAddress),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || []),
formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"),
formatHashes(tx.blobVersionedHashes || [], "blobVersionedHashes")
];
if (sig) {
fields.push(formatNumber(sig.yParity, "yParity"));
fields.push((0, index_js_3.toBeArray)(sig.r));
fields.push((0, index_js_3.toBeArray)(sig.s));
}
return (0, index_js_3.concat)(["0x03", (0, index_js_3.encodeRlp)(fields)]);
}
/**

@@ -280,2 +338,4 @@ * A **Transaction** describes an operation to be executed on

#accessList;
#maxFeePerBlobGas;
#blobVersionedHashes;
/**

@@ -307,2 +367,7 @@ * The transaction type.

break;
case 3:
case "cancun":
case "eip-4844":
this.#type = 3;
break;
default:

@@ -320,2 +385,3 @@ (0, index_js_3.assertArgument)(false, "unsupported transaction type", "type", value);

case 2: return "eip-1559";
case 3: return "eip-4844";
}

@@ -328,3 +394,9 @@ return null;

*/
get to() { return this.#to; }
get to() {
const value = this.#to;
if (value == null && this.type === 3) {
return addresses_js_1.ZeroAddress;
}
return value;
}
set to(value) {

@@ -366,3 +438,3 @@ this.#to = (value == null) ? null : (0, index_js_1.getAddress)(value);

if (value == null) {
if (this.type === 2) {
if (this.type === 2 || this.type === 3) {
return BN_0;

@@ -384,3 +456,3 @@ }

if (value == null) {
if (this.type === 2) {
if (this.type === 2 || this.type === 3) {
return BN_0;

@@ -429,3 +501,5 @@ }

if (value == null) {
if (this.type === 1 || this.type === 2) {
if (this.type === 1 || this.type === 2 || this.type === 3) {
// @TODO: in v7, this should assign the value or become
// a live object itself, otherwise mutation is inconsistent
return [];

@@ -441,2 +515,37 @@ }

/**
* The max fee per blob gas for Cancun transactions.
*/
get maxFeePerBlobGas() {
const value = this.#maxFeePerBlobGas;
if (value == null && this.type === 3) {
return BN_0;
}
return value;
}
set maxFeePerBlobGas(value) {
this.#maxFeePerBlobGas = (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxFeePerBlobGas");
}
/**
* The BLOB versioned hashes for Cancun transactions.
*/
get blobVersionedHashes() {
// @TODO: Mutation is inconsistent; if unset, the returned value
// cannot mutate the object, if set it can
let value = this.#blobVersionedHashes;
if (value == null && this.type === 3) {
return [];
}
return value;
}
set blobVersionedHashes(value) {
if (value != null) {
(0, index_js_3.assertArgument)(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value);
value = value.slice();
for (let i = 0; i < value.length; i++) {
(0, index_js_3.assertArgument)((0, index_js_3.isHexString)(value[i], 32), "invalid blobVersionedHash", `value[${i}]`, value[i]);
}
}
this.#blobVersionedHashes = value;
}
/**
* Creates a new Transaction with default values.

@@ -448,3 +557,3 @@ */

this.#nonce = 0;
this.#gasLimit = BigInt(0);
this.#gasLimit = BN_0;
this.#gasPrice = null;

@@ -454,6 +563,8 @@ this.#maxPriorityFeePerGas = null;

this.#data = "0x";
this.#value = BigInt(0);
this.#chainId = BigInt(0);
this.#value = BN_0;
this.#chainId = BN_0;
this.#sig = null;
this.#accessList = null;
this.#maxFeePerBlobGas = null;
this.#blobVersionedHashes = null;
}

@@ -503,3 +614,2 @@ /**

isSigned() {
//isSigned(): this is SignedTransaction {
return this.signature != null;

@@ -522,2 +632,4 @@ }

return _serializeEip1559(this, this.signature);
case 3:
return _serializeEip4844(this, this.signature);
}

@@ -540,2 +652,4 @@ (0, index_js_3.assert)(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" });

return _serializeEip1559(this);
case 3:
return _serializeEip4844(this);
}

@@ -549,3 +663,9 @@ (0, index_js_3.assert)(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".unsignedSerialized" });

inferType() {
return (this.inferTypes().pop());
const types = this.inferTypes();
// Prefer London (EIP-1559) over Cancun (BLOb)
if (types.indexOf(2) >= 0) {
return 2;
}
// Return the highest inferred type
return (types.pop());
}

@@ -561,2 +681,3 @@ /**

const hasAccessList = (this.accessList != null);
const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes);
//if (hasGasPrice && hasFee) {

@@ -592,2 +713,5 @@ // throw new Error("transaction cannot have gasPrice and maxFeePerGas");

}
else if (hasBlob && this.to) {
types.push(3);
}
else {

@@ -597,2 +721,3 @@ types.push(0);

types.push(2);
types.push(3);
}

@@ -634,2 +759,12 @@ }

/**
* Returns true if this transaction is an [[link-eip-4844]] BLOB
* transaction.
*
* This provides a Type Guard that the related properties are
* non-null.
*/
isCancun() {
return (this.type === 3);
}
/**
* Create a copy of this transaciton.

@@ -682,2 +817,3 @@ */

case 2: return Transaction.from(_parseEip1559(payload));
case 3: return Transaction.from(_parseEip4844(payload));
}

@@ -708,2 +844,5 @@ (0, index_js_3.assert)(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" });

}
if (tx.maxFeePerBlobGas != null) {
result.maxFeePerBlobGas = tx.maxFeePerBlobGas;
}
if (tx.data != null) {

@@ -724,2 +863,5 @@ result.data = tx.data;

}
if (tx.blobVersionedHashes != null) {
result.blobVersionedHashes = tx.blobVersionedHashes;
}
if (tx.hash != null) {

@@ -726,0 +868,0 @@ (0, index_js_3.assertArgument)(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx);

@@ -175,3 +175,3 @@ "use strict";

});
assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", {
assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", {
count: count,

@@ -178,0 +178,0 @@ expectedCount: expectedCount

@@ -827,4 +827,19 @@ "use strict";

}
let requestUrl = null;
if (this.request) {
requestUrl = this.request.url;
}
let responseBody = null;
try {
if (this.#body) {
responseBody = (0, utf8_js_1.toUtf8String)(this.#body);
}
}
catch (e) { }
(0, errors_js_1.assert)(false, message, "SERVER_ERROR", {
request: (this.request || "unknown request"), response: this, error
request: (this.request || "unknown request"), response: this, error,
info: {
requestUrl, responseBody,
responseStatus: `${this.statusCode} ${this.statusMessage}`
}
});

@@ -831,0 +846,0 @@ }

@@ -5,3 +5,3 @@ /* Do NOT modify this file; see /src.ts/_admin/update-version.ts */

*/
export const version = "6.10.0";
export const version = "6.11.0";
//# sourceMappingURL=_version.js.map

@@ -21,6 +21,6 @@ /**

}
const _kwVisibDeploy = "external public payable";
const _kwVisibDeploy = "external public payable override";
const KwVisibDeploy = setify(_kwVisibDeploy.split(" "));
// Visibility Keywords
const _kwVisib = "constant external internal payable private public pure view";
const _kwVisib = "constant external internal payable private public pure view override";
const KwVisib = setify(_kwVisib.split(" "));

@@ -79,3 +79,4 @@ const _kwTypes = "constructor error event fallback function receive struct";

if (this.peek().type !== type) {
throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`);
const top = this.peek();
throw new Error(`expected ${type}; got ${top.type} ${JSON.stringify(top.text)}`);
}

@@ -312,3 +313,3 @@ return this.pop().text;

if (tokens.length) {
throw new Error(`unexpected tokens: ${tokens.toString()}`);
throw new Error(`unexpected tokens at offset ${tokens.offset}: ${tokens.toString()}`);
}

@@ -315,0 +316,0 @@ }

@@ -364,3 +364,3 @@ /**

parseLog(log: {
topics: Array<string>;
topics: ReadonlyArray<string>;
data: string;

@@ -367,0 +367,0 @@ }): null | LogDescription;

@@ -248,3 +248,3 @@ /**

catch (error) {
console.log("EE", error);
console.log(`[Warning] Invalid Fragment ${JSON.stringify(a)}:`, error.message);
}

@@ -251,0 +251,0 @@ }

@@ -161,3 +161,3 @@ import { Interface } from "../abi/index.js";

}
declare const Contract_base: new (target: string, abi: Interface | InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit<ContractInterface, keyof BaseContract>;
declare const Contract_base: new (target: string | Addressable, abi: Interface | InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit<ContractInterface, keyof BaseContract>;
/**

@@ -164,0 +164,0 @@ * A [[BaseContract]] with no type guards on its methods or events.

@@ -45,3 +45,3 @@ import { Interface } from "../abi/index.js";

*
* This will resovle to the Contract before it has been deployed to the
* This will resolve to the Contract before it has been deployed to the
* network, so the [[BaseContract-waitForDeployment]] should be used before

@@ -48,0 +48,0 @@ * sending any transactions to it.

@@ -73,3 +73,3 @@ import { Interface } from "../abi/index.js";

*
* This will resovle to the Contract before it has been deployed to the
* This will resolve to the Contract before it has been deployed to the
* network, so the [[BaseContract-waitForDeployment]] should be used before

@@ -76,0 +76,0 @@ * sending any transactions to it.

@@ -85,3 +85,3 @@ import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js";

*/
wait(confirms?: number): Promise<null | ContractTransactionReceipt>;
wait(confirms?: number, timeout?: number): Promise<null | ContractTransactionReceipt>;
}

@@ -88,0 +88,0 @@ /**

@@ -108,4 +108,4 @@ // import from provider.ts instead of index.ts to prevent circular dep

*/
async wait(confirms) {
const receipt = await super.wait(confirms);
async wait(confirms, timeout) {
const receipt = await super.wait(confirms, timeout);
if (receipt == null) {

@@ -112,0 +112,0 @@ return null;

@@ -19,3 +19,3 @@ /**

*/
export declare function dnsEncode(name: string): string;
export declare function dnsEncode(name: string, _maxLength?: number): string;
//# sourceMappingURL=namehash.d.ts.map

@@ -73,8 +73,7 @@ import { keccak256 } from "../crypto/index.js";

*/
export function dnsEncode(name) {
export function dnsEncode(name, _maxLength) {
const length = (_maxLength != null) ? _maxLength : 63;
assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length);
return hexlify(concat(ensNameSplit(name).map((comp) => {
// DNS does not allow components over 63 bytes in length
if (comp.length > 63) {
throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");
}
assertArgument(comp.length <= length, `label ${JSON.stringify(name)} exceeds ${length} bytes`, "name", name);
const bytes = new Uint8Array(comp.length + 1);

@@ -81,0 +80,0 @@ bytes.set(comp, 1);

@@ -71,3 +71,3 @@ import type { SignatureLike } from "../crypto/index.js";

*/
constructor(types: Record<string, Array<TypedDataField>>);
constructor(_types: Record<string, Array<TypedDataField>>);
/**

@@ -74,0 +74,0 @@ * Returnthe encoder for the specific %%type%%.

@@ -68,7 +68,7 @@ //import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer";

{
const match = type.match(/^(u?)int(\d*)$/);
const match = type.match(/^(u?)int(\d+)$/);
if (match) {
const signed = (match[1] === "");
const width = parseInt(match[2] || "256");
assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && (match[2] == null || match[2] === String(width)), "invalid numeric width", "type", type);
const width = parseInt(match[2]);
assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type);
const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1) : width);

@@ -115,2 +115,19 @@ const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0;

}
// foo[][3] => { base: "foo", index: "[][3]", array: {
// base: "foo", prefix: "foo[]", count: 3 } }
function splitArray(type) {
const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);
if (match) {
return {
base: match[1],
index: (match[2] + match[4]),
array: {
base: match[1],
prefix: (match[1] + match[2]),
count: (match[5] ? parseInt(match[5]) : -1),
}
};
}
return { base: type };
}
/**

@@ -150,4 +167,3 @@ * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads

*/
constructor(types) {
this.#types = JSON.stringify(types);
constructor(_types) {
this.#fullTypes = new Map();

@@ -161,3 +177,15 @@ this.#encoderCache = new Map();

const subtypes = new Map();
Object.keys(types).forEach((type) => {
const types = {};
Object.keys(_types).forEach((type) => {
types[type] = _types[type].map(({ name, type }) => {
// Normalize the base type (unless name conflict)
let { base, index } = splitArray(type);
if (base === "int" && !_types["int"]) {
base = "int256";
}
if (base === "uint" && !_types["uint"]) {
base = "uint256";
}
return { name, type: (base + (index || "")) };
});
links.set(type, new Set());

@@ -167,2 +195,3 @@ parents.set(type, []);

});
this.#types = JSON.stringify(types);
for (const name in types) {

@@ -172,7 +201,7 @@ const uniqueNames = new Set();

// Check each field has a unique name
assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types);
assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", _types);
uniqueNames.add(field.name);
// Get the base type (drop any array specifiers)
const baseType = (field.type.match(/^([^\x5b]*)(\x5b|$)/))[1] || null;
assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", types);
const baseType = splitArray(field.type).base;
assertArgument(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", _types);
// Is this a base encoding type?

@@ -183,3 +212,3 @@ const encoder = getBaseEncoder(baseType);

}
assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", types);
assertArgument(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", _types);
// Add linkage

@@ -192,8 +221,8 @@ parents.get(baseType).push(name);

const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0));
assertArgument(primaryTypes.length !== 0, "missing primary type", "types", types);
assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types);
assertArgument(primaryTypes.length !== 0, "missing primary type", "types", _types);
assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", _types);
defineProperties(this, { primaryType: primaryTypes[0] });
// Check for circular type references
function checkCircular(type, found) {
assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", types);
assertArgument(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", _types);
found.add(type);

@@ -241,8 +270,8 @@ for (const child of links.get(type)) {

// Array
const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
const subtype = match[1];
const array = splitArray(type).array;
if (array) {
const subtype = array.prefix;
const subEncoder = this.getEncoder(subtype);
return (value) => {
assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value);
assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value);
let result = value.map(subEncoder);

@@ -317,6 +346,6 @@ if (this.#fullTypes.has(subtype)) {

// Array
const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value);
return value.map((v) => this._visit(match[1], v, callback));
const array = splitArray(type).array;
if (array) {
assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${array.count}`, "value", value);
return value.map((v) => this._visit(array.prefix, v, callback));
}

@@ -460,2 +489,4 @@ // Struct

const encoder = TypedDataEncoder.from(types);
// Get the normalized types
types = encoder.types;
const typesWithDomain = Object.assign({}, types);

@@ -462,0 +493,0 @@ assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types);

@@ -47,3 +47,3 @@ import type { AbstractProvider } from "./abstract-provider.js";

*/
export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider;
export declare function getDefaultProvider(network?: string | Networkish | WebSocketLike, options?: any): AbstractProvider;
//# sourceMappingURL=default-provider.d.ts.map
import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js";
export type FormatFunc = (value: any) => any;
export declare function allowNull(format: FormatFunc, nullValue?: any): FormatFunc;
export declare function arrayOf(format: FormatFunc): FormatFunc;
export declare function arrayOf(format: FormatFunc, allowNull?: boolean): FormatFunc;
export declare function object(format: Record<string, FormatFunc>, altNames?: Record<string, Array<string>>): FormatFunc;

@@ -6,0 +6,0 @@ export declare function formatBoolean(value: any): boolean;

@@ -17,4 +17,7 @@ /**

}
export function arrayOf(format) {
export function arrayOf(format, allowNull) {
return ((array) => {
if (allowNull && array == null) {
return null;
}
if (!Array.isArray(array)) {

@@ -100,2 +103,3 @@ throw new Error("not an array");

parentHash: formatHash,
parentBeaconBlockRoot: allowNull(formatHash, null),
number: getNumber,

@@ -107,2 +111,6 @@ timestamp: getNumber,

gasUsed: getBigInt,
stateRoot: allowNull(formatHash, null),
receiptsRoot: allowNull(formatHash, null),
blobGasUsed: allowNull(getBigInt, null),
excessBlobGas: allowNull(getBigInt, null),
miner: allowNull(getAddress),

@@ -145,2 +153,3 @@ extraData: formatData,

gasUsed: getBigInt,
blobGasUsed: allowNull(getBigInt, null),
logsBloom: allowNull(formatData),

@@ -154,2 +163,3 @@ blockHash: formatHash,

effectiveGasPrice: allowNull(getBigInt),
blobGasPrice: allowNull(getBigInt, null),
status: allowNull(getNumber),

@@ -180,2 +190,3 @@ type: allowNull(getNumber, 0)

accessList: allowNull(accessListify, null),
blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),
blockHash: allowNull(formatHash, null),

@@ -190,2 +201,3 @@ blockNumber: allowNull(getNumber, null),

maxFeePerGas: allowNull(getBigInt),
maxFeePerBlobGas: allowNull(getBigInt, null),
gasLimit: getBigInt,

@@ -192,0 +204,0 @@ to: allowNull(getAddress, null),

@@ -32,2 +32,7 @@ /**

/**
* The hash tree root of the parent beacon block for the given
* execution block. See [[link-eip-4788]].
*/
parentBeaconBlockRoot?: null | string;
/**
* A random sequence provided during the mining process for

@@ -51,2 +56,12 @@ * proof-of-work networks.

/**
* The total amount of BLOb gas consumed by transactions within
* the block. See [[link-eip4844].
*/
blobGasUsed?: null | bigint;
/**
* The running total of BLOb gas consumed in excess of the target
* prior to the block. See [[link-eip-4844]].
*/
excessBlobGas?: null | bigint;
/**
* The miner (or author) of a block.

@@ -65,2 +80,11 @@ */

/**
* The root hash for the global state after applying changes
* in this block.
*/
stateRoot?: null | string;
/**
* The hash of the transaction receipts trie.
*/
receiptsRoot?: null | string;
/**
* The list of transactions in the block.

@@ -165,2 +189,6 @@ */

/**
* The amount of BLOb gas used. See [[link-eip-4844]].
*/
blobGasUsed?: null | bigint;
/**
* The total amount of gas consumed during the entire block up to

@@ -175,2 +203,6 @@ * and including this transaction.

/**
* The actual BLOb gas price that was charged. See [[link-eip-4844]].
*/
blobGasPrice?: null | bigint;
/**
* The actual gas price per gas charged for this transaction.

@@ -253,2 +285,7 @@ */

/**
* For [[link-eip-4844]] transactions, this is the maximum fee that
* will be paid per BLOb.
*/
maxFeePerBlobGas?: null | bigint;
/**
* The transaction data.

@@ -273,3 +310,7 @@ */

accessList: null | AccessList;
/**
* The [[link-eip-4844]] BLOb versioned hashes.
*/
blobVersionedHashes?: null | Array<string>;
}
//# sourceMappingURL=formatting.d.ts.map

@@ -326,2 +326,3 @@ /**

registerEth("sepolia", 11155111, { ensNetwork: 11155111 });
registerEth("holesky", 17000, { ensNetwork: 17000 });
registerEth("classic", 61, {});

@@ -333,2 +334,3 @@ registerEth("classicKotti", 6, {});

registerEth("arbitrum-goerli", 421613, {});
registerEth("arbitrum-sepolia", 421614, {});
registerEth("base", 8453, { ensNetwork: 1 });

@@ -358,4 +360,5 @@ registerEth("base-goerli", 84531, {});

registerEth("optimism-goerli", 420, {});
registerEth("optimism-sepolia", 11155420, {});
registerEth("xdai", 100, { ensNetwork: 1 });
}
//# sourceMappingURL=network.js.map
/**
* About Alchemy
* [[link-alchemy]] provides a third-party service for connecting to
* various blockchains over JSON-RPC.
*
* **Supported Networks**
*
* - Ethereum Mainnet (``mainnet``)
* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*
* @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]

@@ -5,0 +23,0 @@ */

/**
* About Alchemy
* [[link-alchemy]] provides a third-party service for connecting to
* various blockchains over JSON-RPC.
*
* **Supported Networks**
*
* - Ethereum Mainnet (``mainnet``)
* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*
* @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]

@@ -23,2 +41,4 @@ */

return "arb-goerli.g.alchemy.com";
case "arbitrum-sepolia":
return "arb-sepolia.g.alchemy.com";
case "base":

@@ -28,2 +48,4 @@ return "base-mainnet.g.alchemy.com";

return "base-goerli.g.alchemy.com";
case "base-sepolia":
return "base-sepolia.g.alchemy.com";
case "matic":

@@ -37,2 +59,4 @@ return "polygon-mainnet.g.alchemy.com";

return "opt-goerli.g.alchemy.com";
case "optimism-sepolia":
return "opt-sepolia.g.alchemy.com";
}

@@ -39,0 +63,0 @@ assertArgument(false, "unsupported network", "network", name);

@@ -9,4 +9,14 @@ /**

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB (``bnb``)
* - BNB Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Arbitrum (``arbitrum``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*

@@ -13,0 +23,0 @@ * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]

@@ -9,4 +9,14 @@ /**

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB (``bnb``)
* - BNB Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Arbitrum (``arbitrum``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*

@@ -26,6 +36,26 @@ * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]

return "rpc.ankr.com/eth_goerli";
case "sepolia":
return "rpc.ankr.com/eth_sepolia";
case "arbitrum":
return "rpc.ankr.com/arbitrum";
case "base":
return "rpc.ankr.com/base";
case "base-goerli":
return "rpc.ankr.com/base_goerli";
case "base-sepolia":
return "rpc.ankr.com/base_sepolia";
case "bnb":
return "rpc.ankr.com/bsc";
case "bnbt":
return "rpc.ankr.com/bsc_testnet_chapel";
case "matic":
return "rpc.ankr.com/polygon";
case "arbitrum":
return "rpc.ankr.com/arbitrum";
case "matic-mumbai":
return "rpc.ankr.com/polygon_mumbai";
case "optimism":
return "rpc.ankr.com/optimism";
case "optimism-goerli":
return "rpc.ankr.com/optimism_testnet";
case "optimism-sepolia":
return "rpc.ankr.com/optimism_sepolia";
}

@@ -32,0 +62,0 @@ assertArgument(false, "unsupported network", "network", name);

@@ -16,2 +16,3 @@ import { assertArgument } from "../utils/index.js";

constructor(ethereum, network) {
assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum);
super(network, { batchMaxCount: 1 });

@@ -18,0 +19,0 @@ this.#request = async (method, params) => {

@@ -11,4 +11,7 @@ /**

* - Sepolia Testnet (``sepolia``)
* - Sepolia Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)

@@ -15,0 +18,0 @@ * - Optimism Goerli Testnet (``optimism-goerli``)

@@ -11,4 +11,7 @@ /**

* - Sepolia Testnet (``sepolia``)
* - Sepolia Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)

@@ -111,2 +114,4 @@ * - Optimism Goerli Testnet (``optimism-goerli``)

return "https:/\/api-sepolia.etherscan.io";
case "holesky":
return "https:/\/api-holesky.etherscan.io";
case "arbitrum":

@@ -116,2 +121,6 @@ return "https:/\/api.arbiscan.io";

return "https:/\/api-goerli.arbiscan.io";
case "bnb":
return "https:/\/api.bscscan.com";
case "bnbt":
return "https:/\/api-testnet.bscscan.com";
case "matic":

@@ -125,6 +134,2 @@ return "https:/\/api.polygonscan.com";

return "https:/\/api-goerli-optimistic.etherscan.io";
case "bnb":
return "http:/\/api.bscscan.com";
case "bnbt":
return "http:/\/api-testnet.bscscan.com";
default:

@@ -131,0 +136,0 @@ }

@@ -78,3 +78,3 @@ import { AbstractProvider } from "./abstract-provider.js";

* A **FallbackProvider** manages several [[Providers]] providing
* resiliance by switching between slow or misbehaving nodes, security
* resilience by switching between slow or misbehaving nodes, security
* by requiring multiple backends to aggree and performance by allowing

@@ -81,0 +81,0 @@ * faster backends to respond earlier.

/**
* A **FallbackProvider** providers resiliance, security and performatnce
* A **FallbackProvider** provides resilience, security and performance
* in a way that is customizable and configurable.

@@ -204,3 +204,3 @@ *

* A **FallbackProvider** manages several [[Providers]] providing
* resiliance by switching between slow or misbehaving nodes, security
* resilience by switching between slow or misbehaving nodes, security
* by requiring multiple backends to aggree and performance by allowing

@@ -207,0 +207,0 @@ * faster backends to respond earlier.

@@ -12,4 +12,13 @@ /**

* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Linea (``linea``)
* - Linea Goerlia Testnet (``linea-goerli``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -16,0 +25,0 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

@@ -12,4 +12,13 @@ /**

* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Linea (``linea``)
* - Linea Goerlia Testnet (``linea-goerli``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -38,2 +47,14 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

return "arbitrum-goerli.infura.io";
case "arbitrum-sepolia":
return "arbitrum-sepolia.infura.io";
case "base":
return "base-mainnet.infura.io";
case "base-goerlia":
return "base-goerli.infura.io";
case "base-sepolia":
return "base-sepolia.infura.io";
case "bnb":
return "bnbsmartchain-mainnet.infura.io";
case "bnbt":
return "bnbsmartchain-testnet.infura.io";
case "linea":

@@ -51,2 +72,4 @@ return "linea-mainnet.infura.io";

return "optimism-goerli.infura.io";
case "optimism-sepolia":
return "optimism-sepolia.infura.io";
}

@@ -53,0 +76,0 @@ assertArgument(false, "unsupported network", "network", name);

@@ -103,3 +103,3 @@ /**

* can have tragic consequences. For example, this **CANNOT** be used
* with MetaMask, since the used can select a new network from the
* with MetaMask, since the user can select a new network from the
* drop-down at any time.

@@ -106,0 +106,0 @@ *

@@ -9,6 +9,15 @@ /**

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Holesky Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base Mainnet (``base``);
* - Base Goerli Testnet (``base-goerli``);
* - Base Sepolia Testnet (``base-sepolia``);
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -15,0 +24,0 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

@@ -9,6 +9,15 @@ /**

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Holesky Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base Mainnet (``base``);
* - Base Goerli Testnet (``base-goerli``);
* - Base Sepolia Testnet (``base-sepolia``);
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -30,4 +39,6 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

return "ethers.ethereum-goerli.quiknode.pro";
//case "sepolia":
// return "sepolia.infura.io";
case "sepolia":
return "ethers.ethereum-sepolia.quiknode.pro";
case "holesky":
return "ethers.ethereum-holesky.quiknode.pro";
case "arbitrum":

@@ -37,2 +48,14 @@ return "ethers.arbitrum-mainnet.quiknode.pro";

return "ethers.arbitrum-goerli.quiknode.pro";
case "arbitrum-sepolia":
return "ethers.arbitrum-sepolia.quiknode.pro";
case "base":
return "ethers.base-mainnet.quiknode.pro";
case "base-goerli":
return "ethers.base-goerli.quiknode.pro";
case "base-spolia":
return "ethers.base-sepolia.quiknode.pro";
case "bnb":
return "ethers.bsc.quiknode.pro";
case "bnbt":
return "ethers.bsc-testnet.quiknode.pro";
case "matic":

@@ -46,5 +69,36 @@ return "ethers.matic.quiknode.pro";

return "ethers.optimism-goerli.quiknode.pro";
case "optimism-sepolia":
return "ethers.optimism-sepolia.quiknode.pro";
case "xdai":
return "ethers.xdai.quiknode.pro";
}
assertArgument(false, "unsupported network", "network", name);
}
/*
@TODO:
These networks are not currently present in the Network
default included networks. Research them and ensure they
are EVM compatible and work with ethers
http://ethers.matic-amoy.quiknode.pro
http://ethers.avalanche-mainnet.quiknode.pro
http://ethers.avalanche-testnet.quiknode.pro
http://ethers.blast-sepolia.quiknode.pro
http://ethers.celo-mainnet.quiknode.pro
http://ethers.fantom.quiknode.pro
http://ethers.imx-demo.quiknode.pro
http://ethers.imx-mainnet.quiknode.pro
http://ethers.imx-testnet.quiknode.pro
http://ethers.near-mainnet.quiknode.pro
http://ethers.near-testnet.quiknode.pro
http://ethers.nova-mainnet.quiknode.pro
http://ethers.scroll-mainnet.quiknode.pro
http://ethers.scroll-testnet.quiknode.pro
http://ethers.tron-mainnet.quiknode.pro
http://ethers.zkevm-mainnet.quiknode.pro
http://ethers.zkevm-testnet.quiknode.pro
http://ethers.zksync-mainnet.quiknode.pro
http://ethers.zksync-testnet.quiknode.pro
*/
/**

@@ -51,0 +105,0 @@ * The **QuickNodeProvider** connects to the [[link-quicknode]]

@@ -89,3 +89,3 @@ import type { AddressLike, NameResolver } from "../address/index.js";

/**
* The maximum amount of gas to allow this transaction to consime.
* The maximum amount of gas to allow this transaction to consume.
*/

@@ -298,2 +298,7 @@ gasLimit?: null | BigNumberish;

/**
* The hash tree root of the parent beacon block for the given
* execution block. See [[link-eip-4788]].
*/
parentBeaconBlockRoot: null | string;
/**
* The nonce.

@@ -324,2 +329,21 @@ *

/**
* The root hash for the global state after applying changes
* in this block.
*/
readonly stateRoot: null | string;
/**
* The hash of the transaction receipts trie.
*/
readonly receiptsRoot: null | string;
/**
* The total amount of blob gas consumed by the transactions
* within the block. See [[link-eip-4844]].
*/
readonly blobGasUsed: null | bigint;
/**
* The running total of blob gas consumed in excess of the
* target, prior to the block. See [[link-eip-4844]].
*/
readonly excessBlobGas: null | bigint;
/**
* The miner coinbase address, wihch receives any subsidies for

@@ -546,2 +570,6 @@ * including this block.

/**
* The gas used for BLObs. See [[link-eip-4844]].
*/
readonly blobGasUsed: null | bigint;
/**
* The amount of gas used by all transactions within the block for this

@@ -563,2 +591,6 @@ * and all transactions with a lower ``index``.

/**
* The price paid per BLOB in gas. See [[link-eip-4844]].
*/
readonly blobGasPrice: null | bigint;
/**
* The [[link-eip-2718]] transaction type.

@@ -746,2 +778,6 @@ */

/**
* The [[link-eip-4844]] max fee per BLOb gas.
*/
readonly maxFeePerBlobGas: null | bigint;
/**
* The data.

@@ -769,2 +805,6 @@ */

/**
* The [[link-eip-4844]] BLOb versioned hashes.
*/
readonly blobVersionedHashes: null | Array<string>;
/**
* @_ignore:

@@ -852,2 +892,13 @@ */

/**
* Returns true if hte transaction is a Cancun (i.e. ``type == 3``)
* transaction. See [[link-eip-4844]].
*/
isCancun(): this is (TransactionResponse & {
accessList: AccessList;
maxFeePerGas: bigint;
maxPriorityFeePerGas: bigint;
maxFeePerBlobGas: bigint;
blobVersionedHashes: Array<string>;
});
/**
* Returns a filter which can be used to listen for orphan events

@@ -854,0 +905,0 @@ * that evict this transaction.

@@ -152,2 +152,7 @@ //import { resolveAddress } from "@ethersproject/address";

/**
* The hash tree root of the parent beacon block for the given
* execution block. See [[link-eip-4788]].
*/
parentBeaconBlockRoot;
/**
* The nonce.

@@ -178,2 +183,21 @@ *

/**
* The root hash for the global state after applying changes
* in this block.
*/
stateRoot;
/**
* The hash of the transaction receipts trie.
*/
receiptsRoot;
/**
* The total amount of blob gas consumed by the transactions
* within the block. See [[link-eip-4844]].
*/
blobGasUsed;
/**
* The running total of blob gas consumed in excess of the
* target, prior to the block. See [[link-eip-4844]].
*/
excessBlobGas;
/**
* The miner coinbase address, wihch receives any subsidies for

@@ -215,2 +239,3 @@ * including this block.

parentHash: block.parentHash,
parentBeaconBlockRoot: block.parentBeaconBlockRoot,
nonce: block.nonce,

@@ -220,5 +245,9 @@ difficulty: block.difficulty,

gasUsed: block.gasUsed,
blobGasUsed: block.blobGasUsed,
excessBlobGas: block.excessBlobGas,
miner: block.miner,
extraData: block.extraData,
baseFeePerGas: getValue(block.baseFeePerGas)
baseFeePerGas: getValue(block.baseFeePerGas),
stateRoot: block.stateRoot,
receiptsRoot: block.receiptsRoot,
});

@@ -262,3 +291,3 @@ }

toJSON() {
const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, nonce, number, parentHash, timestamp, transactions } = this;
const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, nonce, number, parentHash, parentBeaconBlockRoot, stateRoot, receiptsRoot, timestamp, transactions } = this;
return {

@@ -271,3 +300,6 @@ _type: "Block",

gasUsed: toJson(gasUsed),
blobGasUsed: toJson(this.blobGasUsed),
excessBlobGas: toJson(this.excessBlobGas),
hash, miner, nonce, number, parentHash, timestamp,
parentBeaconBlockRoot, stateRoot, receiptsRoot,
transactions,

@@ -576,2 +608,6 @@ };

/**
* The gas used for BLObs. See [[link-eip-4844]].
*/
blobGasUsed;
/**
* The amount of gas used by all transactions within the block for this

@@ -593,2 +629,6 @@ * and all transactions with a lower ``index``.

/**
* The price paid per BLOB in gas. See [[link-eip-4844]].
*/
blobGasPrice;
/**
* The [[link-eip-2718]] transaction type.

@@ -640,3 +680,5 @@ */

cumulativeGasUsed: tx.cumulativeGasUsed,
blobGasUsed: tx.blobGasUsed,
gasPrice,
blobGasPrice: tx.blobGasPrice,
type: tx.type,

@@ -666,2 +708,4 @@ //byzantium: tx.byzantium,

gasPrice: toJson(this.gasPrice),
blobGasUsed: toJson(this.blobGasUsed),
blobGasPrice: toJson(this.blobGasPrice),
gasUsed: toJson(this.gasUsed),

@@ -836,2 +880,6 @@ hash, index, logs, logsBloom, root, status, to

/**
* The [[link-eip-4844]] max fee per BLOb gas.
*/
maxFeePerBlobGas;
/**
* The data.

@@ -858,2 +906,6 @@ */

accessList;
/**
* The [[link-eip-4844]] BLOb versioned hashes.
*/
blobVersionedHashes;
#startBlock;

@@ -879,5 +931,7 @@ /**

this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null;
this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas : null;
this.chainId = tx.chainId;
this.signature = tx.signature;
this.accessList = (tx.accessList != null) ? tx.accessList : null;
this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes : null;
this.#startBlock = -1;

@@ -889,6 +943,7 @@ }

toJSON() {
const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList } = this;
const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList, blobVersionedHashes } = this;
return {
_type: "TransactionReceipt",
_type: "TransactionResponse",
accessList, blockNumber, blockHash,
blobVersionedHashes,
chainId: toJson(this.chainId),

@@ -901,2 +956,3 @@ data, from,

maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas),
maxFeePerBlobGas: toJson(this.maxFeePerBlobGas),
nonce, signature, to, index, type,

@@ -1184,2 +1240,9 @@ value: toJson(this.value),

/**
* Returns true if hte transaction is a Cancun (i.e. ``type == 3``)
* transaction. See [[link-eip-4844]].
*/
isCancun() {
return (this.type === 3);
}
/**
* Returns a filter which can be used to listen for orphan events

@@ -1186,0 +1249,0 @@ * that evict this transaction.

@@ -67,2 +67,10 @@ import { Signature } from "../crypto/index.js";

accessList?: null | AccessListish;
/**
* The maximum fee per blob gas (see [[link-eip-4844]]).
*/
maxFeePerBlobGas?: null | BigNumberish;
/**
* The versioned hashes (see [[link-eip-4844]]).
*/
blobVersionedHashes?: null | Array<string>;
}

@@ -162,2 +170,12 @@ /**

/**
* The max fee per blob gas for Cancun transactions.
*/
get maxFeePerBlobGas(): null | bigint;
set maxFeePerBlobGas(value: null | BigNumberish);
/**
* The BLOB versioned hashes for Cancun transactions.
*/
get blobVersionedHashes(): null | Array<string>;
set blobVersionedHashes(value: null | Array<string>);
/**
* Creates a new Transaction with default values.

@@ -258,2 +276,18 @@ */

/**
* Returns true if this transaction is an [[link-eip-4844]] BLOB
* transaction.
*
* This provides a Type Guard that the related properties are
* non-null.
*/
isCancun(): this is (Transaction & {
type: 3;
to: string;
accessList: AccessList;
maxFeePerGas: bigint;
maxPriorityFeePerGas: bigint;
maxFeePerBlobGas: bigint;
blobVersionedHashes: Array<string>;
});
/**
* Create a copy of this transaciton.

@@ -260,0 +294,0 @@ */

import { getAddress } from "../address/index.js";
import { ZeroAddress } from "../constants/addresses.js";
import { keccak256, Signature, SigningKey } from "../crypto/index.js";
import { concat, decodeRlp, encodeRlp, getBytes, getBigInt, getNumber, hexlify, assert, assertArgument, toBeArray, zeroPadValue } from "../utils/index.js";
import { concat, decodeRlp, encodeRlp, getBytes, getBigInt, getNumber, hexlify, assert, assertArgument, isHexString, toBeArray, zeroPadValue } from "../utils/index.js";
import { accessListify } from "./accesslist.js";

@@ -49,2 +50,9 @@ import { recoverAddress } from "./address.js";

}
function formatHashes(value, param) {
assertArgument(Array.isArray(value), `invalid ${param}`, "value", value);
for (let i = 0; i < value.length; i++) {
assertArgument(isHexString(value[i], 32), "invalid ${ param } hash", `value[${i}]`, value[i]);
}
return value;
}
function _parseLegacy(data) {

@@ -94,8 +102,8 @@ const fields = decodeRlp(data);

const fields = [
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.gasPrice || 0, "gasPrice"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? getAddress(tx.to) : "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
];

@@ -163,4 +171,2 @@ let chainId = BN_0;

assertArgument(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), "invalid field count for transaction type: 2", "data", hexlify(data));
const maxPriorityFeePerGas = handleUint(fields[2], "maxPriorityFeePerGas");
const maxFeePerGas = handleUint(fields[3], "maxFeePerGas");
const tx = {

@@ -170,4 +176,4 @@ type: 2,

nonce: handleNumber(fields[1], "nonce"),
maxPriorityFeePerGas: maxPriorityFeePerGas,
maxFeePerGas: maxFeePerGas,
maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"),
maxFeePerGas: handleUint(fields[3], "maxFeePerGas"),
gasPrice: null,

@@ -190,11 +196,11 @@ gasLimit: handleUint(fields[4], "gasLimit"),

const fields = [
formatNumber(tx.chainId || 0, "chainId"),
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? getAddress(tx.to) : "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
(formatAccessList(tx.accessList || []))
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || [])
];

@@ -232,10 +238,10 @@ if (sig) {

const fields = [
formatNumber(tx.chainId || 0, "chainId"),
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.gasPrice || 0, "gasPrice"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? getAddress(tx.to) : "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
(formatAccessList(tx.accessList || []))
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || [])
];

@@ -249,2 +255,54 @@ if (sig) {

}
function _parseEip4844(data) {
const fields = decodeRlp(getBytes(data).slice(1));
assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14), "invalid field count for transaction type: 3", "data", hexlify(data));
const tx = {
type: 3,
chainId: handleUint(fields[0], "chainId"),
nonce: handleNumber(fields[1], "nonce"),
maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"),
maxFeePerGas: handleUint(fields[3], "maxFeePerGas"),
gasPrice: null,
gasLimit: handleUint(fields[4], "gasLimit"),
to: handleAddress(fields[5]),
value: handleUint(fields[6], "value"),
data: hexlify(fields[7]),
accessList: handleAccessList(fields[8], "accessList"),
maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"),
blobVersionedHashes: fields[10]
};
assertArgument(tx.to != null, "invalid address for transaction type: 3", "data", data);
assertArgument(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data);
for (let i = 0; i < tx.blobVersionedHashes.length; i++) {
assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${i}: must be length 32`, "data", data);
}
// Unsigned EIP-4844 Transaction
if (fields.length === 11) {
return tx;
}
tx.hash = keccak256(data);
_parseEipSignature(tx, fields.slice(11));
return tx;
}
function _serializeEip4844(tx, sig) {
const fields = [
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"),
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || ZeroAddress),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || []),
formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"),
formatHashes(tx.blobVersionedHashes || [], "blobVersionedHashes")
];
if (sig) {
fields.push(formatNumber(sig.yParity, "yParity"));
fields.push(toBeArray(sig.r));
fields.push(toBeArray(sig.s));
}
return concat(["0x03", encodeRlp(fields)]);
}
/**

@@ -276,2 +334,4 @@ * A **Transaction** describes an operation to be executed on

#accessList;
#maxFeePerBlobGas;
#blobVersionedHashes;
/**

@@ -303,2 +363,7 @@ * The transaction type.

break;
case 3:
case "cancun":
case "eip-4844":
this.#type = 3;
break;
default:

@@ -316,2 +381,3 @@ assertArgument(false, "unsupported transaction type", "type", value);

case 2: return "eip-1559";
case 3: return "eip-4844";
}

@@ -324,3 +390,9 @@ return null;

*/
get to() { return this.#to; }
get to() {
const value = this.#to;
if (value == null && this.type === 3) {
return ZeroAddress;
}
return value;
}
set to(value) {

@@ -362,3 +434,3 @@ this.#to = (value == null) ? null : getAddress(value);

if (value == null) {
if (this.type === 2) {
if (this.type === 2 || this.type === 3) {
return BN_0;

@@ -380,3 +452,3 @@ }

if (value == null) {
if (this.type === 2) {
if (this.type === 2 || this.type === 3) {
return BN_0;

@@ -425,3 +497,5 @@ }

if (value == null) {
if (this.type === 1 || this.type === 2) {
if (this.type === 1 || this.type === 2 || this.type === 3) {
// @TODO: in v7, this should assign the value or become
// a live object itself, otherwise mutation is inconsistent
return [];

@@ -437,2 +511,37 @@ }

/**
* The max fee per blob gas for Cancun transactions.
*/
get maxFeePerBlobGas() {
const value = this.#maxFeePerBlobGas;
if (value == null && this.type === 3) {
return BN_0;
}
return value;
}
set maxFeePerBlobGas(value) {
this.#maxFeePerBlobGas = (value == null) ? null : getBigInt(value, "maxFeePerBlobGas");
}
/**
* The BLOB versioned hashes for Cancun transactions.
*/
get blobVersionedHashes() {
// @TODO: Mutation is inconsistent; if unset, the returned value
// cannot mutate the object, if set it can
let value = this.#blobVersionedHashes;
if (value == null && this.type === 3) {
return [];
}
return value;
}
set blobVersionedHashes(value) {
if (value != null) {
assertArgument(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value);
value = value.slice();
for (let i = 0; i < value.length; i++) {
assertArgument(isHexString(value[i], 32), "invalid blobVersionedHash", `value[${i}]`, value[i]);
}
}
this.#blobVersionedHashes = value;
}
/**
* Creates a new Transaction with default values.

@@ -444,3 +553,3 @@ */

this.#nonce = 0;
this.#gasLimit = BigInt(0);
this.#gasLimit = BN_0;
this.#gasPrice = null;

@@ -450,6 +559,8 @@ this.#maxPriorityFeePerGas = null;

this.#data = "0x";
this.#value = BigInt(0);
this.#chainId = BigInt(0);
this.#value = BN_0;
this.#chainId = BN_0;
this.#sig = null;
this.#accessList = null;
this.#maxFeePerBlobGas = null;
this.#blobVersionedHashes = null;
}

@@ -499,3 +610,2 @@ /**

isSigned() {
//isSigned(): this is SignedTransaction {
return this.signature != null;

@@ -518,2 +628,4 @@ }

return _serializeEip1559(this, this.signature);
case 3:
return _serializeEip4844(this, this.signature);
}

@@ -536,2 +648,4 @@ assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" });

return _serializeEip1559(this);
case 3:
return _serializeEip4844(this);
}

@@ -545,3 +659,9 @@ assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".unsignedSerialized" });

inferType() {
return (this.inferTypes().pop());
const types = this.inferTypes();
// Prefer London (EIP-1559) over Cancun (BLOb)
if (types.indexOf(2) >= 0) {
return 2;
}
// Return the highest inferred type
return (types.pop());
}

@@ -557,2 +677,3 @@ /**

const hasAccessList = (this.accessList != null);
const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes);
//if (hasGasPrice && hasFee) {

@@ -588,2 +709,5 @@ // throw new Error("transaction cannot have gasPrice and maxFeePerGas");

}
else if (hasBlob && this.to) {
types.push(3);
}
else {

@@ -593,2 +717,3 @@ types.push(0);

types.push(2);
types.push(3);
}

@@ -630,2 +755,12 @@ }

/**
* Returns true if this transaction is an [[link-eip-4844]] BLOB
* transaction.
*
* This provides a Type Guard that the related properties are
* non-null.
*/
isCancun() {
return (this.type === 3);
}
/**
* Create a copy of this transaciton.

@@ -678,2 +813,3 @@ */

case 2: return Transaction.from(_parseEip1559(payload));
case 3: return Transaction.from(_parseEip4844(payload));
}

@@ -704,2 +840,5 @@ assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" });

}
if (tx.maxFeePerBlobGas != null) {
result.maxFeePerBlobGas = tx.maxFeePerBlobGas;
}
if (tx.data != null) {

@@ -720,2 +859,5 @@ result.data = tx.data;

}
if (tx.blobVersionedHashes != null) {
result.blobVersionedHashes = tx.blobVersionedHashes;
}
if (tx.hash != null) {

@@ -722,0 +864,0 @@ assertArgument(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx);

@@ -167,3 +167,3 @@ /**

});
assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", {
assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", {
count: count,

@@ -170,0 +170,0 @@ expectedCount: expectedCount

@@ -822,4 +822,19 @@ /**

}
let requestUrl = null;
if (this.request) {
requestUrl = this.request.url;
}
let responseBody = null;
try {
if (this.#body) {
responseBody = toUtf8String(this.#body);
}
}
catch (e) { }
assert(false, message, "SERVER_ERROR", {
request: (this.request || "unknown request"), response: this, error
request: (this.request || "unknown request"), response: this, error,
info: {
requestUrl, responseBody,
responseStatus: `${this.statusCode} ${this.statusMessage}`
}
});

@@ -826,0 +841,0 @@ }

@@ -12,3 +12,3 @@ {

"dependencies": {
"@adraffy/ens-normalize": "1.10.0",
"@adraffy/ens-normalize": "1.10.1",
"@noble/curves": "1.2.0",

@@ -97,3 +97,3 @@ "@noble/hashes": "1.3.2",

],
"gitHead": "1b4debd4a9e61d171bfc60590116facb8bdbd2da",
"gitHead": "f02211d055567b51373b5faa2c3dc6efe0523618",
"homepage": "https://ethers.org",

@@ -136,3 +136,3 @@ "keywords": [

"sideEffects": false,
"version": "6.10.0"
"version": "6.11.0"
}

@@ -6,2 +6,2 @@ /* Do NOT modify this file; see /src.ts/_admin/update-version.ts */

*/
export const version: string = "6.10.0";
export const version: string = "6.11.0";

@@ -124,7 +124,7 @@ /**

const _kwVisibDeploy = "external public payable";
const _kwVisibDeploy = "external public payable override";
const KwVisibDeploy = setify(_kwVisibDeploy.split(" "));
// Visibility Keywords
const _kwVisib = "constant external internal payable private public pure view";
const _kwVisib = "constant external internal payable private public pure view override";
const KwVisib = setify(_kwVisib.split(" "));

@@ -222,3 +222,6 @@

popType(type: string): string {
if (this.peek().type !== type) { throw new Error(`expected ${ type }; got ${ JSON.stringify(this.peek()) }`); }
if (this.peek().type !== type) {
const top = this.peek();
throw new Error(`expected ${ type }; got ${ top.type } ${ JSON.stringify(top.text) }`);
}
return this.pop().text;

@@ -476,3 +479,3 @@ }

if (tokens.length) {
throw new Error(`unexpected tokens: ${ tokens.toString() }`);
throw new Error(`unexpected tokens at offset ${ tokens.offset }: ${ tokens.toString() }`);
}

@@ -479,0 +482,0 @@ }

@@ -345,4 +345,4 @@ /**

frags.push(Fragment.from(a));
} catch (error) {
console.log("EE", error);
} catch (error: any) {
console.log(`[Warning] Invalid Fragment ${ JSON.stringify(a) }:`, error.message);
}

@@ -1216,3 +1216,3 @@ }

*/
parseLog(log: { topics: Array<string>, data: string}): null | LogDescription {
parseLog(log: { topics: ReadonlyArray<string>, data: string}): null | LogDescription {
const fragment = this.getEvent(log.topics[0]);

@@ -1219,0 +1219,0 @@

@@ -1113,3 +1113,3 @@ import { Interface, Typed } from "../abi/index.js";

function _ContractBase(): new (target: string, abi: Interface | InterfaceAbi, runner?: null | ContractRunner) => BaseContract & Omit<ContractInterface, keyof BaseContract> {
function _ContractBase(): new (target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner) => BaseContract & Omit<ContractInterface, keyof BaseContract> {
return BaseContract as any;

@@ -1116,0 +1116,0 @@ }

@@ -100,3 +100,3 @@

*
* This will resovle to the Contract before it has been deployed to the
* This will resolve to the Contract before it has been deployed to the
* network, so the [[BaseContract-waitForDeployment]] should be used before

@@ -103,0 +103,0 @@ * sending any transactions to it.

@@ -135,4 +135,4 @@ // import from provider.ts instead of index.ts to prevent circular dep

*/
async wait(confirms?: number): Promise<null | ContractTransactionReceipt> {
const receipt = await super.wait(confirms);
async wait(confirms?: number, timeout?: number): Promise<null | ContractTransactionReceipt> {
const receipt = await super.wait(confirms, timeout);
if (receipt == null) { return null; }

@@ -139,0 +139,0 @@ return new ContractTransactionReceipt(this.#iface, this.provider, receipt);

@@ -88,8 +88,9 @@

*/
export function dnsEncode(name: string): string {
export function dnsEncode(name: string, _maxLength?: number): string {
const length = (_maxLength != null) ? _maxLength: 63;
assertArgument(length <= 255, "DNS encoded label cannot exceed 255", "length", length);
return hexlify(concat(ensNameSplit(name).map((comp) => {
// DNS does not allow components over 63 bytes in length
if (comp.length > 63) {
throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");
}
assertArgument(comp.length <= length, `label ${ JSON.stringify(name) } exceeds ${ length } bytes`, "name", name);

@@ -100,4 +101,3 @@ const bytes = new Uint8Array(comp.length + 1);

return bytes;
}))) + "00";
}

@@ -127,8 +127,8 @@ //import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer";

{
const match = type.match(/^(u?)int(\d*)$/);
const match = type.match(/^(u?)int(\d+)$/);
if (match) {
const signed = (match[1] === "");
const width = parseInt(match[2] || "256");
assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && (match[2] == null || match[2] === String(width)), "invalid numeric width", "type", type);
const width = parseInt(match[2]);
assertArgument(width % 8 === 0 && width !== 0 && width <= 256 && match[2] === String(width), "invalid numeric width", "type", type);

@@ -185,2 +185,31 @@ const boundsUpper = mask(BN_MAX_UINT256, signed ? (width - 1): width);

type ArrayResult = {
base: string; // The base type
index?: string; // the full Index (if any)
array?: { // The Array... (if index)
base: string; // ...base type (same as above)
prefix: string; // ...sans the final Index
count: number; // ...the final Index (-1 for dynamic)
}
};
// foo[][3] => { base: "foo", index: "[][3]", array: {
// base: "foo", prefix: "foo[]", count: 3 } }
function splitArray(type: string): ArrayResult {
const match = type.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);
if (match) {
return {
base: match[1],
index: (match[2] + match[4]),
array: {
base: match[1],
prefix: (match[1] + match[2]),
count: (match[5] ? parseInt(match[5]): -1),
}
};
}
return { base: type };
}
/**

@@ -225,4 +254,3 @@ * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads

*/
constructor(types: Record<string, Array<TypedDataField>>) {
this.#types = JSON.stringify(types);
constructor(_types: Record<string, Array<TypedDataField>>) {
this.#fullTypes = new Map();

@@ -240,3 +268,14 @@ this.#encoderCache = new Map();

Object.keys(types).forEach((type) => {
const types: Record<string, Array<TypedDataField>> = { };
Object.keys(_types).forEach((type) => {
types[type] = _types[type].map(({ name, type }) => {
// Normalize the base type (unless name conflict)
let { base, index } = splitArray(type);
if (base === "int" && !_types["int"]) { base = "int256"; }
if (base === "uint" && !_types["uint"]) { base = "uint256"; }
return { name, type: (base + (index || "")) };
});
links.set(type, new Set());

@@ -246,2 +285,3 @@ parents.set(type, [ ]);

});
this.#types = JSON.stringify(types);

@@ -254,8 +294,8 @@ for (const name in types) {

// Check each field has a unique name
assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${ JSON.stringify(field.name) } in ${ JSON.stringify(name) }`, "types", types);
assertArgument(!uniqueNames.has(field.name), `duplicate variable name ${ JSON.stringify(field.name) } in ${ JSON.stringify(name) }`, "types", _types);
uniqueNames.add(field.name);
// Get the base type (drop any array specifiers)
const baseType = (<any>(field.type.match(/^([^\x5b]*)(\x5b|$)/)))[1] || null;
assertArgument(baseType !== name, `circular type reference to ${ JSON.stringify(baseType) }`, "types", types);
const baseType = splitArray(field.type).base;
assertArgument(baseType !== name, `circular type reference to ${ JSON.stringify(baseType) }`, "types", _types);

@@ -266,3 +306,3 @@ // Is this a base encoding type?

assertArgument(parents.has(baseType), `unknown type ${ JSON.stringify(baseType) }`, "types", types);
assertArgument(parents.has(baseType), `unknown type ${ JSON.stringify(baseType) }`, "types", _types);

@@ -277,4 +317,4 @@ // Add linkage

const primaryTypes = Array.from(parents.keys()).filter((n) => ((parents.get(n) as Array<string>).length === 0));
assertArgument(primaryTypes.length !== 0, "missing primary type", "types", types);
assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${ primaryTypes.map((t) => (JSON.stringify(t))).join(", ") }`, "types", types);
assertArgument(primaryTypes.length !== 0, "missing primary type", "types", _types);
assertArgument(primaryTypes.length === 1, `ambiguous primary types or unused types: ${ primaryTypes.map((t) => (JSON.stringify(t))).join(", ") }`, "types", _types);

@@ -285,3 +325,3 @@ defineProperties<TypedDataEncoder>(this, { primaryType: primaryTypes[0] });

function checkCircular(type: string, found: Set<string>) {
assertArgument(!found.has(type), `circular type reference to ${ JSON.stringify(type) }`, "types", types);
assertArgument(!found.has(type), `circular type reference to ${ JSON.stringify(type) }`, "types", _types);

@@ -335,8 +375,8 @@ found.add(type);

// Array
const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
const subtype = match[1];
const array = splitArray(type).array;
if (array) {
const subtype = array.prefix;
const subEncoder = this.getEncoder(subtype);
return (value: Array<any>) => {
assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${ parseInt(match[3]) }`, "value", value);
assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${ array.count }`, "value", value);

@@ -418,6 +458,6 @@ let result = value.map(subEncoder);

// Array
const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/);
if (match) {
assertArgument(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${ parseInt(match[3]) }`, "value", value);
return value.map((v: any) => this._visit(match[1], v, callback));
const array = splitArray(type).array;
if (array) {
assertArgument(array.count === -1 || array.count === value.length, `array length mismatch; expected length ${ array.count }`, "value", value);
return value.map((v: any) => this._visit(array.prefix, v, callback));
}

@@ -581,2 +621,5 @@

// Get the normalized types
types = encoder.types;
const typesWithDomain = Object.assign({ }, types);

@@ -583,0 +626,0 @@ assertArgument(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types);

@@ -71,3 +71,3 @@

*/
export function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider {
export function getDefaultProvider(network?: string | Networkish | WebSocketLike, options?: any): AbstractProvider {
if (options == null) { options = { }; }

@@ -74,0 +74,0 @@

@@ -29,4 +29,5 @@ /**

export function arrayOf(format: FormatFunc): FormatFunc {
export function arrayOf(format: FormatFunc, allowNull?: boolean): FormatFunc {
return ((array: any) => {
if (allowNull && array == null) { return null; }
if (!Array.isArray(array)) { throw new Error("not an array"); }

@@ -114,2 +115,4 @@ return array.map((i) => format(i));

parentHash: formatHash,
parentBeaconBlockRoot: allowNull(formatHash, null),
number: getNumber,

@@ -124,2 +127,8 @@

stateRoot: allowNull(formatHash, null),
receiptsRoot: allowNull(formatHash, null),
blobGasUsed: allowNull(getBigInt, null),
excessBlobGas: allowNull(getBigInt, null),
miner: allowNull(getAddress),

@@ -165,2 +174,3 @@ extraData: formatData,

gasUsed: getBigInt,
blobGasUsed: allowNull(getBigInt, null),
logsBloom: allowNull(formatData),

@@ -174,2 +184,3 @@ blockHash: formatHash,

effectiveGasPrice: allowNull(getBigInt),
blobGasPrice: allowNull(getBigInt, null),
status: allowNull(getNumber),

@@ -203,2 +214,3 @@ type: allowNull(getNumber, 0)

accessList: allowNull(accessListify, null),
blobVersionedHashes: allowNull(arrayOf(formatHash, true), null),

@@ -217,2 +229,3 @@ blockHash: allowNull(formatHash, null),

maxFeePerGas: allowNull(getBigInt),
maxFeePerBlobGas: allowNull(getBigInt, null),

@@ -219,0 +232,0 @@ gasLimit: getBigInt,

@@ -42,2 +42,8 @@ /**

/**
* The hash tree root of the parent beacon block for the given
* execution block. See [[link-eip-4788]].
*/
parentBeaconBlockRoot?: null | string;
/**
* A random sequence provided during the mining process for

@@ -65,2 +71,14 @@ * proof-of-work networks.

/**
* The total amount of BLOb gas consumed by transactions within
* the block. See [[link-eip4844].
*/
blobGasUsed?: null | bigint;
/**
* The running total of BLOb gas consumed in excess of the target
* prior to the block. See [[link-eip-4844]].
*/
excessBlobGas?: null | bigint;
/**
* The miner (or author) of a block.

@@ -82,2 +100,13 @@ */

/**
* The root hash for the global state after applying changes
* in this block.
*/
stateRoot?: null | string;
/**
* The hash of the transaction receipts trie.
*/
receiptsRoot?: null | string;
/**
* The list of transactions in the block.

@@ -210,2 +239,7 @@ */

/**
* The amount of BLOb gas used. See [[link-eip-4844]].
*/
blobGasUsed?: null | bigint;
/**
* The total amount of gas consumed during the entire block up to

@@ -222,2 +256,7 @@ * and including this transaction.

/**
* The actual BLOb gas price that was charged. See [[link-eip-4844]].
*/
blobGasPrice?: null | bigint;
/**
* The actual gas price per gas charged for this transaction.

@@ -336,2 +375,8 @@ */

/**
* For [[link-eip-4844]] transactions, this is the maximum fee that
* will be paid per BLOb.
*/
maxFeePerBlobGas?: null | bigint;
/**
* The transaction data.

@@ -360,4 +405,9 @@ */

accessList: null | AccessList;
/**
* The [[link-eip-4844]] BLOb versioned hashes.
*/
blobVersionedHashes?: null | Array<string>;
};

@@ -391,5 +391,4 @@ /**

registerEth("sepolia", 11155111, { ensNetwork: 11155111 });
registerEth("holesky", 17000, { ensNetwork: 17000 });
registerEth("classic", 61, { });

@@ -402,2 +401,3 @@ registerEth("classicKotti", 6, { });

registerEth("arbitrum-goerli", 421613, { });
registerEth("arbitrum-sepolia", 421614, { });

@@ -432,4 +432,5 @@ registerEth("base", 8453, { ensNetwork: 1 });

registerEth("optimism-goerli", 420, { });
registerEth("optimism-sepolia", 11155420, { });
registerEth("xdai", 100, { ensNetwork: 1 });
}
/**
* About Alchemy
* [[link-alchemy]] provides a third-party service for connecting to
* various blockchains over JSON-RPC.
*
* **Supported Networks**
*
* - Ethereum Mainnet (``mainnet``)
* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*
* @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy]
*/
import {

@@ -35,2 +54,4 @@ defineProperties, resolveProperties, assert, assertArgument,

return "arb-goerli.g.alchemy.com";
case "arbitrum-sepolia":
return "arb-sepolia.g.alchemy.com";
case "base":

@@ -40,2 +61,4 @@ return "base-mainnet.g.alchemy.com";

return "base-goerli.g.alchemy.com";
case "base-sepolia":
return "base-sepolia.g.alchemy.com";
case "matic":

@@ -49,2 +72,4 @@ return "polygon-mainnet.g.alchemy.com";

return "opt-goerli.g.alchemy.com";
case "optimism-sepolia":
return "opt-sepolia.g.alchemy.com";
}

@@ -51,0 +76,0 @@

@@ -9,4 +9,14 @@ /**

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Arbitrum (``arbitrum``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB (``bnb``)
* - BNB Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)
* - Arbitrum (``arbitrum``)
* - Polygon Mumbai Testnet (``matic-mumbai``)
*

@@ -37,6 +47,27 @@ * @_subsection: api/providers/thirdparty:Ankr [providers-ankr]

return "rpc.ankr.com/eth_goerli";
case "sepolia":
return "rpc.ankr.com/eth_sepolia";
case "arbitrum":
return "rpc.ankr.com/arbitrum";
case "base":
return "rpc.ankr.com/base";
case "base-goerli":
return "rpc.ankr.com/base_goerli";
case "base-sepolia":
return "rpc.ankr.com/base_sepolia";
case "bnb":
return "rpc.ankr.com/bsc";
case "bnbt":
return "rpc.ankr.com/bsc_testnet_chapel";
case "matic":
return "rpc.ankr.com/polygon";
case "arbitrum":
return "rpc.ankr.com/arbitrum";
case "matic-mumbai":
return "rpc.ankr.com/polygon_mumbai";
case "optimism":
return "rpc.ankr.com/optimism";
case "optimism-goerli":
return "rpc.ankr.com/optimism_testnet";
case "optimism-sepolia":
return "rpc.ankr.com/optimism_sepolia";
}

@@ -43,0 +74,0 @@

@@ -52,2 +52,4 @@ import { assertArgument } from "../utils/index.js";

constructor(ethereum: Eip1193Provider, network?: Networkish) {
assertArgument(ethereum && ethereum.request, "invalid EIP-1193 provider", "ethereum", ethereum);
super(network, { batchMaxCount: 1 });

@@ -54,0 +56,0 @@

@@ -11,4 +11,7 @@ /**

* - Sepolia Testnet (``sepolia``)
* - Sepolia Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)

@@ -164,2 +167,4 @@ * - Optimism Goerli Testnet (``optimism-goerli``)

return "https:/\/api-sepolia.etherscan.io";
case "holesky":
return "https:/\/api-holesky.etherscan.io";

@@ -170,2 +175,6 @@ case "arbitrum":

return "https:/\/api-goerli.arbiscan.io";
case "bnb":
return "https:/\/api.bscscan.com";
case "bnbt":
return "https:/\/api-testnet.bscscan.com";
case "matic":

@@ -180,7 +189,2 @@ return "https:/\/api.polygonscan.com";

case "bnb":
return "http:/\/api.bscscan.com";
case "bnbt":
return "http:/\/api-testnet.bscscan.com";
default:

@@ -187,0 +191,0 @@ }

/**
* A **FallbackProvider** providers resiliance, security and performatnce
* A **FallbackProvider** provides resilience, security and performance
* in a way that is customizable and configurable.

@@ -352,3 +352,3 @@ *

* A **FallbackProvider** manages several [[Providers]] providing
* resiliance by switching between slow or misbehaving nodes, security
* resilience by switching between slow or misbehaving nodes, security
* by requiring multiple backends to aggree and performance by allowing

@@ -355,0 +355,0 @@ * faster backends to respond earlier.

@@ -12,4 +12,13 @@ /**

* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base (``base``)
* - Base Goerlia Testnet (``base-goerli``)
* - Base Sepolia Testnet (``base-sepolia``)
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Linea (``linea``)
* - Linea Goerlia Testnet (``linea-goerli``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -49,2 +58,14 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

return "arbitrum-goerli.infura.io";
case "arbitrum-sepolia":
return "arbitrum-sepolia.infura.io";
case "base":
return "base-mainnet.infura.io";
case "base-goerlia":
return "base-goerli.infura.io";
case "base-sepolia":
return "base-sepolia.infura.io";
case "bnb":
return "bnbsmartchain-mainnet.infura.io";
case "bnbt":
return "bnbsmartchain-testnet.infura.io";
case "linea":

@@ -62,2 +83,4 @@ return "linea-mainnet.infura.io";

return "optimism-goerli.infura.io";
case "optimism-sepolia":
return "optimism-sepolia.infura.io";
}

@@ -64,0 +87,0 @@

@@ -175,3 +175,3 @@ /**

* can have tragic consequences. For example, this **CANNOT** be used
* with MetaMask, since the used can select a new network from the
* with MetaMask, since the user can select a new network from the
* drop-down at any time.

@@ -178,0 +178,0 @@ *

@@ -9,6 +9,15 @@ /**

* - Goerli Testnet (``goerli``)
* - Sepolia Testnet (``sepolia``)
* - Holesky Testnet (``holesky``)
* - Arbitrum (``arbitrum``)
* - Arbitrum Goerli Testnet (``arbitrum-goerli``)
* - Arbitrum Sepolia Testnet (``arbitrum-sepolia``)
* - Base Mainnet (``base``);
* - Base Goerli Testnet (``base-goerli``);
* - Base Sepolia Testnet (``base-sepolia``);
* - BNB Smart Chain Mainnet (``bnb``)
* - BNB Smart Chain Testnet (``bnbt``)
* - Optimism (``optimism``)
* - Optimism Goerli Testnet (``optimism-goerli``)
* - Optimism Sepolia Testnet (``optimism-sepolia``)
* - Polygon (``matic``)

@@ -41,4 +50,6 @@ * - Polygon Mumbai Testnet (``matic-mumbai``)

return "ethers.ethereum-goerli.quiknode.pro";
//case "sepolia":
// return "sepolia.infura.io";
case "sepolia":
return "ethers.ethereum-sepolia.quiknode.pro";
case "holesky":
return "ethers.ethereum-holesky.quiknode.pro";

@@ -49,2 +60,14 @@ case "arbitrum":

return "ethers.arbitrum-goerli.quiknode.pro";
case "arbitrum-sepolia":
return "ethers.arbitrum-sepolia.quiknode.pro";
case "base":
return "ethers.base-mainnet.quiknode.pro";
case "base-goerli":
return "ethers.base-goerli.quiknode.pro";
case "base-spolia":
return "ethers.base-sepolia.quiknode.pro";
case "bnb":
return "ethers.bsc.quiknode.pro";
case "bnbt":
return "ethers.bsc-testnet.quiknode.pro";
case "matic":

@@ -58,2 +81,6 @@ return "ethers.matic.quiknode.pro";

return "ethers.optimism-goerli.quiknode.pro";
case "optimism-sepolia":
return "ethers.optimism-sepolia.quiknode.pro";
case "xdai":
return "ethers.xdai.quiknode.pro";
}

@@ -64,3 +91,32 @@

/*
@TODO:
These networks are not currently present in the Network
default included networks. Research them and ensure they
are EVM compatible and work with ethers
http://ethers.matic-amoy.quiknode.pro
http://ethers.avalanche-mainnet.quiknode.pro
http://ethers.avalanche-testnet.quiknode.pro
http://ethers.blast-sepolia.quiknode.pro
http://ethers.celo-mainnet.quiknode.pro
http://ethers.fantom.quiknode.pro
http://ethers.imx-demo.quiknode.pro
http://ethers.imx-mainnet.quiknode.pro
http://ethers.imx-testnet.quiknode.pro
http://ethers.near-mainnet.quiknode.pro
http://ethers.near-testnet.quiknode.pro
http://ethers.nova-mainnet.quiknode.pro
http://ethers.scroll-mainnet.quiknode.pro
http://ethers.scroll-testnet.quiknode.pro
http://ethers.tron-mainnet.quiknode.pro
http://ethers.zkevm-mainnet.quiknode.pro
http://ethers.zkevm-testnet.quiknode.pro
http://ethers.zksync-mainnet.quiknode.pro
http://ethers.zksync-testnet.quiknode.pro
*/
/**

@@ -67,0 +123,0 @@ * The **QuickNodeProvider** connects to the [[link-quicknode]]

@@ -146,3 +146,3 @@ //import { resolveAddress } from "@ethersproject/address";

/**
* The maximum amount of gas to allow this transaction to consime.
* The maximum amount of gas to allow this transaction to consume.
*/

@@ -441,2 +441,8 @@ gasLimit?: null | BigNumberish;

/**
* The hash tree root of the parent beacon block for the given
* execution block. See [[link-eip-4788]].
*/
parentBeaconBlockRoot!: null | string;
/**
* The nonce.

@@ -471,3 +477,27 @@ *

/**
* The root hash for the global state after applying changes
* in this block.
*/
readonly stateRoot!: null | string;
/**
* The hash of the transaction receipts trie.
*/
readonly receiptsRoot!: null | string;
/**
* The total amount of blob gas consumed by the transactions
* within the block. See [[link-eip-4844]].
*/
readonly blobGasUsed!: null | bigint;
/**
* The running total of blob gas consumed in excess of the
* target, prior to the block. See [[link-eip-4844]].
*/
readonly excessBlobGas!: null | bigint;
/**
* The miner coinbase address, wihch receives any subsidies for

@@ -518,2 +548,3 @@ * including this block.

parentHash: block.parentHash,
parentBeaconBlockRoot: block.parentBeaconBlockRoot,

@@ -525,6 +556,11 @@ nonce: block.nonce,

gasUsed: block.gasUsed,
blobGasUsed: block.blobGasUsed,
excessBlobGas: block.excessBlobGas,
miner: block.miner,
extraData: block.extraData,
baseFeePerGas: getValue(block.baseFeePerGas)
baseFeePerGas: getValue(block.baseFeePerGas),
stateRoot: block.stateRoot,
receiptsRoot: block.receiptsRoot,
});

@@ -572,3 +608,4 @@ }

baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash,
miner, nonce, number, parentHash, timestamp, transactions
miner, nonce, number, parentHash, parentBeaconBlockRoot,
stateRoot, receiptsRoot, timestamp, transactions
} = this;

@@ -583,3 +620,6 @@

gasUsed: toJson(gasUsed),
blobGasUsed: toJson(this.blobGasUsed),
excessBlobGas: toJson(this.excessBlobGas),
hash, miner, nonce, number, parentHash, timestamp,
parentBeaconBlockRoot, stateRoot, receiptsRoot,
transactions,

@@ -925,2 +965,7 @@ };

/**
* The gas used for BLObs. See [[link-eip-4844]].
*/
readonly blobGasUsed!: null | bigint;
/**
* The amount of gas used by all transactions within the block for this

@@ -944,2 +989,7 @@ * and all transactions with a lower ``index``.

/**
* The price paid per BLOB in gas. See [[link-eip-4844]].
*/
readonly blobGasPrice!: null | bigint;
/**
* The [[link-eip-2718]] transaction type.

@@ -1001,3 +1051,5 @@ */

cumulativeGasUsed: tx.cumulativeGasUsed,
blobGasUsed: tx.blobGasUsed,
gasPrice,
blobGasPrice: tx.blobGasPrice,

@@ -1021,3 +1073,4 @@ type: tx.type,

const {
to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom,
to, from, contractAddress, hash, index,
blockHash, blockNumber, logsBloom,
logs, //byzantium,

@@ -1035,2 +1088,4 @@ status, root

gasPrice: toJson(this.gasPrice),
blobGasUsed: toJson(this.blobGasUsed),
blobGasPrice: toJson(this.blobGasPrice),
gasUsed: toJson(this.gasUsed),

@@ -1252,2 +1307,7 @@ hash, index, logs, logsBloom, root, status, to

/**
* The [[link-eip-4844]] max fee per BLOb gas.
*/
readonly maxFeePerBlobGas!: null | bigint;
/**
* The data.

@@ -1279,2 +1339,7 @@ */

/**
* The [[link-eip-4844]] BLOb versioned hashes.
*/
readonly blobVersionedHashes!: null | Array<string>;
#startBlock: number;

@@ -1307,2 +1372,3 @@

this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas: null;
this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas: null;

@@ -1313,2 +1379,3 @@ this.chainId = tx.chainId;

this.accessList = (tx.accessList != null) ? tx.accessList: null;
this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes: null;

@@ -1324,8 +1391,9 @@ this.#startBlock = -1;

blockNumber, blockHash, index, hash, type, to, from, nonce,
data, signature, accessList
data, signature, accessList, blobVersionedHashes
} = this;
return {
_type: "TransactionReceipt",
_type: "TransactionResponse",
accessList, blockNumber, blockHash,
blobVersionedHashes,
chainId: toJson(this.chainId),

@@ -1338,2 +1406,3 @@ data, from,

maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas),
maxFeePerBlobGas: toJson(this.maxFeePerBlobGas),
nonce, signature, to, index, type,

@@ -1621,2 +1690,10 @@ value: toJson(this.value),

/**
* Returns true if hte transaction is a Cancun (i.e. ``type == 3``)
* transaction. See [[link-eip-4844]].
*/
isCancun(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, maxFeePerBlobGas: bigint, blobVersionedHashes: Array<string> }){
return (this.type === 3);
}
/**
* Returns a filter which can be used to listen for orphan events

@@ -1623,0 +1700,0 @@ * that evict this transaction.

import { getAddress } from "../address/index.js";
import { ZeroAddress } from "../constants/addresses.js";
import { keccak256, Signature, SigningKey } from "../crypto/index.js";
import {
concat, decodeRlp, encodeRlp, getBytes, getBigInt, getNumber, hexlify,
assert, assertArgument, toBeArray, zeroPadValue
assert, assertArgument, isHexString, toBeArray, zeroPadValue
} from "../utils/index.js";

@@ -25,2 +26,3 @@

/**

@@ -101,2 +103,12 @@ * A **TransactionLike** is an object which is appropriate as a loose

accessList?: null | AccessListish;
/**
* The maximum fee per blob gas (see [[link-eip-4844]]).
*/
maxFeePerBlobGas?: null | BigNumberish;
/**
* The versioned hashes (see [[link-eip-4844]]).
*/
blobVersionedHashes?: null | Array<string>;
}

@@ -140,2 +152,10 @@

function formatHashes(value: Array<string>, param: string): Array<string> {
assertArgument(Array.isArray(value), `invalid ${ param }`, "value", value);
for (let i = 0; i < value.length; i++) {
assertArgument(isHexString(value[i], 32), "invalid ${ param } hash", `value[${ i }]`, value[i]);
}
return value;
}
function _parseLegacy(data: Uint8Array): TransactionLike {

@@ -193,8 +213,8 @@ const fields: any = decodeRlp(data);

const fields: Array<any> = [
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.gasPrice || 0, "gasPrice"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? getAddress(tx.to): "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
];

@@ -272,4 +292,2 @@

const maxPriorityFeePerGas = handleUint(fields[2], "maxPriorityFeePerGas");
const maxFeePerGas = handleUint(fields[3], "maxFeePerGas");
const tx: TransactionLike = {

@@ -279,4 +297,4 @@ type: 2,

nonce: handleNumber(fields[1], "nonce"),
maxPriorityFeePerGas: maxPriorityFeePerGas,
maxFeePerGas: maxFeePerGas,
maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"),
maxFeePerGas: handleUint(fields[3], "maxFeePerGas"),
gasPrice: null,

@@ -300,13 +318,13 @@ gasLimit: handleUint(fields[4], "gasLimit"),

function _serializeEip1559(tx: TransactionLike, sig?: Signature): string {
function _serializeEip1559(tx: Transaction, sig?: Signature): string {
const fields: Array<any> = [
formatNumber(tx.chainId || 0, "chainId"),
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? getAddress(tx.to): "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
(formatAccessList(tx.accessList || []))
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || [ ])
];

@@ -351,12 +369,12 @@

function _serializeEip2930(tx: TransactionLike, sig?: Signature): string {
function _serializeEip2930(tx: Transaction, sig?: Signature): string {
const fields: any = [
formatNumber(tx.chainId || 0, "chainId"),
formatNumber(tx.nonce || 0, "nonce"),
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.gasPrice || 0, "gasPrice"),
formatNumber(tx.gasLimit || 0, "gasLimit"),
((tx.to != null) ? getAddress(tx.to): "0x"),
formatNumber(tx.value || 0, "value"),
(tx.data || "0x"),
(formatAccessList(tx.accessList || []))
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || "0x"),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || [ ])
];

@@ -373,2 +391,65 @@

function _parseEip4844(data: Uint8Array): TransactionLike {
const fields: any = decodeRlp(getBytes(data).slice(1));
assertArgument(Array.isArray(fields) && (fields.length === 11 || fields.length === 14),
"invalid field count for transaction type: 3", "data", hexlify(data));
const tx: TransactionLike = {
type: 3,
chainId: handleUint(fields[0], "chainId"),
nonce: handleNumber(fields[1], "nonce"),
maxPriorityFeePerGas: handleUint(fields[2], "maxPriorityFeePerGas"),
maxFeePerGas: handleUint(fields[3], "maxFeePerGas"),
gasPrice: null,
gasLimit: handleUint(fields[4], "gasLimit"),
to: handleAddress(fields[5]),
value: handleUint(fields[6], "value"),
data: hexlify(fields[7]),
accessList: handleAccessList(fields[8], "accessList"),
maxFeePerBlobGas: handleUint(fields[9], "maxFeePerBlobGas"),
blobVersionedHashes: fields[10]
};
assertArgument(tx.to != null, "invalid address for transaction type: 3", "data", data);
assertArgument(Array.isArray(tx.blobVersionedHashes), "invalid blobVersionedHashes: must be an array", "data", data);
for (let i = 0; i < tx.blobVersionedHashes.length; i++) {
assertArgument(isHexString(tx.blobVersionedHashes[i], 32), `invalid blobVersionedHash at index ${ i }: must be length 32`, "data", data);
}
// Unsigned EIP-4844 Transaction
if (fields.length === 11) { return tx; }
tx.hash = keccak256(data);
_parseEipSignature(tx, fields.slice(11));
return tx;
}
function _serializeEip4844(tx: Transaction, sig?: Signature): string {
const fields: Array<any> = [
formatNumber(tx.chainId, "chainId"),
formatNumber(tx.nonce, "nonce"),
formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"),
formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"),
formatNumber(tx.gasLimit, "gasLimit"),
(tx.to || ZeroAddress),
formatNumber(tx.value, "value"),
tx.data,
formatAccessList(tx.accessList || [ ]),
formatNumber(tx.maxFeePerBlobGas || 0, "maxFeePerBlobGas"),
formatHashes(tx.blobVersionedHashes || [ ], "blobVersionedHashes")
];
if (sig) {
fields.push(formatNumber(sig.yParity, "yParity"));
fields.push(toBeArray(sig.r));
fields.push(toBeArray(sig.s));
}
return concat([ "0x03", encodeRlp(fields)]);
}
/**

@@ -400,2 +481,4 @@ * A **Transaction** describes an operation to be executed on

#accessList: null | AccessList;
#maxFeePerBlobGas: null | bigint;
#blobVersionedHashes: null | Array<string>;

@@ -423,2 +506,5 @@ /**

break;
case 3: case "cancun": case "eip-4844":
this.#type = 3;
break;
default:

@@ -437,2 +523,3 @@ assertArgument(false, "unsupported transaction type", "type", value);

case 2: return "eip-1559";
case 3: return "eip-4844";
}

@@ -447,3 +534,7 @@

*/
get to(): null | string { return this.#to; }
get to(): null | string {
const value = this.#to;
if (value == null && this.type === 3) { return ZeroAddress; }
return value;
}
set to(value: null | string) {

@@ -487,3 +578,3 @@ this.#to = (value == null) ? null: getAddress(value);

if (value == null) {
if (this.type === 2) { return BN_0; }
if (this.type === 2 || this.type === 3) { return BN_0; }
return null;

@@ -504,3 +595,3 @@ }

if (value == null) {
if (this.type === 2) { return BN_0; }
if (this.type === 2 || this.type === 3) { return BN_0; }
return null;

@@ -552,3 +643,7 @@ }

if (value == null) {
if (this.type === 1 || this.type === 2) { return [ ]; }
if (this.type === 1 || this.type === 2 || this.type === 3) {
// @TODO: in v7, this should assign the value or become
// a live object itself, otherwise mutation is inconsistent
return [ ];
}
return null;

@@ -563,2 +658,35 @@ }

/**
* The max fee per blob gas for Cancun transactions.
*/
get maxFeePerBlobGas(): null | bigint {
const value = this.#maxFeePerBlobGas;
if (value == null && this.type === 3) { return BN_0; }
return value;
}
set maxFeePerBlobGas(value: null | BigNumberish) {
this.#maxFeePerBlobGas = (value == null) ? null: getBigInt(value, "maxFeePerBlobGas");
}
/**
* The BLOB versioned hashes for Cancun transactions.
*/
get blobVersionedHashes(): null | Array<string> {
// @TODO: Mutation is inconsistent; if unset, the returned value
// cannot mutate the object, if set it can
let value = this.#blobVersionedHashes;
if (value == null && this.type === 3) { return [ ]; }
return value;
}
set blobVersionedHashes(value: null | Array<string>) {
if (value != null) {
assertArgument(Array.isArray(value), "blobVersionedHashes must be an Array", "value", value);
value = value.slice();
for (let i = 0; i < value.length; i++) {
assertArgument(isHexString(value[i], 32), "invalid blobVersionedHash", `value[${ i }]`, value[i]);
}
}
this.#blobVersionedHashes = value;
}
/**
* Creates a new Transaction with default values.

@@ -570,3 +698,3 @@ */

this.#nonce = 0;
this.#gasLimit = BigInt(0);
this.#gasLimit = BN_0;
this.#gasPrice = null;

@@ -576,6 +704,8 @@ this.#maxPriorityFeePerGas = null;

this.#data = "0x";
this.#value = BigInt(0);
this.#chainId = BigInt(0);
this.#value = BN_0;
this.#chainId = BN_0;
this.#sig = null;
this.#accessList = null;
this.#maxFeePerBlobGas = null;
this.#blobVersionedHashes = null;
}

@@ -624,3 +754,2 @@

isSigned(): this is (Transaction & { type: number, typeName: string, from: string, signature: Signature }) {
//isSigned(): this is SignedTransaction {
return this.signature != null;

@@ -645,2 +774,4 @@ }

return _serializeEip1559(this, this.signature);
case 3:
return _serializeEip4844(this, this.signature);
}

@@ -665,2 +796,4 @@

return _serializeEip1559(this);
case 3:
return _serializeEip4844(this);
}

@@ -676,3 +809,9 @@

inferType(): number {
return <number>(this.inferTypes().pop());
const types = this.inferTypes();
// Prefer London (EIP-1559) over Cancun (BLOb)
if (types.indexOf(2) >= 0) { return 2; }
// Return the highest inferred type
return <number>(types.pop());
}

@@ -690,2 +829,3 @@

const hasAccessList = (this.accessList != null);
const hasBlob = (this.#maxFeePerBlobGas != null || this.#blobVersionedHashes);

@@ -722,2 +862,4 @@ //if (hasGasPrice && hasFee) {

types.push(2);
} else if (hasBlob && this.to) {
types.push(3);
} else {

@@ -727,2 +869,3 @@ types.push(0);

types.push(2);
types.push(3);
}

@@ -765,3 +908,3 @@ }

*/
isLondon(): this is (Transaction & { type: 2, accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint}) {
isLondon(): this is (Transaction & { type: 2, accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint }) {
return (this.type === 2);

@@ -771,2 +914,13 @@ }

/**
* Returns true if this transaction is an [[link-eip-4844]] BLOB
* transaction.
*
* This provides a Type Guard that the related properties are
* non-null.
*/
isCancun(): this is (Transaction & { type: 3, to: string, accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, maxFeePerBlobGas: bigint, blobVersionedHashes: Array<string> }) {
return (this.type === 3);
}
/**
* Create a copy of this transaciton.

@@ -821,2 +975,3 @@ */

case 2: return Transaction.from(_parseEip1559(payload));
case 3: return Transaction.from(_parseEip4844(payload));
}

@@ -834,2 +989,3 @@ assert(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" });

if (tx.maxFeePerGas != null) { result.maxFeePerGas = tx.maxFeePerGas; }
if (tx.maxFeePerBlobGas != null) { result.maxFeePerBlobGas = tx.maxFeePerBlobGas; }
if (tx.data != null) { result.data = tx.data; }

@@ -840,2 +996,3 @@ if (tx.value != null) { result.value = tx.value; }

if (tx.accessList != null) { result.accessList = tx.accessList; }
if (tx.blobVersionedHashes != null) { result.blobVersionedHashes = tx.blobVersionedHashes; }

@@ -842,0 +999,0 @@ if (tx.hash != null) {

@@ -739,3 +739,3 @@ /**

assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", {
assert(count <= expectedCount, "too many arguments" + message, "UNEXPECTED_ARGUMENT", {
count: count,

@@ -742,0 +742,0 @@ expectedCount: expectedCount

@@ -939,4 +939,16 @@ /**

}
let requestUrl: null | string = null;
if (this.request) { requestUrl = this.request.url; }
let responseBody: null | string = null;
try {
if (this.#body) { responseBody = toUtf8String(this.#body); }
} catch (e) { }
assert(false, message, "SERVER_ERROR", {
request: (this.request || "unknown request"), response: this, error
request: (this.request || "unknown request"), response: this, error,
info: {
requestUrl, responseBody,
responseStatus: `${ this.statusCode } ${ this.statusMessage }` }
});

@@ -943,0 +955,0 @@ }

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 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 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 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 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 not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc