-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
61 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Cursor } from "@hazae41/cursor"; | ||
import { Nullable } from "@hazae41/option"; | ||
import { BytesAsInteger } from "../helpers/generic.js"; | ||
|
||
export interface Eip1559TransactionEnvelopeInit { | ||
readonly to?: Nullable<BytesAsInteger.From> | ||
readonly from: BytesAsInteger.From | ||
readonly value: BytesAsInteger.From | ||
readonly data: BytesAsInteger.From | ||
readonly nonce: BytesAsInteger.From | ||
readonly gas: BytesAsInteger.From | ||
readonly gasPrice: BytesAsInteger.From | ||
readonly maxPriorityFeePerGas: BytesAsInteger.From | ||
readonly maxFeePerGas: BytesAsInteger.From | ||
readonly chainId: BytesAsInteger.From | ||
} | ||
|
||
export namespace Eip1559TransactionEnvelope { | ||
|
||
export type From = Eip1559TransactionEnvelopeInit | ||
|
||
} | ||
|
||
export class Eip1559TransactionEnvelope { | ||
|
||
readonly type = 0x02 | ||
|
||
constructor( | ||
readonly to: Nullable<BytesAsInteger.From>, | ||
readonly from: BytesAsInteger.From, | ||
readonly value: BytesAsInteger.From, | ||
readonly data: BytesAsInteger.From, | ||
readonly nonce: BytesAsInteger.From, | ||
readonly gas: BytesAsInteger.From, | ||
readonly gasPrice: BytesAsInteger.From, | ||
readonly maxPriorityFeePerGas: BytesAsInteger.From, | ||
readonly maxFeePerGas: BytesAsInteger.From, | ||
readonly chainId: BytesAsInteger.From | ||
) { } | ||
|
||
static create(init: Eip1559TransactionEnvelopeInit): Eip1559TransactionEnvelope { | ||
const { to, from, value, data, nonce, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, chainId } = init | ||
return new Eip1559TransactionEnvelope(to, from, value, data, nonce, gas, gasPrice, maxPriorityFeePerGas, maxFeePerGas, chainId) | ||
} | ||
|
||
static fromOrThrow(init: Eip1559TransactionEnvelopeInit): Eip1559TransactionEnvelope { | ||
return Eip1559TransactionEnvelope.create(init) | ||
} | ||
|
||
writeOrThrow(cursor: Cursor) { | ||
|
||
} | ||
|
||
} | ||
|
||
export interface Eip2718TransactionEnvelope { | ||
|
||
|
||
} |