ox 1.7.4 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/core/AbiEvent.d.ts.map +1 -1
- package/dist/core/AbiEvent.js +10 -9
- package/dist/core/AbiEvent.js.map +1 -1
- package/dist/core/Blobs.d.ts.map +1 -1
- package/dist/core/Blobs.js +6 -2
- package/dist/core/Blobs.js.map +1 -1
- package/dist/core/Frame.d.ts +290 -0
- package/dist/core/Frame.d.ts.map +1 -0
- package/dist/core/Frame.js +306 -0
- package/dist/core/Frame.js.map +1 -0
- package/dist/core/FrameReceipt.d.ts +92 -0
- package/dist/core/FrameReceipt.d.ts.map +1 -0
- package/dist/core/FrameReceipt.js +72 -0
- package/dist/core/FrameReceipt.js.map +1 -0
- package/dist/core/FrameSignature.d.ts +357 -0
- package/dist/core/FrameSignature.d.ts.map +1 -0
- package/dist/core/FrameSignature.js +411 -0
- package/dist/core/FrameSignature.js.map +1 -0
- package/dist/core/Signature.d.ts +6 -5
- package/dist/core/Signature.d.ts.map +1 -1
- package/dist/core/Signature.js +17 -7
- package/dist/core/Signature.js.map +1 -1
- package/dist/core/Siwe.d.ts.map +1 -1
- package/dist/core/Siwe.js +21 -1
- package/dist/core/Siwe.js.map +1 -1
- package/dist/core/Transaction.d.ts +29 -4
- package/dist/core/Transaction.d.ts.map +1 -1
- package/dist/core/Transaction.js +25 -4
- package/dist/core/Transaction.js.map +1 -1
- package/dist/core/TransactionReceipt.d.ts +13 -4
- package/dist/core/TransactionReceipt.d.ts.map +1 -1
- package/dist/core/TransactionReceipt.js +14 -0
- package/dist/core/TransactionReceipt.js.map +1 -1
- package/dist/core/TransactionRequest.d.ts +15 -7
- package/dist/core/TransactionRequest.d.ts.map +1 -1
- package/dist/core/TransactionRequest.js +47 -1
- package/dist/core/TransactionRequest.js.map +1 -1
- package/dist/core/TxEnvelope.d.ts +35 -21
- package/dist/core/TxEnvelope.d.ts.map +1 -1
- package/dist/core/TxEnvelope.js +46 -6
- package/dist/core/TxEnvelope.js.map +1 -1
- package/dist/core/TxEnvelopeEip8141.d.ts +341 -0
- package/dist/core/TxEnvelopeEip8141.d.ts.map +1 -0
- package/dist/core/TxEnvelopeEip8141.js +485 -0
- package/dist/core/TxEnvelopeEip8141.js.map +1 -0
- package/dist/core/internal/curves.d.ts +2 -0
- package/dist/core/internal/curves.d.ts.map +1 -1
- package/dist/core/internal/curves.js +2 -0
- package/dist/core/internal/curves.js.map +1 -1
- package/dist/index.d.ts +73 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +73 -0
- package/dist/index.js.map +1 -1
- package/dist/tempo/KeyAuthorization.d.ts +42 -38
- package/dist/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/tempo/KeyAuthorization.js +24 -4
- package/dist/tempo/KeyAuthorization.js.map +1 -1
- package/dist/tempo/MultisigConfig.d.ts +18 -15
- package/dist/tempo/MultisigConfig.d.ts.map +1 -1
- package/dist/tempo/MultisigConfig.js +49 -20
- package/dist/tempo/MultisigConfig.js.map +1 -1
- package/dist/tempo/MultisigOperation.d.ts +3 -2
- package/dist/tempo/MultisigOperation.d.ts.map +1 -1
- package/dist/tempo/MultisigOperation.js +20 -100
- package/dist/tempo/MultisigOperation.js.map +1 -1
- package/dist/tempo/MultisigSimulation.d.ts +2 -49
- package/dist/tempo/MultisigSimulation.d.ts.map +1 -1
- package/dist/tempo/MultisigSimulation.js +18 -46
- package/dist/tempo/MultisigSimulation.js.map +1 -1
- package/dist/tempo/SignatureEnvelope.d.ts +72 -140
- package/dist/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/dist/tempo/SignatureEnvelope.js +130 -181
- package/dist/tempo/SignatureEnvelope.js.map +1 -1
- package/dist/tempo/Transaction.d.ts +2 -0
- package/dist/tempo/Transaction.d.ts.map +1 -1
- package/dist/tempo/TransactionReceipt.d.ts +2 -0
- package/dist/tempo/TransactionReceipt.d.ts.map +1 -1
- package/dist/tempo/TransactionRequest.d.ts +4 -2
- package/dist/tempo/TransactionRequest.d.ts.map +1 -1
- package/dist/tempo/TransactionRequest.js +6 -1
- package/dist/tempo/TransactionRequest.js.map +1 -1
- package/dist/tempo/index.d.ts +3 -1
- package/dist/tempo/index.d.ts.map +1 -1
- package/dist/tempo/index.js +3 -1
- package/dist/tempo/index.js.map +1 -1
- package/dist/zod/Block.d.ts +123 -0
- package/dist/zod/Block.d.ts.map +1 -1
- package/dist/zod/Frame.d.ts +73 -0
- package/dist/zod/Frame.d.ts.map +1 -0
- package/dist/zod/Frame.js +74 -0
- package/dist/zod/Frame.js.map +1 -0
- package/dist/zod/FrameReceipt.d.ts +50 -0
- package/dist/zod/FrameReceipt.d.ts.map +1 -0
- package/dist/zod/FrameReceipt.js +37 -0
- package/dist/zod/FrameReceipt.js.map +1 -0
- package/dist/zod/FrameSignature.d.ts +63 -0
- package/dist/zod/FrameSignature.d.ts.map +1 -0
- package/dist/zod/FrameSignature.js +66 -0
- package/dist/zod/FrameSignature.js.map +1 -0
- package/dist/zod/RpcSchema.d.ts +806 -11
- package/dist/zod/RpcSchema.d.ts.map +1 -1
- package/dist/zod/Transaction.d.ts +252 -0
- package/dist/zod/Transaction.d.ts.map +1 -1
- package/dist/zod/Transaction.js +54 -0
- package/dist/zod/Transaction.js.map +1 -1
- package/dist/zod/TransactionEnvelope.d.ts +233 -4
- package/dist/zod/TransactionEnvelope.d.ts.map +1 -1
- package/dist/zod/TransactionEnvelope.js +9 -0
- package/dist/zod/TransactionEnvelope.js.map +1 -1
- package/dist/zod/TransactionReceipt.d.ts +48 -0
- package/dist/zod/TransactionReceipt.d.ts.map +1 -1
- package/dist/zod/TransactionReceipt.js +8 -3
- package/dist/zod/TransactionReceipt.js.map +1 -1
- package/dist/zod/TransactionRequest.d.ts +50 -2
- package/dist/zod/TransactionRequest.d.ts.map +1 -1
- package/dist/zod/TransactionRequest.js +10 -4
- package/dist/zod/TransactionRequest.js.map +1 -1
- package/dist/zod/TxEnvelopeEip8141.d.ts +166 -0
- package/dist/zod/TxEnvelopeEip8141.d.ts.map +1 -0
- package/dist/zod/TxEnvelopeEip8141.js +76 -0
- package/dist/zod/TxEnvelopeEip8141.js.map +1 -0
- package/dist/zod/internal/Frame.d.ts +4 -0
- package/dist/zod/internal/Frame.d.ts.map +1 -0
- package/dist/zod/internal/Frame.js +17 -0
- package/dist/zod/internal/Frame.js.map +1 -0
- package/dist/zod/internal/rpcSchemas/Eth.d.ts +842 -11
- package/dist/zod/internal/rpcSchemas/Eth.d.ts.map +1 -1
- package/dist/zod/internal/rpcSchemas/Wallet.d.ts +56 -2
- package/dist/zod/internal/rpcSchemas/Wallet.d.ts.map +1 -1
- package/dist/zod/tempo/AuthorizationTempo.d.ts +350 -10
- package/dist/zod/tempo/AuthorizationTempo.d.ts.map +1 -1
- package/dist/zod/tempo/KeyAuthorization.d.ts +242 -422
- package/dist/zod/tempo/KeyAuthorization.d.ts.map +1 -1
- package/dist/zod/tempo/KeyAuthorization.js +29 -31
- package/dist/zod/tempo/KeyAuthorization.js.map +1 -1
- package/dist/zod/tempo/MultisigSimulation.d.ts +8 -76
- package/dist/zod/tempo/MultisigSimulation.d.ts.map +1 -1
- package/dist/zod/tempo/MultisigSimulation.js +3 -37
- package/dist/zod/tempo/MultisigSimulation.js.map +1 -1
- package/dist/zod/tempo/RpcSchemaTempo.d.ts +424 -228
- package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
- package/dist/zod/tempo/SignatureEnvelope.d.ts +105 -3
- package/dist/zod/tempo/SignatureEnvelope.d.ts.map +1 -1
- package/dist/zod/tempo/SignatureEnvelope.js +21 -9
- package/dist/zod/tempo/SignatureEnvelope.js.map +1 -1
- package/dist/zod/tempo/Transaction.d.ts +783 -432
- package/dist/zod/tempo/Transaction.d.ts.map +1 -1
- package/dist/zod/tempo/TransactionRequest.d.ts +590 -473
- package/dist/zod/tempo/TransactionRequest.d.ts.map +1 -1
- package/dist/zod/tempo/TransactionRequest.js +8 -0
- package/dist/zod/tempo/TransactionRequest.js.map +1 -1
- package/dist/zod/tempo/TxEnvelopeTempo.d.ts +327 -213
- package/dist/zod/tempo/TxEnvelopeTempo.d.ts.map +1 -1
- package/dist/zod/tempo/ZoneRpcAuthentication.d.ts +105 -3
- package/dist/zod/tempo/ZoneRpcAuthentication.d.ts.map +1 -1
- package/dist/zod/z.d.ts +4 -0
- package/dist/zod/z.d.ts.map +1 -1
- package/dist/zod/z.js +4 -0
- package/dist/zod/z.js.map +1 -1
- package/package.json +41 -1
- package/src/core/AbiEvent.ts +11 -9
- package/src/core/Blobs.ts +6 -2
- package/src/core/Frame.ts +443 -0
- package/src/core/FrameReceipt.ts +117 -0
- package/src/core/FrameSignature.ts +593 -0
- package/src/core/Signature.ts +41 -11
- package/src/core/Siwe.ts +20 -1
- package/src/core/Transaction.ts +82 -5
- package/src/core/TransactionReceipt.ts +41 -3
- package/src/core/TransactionRequest.ts +71 -4
- package/src/core/TxEnvelope.ts +159 -90
- package/src/core/TxEnvelopeEip8141.ts +715 -0
- package/src/core/_test/AbiEvent.test.ts +45 -0
- package/src/core/_test/Blobs.test.ts +22 -0
- package/src/core/_test/Frame.test-d.ts +96 -0
- package/src/core/_test/Frame.test.ts +267 -0
- package/src/core/_test/FrameReceipt.test.ts +86 -0
- package/src/core/_test/FrameSignature.test-d.ts +93 -0
- package/src/core/_test/FrameSignature.test.ts +554 -0
- package/src/core/_test/Signature.test.ts +166 -0
- package/src/core/_test/Siwe.test.ts +100 -1
- package/src/core/_test/Transaction.test.ts +33 -0
- package/src/core/_test/TransactionEnvelope.test-d.ts +74 -0
- package/src/core/_test/TransactionEnvelope.test.ts +107 -0
- package/src/core/_test/TransactionReceipt.test.ts +59 -0
- package/src/core/_test/TransactionRequest.test-d.ts +50 -0
- package/src/core/_test/TransactionRequest.test.ts +88 -1
- package/src/core/_test/TxEnvelopeEip8141.test-d.ts +44 -0
- package/src/core/_test/TxEnvelopeEip8141.test.ts +1775 -0
- package/src/core/_test/curves.test.ts +6 -1
- package/src/core/_test/index.test.ts +4 -0
- package/src/core/internal/curves.ts +4 -0
- package/src/index.ts +77 -0
- package/src/tempo/AuthorizationTempo.test.ts +8 -4
- package/src/tempo/KeyAuthorization.test-d.ts +16 -63
- package/src/tempo/KeyAuthorization.test.ts +69 -11
- package/src/tempo/KeyAuthorization.ts +107 -63
- package/src/tempo/MultisigConfig.test.ts +44 -20
- package/src/tempo/MultisigConfig.ts +65 -23
- package/src/tempo/MultisigOperation.test.ts +79 -550
- package/src/tempo/MultisigOperation.ts +31 -146
- package/src/tempo/MultisigSimulation.test-d.ts +2 -2
- package/src/tempo/MultisigSimulation.test.ts +21 -110
- package/src/tempo/MultisigSimulation.ts +25 -99
- package/src/tempo/SignatureEnvelope.test-d.ts +29 -47
- package/src/tempo/SignatureEnvelope.test.ts +328 -541
- package/src/tempo/SignatureEnvelope.ts +196 -291
- package/src/tempo/Transaction.test.ts +4 -4
- package/src/tempo/TransactionRequest.test.ts +17 -80
- package/src/tempo/TransactionRequest.ts +19 -2
- package/src/tempo/index.ts +3 -1
- package/src/tempo/multisig.e2e.test.ts +321 -860
- package/src/version.ts +1 -1
- package/src/zod/Frame.ts +82 -0
- package/src/zod/FrameReceipt.ts +48 -0
- package/src/zod/FrameSignature.ts +78 -0
- package/src/zod/Transaction.ts +63 -0
- package/src/zod/TransactionEnvelope.ts +33 -0
- package/src/zod/TransactionReceipt.ts +14 -3
- package/src/zod/TransactionRequest.ts +18 -3
- package/src/zod/TxEnvelopeEip8141.ts +102 -0
- package/src/zod/_test/Frame.test-d.ts +41 -0
- package/src/zod/_test/Frame.test.ts +54 -0
- package/src/zod/_test/FrameReceipt.test.ts +75 -0
- package/src/zod/_test/FrameSignature.test.ts +94 -0
- package/src/zod/_test/TxEnvelopeEip8141.test.ts +116 -0
- package/src/zod/internal/Frame.ts +26 -0
- package/src/zod/tempo/KeyAuthorization.ts +50 -39
- package/src/zod/tempo/MultisigSimulation.ts +3 -48
- package/src/zod/tempo/SignatureEnvelope.ts +46 -35
- package/src/zod/tempo/TransactionRequest.ts +14 -0
- package/src/zod/tempo/_test/KeyAuthorization.test.ts +69 -20
- package/src/zod/tempo/_test/MultisigSimulation.test.ts +6 -31
- package/src/zod/tempo/_test/SignatureEnvelope.test.ts +118 -85
- package/src/zod/tempo/_test/TransactionRequest.test.ts +9 -19
- package/src/zod/z.ts +4 -0
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import * as Address from './Address.js';
|
|
2
|
+
import * as Errors from './Errors.js';
|
|
3
|
+
import * as Frame from './Frame.js';
|
|
4
|
+
import * as FrameSignature from './FrameSignature.js';
|
|
5
|
+
import * as Hash from './Hash.js';
|
|
6
|
+
import * as Hex from './Hex.js';
|
|
7
|
+
import type { Assign, Compute, PartialBy } from './internal/types.js';
|
|
8
|
+
import * as Rlp from './Rlp.js';
|
|
9
|
+
import type * as TxEnvelopeEip4844 from './TxEnvelopeEip4844.js';
|
|
10
|
+
/** An EIP-8141 transaction containing independently budgeted call frames. */
|
|
11
|
+
export type TxEnvelopeEip8141 = {
|
|
12
|
+
/** Versioned blob hashes. @default [] */
|
|
13
|
+
blobVersionedHashes?: readonly Hex.Hex[] | undefined;
|
|
14
|
+
/** Chain ID. Use bigint for IDs beyond the safe integer range. */
|
|
15
|
+
chainId: number | bigint;
|
|
16
|
+
/** Frames to execute, in order. */
|
|
17
|
+
frames: readonly Frame.Frame[];
|
|
18
|
+
/** Maximum fee per blob gas, in wei. @default 0n */
|
|
19
|
+
maxFeePerBlobGas?: bigint | undefined;
|
|
20
|
+
/** Maximum fee per gas, in wei. @default 0n */
|
|
21
|
+
maxFeePerGas?: bigint | undefined;
|
|
22
|
+
/** Maximum priority fee per gas, in wei. @default 0n */
|
|
23
|
+
maxPriorityFeePerGas?: bigint | undefined;
|
|
24
|
+
/** Sender nonce. @default 0n */
|
|
25
|
+
nonce?: bigint | undefined;
|
|
26
|
+
/** Account authorizing execution. */
|
|
27
|
+
sender: Address.Address;
|
|
28
|
+
/** PeerDAS sidecars. Excluded from transaction and signing hashes. */
|
|
29
|
+
sidecars?: TxEnvelopeEip4844.Sidecars<Hex.Hex> | undefined;
|
|
30
|
+
/** Signature entries, including unsigned placeholders before signing. @default [] */
|
|
31
|
+
signatures?: readonly FrameSignature.FrameSignature[] | undefined;
|
|
32
|
+
/** Transaction type. */
|
|
33
|
+
type: Type;
|
|
34
|
+
};
|
|
35
|
+
/** JSON-RPC representation of an EIP-8141 envelope. */
|
|
36
|
+
export type Rpc = {
|
|
37
|
+
/** Versioned blob hashes. */
|
|
38
|
+
blobVersionedHashes: readonly Hex.Hex[];
|
|
39
|
+
/** Chain ID. */
|
|
40
|
+
chainId: Hex.Hex;
|
|
41
|
+
/** Frames in execution order. */
|
|
42
|
+
frames: readonly Frame.Rpc[];
|
|
43
|
+
/** Account authorizing execution. */
|
|
44
|
+
from: Address.Address;
|
|
45
|
+
/** Maximum fee per blob gas. */
|
|
46
|
+
maxFeePerBlobGas: Hex.Hex;
|
|
47
|
+
/** Maximum fee per gas. */
|
|
48
|
+
maxFeePerGas: Hex.Hex;
|
|
49
|
+
/** Maximum priority fee per gas. */
|
|
50
|
+
maxPriorityFeePerGas: Hex.Hex;
|
|
51
|
+
/** Sender nonce. */
|
|
52
|
+
nonce: Hex.Hex;
|
|
53
|
+
/** Frame signature entries. */
|
|
54
|
+
signatures: readonly FrameSignature.Rpc[];
|
|
55
|
+
/** RPC transaction type. */
|
|
56
|
+
type: '0x6';
|
|
57
|
+
};
|
|
58
|
+
/** Serialized EIP-8141 transaction envelope. */
|
|
59
|
+
export type Serialized = `${SerializedType}${string}`;
|
|
60
|
+
/** Serialized EIP-8141 transaction type prefix. */
|
|
61
|
+
export declare const serializedType: "0x06";
|
|
62
|
+
/** Serialized EIP-8141 transaction type. */
|
|
63
|
+
export type SerializedType = typeof serializedType;
|
|
64
|
+
/** EIP-8141 transaction type. */
|
|
65
|
+
export declare const type: "eip8141";
|
|
66
|
+
/** EIP-8141 transaction type identifier. */
|
|
67
|
+
export type Type = typeof type;
|
|
68
|
+
/**
|
|
69
|
+
* Asserts that an EIP-8141 envelope satisfies structural transaction constraints.
|
|
70
|
+
*
|
|
71
|
+
* Accepts unsigned signature entries for construction. Does not verify signatures,
|
|
72
|
+
* account authorization, balances, or blob proofs.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ### Basic Usage
|
|
76
|
+
*
|
|
77
|
+
* ```ts twoslash
|
|
78
|
+
* import { TxEnvelopeEip8141 } from 'ox'
|
|
79
|
+
*
|
|
80
|
+
* TxEnvelopeEip8141.assert({
|
|
81
|
+
* chainId: 1,
|
|
82
|
+
* frames: [{ gas: 50_000n, mode: 'verify' }],
|
|
83
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
84
|
+
* })
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @param envelope - The transaction envelope to assert.
|
|
88
|
+
*/
|
|
89
|
+
export declare function assert(envelope: PartialBy<TxEnvelopeEip8141, 'type'>): void;
|
|
90
|
+
export declare namespace assert {
|
|
91
|
+
type ErrorType = InvalidError | Frame.assert.ErrorType | FrameSignature.toTuple.ErrorType | Address.assert.ErrorType | Errors.GlobalErrorType;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Deserializes an EIP-8141 transaction body or PeerDAS network wrapper.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ### Basic Usage
|
|
98
|
+
*
|
|
99
|
+
* ```ts twoslash
|
|
100
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
101
|
+
*
|
|
102
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
103
|
+
* chainId: 1,
|
|
104
|
+
* frames: [Frame.from({})],
|
|
105
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
106
|
+
* })
|
|
107
|
+
*
|
|
108
|
+
* const serialized = TxEnvelopeEip8141.serialize(envelope)
|
|
109
|
+
* const decoded = TxEnvelopeEip8141.deserialize(serialized)
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @param serialized - Serialized transaction or network wrapper.
|
|
113
|
+
* @returns The transaction envelope.
|
|
114
|
+
*/
|
|
115
|
+
export declare function deserialize(serialized: Serialized): TxEnvelopeEip8141;
|
|
116
|
+
export declare namespace deserialize {
|
|
117
|
+
type ErrorType = assert.ErrorType | Hex.slice.ErrorType | Rlp.toHex.ErrorType | serialize.ErrorType | Errors.GlobalErrorType;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Creates an EIP-8141 transaction envelope from an object or serialized transaction.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ### Basic Usage
|
|
124
|
+
*
|
|
125
|
+
* ```ts twoslash
|
|
126
|
+
* import { TxEnvelopeEip8141 } from 'ox'
|
|
127
|
+
*
|
|
128
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
129
|
+
* chainId: 1,
|
|
130
|
+
* frames: [
|
|
131
|
+
* {
|
|
132
|
+
* flags: 'approveExecutionAndPayment',
|
|
133
|
+
* gas: 50_000n,
|
|
134
|
+
* mode: 'verify'
|
|
135
|
+
* }
|
|
136
|
+
* ],
|
|
137
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
138
|
+
* })
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @param envelope - An envelope object or serialized transaction.
|
|
142
|
+
* @returns The envelope with its transaction type.
|
|
143
|
+
*/
|
|
144
|
+
export declare function from<const envelope extends PartialBy<TxEnvelopeEip8141, 'type'> | Serialized>(envelope: envelope): from.ReturnType<envelope>;
|
|
145
|
+
export declare namespace from {
|
|
146
|
+
type ReturnType<envelope extends PartialBy<TxEnvelopeEip8141, 'type'> | Serialized> = envelope extends Serialized ? TxEnvelopeEip8141 : Compute<Assign<envelope, {
|
|
147
|
+
readonly type: Type;
|
|
148
|
+
}>>;
|
|
149
|
+
type ErrorType = assert.ErrorType | deserialize.ErrorType | Errors.GlobalErrorType;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Converts an RPC envelope to an EIP-8141 envelope without losing chain ID precision.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ### Basic Usage
|
|
156
|
+
*
|
|
157
|
+
* ```ts twoslash
|
|
158
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
159
|
+
*
|
|
160
|
+
* const rpc = TxEnvelopeEip8141.toRpc(
|
|
161
|
+
* TxEnvelopeEip8141.from({
|
|
162
|
+
* chainId: 1,
|
|
163
|
+
* frames: [Frame.from({})],
|
|
164
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
165
|
+
* })
|
|
166
|
+
* )
|
|
167
|
+
* const envelope = TxEnvelopeEip8141.fromRpc(rpc)
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @param envelope - The value to convert.
|
|
171
|
+
* @returns The converted value.
|
|
172
|
+
*/
|
|
173
|
+
export declare function fromRpc(envelope: Rpc): TxEnvelopeEip8141;
|
|
174
|
+
export declare namespace fromRpc {
|
|
175
|
+
type ErrorType = from.ErrorType | Frame.fromRpc.ErrorType | FrameSignature.fromRpc.ErrorType | Hex.toBigInt.ErrorType;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Converts an EIP-8141 envelope to RPC fields. Sidecars are excluded.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ### Basic Usage
|
|
182
|
+
*
|
|
183
|
+
* ```ts twoslash
|
|
184
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
185
|
+
*
|
|
186
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
187
|
+
* chainId: 1,
|
|
188
|
+
* frames: [Frame.from({})],
|
|
189
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
190
|
+
* })
|
|
191
|
+
* const rpc = TxEnvelopeEip8141.toRpc(envelope)
|
|
192
|
+
* ```
|
|
193
|
+
*
|
|
194
|
+
* @param envelope - The value to convert.
|
|
195
|
+
* @returns The converted value.
|
|
196
|
+
*/
|
|
197
|
+
export declare function toRpc(envelope: toRpc.Input): Rpc;
|
|
198
|
+
export declare namespace toRpc {
|
|
199
|
+
type Input = Omit<TxEnvelopeEip8141, 'chainId' | 'frames' | 'maxFeePerBlobGas' | 'maxFeePerGas' | 'maxPriorityFeePerGas' | 'nonce' | 'type'> & {
|
|
200
|
+
chainId: Hex.Hex | bigint | number;
|
|
201
|
+
frames: readonly Frame.toRpc.Input[];
|
|
202
|
+
maxFeePerBlobGas?: Hex.Hex | bigint | number | undefined;
|
|
203
|
+
maxFeePerGas?: Hex.Hex | bigint | number | undefined;
|
|
204
|
+
maxPriorityFeePerGas?: Hex.Hex | bigint | number | undefined;
|
|
205
|
+
nonce?: Hex.Hex | bigint | number | undefined;
|
|
206
|
+
type?: Type | undefined;
|
|
207
|
+
};
|
|
208
|
+
type ErrorType = Frame.toRpc.ErrorType | FrameSignature.toRpc.ErrorType | Hex.fromNumber.ErrorType;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Returns the canonical signing payload of an EIP-8141 envelope.
|
|
212
|
+
*
|
|
213
|
+
* Elides signature bytes only for entries with an empty payload. Explicit-payload
|
|
214
|
+
* signatures remain committed. The envelope is not mutated.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ### Signing
|
|
218
|
+
*
|
|
219
|
+
* ```ts twoslash
|
|
220
|
+
* import {
|
|
221
|
+
* Address,
|
|
222
|
+
* FrameSignature,
|
|
223
|
+
* Secp256k1,
|
|
224
|
+
* TxEnvelopeEip8141
|
|
225
|
+
* } from 'ox'
|
|
226
|
+
*
|
|
227
|
+
* const privateKey = Secp256k1.randomPrivateKey()
|
|
228
|
+
* const sender = Address.fromPublicKey(
|
|
229
|
+
* Secp256k1.getPublicKey({ privateKey })
|
|
230
|
+
* )
|
|
231
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
232
|
+
* chainId: 1,
|
|
233
|
+
* frames: [
|
|
234
|
+
* {
|
|
235
|
+
* flags: 'approveExecutionAndPayment',
|
|
236
|
+
* gas: 50_000n,
|
|
237
|
+
* mode: 'verify'
|
|
238
|
+
* }
|
|
239
|
+
* ],
|
|
240
|
+
* sender,
|
|
241
|
+
* signatures: [FrameSignature.from({ scheme: 'secp256k1' })]
|
|
242
|
+
* })
|
|
243
|
+
*
|
|
244
|
+
* const payload = TxEnvelopeEip8141.getSignPayload(envelope)
|
|
245
|
+
* const signature = Secp256k1.sign({ payload, privateKey })
|
|
246
|
+
* const signed = TxEnvelopeEip8141.from({
|
|
247
|
+
* ...envelope,
|
|
248
|
+
* signatures: [
|
|
249
|
+
* FrameSignature.from({ scheme: 'secp256k1', signature })
|
|
250
|
+
* ]
|
|
251
|
+
* })
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* @param envelope - The transaction envelope to sign.
|
|
255
|
+
* @returns The canonical signing digest.
|
|
256
|
+
*/
|
|
257
|
+
export declare function getSignPayload(envelope: PartialBy<TxEnvelopeEip8141, 'type'>): Hex.Hex;
|
|
258
|
+
export declare namespace getSignPayload {
|
|
259
|
+
type ErrorType = hash.ErrorType;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Hashes an EIP-8141 transaction, excluding its blob sidecars.
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ### Basic Usage
|
|
266
|
+
*
|
|
267
|
+
* ```ts twoslash
|
|
268
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
269
|
+
*
|
|
270
|
+
* const hash = TxEnvelopeEip8141.hash({
|
|
271
|
+
* chainId: 1,
|
|
272
|
+
* frames: [Frame.from({})],
|
|
273
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
274
|
+
* })
|
|
275
|
+
* ```
|
|
276
|
+
*
|
|
277
|
+
* @param envelope - The transaction envelope to hash.
|
|
278
|
+
* @param options - Hashing options.
|
|
279
|
+
* @returns The transaction hash or signing digest.
|
|
280
|
+
*/
|
|
281
|
+
export declare function hash(envelope: PartialBy<TxEnvelopeEip8141, 'type'>, options?: hash.Options): Hex.Hex;
|
|
282
|
+
export declare namespace hash {
|
|
283
|
+
type Options = {
|
|
284
|
+
/** Whether to compute the canonical signing digest. @default false */
|
|
285
|
+
presign?: boolean | undefined;
|
|
286
|
+
};
|
|
287
|
+
type ErrorType = assert.ErrorType | Hash.keccak256.ErrorType | Rlp.fromHex.ErrorType | Errors.GlobalErrorType;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Serializes an EIP-8141 envelope, including a PeerDAS wrapper when sidecars exist.
|
|
291
|
+
*
|
|
292
|
+
* @example
|
|
293
|
+
* ### Basic Usage
|
|
294
|
+
*
|
|
295
|
+
* ```ts twoslash
|
|
296
|
+
* import { TxEnvelopeEip8141 } from 'ox'
|
|
297
|
+
*
|
|
298
|
+
* const envelope = TxEnvelopeEip8141.from({
|
|
299
|
+
* chainId: 1,
|
|
300
|
+
* frames: [{ gas: 50_000n, mode: 'sender' }],
|
|
301
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
302
|
+
* })
|
|
303
|
+
* const serialized = TxEnvelopeEip8141.serialize(envelope)
|
|
304
|
+
* ```
|
|
305
|
+
*
|
|
306
|
+
* @param envelope - The transaction envelope to serialize.
|
|
307
|
+
* @returns The serialized transaction.
|
|
308
|
+
*/
|
|
309
|
+
export declare function serialize(envelope: PartialBy<TxEnvelopeEip8141, 'type'>): Serialized;
|
|
310
|
+
export declare namespace serialize {
|
|
311
|
+
type ErrorType = assert.ErrorType | Rlp.fromHex.ErrorType | Hex.concat.ErrorType | Errors.GlobalErrorType;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Returns whether an EIP-8141 envelope satisfies structural constraints.
|
|
315
|
+
*
|
|
316
|
+
* @example
|
|
317
|
+
* ### Basic Usage
|
|
318
|
+
*
|
|
319
|
+
* ```ts twoslash
|
|
320
|
+
* import { Frame, TxEnvelopeEip8141 } from 'ox'
|
|
321
|
+
*
|
|
322
|
+
* const valid = TxEnvelopeEip8141.validate({
|
|
323
|
+
* chainId: 1,
|
|
324
|
+
* frames: [Frame.from({})],
|
|
325
|
+
* sender: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8'
|
|
326
|
+
* })
|
|
327
|
+
* ```
|
|
328
|
+
*
|
|
329
|
+
* @param envelope - The transaction envelope to validate.
|
|
330
|
+
* @returns Whether the envelope is structurally valid.
|
|
331
|
+
*/
|
|
332
|
+
export declare function validate(envelope: PartialBy<TxEnvelopeEip8141, 'type'>): boolean;
|
|
333
|
+
export declare namespace validate {
|
|
334
|
+
type ErrorType = Errors.GlobalErrorType;
|
|
335
|
+
}
|
|
336
|
+
/** Thrown when an EIP-8141 envelope is structurally invalid. */
|
|
337
|
+
export declare class InvalidError extends Errors.BaseError {
|
|
338
|
+
readonly name = "TxEnvelopeEip8141.InvalidError";
|
|
339
|
+
constructor(reason: string);
|
|
340
|
+
}
|
|
341
|
+
//# sourceMappingURL=TxEnvelopeEip8141.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TxEnvelopeEip8141.d.ts","sourceRoot":"","sources":["../../src/core/TxEnvelopeEip8141.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B,OAAO,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,KAAK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