Skip to content

Commit

Permalink
Merge branch 'wip-4844-write'
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Apr 10, 2024
2 parents 1717abb + a05f40f commit 531ab95
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 49 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"url": "https://www.buymeacoffee.com/ricmoo"
}
],
"gitHead": "556fdd91d9b6bf7db4041bb099e66b2080e1a985",
"gitHead": "12772e9498b70f8538838f30e16f3792ea90e173",
"homepage": "https://ethers.org",
"keywords": [
"ethereum",
Expand All @@ -106,7 +106,7 @@
"name": "ethers",
"publishConfig": {
"access": "public",
"tag": "latest"
"tag": "next"
},
"repository": {
"type": "git",
Expand All @@ -131,5 +131,5 @@
"test-esm": "mocha --trace-warnings --reporter ./reporter.cjs ./lib.esm/_tests/test-*.js"
},
"sideEffects": false,
"version": "6.11.1"
"version": "6.12.0-beta.1"
}
2 changes: 1 addition & 1 deletion src.ts/_version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
/**
* The current version of Ethers.
*/
export const version: string = "6.11.1";
export const version: string = "6.12.0-beta.1";
1 change: 1 addition & 0 deletions src.ts/ethers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export type {

export type {
AccessList, AccessListish, AccessListEntry,
Blob, BlobLike, KzgLibrary,
TransactionLike
} from "./transaction/index.js";

Expand Down
4 changes: 2 additions & 2 deletions src.ts/providers/abstract-signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ export abstract class AbstractSigner<P extends null | Provider = null | Provider
operation: "signer.getFeeData" });
}

} else if (pop.type === 2) {
// Explicitly using EIP-1559
} else if (pop.type === 2 || pop.type === 3) {
// Explicitly using EIP-1559 or EIP-4844

// Populate missing fee data
if (pop.maxFeePerGas == null) {
Expand Down
46 changes: 43 additions & 3 deletions src.ts/providers/provider.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
//import { resolveAddress } from "@ethersproject/address";
import {
defineProperties, getBigInt, getNumber, hexlify, resolveProperties,
defineProperties, getBigInt, getNumber, hexlify, isBytesLike,
resolveProperties,
assert, assertArgument, isError, makeError
} from "../utils/index.js";
import { accessListify } from "../transaction/index.js";

import type { AddressLike, NameResolver } from "../address/index.js";
import type { BigNumberish, EventEmitterable } from "../utils/index.js";
import type { Signature } from "../crypto/index.js";
import type { AccessList, AccessListish, TransactionLike } from "../transaction/index.js";
import type {
AccessList, AccessListish, BlobLike, KzgLibrary, TransactionLike
} from "../transaction/index.js";

import type { ContractRunner } from "./contracts.js";
import type { Network } from "./network.js";
Expand Down Expand Up @@ -214,6 +217,30 @@ export interface TransactionRequest {
*/
enableCcipRead?: boolean;

/**
* The blob versioned hashes (see [[link-eip-4844]]).
*/
blobVersionedHashes?: null | Array<string>

/**
* The maximum fee per blob gas (see [[link-eip-4844]]).
*/
maxFeePerBlobGas?: null | BigNumberish;

/**
* Any blobs to include in the transaction (see [[link-eip-4844]]).
*/
blobs?: null | Array<BlobLike>;

/**
* An external library for computing the KZG commitments and
* proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]).
*
* This is generally ``null``, unless you are creating BLOb
* transactions.
*/
kzg?: null | KzgLibrary;

// Todo?
//gasMultiplier?: number;
};
Expand Down Expand Up @@ -332,7 +359,7 @@ export function copyRequest(req: TransactionRequest): PreparedTransactionRequest

if (req.data) { result.data = hexlify(req.data); }

const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);
const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);
for (const key of bigIntKeys) {
if (!(key in req) || (<any>req)[key] == null) { continue; }
result[key] = getBigInt((<any>req)[key], `request.${ key }`);
Expand All @@ -358,6 +385,19 @@ export function copyRequest(req: TransactionRequest): PreparedTransactionRequest
result.customData = req.customData;
}

if ("blobVersionedHashes" in req && req.blobVersionedHashes) {
result.blobVersionedHashes = req.blobVersionedHashes.slice();
}

if ("kzg" in req) { result.kzg = req.kzg; }

if ("blobs" in req && req.blobs) {
result.blobs = req.blobs.map((b) => {
if (isBytesLike(b)) { return hexlify(b); }
return Object.assign({ }, b);
});
}

return result;
}

Expand Down
4 changes: 3 additions & 1 deletion src.ts/transaction/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ export { accessListify } from "./accesslist.js";
export { computeAddress, recoverAddress } from "./address.js";
export { Transaction } from "./transaction.js";

export type { TransactionLike } from "./transaction.js";
export type {
Blob, BlobLike, KzgLibrary, TransactionLike
} from "./transaction.js";

0 comments on commit 531ab95

Please sign in to comment.