Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hazae41 committed Jul 7, 2024
1 parent 44749a5 commit 1aae643
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mods/abi/types/function/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class AbiFunctionSelector {
}

codegen() {
return `Abi.FunctionSelector.from([${this.value}])`
return `Abi.FunctionSelector.fromOrThrow([${this.value}])`
}

get class() {
Expand Down Expand Up @@ -139,7 +139,7 @@ export class AbiFunctionSelectorAndArguments {
}

static codegen() {
return `Abi.FunctionSelectorAndArguments.fromOrThrow(${$func.codegen()},${$args.codegen()})`
return `Abi.FunctionSelectorAndArguments.create(${$func.codegen()},${$args.codegen()})`
}

get class() {
Expand Down
59 changes: 59 additions & 0 deletions src/mods/types/transaction/index.ts
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 {


}

0 comments on commit 1aae643

Please sign in to comment.