@ethereumjs/tx
Advanced tools
Comparing version 4.1.2 to 4.2.0
export { FeeMarketEIP1559Transaction } from './eip1559Transaction'; | ||
export { AccessListEIP2930Transaction } from './eip2930Transaction'; | ||
export { BlobEIP4844Transaction } from './eip4844Transaction'; | ||
export { initKZG, kzg } from './kzg/kzg'; | ||
export { Transaction } from './legacyTransaction'; | ||
export { TransactionFactory } from './transactionFactory'; | ||
export * from './types'; | ||
export { computeVersionedHash } from './utils/blobHelpers'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.computeVersionedHash = exports.TransactionFactory = exports.Transaction = exports.kzg = exports.initKZG = exports.BlobEIP4844Transaction = exports.AccessListEIP2930Transaction = exports.FeeMarketEIP1559Transaction = void 0; | ||
exports.TransactionFactory = exports.Transaction = exports.AccessListEIP2930Transaction = exports.FeeMarketEIP1559Transaction = void 0; | ||
var eip1559Transaction_1 = require("./eip1559Transaction"); | ||
@@ -23,7 +23,2 @@ Object.defineProperty(exports, "FeeMarketEIP1559Transaction", { enumerable: true, get: function () { return eip1559Transaction_1.FeeMarketEIP1559Transaction; } }); | ||
Object.defineProperty(exports, "AccessListEIP2930Transaction", { enumerable: true, get: function () { return eip2930Transaction_1.AccessListEIP2930Transaction; } }); | ||
var eip4844Transaction_1 = require("./eip4844Transaction"); | ||
Object.defineProperty(exports, "BlobEIP4844Transaction", { enumerable: true, get: function () { return eip4844Transaction_1.BlobEIP4844Transaction; } }); | ||
var kzg_1 = require("./kzg/kzg"); | ||
Object.defineProperty(exports, "initKZG", { enumerable: true, get: function () { return kzg_1.initKZG; } }); | ||
Object.defineProperty(exports, "kzg", { enumerable: true, get: function () { return kzg_1.kzg; } }); | ||
var legacyTransaction_1 = require("./legacyTransaction"); | ||
@@ -34,4 +29,2 @@ Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return legacyTransaction_1.Transaction; } }); | ||
__exportStar(require("./types"), exports); | ||
var blobHelpers_1 = require("./utils/blobHelpers"); | ||
Object.defineProperty(exports, "computeVersionedHash", { enumerable: true, get: function () { return blobHelpers_1.computeVersionedHash; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -153,3 +153,3 @@ "use strict"; | ||
if (this.supports(types_1.Capability.EIP155ReplayProtection)) { | ||
values.push((0, util_1.toBuffer)(this.common.chainId())); | ||
values.push((0, util_1.bigIntToUnpaddedBuffer)(this.common.chainId())); | ||
values.push((0, util_1.unpadBuffer)((0, util_1.toBuffer)(0))); | ||
@@ -156,0 +156,0 @@ values.push((0, util_1.unpadBuffer)((0, util_1.toBuffer)(0))); |
/// <reference types="node" /> | ||
import type { AccessListEIP2930TxData, BlobEIP4844TxData, FeeMarketEIP1559TxData, TxData, TxOptions, TypedTransaction } from './types'; | ||
import type { AccessListEIP2930TxData, FeeMarketEIP1559TxData, TxData, TxOptions, TypedTransaction } from './types'; | ||
export declare class TransactionFactory { | ||
@@ -11,3 +11,3 @@ private constructor(); | ||
*/ | ||
static fromTxData(txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData | BlobEIP4844TxData, txOptions?: TxOptions): TypedTransaction; | ||
static fromTxData(txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData, txOptions?: TxOptions): TypedTransaction; | ||
/** | ||
@@ -45,4 +45,4 @@ * This method tries to decode serialized data. | ||
*/ | ||
static fromRPCTx(txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData | BlobEIP4844TxData, txOptions?: TxOptions): Promise<TypedTransaction>; | ||
static fromRPCTx(txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData, txOptions?: TxOptions): Promise<TypedTransaction>; | ||
} | ||
//# sourceMappingURL=transactionFactory.d.ts.map |
@@ -7,3 +7,2 @@ "use strict"; | ||
const eip2930Transaction_1 = require("./eip2930Transaction"); | ||
const eip4844Transaction_1 = require("./eip4844Transaction"); | ||
const fromRpc_1 = require("./fromRpc"); | ||
@@ -36,5 +35,2 @@ const legacyTransaction_1 = require("./legacyTransaction"); | ||
} | ||
else if (txType === 5) { | ||
return eip4844Transaction_1.BlobEIP4844Transaction.fromTxData(txData, txOptions); | ||
} | ||
else { | ||
@@ -59,4 +55,2 @@ throw new Error(`Tx instantiation with type ${txType} not supported`); | ||
return eip1559Transaction_1.FeeMarketEIP1559Transaction.fromSerializedTx(data, txOptions); | ||
case 5: | ||
return eip4844Transaction_1.BlobEIP4844Transaction.fromSerializedTx(data, txOptions); | ||
default: | ||
@@ -63,0 +57,0 @@ throw new Error(`TypedTransaction with ID ${data[0]} unknown`); |
/// <reference types="node" /> | ||
import { BooleanType, ByteListType, ByteVectorType, ContainerType, ListCompositeType, NoneType, UintBigintType, UnionType } from '@chainsafe/ssz'; | ||
import type { FeeMarketEIP1559Transaction } from './eip1559Transaction'; | ||
import type { AccessListEIP2930Transaction } from './eip2930Transaction'; | ||
import type { BlobEIP4844Transaction } from './eip4844Transaction'; | ||
import type { Transaction } from './legacyTransaction'; | ||
@@ -83,3 +81,3 @@ import type { Common } from '@ethereumjs/common'; | ||
*/ | ||
export declare type TypedTransaction = Transaction | AccessListEIP2930Transaction | FeeMarketEIP1559Transaction | BlobEIP4844Transaction; | ||
export declare type TypedTransaction = Transaction | AccessListEIP2930Transaction | FeeMarketEIP1559Transaction; | ||
/** | ||
@@ -162,27 +160,2 @@ * Legacy {@link Transaction} Data | ||
/** | ||
* {@link BlobEIP4844Transaction} data. | ||
*/ | ||
export interface BlobEIP4844TxData extends FeeMarketEIP1559TxData { | ||
/** | ||
* The versioned hashes used to validate the blobs attached to a transaction | ||
*/ | ||
versionedHashes?: BufferLike[]; | ||
/** | ||
* The maximum fee per data gas paid for the transaction | ||
*/ | ||
maxFeePerDataGas?: BigIntLike; | ||
/** | ||
* The blobs associated with a transaction | ||
*/ | ||
blobs?: BufferLike[]; | ||
/** | ||
* The KZG commitments corresponding to the versioned hashes for each blob | ||
*/ | ||
kzgCommitments?: BufferLike[]; | ||
/** | ||
* The aggregate KZG proof associated with the transaction | ||
*/ | ||
kzgProof?: BufferLike; | ||
} | ||
/** | ||
* Buffer values array for a legacy {@link Transaction} | ||
@@ -277,83 +250,3 @@ */ | ||
} | ||
/** EIP4844 types */ | ||
export declare const AddressType: ByteVectorType; | ||
export declare const AccessTupleType: ContainerType<{ | ||
address: ByteVectorType; | ||
storageKeys: ListCompositeType<ByteVectorType>; | ||
}>; | ||
export declare const BlobTransactionType: ContainerType<{ | ||
chainId: UintBigintType; | ||
nonce: UintBigintType; | ||
maxPriorityFeePerGas: UintBigintType; | ||
maxFeePerGas: UintBigintType; | ||
gas: UintBigintType; | ||
to: UnionType<(ByteVectorType | NoneType)[]>; | ||
value: UintBigintType; | ||
data: ByteListType; | ||
accessList: ListCompositeType<ContainerType<{ | ||
address: ByteVectorType; | ||
storageKeys: ListCompositeType<ByteVectorType>; | ||
}>>; | ||
maxFeePerDataGas: UintBigintType; | ||
blobVersionedHashes: ListCompositeType<ByteVectorType>; | ||
}>; | ||
export declare const ECDSASignatureType: ContainerType<{ | ||
yParity: BooleanType; | ||
r: UintBigintType; | ||
s: UintBigintType; | ||
}>; | ||
export declare const SignedBlobTransactionType: ContainerType<{ | ||
message: ContainerType<{ | ||
chainId: UintBigintType; | ||
nonce: UintBigintType; | ||
maxPriorityFeePerGas: UintBigintType; | ||
maxFeePerGas: UintBigintType; | ||
gas: UintBigintType; | ||
to: UnionType<(ByteVectorType | NoneType)[]>; | ||
value: UintBigintType; | ||
data: ByteListType; | ||
accessList: ListCompositeType<ContainerType<{ | ||
address: ByteVectorType; | ||
storageKeys: ListCompositeType<ByteVectorType>; | ||
}>>; | ||
maxFeePerDataGas: UintBigintType; | ||
blobVersionedHashes: ListCompositeType<ByteVectorType>; | ||
}>; | ||
signature: ContainerType<{ | ||
yParity: BooleanType; | ||
r: UintBigintType; | ||
s: UintBigintType; | ||
}>; | ||
}>; | ||
export declare const KZGCommitmentType: ByteVectorType; | ||
export declare const KZGProofType: ByteVectorType; | ||
export declare const BlobNetworkTransactionWrapper: ContainerType<{ | ||
tx: ContainerType<{ | ||
message: ContainerType<{ | ||
chainId: UintBigintType; | ||
nonce: UintBigintType; | ||
maxPriorityFeePerGas: UintBigintType; | ||
maxFeePerGas: UintBigintType; | ||
gas: UintBigintType; | ||
to: UnionType<(ByteVectorType | NoneType)[]>; | ||
value: UintBigintType; | ||
data: ByteListType; | ||
accessList: ListCompositeType<ContainerType<{ | ||
address: ByteVectorType; | ||
storageKeys: ListCompositeType<ByteVectorType>; | ||
}>>; | ||
maxFeePerDataGas: UintBigintType; | ||
blobVersionedHashes: ListCompositeType<ByteVectorType>; | ||
}>; | ||
signature: ContainerType<{ | ||
yParity: BooleanType; | ||
r: UintBigintType; | ||
s: UintBigintType; | ||
}>; | ||
}>; | ||
blobKzgs: ListCompositeType<ByteVectorType>; | ||
blobs: ListCompositeType<ByteVectorType>; | ||
kzgAggregatedProof: ByteVectorType; | ||
}>; | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BlobNetworkTransactionWrapper = exports.KZGProofType = exports.KZGCommitmentType = exports.SignedBlobTransactionType = exports.ECDSASignatureType = exports.BlobTransactionType = exports.AccessTupleType = exports.AddressType = exports.isAccessList = exports.isAccessListBuffer = exports.Capability = void 0; | ||
const ssz_1 = require("@chainsafe/ssz"); | ||
const constants_1 = require("./constants"); | ||
const Bytes20 = new ssz_1.ByteVectorType(20); | ||
const Bytes32 = new ssz_1.ByteVectorType(32); | ||
const Bytes48 = new ssz_1.ByteVectorType(48); | ||
const Uint64 = new ssz_1.UintBigintType(8); | ||
const Uint256 = new ssz_1.UintBigintType(32); | ||
exports.isAccessList = exports.isAccessListBuffer = exports.Capability = void 0; | ||
/** | ||
@@ -53,44 +46,2 @@ * Can be used in conjunction with {@link Transaction.supports} | ||
exports.isAccessList = isAccessList; | ||
/** EIP4844 types */ | ||
exports.AddressType = Bytes20; // SSZ encoded address | ||
// SSZ encoded container for address and storage keys | ||
exports.AccessTupleType = new ssz_1.ContainerType({ | ||
address: exports.AddressType, | ||
storageKeys: new ssz_1.ListCompositeType(Bytes32, constants_1.MAX_VERSIONED_HASHES_LIST_SIZE), | ||
}); | ||
// SSZ encoded blob transaction | ||
exports.BlobTransactionType = new ssz_1.ContainerType({ | ||
chainId: Uint256, | ||
nonce: Uint64, | ||
maxPriorityFeePerGas: Uint256, | ||
maxFeePerGas: Uint256, | ||
gas: Uint64, | ||
to: new ssz_1.UnionType([new ssz_1.NoneType(), exports.AddressType]), | ||
value: Uint256, | ||
data: new ssz_1.ByteListType(constants_1.MAX_CALLDATA_SIZE), | ||
accessList: new ssz_1.ListCompositeType(exports.AccessTupleType, constants_1.MAX_ACCESS_LIST_SIZE), | ||
maxFeePerDataGas: Uint256, | ||
blobVersionedHashes: new ssz_1.ListCompositeType(Bytes32, constants_1.MAX_VERSIONED_HASHES_LIST_SIZE), | ||
}); | ||
// SSZ encoded ECDSA Signature | ||
exports.ECDSASignatureType = new ssz_1.ContainerType({ | ||
yParity: new ssz_1.BooleanType(), | ||
r: Uint256, | ||
s: Uint256, | ||
}); | ||
// SSZ encoded signed blob transaction | ||
exports.SignedBlobTransactionType = new ssz_1.ContainerType({ | ||
message: exports.BlobTransactionType, | ||
signature: exports.ECDSASignatureType, | ||
}); | ||
// SSZ encoded KZG Commitment/Proof (48 bytes) | ||
exports.KZGCommitmentType = Bytes48; | ||
exports.KZGProofType = exports.KZGCommitmentType; | ||
// SSZ encoded blob network transaction wrapper | ||
exports.BlobNetworkTransactionWrapper = new ssz_1.ContainerType({ | ||
tx: exports.SignedBlobTransactionType, | ||
blobKzgs: new ssz_1.ListCompositeType(exports.KZGCommitmentType, constants_1.MAX_TX_WRAP_KZG_COMMITMENTS), | ||
blobs: new ssz_1.ListCompositeType(new ssz_1.ByteVectorType(constants_1.FIELD_ELEMENTS_PER_BLOB * constants_1.BYTES_PER_FIELD_ELEMENT), constants_1.LIMIT_BLOBS_PER_TX), | ||
kzgAggregatedProof: exports.KZGProofType, | ||
}); | ||
//# sourceMappingURL=types.js.map |
@@ -1,3 +0,1 @@ | ||
/// <reference types="node" /> | ||
import type { BlobEIP4844Transaction } from './eip4844Transaction'; | ||
import type { AccessList, AccessListBuffer } from './types'; | ||
@@ -15,28 +13,2 @@ import type { Common } from '@ethereumjs/common'; | ||
} | ||
export declare const blobTxToNetworkWrapperDataFormat: (tx: BlobEIP4844Transaction) => { | ||
message: { | ||
chainId: bigint; | ||
nonce: bigint; | ||
maxPriorityFeePerGas: bigint; | ||
maxFeePerGas: bigint; | ||
gas: bigint; | ||
to: { | ||
selector: number; | ||
value: Buffer | null; | ||
}; | ||
value: bigint; | ||
data: Buffer; | ||
accessList: { | ||
address: Buffer; | ||
storageKeys: Buffer[]; | ||
}[]; | ||
blobVersionedHashes: Buffer[]; | ||
maxFeePerDataGas: bigint; | ||
}; | ||
signature: { | ||
r: bigint; | ||
s: bigint; | ||
yParity: boolean; | ||
}; | ||
}; | ||
//# sourceMappingURL=util.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.blobTxToNetworkWrapperDataFormat = exports.AccessLists = exports.checkMaxInitCodeSize = void 0; | ||
exports.AccessLists = exports.checkMaxInitCodeSize = void 0; | ||
const util_1 = require("@ethereumjs/util"); | ||
@@ -104,32 +104,2 @@ const types_1 = require("./types"); | ||
exports.AccessLists = AccessLists; | ||
const blobTxToNetworkWrapperDataFormat = (tx) => { | ||
const to = { | ||
selector: tx.to !== undefined ? 1 : 0, | ||
value: tx.to?.toBuffer() ?? null, | ||
}; | ||
return { | ||
message: { | ||
chainId: tx.common.chainId(), | ||
nonce: tx.nonce, | ||
maxPriorityFeePerGas: tx.maxPriorityFeePerGas, | ||
maxFeePerGas: tx.maxFeePerGas, | ||
gas: tx.gasLimit, | ||
to, | ||
value: tx.value, | ||
data: tx.data, | ||
accessList: tx.accessList.map((listItem) => { | ||
return { address: listItem[0], storageKeys: listItem[1] }; | ||
}), | ||
blobVersionedHashes: tx.versionedHashes, | ||
maxFeePerDataGas: tx.maxFeePerDataGas, | ||
}, | ||
// If transaction is unsigned, signature fields will be initialized to zeroes | ||
signature: { | ||
r: tx.r ?? BigInt(0), | ||
s: tx.s ?? BigInt(0), | ||
yParity: tx.v === BigInt(1) ? true : false, | ||
}, | ||
}; | ||
}; | ||
exports.blobTxToNetworkWrapperDataFormat = blobTxToNetworkWrapperDataFormat; | ||
//# sourceMappingURL=util.js.map |
{ | ||
"name": "@ethereumjs/tx", | ||
"version": "4.1.2", | ||
"version": "4.2.0", | ||
"description": "A simple module for creating, manipulating and signing Ethereum transactions", | ||
@@ -54,16 +54,7 @@ "keywords": [ | ||
"dependencies": { | ||
"@chainsafe/ssz": "^0.11.1", | ||
"@ethereumjs/common": "^3.1.2", | ||
"@ethereumjs/common": "^3.2.0", | ||
"@ethereumjs/rlp": "^4.0.1", | ||
"@ethereumjs/util": "^8.0.6", | ||
"@ethereumjs/util": "^8.1.0", | ||
"ethereum-cryptography": "^2.0.0" | ||
}, | ||
"peerDependencies": { | ||
"c-kzg": "^1.0.8" | ||
}, | ||
"peerDependenciesMeta": { | ||
"c-kzg": { | ||
"optional": true | ||
} | ||
}, | ||
"devDependencies": { | ||
@@ -70,0 +61,0 @@ "@types/minimist": "^1.2.0", |
@@ -95,3 +95,3 @@ # @ethereumjs/tx | ||
- `BlobEIP4844Transaction` ([EIP-4844](https://eips.ethereumorg/EIPS/eip-4844), proto-danksharding) | ||
- `BlobEIP4844Transaction` ([EIP-4844](https://eips.ethereum.org/EIPS/eip-4844), proto-danksharding) | ||
- `FeeMarketEIP1559Transaction` ([EIP-1559](https://eips.ethereum.org/EIPS/eip-1559), gas fee market) | ||
@@ -98,0 +98,0 @@ - `AccessListEIP2930Transaction` ([EIP-2930](https://eips.ethereum.org/EIPS/eip-2930), optional access lists) |
export { FeeMarketEIP1559Transaction } from './eip1559Transaction' | ||
export { AccessListEIP2930Transaction } from './eip2930Transaction' | ||
export { BlobEIP4844Transaction } from './eip4844Transaction' | ||
export { initKZG, kzg } from './kzg/kzg' | ||
export { Transaction } from './legacyTransaction' | ||
export { TransactionFactory } from './transactionFactory' | ||
export * from './types' | ||
export { computeVersionedHash } from './utils/blobHelpers' |
@@ -193,3 +193,3 @@ import { RLP } from '@ethereumjs/rlp' | ||
if (this.supports(Capability.EIP155ReplayProtection)) { | ||
values.push(toBuffer(this.common.chainId())) | ||
values.push(bigIntToUnpaddedBuffer(this.common.chainId())) | ||
values.push(unpadBuffer(toBuffer(0))) | ||
@@ -196,0 +196,0 @@ values.push(unpadBuffer(toBuffer(0))) |
@@ -5,3 +5,2 @@ import { bufferToBigInt, fetchFromProvider, getProvider, toBuffer } from '@ethereumjs/util' | ||
import { AccessListEIP2930Transaction } from './eip2930Transaction' | ||
import { BlobEIP4844Transaction } from './eip4844Transaction' | ||
import { normalizeTxParams } from './fromRpc' | ||
@@ -12,3 +11,2 @@ import { Transaction } from './legacyTransaction' | ||
AccessListEIP2930TxData, | ||
BlobEIP4844TxData, | ||
FeeMarketEIP1559TxData, | ||
@@ -31,3 +29,3 @@ TxData, | ||
public static fromTxData( | ||
txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData | BlobEIP4844TxData, | ||
txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData, | ||
txOptions: TxOptions = {} | ||
@@ -46,4 +44,2 @@ ): TypedTransaction { | ||
return FeeMarketEIP1559Transaction.fromTxData(<FeeMarketEIP1559TxData>txData, txOptions) | ||
} else if (txType === 5) { | ||
return BlobEIP4844Transaction.fromTxData(<BlobEIP4844TxData>txData, txOptions) | ||
} else { | ||
@@ -69,4 +65,2 @@ throw new Error(`Tx instantiation with type ${txType} not supported`) | ||
return FeeMarketEIP1559Transaction.fromSerializedTx(data, txOptions) | ||
case 5: | ||
return BlobEIP4844Transaction.fromSerializedTx(data, txOptions) | ||
default: | ||
@@ -131,3 +125,3 @@ throw new Error(`TypedTransaction with ID ${data[0]} unknown`) | ||
public static async fromRPCTx( | ||
txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData | BlobEIP4844TxData, | ||
txData: TxData | AccessListEIP2930TxData | FeeMarketEIP1559TxData, | ||
txOptions: TxOptions = {} | ||
@@ -134,0 +128,0 @@ ) { |
108
src/types.ts
@@ -1,25 +0,3 @@ | ||
import { | ||
BooleanType, | ||
ByteListType, | ||
ByteVectorType, | ||
ContainerType, | ||
ListCompositeType, | ||
NoneType, | ||
UintBigintType, | ||
UnionType, | ||
} from '@chainsafe/ssz' | ||
import { | ||
BYTES_PER_FIELD_ELEMENT, | ||
FIELD_ELEMENTS_PER_BLOB, | ||
LIMIT_BLOBS_PER_TX, | ||
MAX_ACCESS_LIST_SIZE, | ||
MAX_CALLDATA_SIZE, | ||
MAX_TX_WRAP_KZG_COMMITMENTS, | ||
MAX_VERSIONED_HASHES_LIST_SIZE, | ||
} from './constants' | ||
import type { FeeMarketEIP1559Transaction } from './eip1559Transaction' | ||
import type { AccessListEIP2930Transaction } from './eip2930Transaction' | ||
import type { BlobEIP4844Transaction } from './eip4844Transaction' | ||
import type { Transaction } from './legacyTransaction' | ||
@@ -29,9 +7,2 @@ import type { Common } from '@ethereumjs/common' | ||
const Bytes20 = new ByteVectorType(20) | ||
const Bytes32 = new ByteVectorType(32) | ||
const Bytes48 = new ByteVectorType(48) | ||
const Uint64 = new UintBigintType(8) | ||
const Uint256 = new UintBigintType(32) | ||
/** | ||
@@ -145,3 +116,2 @@ * Can be used in conjunction with {@link Transaction.supports} | ||
| FeeMarketEIP1559Transaction | ||
| BlobEIP4844Transaction | ||
@@ -239,28 +209,2 @@ /** | ||
/** | ||
* {@link BlobEIP4844Transaction} data. | ||
*/ | ||
export interface BlobEIP4844TxData extends FeeMarketEIP1559TxData { | ||
/** | ||
* The versioned hashes used to validate the blobs attached to a transaction | ||
*/ | ||
versionedHashes?: BufferLike[] | ||
/** | ||
* The maximum fee per data gas paid for the transaction | ||
*/ | ||
maxFeePerDataGas?: BigIntLike | ||
/** | ||
* The blobs associated with a transaction | ||
*/ | ||
blobs?: BufferLike[] | ||
/** | ||
* The KZG commitments corresponding to the versioned hashes for each blob | ||
*/ | ||
kzgCommitments?: BufferLike[] | ||
/** | ||
* The aggregate KZG proof associated with the transaction | ||
*/ | ||
kzgProof?: BufferLike | ||
} | ||
/** | ||
* Buffer values array for a legacy {@link Transaction} | ||
@@ -360,53 +304,1 @@ */ | ||
} | ||
/** EIP4844 types */ | ||
export const AddressType = Bytes20 // SSZ encoded address | ||
// SSZ encoded container for address and storage keys | ||
export const AccessTupleType = new ContainerType({ | ||
address: AddressType, | ||
storageKeys: new ListCompositeType(Bytes32, MAX_VERSIONED_HASHES_LIST_SIZE), | ||
}) | ||
// SSZ encoded blob transaction | ||
export const BlobTransactionType = new ContainerType({ | ||
chainId: Uint256, | ||
nonce: Uint64, | ||
maxPriorityFeePerGas: Uint256, | ||
maxFeePerGas: Uint256, | ||
gas: Uint64, | ||
to: new UnionType([new NoneType(), AddressType]), | ||
value: Uint256, | ||
data: new ByteListType(MAX_CALLDATA_SIZE), | ||
accessList: new ListCompositeType(AccessTupleType, MAX_ACCESS_LIST_SIZE), | ||
maxFeePerDataGas: Uint256, | ||
blobVersionedHashes: new ListCompositeType(Bytes32, MAX_VERSIONED_HASHES_LIST_SIZE), | ||
}) | ||
// SSZ encoded ECDSA Signature | ||
export const ECDSASignatureType = new ContainerType({ | ||
yParity: new BooleanType(), | ||
r: Uint256, | ||
s: Uint256, | ||
}) | ||
// SSZ encoded signed blob transaction | ||
export const SignedBlobTransactionType = new ContainerType({ | ||
message: BlobTransactionType, | ||
signature: ECDSASignatureType, | ||
}) | ||
// SSZ encoded KZG Commitment/Proof (48 bytes) | ||
export const KZGCommitmentType = Bytes48 | ||
export const KZGProofType = KZGCommitmentType | ||
// SSZ encoded blob network transaction wrapper | ||
export const BlobNetworkTransactionWrapper = new ContainerType({ | ||
tx: SignedBlobTransactionType, | ||
blobKzgs: new ListCompositeType(KZGCommitmentType, MAX_TX_WRAP_KZG_COMMITMENTS), | ||
blobs: new ListCompositeType( | ||
new ByteVectorType(FIELD_ELEMENTS_PER_BLOB * BYTES_PER_FIELD_ELEMENT), | ||
LIMIT_BLOBS_PER_TX | ||
), | ||
kzgAggregatedProof: KZGProofType, | ||
}) |
@@ -5,3 +5,2 @@ import { bufferToHex, setLengthLeft, toBuffer } from '@ethereumjs/util' | ||
import type { BlobEIP4844Transaction } from './eip4844Transaction' | ||
import type { AccessList, AccessListBuffer, AccessListItem } from './types' | ||
@@ -120,31 +119,1 @@ import type { Common } from '@ethereumjs/common' | ||
} | ||
export const blobTxToNetworkWrapperDataFormat = (tx: BlobEIP4844Transaction) => { | ||
const to = { | ||
selector: tx.to !== undefined ? 1 : 0, | ||
value: tx.to?.toBuffer() ?? null, | ||
} | ||
return { | ||
message: { | ||
chainId: tx.common.chainId(), | ||
nonce: tx.nonce, | ||
maxPriorityFeePerGas: tx.maxPriorityFeePerGas, | ||
maxFeePerGas: tx.maxFeePerGas, | ||
gas: tx.gasLimit, | ||
to, | ||
value: tx.value, | ||
data: tx.data, | ||
accessList: tx.accessList.map((listItem) => { | ||
return { address: listItem[0], storageKeys: listItem[1] } | ||
}), | ||
blobVersionedHashes: tx.versionedHashes, | ||
maxFeePerDataGas: tx.maxFeePerDataGas, | ||
}, | ||
// If transaction is unsigned, signature fields will be initialized to zeroes | ||
signature: { | ||
r: tx.r ?? BigInt(0), | ||
s: tx.s ?? BigInt(0), | ||
yParity: tx.v === BigInt(1) ? true : false, | ||
}, | ||
} | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4
275350
53
4682
- Removed@chainsafe/ssz@^0.11.1
- Removed@chainsafe/as-sha256@0.4.2(transitive)
- Removed@chainsafe/persistent-merkle-tree@0.6.1(transitive)
- Removed@chainsafe/ssz@0.11.1(transitive)
- Removed@noble/hashes@1.5.0(transitive)
- Removedc-kzg@1.1.3(transitive)
- Removednode-addon-api@5.1.0(transitive)
Updated@ethereumjs/common@^3.2.0
Updated@ethereumjs/util@^8.1.0