11//import { resolveAddress } from "@ethersproject/address";
22import {
3- defineProperties , getBigInt , getNumber , hexlify , resolveProperties ,
3+ defineProperties , getBigInt , getNumber , hexlify , isBytesLike ,
4+ resolveProperties ,
45 assert , assertArgument , isError , makeError
56} from "../utils/index.js" ;
67import { accessListify } from "../transaction/index.js" ;
78
89import type { AddressLike , NameResolver } from "../address/index.js" ;
910import type { BigNumberish , EventEmitterable } from "../utils/index.js" ;
1011import type { Signature } from "../crypto/index.js" ;
11- import type { AccessList , AccessListish , TransactionLike } from "../transaction/index.js" ;
12+ import type {
13+ AccessList , AccessListish , BlobLike , KzgLibrary , TransactionLike
14+ } from "../transaction/index.js" ;
1215
1316import type { ContractRunner } from "./contracts.js" ;
1417import type { Network } from "./network.js" ;
@@ -214,6 +217,30 @@ export interface TransactionRequest {
214217 */
215218 enableCcipRead ?: boolean ;
216219
220+ /**
221+ * The blob versioned hashes (see [[link-eip-4844]]).
222+ */
223+ blobVersionedHashes ?: null | Array < string >
224+
225+ /**
226+ * The maximum fee per blob gas (see [[link-eip-4844]]).
227+ */
228+ maxFeePerBlobGas ?: null | BigNumberish ;
229+
230+ /**
231+ * Any blobs to include in the transaction (see [[link-eip-4844]]).
232+ */
233+ blobs ?: null | Array < BlobLike > ;
234+
235+ /**
236+ * An external library for computing the KZG commitments and
237+ * proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]).
238+ *
239+ * This is generally ``null``, unless you are creating BLOb
240+ * transactions.
241+ */
242+ kzg ?: null | KzgLibrary ;
243+
217244 // Todo?
218245 //gasMultiplier?: number;
219246} ;
@@ -332,7 +359,7 @@ export function copyRequest(req: TransactionRequest): PreparedTransactionRequest
332359
333360 if ( req . data ) { result . data = hexlify ( req . data ) ; }
334361
335- const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value" . split ( / , / ) ;
362+ const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerBlobGas, maxFeePerGas,maxPriorityFeePerGas,value" . split ( / , / ) ;
336363 for ( const key of bigIntKeys ) {
337364 if ( ! ( key in req ) || ( < any > req ) [ key ] == null ) { continue ; }
338365 result [ key ] = getBigInt ( ( < any > req ) [ key ] , `request.${ key } ` ) ;
@@ -358,6 +385,19 @@ export function copyRequest(req: TransactionRequest): PreparedTransactionRequest
358385 result . customData = req . customData ;
359386 }
360387
388+ if ( "blobVersionedHashes" in req && req . blobVersionedHashes ) {
389+ result . blobVersionedHashes = req . blobVersionedHashes . slice ( ) ;
390+ }
391+
392+ if ( "kzg" in req ) { result . kzg = req . kzg ; }
393+
394+ if ( "blobs" in req && req . blobs ) {
395+ result . blobs = req . blobs . map ( ( b ) => {
396+ if ( isBytesLike ( b ) ) { return hexlify ( b ) ; }
397+ return Object . assign ( { } , b ) ;
398+ } ) ;
399+ }
400+
361401 return result ;
362402}
363403
0 commit comments