ox 1.7.5 → 1.8.1

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.
Files changed (139) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/core/Frame.d.ts +290 -0
  3. package/dist/core/Frame.d.ts.map +1 -0
  4. package/dist/core/Frame.js +306 -0
  5. package/dist/core/Frame.js.map +1 -0
  6. package/dist/core/FrameReceipt.d.ts +92 -0
  7. package/dist/core/FrameReceipt.d.ts.map +1 -0
  8. package/dist/core/FrameReceipt.js +72 -0
  9. package/dist/core/FrameReceipt.js.map +1 -0
  10. package/dist/core/FrameSignature.d.ts +357 -0
  11. package/dist/core/FrameSignature.d.ts.map +1 -0
  12. package/dist/core/FrameSignature.js +411 -0
  13. package/dist/core/FrameSignature.js.map +1 -0
  14. package/dist/core/Transaction.d.ts +29 -4
  15. package/dist/core/Transaction.d.ts.map +1 -1
  16. package/dist/core/Transaction.js +25 -4
  17. package/dist/core/Transaction.js.map +1 -1
  18. package/dist/core/TransactionReceipt.d.ts +13 -4
  19. package/dist/core/TransactionReceipt.d.ts.map +1 -1
  20. package/dist/core/TransactionReceipt.js +14 -0
  21. package/dist/core/TransactionReceipt.js.map +1 -1
  22. package/dist/core/TransactionRequest.d.ts +15 -7
  23. package/dist/core/TransactionRequest.d.ts.map +1 -1
  24. package/dist/core/TransactionRequest.js +47 -1
  25. package/dist/core/TransactionRequest.js.map +1 -1
  26. package/dist/core/TxEnvelope.d.ts +35 -21
  27. package/dist/core/TxEnvelope.d.ts.map +1 -1
  28. package/dist/core/TxEnvelope.js +46 -6
  29. package/dist/core/TxEnvelope.js.map +1 -1
  30. package/dist/core/TxEnvelopeEip8141.d.ts +341 -0
  31. package/dist/core/TxEnvelopeEip8141.d.ts.map +1 -0
  32. package/dist/core/TxEnvelopeEip8141.js +484 -0
  33. package/dist/core/TxEnvelopeEip8141.js.map +1 -0
  34. package/dist/core/internal/curves.d.ts +2 -0
  35. package/dist/core/internal/curves.d.ts.map +1 -1
  36. package/dist/core/internal/curves.js +2 -0
  37. package/dist/core/internal/curves.js.map +1 -1
  38. package/dist/index.d.ts +73 -0
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +73 -0
  41. package/dist/index.js.map +1 -1
  42. package/dist/tempo/Transaction.d.ts +2 -0
  43. package/dist/tempo/Transaction.d.ts.map +1 -1
  44. package/dist/tempo/TransactionReceipt.d.ts +2 -0
  45. package/dist/tempo/TransactionReceipt.d.ts.map +1 -1
  46. package/dist/zod/Block.d.ts +123 -0
  47. package/dist/zod/Block.d.ts.map +1 -1
  48. package/dist/zod/Frame.d.ts +73 -0
  49. package/dist/zod/Frame.d.ts.map +1 -0
  50. package/dist/zod/Frame.js +74 -0
  51. package/dist/zod/Frame.js.map +1 -0
  52. package/dist/zod/FrameReceipt.d.ts +50 -0
  53. package/dist/zod/FrameReceipt.d.ts.map +1 -0
  54. package/dist/zod/FrameReceipt.js +37 -0
  55. package/dist/zod/FrameReceipt.js.map +1 -0
  56. package/dist/zod/FrameSignature.d.ts +63 -0
  57. package/dist/zod/FrameSignature.d.ts.map +1 -0
  58. package/dist/zod/FrameSignature.js +66 -0
  59. package/dist/zod/FrameSignature.js.map +1 -0
  60. package/dist/zod/RpcSchema.d.ts +806 -11
  61. package/dist/zod/RpcSchema.d.ts.map +1 -1
  62. package/dist/zod/Transaction.d.ts +252 -0
  63. package/dist/zod/Transaction.d.ts.map +1 -1
  64. package/dist/zod/Transaction.js +54 -0
  65. package/dist/zod/Transaction.js.map +1 -1
  66. package/dist/zod/TransactionEnvelope.d.ts +233 -4
  67. package/dist/zod/TransactionEnvelope.d.ts.map +1 -1
  68. package/dist/zod/TransactionEnvelope.js +9 -0
  69. package/dist/zod/TransactionEnvelope.js.map +1 -1
  70. package/dist/zod/TransactionReceipt.d.ts +48 -0
  71. package/dist/zod/TransactionReceipt.d.ts.map +1 -1
  72. package/dist/zod/TransactionReceipt.js +8 -3
  73. package/dist/zod/TransactionReceipt.js.map +1 -1
  74. package/dist/zod/TransactionRequest.d.ts +50 -2
  75. package/dist/zod/TransactionRequest.d.ts.map +1 -1
  76. package/dist/zod/TransactionRequest.js +10 -4
  77. package/dist/zod/TransactionRequest.js.map +1 -1
  78. package/dist/zod/TxEnvelopeEip8141.d.ts +166 -0
  79. package/dist/zod/TxEnvelopeEip8141.d.ts.map +1 -0
  80. package/dist/zod/TxEnvelopeEip8141.js +76 -0
  81. package/dist/zod/TxEnvelopeEip8141.js.map +1 -0
  82. package/dist/zod/internal/Frame.d.ts +4 -0
  83. package/dist/zod/internal/Frame.d.ts.map +1 -0
  84. package/dist/zod/internal/Frame.js +17 -0
  85. package/dist/zod/internal/Frame.js.map +1 -0
  86. package/dist/zod/internal/rpcSchemas/Eth.d.ts +842 -11
  87. package/dist/zod/internal/rpcSchemas/Eth.d.ts.map +1 -1
  88. package/dist/zod/internal/rpcSchemas/Wallet.d.ts +56 -2
  89. package/dist/zod/internal/rpcSchemas/Wallet.d.ts.map +1 -1
  90. package/dist/zod/tempo/RpcSchemaTempo.d.ts +140 -0
  91. package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
  92. package/dist/zod/tempo/Transaction.d.ts +123 -0
  93. package/dist/zod/tempo/Transaction.d.ts.map +1 -1
  94. package/dist/zod/z.d.ts +4 -0
  95. package/dist/zod/z.d.ts.map +1 -1
  96. package/dist/zod/z.js +4 -0
  97. package/dist/zod/z.js.map +1 -1
  98. package/package.json +41 -1
  99. package/src/core/Frame.ts +442 -0
  100. package/src/core/FrameReceipt.ts +117 -0
  101. package/src/core/FrameSignature.ts +593 -0
  102. package/src/core/Transaction.ts +82 -5
  103. package/src/core/TransactionReceipt.ts +41 -3
  104. package/src/core/TransactionRequest.ts +71 -4
  105. package/src/core/TxEnvelope.ts +159 -90
  106. package/src/core/TxEnvelopeEip8141.ts +714 -0
  107. package/src/core/_test/Frame.test-d.ts +108 -0
  108. package/src/core/_test/Frame.test.ts +280 -0
  109. package/src/core/_test/FrameReceipt.test.ts +86 -0
  110. package/src/core/_test/FrameSignature.test-d.ts +93 -0
  111. package/src/core/_test/FrameSignature.test.ts +554 -0
  112. package/src/core/_test/Transaction.test.ts +33 -0
  113. package/src/core/_test/TransactionEnvelope.test-d.ts +74 -0
  114. package/src/core/_test/TransactionEnvelope.test.ts +107 -0
  115. package/src/core/_test/TransactionReceipt.test.ts +59 -0
  116. package/src/core/_test/TransactionRequest.test-d.ts +50 -0
  117. package/src/core/_test/TransactionRequest.test.ts +88 -1
  118. package/src/core/_test/TxEnvelopeEip8141.test-d.ts +44 -0
  119. package/src/core/_test/TxEnvelopeEip8141.test.ts +1775 -0
  120. package/src/core/_test/curves.test.ts +6 -1
  121. package/src/core/_test/index.test.ts +4 -0
  122. package/src/core/internal/curves.ts +4 -0
  123. package/src/index.ts +77 -0
  124. package/src/version.ts +1 -1
  125. package/src/zod/Frame.ts +82 -0
  126. package/src/zod/FrameReceipt.ts +48 -0
  127. package/src/zod/FrameSignature.ts +78 -0
  128. package/src/zod/Transaction.ts +63 -0
  129. package/src/zod/TransactionEnvelope.ts +33 -0
  130. package/src/zod/TransactionReceipt.ts +14 -3
  131. package/src/zod/TransactionRequest.ts +18 -3
  132. package/src/zod/TxEnvelopeEip8141.ts +102 -0
  133. package/src/zod/_test/Frame.test-d.ts +41 -0
  134. package/src/zod/_test/Frame.test.ts +57 -0
  135. package/src/zod/_test/FrameReceipt.test.ts +75 -0
  136. package/src/zod/_test/FrameSignature.test.ts +94 -0
  137. package/src/zod/_test/TxEnvelopeEip8141.test.ts +116 -0
  138. package/src/zod/internal/Frame.ts +26 -0
  139. package/src/zod/z.ts +4 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # ox
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#462](https://github.com/wevm/ox/pull/462) [`16c3378`](https://github.com/wevm/ox/commit/16c33788e1b82a66222ff437f4e1814bda092a47) Thanks [@jxom](https://github.com/jxom)! - Renamed the decoded frame destination from `target` to `to`.
8
+
9
+ ```ts
10
+ Frame.from({ to: recipient });
11
+ ```
12
+
13
+ ## 1.8.0
14
+
15
+ ### Minor Changes
16
+
17
+ - [#457](https://github.com/wevm/ox/pull/457) [`bcda555`](https://github.com/wevm/ox/commit/bcda5558e8dd601425b3ddbf469a892c8bae3248) Thanks [@jxom](https://github.com/jxom)! - Added Frame Transactions
18
+
3
19
  ## 1.7.5
4
20
 
5
21
  ### Patch Changes
@@ -0,0 +1,290 @@
1
+ import * as Address from './Address.js';
2
+ import * as Bytes from './Bytes.js';
3
+ import * as Errors from './Errors.js';
4
+ import * as Hex from './Hex.js';
5
+ /** An EIP-8141 call frame. */
6
+ export type Frame<bigintType = bigint> = {
7
+ /**
8
+ * Frame calldata.
9
+ * @default '0x'
10
+ */
11
+ data?: Hex.Hex | undefined;
12
+ /**
13
+ * Approval scope and atomic batching bits.
14
+ * @default 0
15
+ */
16
+ flags?: Flags | undefined;
17
+ /**
18
+ * Execution gas budget.
19
+ * @default 0n
20
+ */
21
+ gas?: bigintType | undefined;
22
+ /**
23
+ * Execution context: default, verify, or sender.
24
+ * @default 0
25
+ */
26
+ mode?: Mode | undefined;
27
+ /**
28
+ * State gas budget.
29
+ * @default 0n
30
+ */
31
+ stateGas?: bigintType | undefined;
32
+ /** Target address. Omit to target the transaction sender. */
33
+ to?: Address.Address | undefined;
34
+ /**
35
+ * Value transferred by a sender frame, in wei.
36
+ * @default 0n
37
+ */
38
+ value?: bigintType | undefined;
39
+ };
40
+ /** JSON-RPC representation of a frame. */
41
+ export type Rpc = {
42
+ /** Frame calldata. */
43
+ data: Hex.Hex;
44
+ /** Execution gas budget. */
45
+ executionGasLimit: Hex.Hex;
46
+ /** Approval scope and batching bits. */
47
+ flags: number;
48
+ /** Execution mode. */
49
+ mode: number;
50
+ /** State gas budget. */
51
+ stateGasLimit: Hex.Hex;
52
+ /** Target address; absent for the transaction sender. */
53
+ target?: Address.Address | null | undefined;
54
+ /** Value transferred in wei. */
55
+ value: Hex.Hex;
56
+ };
57
+ /** Frame execution modes. */
58
+ export declare const modes: {
59
+ readonly default: 0;
60
+ readonly sender: 2;
61
+ readonly verify: 1;
62
+ };
63
+ /** A numeric or named frame execution mode. */
64
+ export type Mode = number | keyof typeof modes;
65
+ /** Approval and atomic batching flags. */
66
+ export declare const flags: {
67
+ readonly approveExecution: 2;
68
+ readonly approveExecutionAndPayment: 3;
69
+ readonly approvePayment: 1;
70
+ readonly atomicBatch: 4;
71
+ readonly none: 0;
72
+ };
73
+ /** Numeric approval and batching bits, or a named flag value. */
74
+ export type Flags = number | keyof typeof flags;
75
+ /** RLP-ready frame tuple. Empty target bytes refer to the transaction sender. */
76
+ export type Tuple = readonly [
77
+ mode: Hex.Hex,
78
+ flags: Hex.Hex,
79
+ target: Hex.Hex,
80
+ limits: readonly [execution: Hex.Hex, state: Hex.Hex],
81
+ value: Hex.Hex,
82
+ data: Hex.Hex
83
+ ];
84
+ /**
85
+ * Asserts that a {@link ox#Frame.Frame} satisfies frame-local constraints.
86
+ *
87
+ * Sender-dependent approval, batch adjacency, expiry, and transaction-wide gas
88
+ * constraints require the enclosing transaction.
89
+ *
90
+ * @example
91
+ * ### Basic Usage
92
+ *
93
+ * Check a verification frame before including it in a transaction.
94
+ *
95
+ * ```ts twoslash
96
+ * import { Frame } from 'ox'
97
+ *
98
+ * Frame.assert({
99
+ * flags: 'approveExecutionAndPayment',
100
+ * gas: 50_000n,
101
+ * mode: 'verify'
102
+ * })
103
+ * ```
104
+ *
105
+ * @param frame - The frame to assert.
106
+ */
107
+ export declare function assert(frame: Frame): void;
108
+ export declare namespace assert {
109
+ type ErrorType = InvalidError | Address.assert.ErrorType | Hex.assert.ErrorType | Errors.GlobalErrorType;
110
+ }
111
+ /**
112
+ * Coerces a frame object into a {@link ox#Frame.Frame}.
113
+ *
114
+ * Validates the frame and returns a copy, preserving literal types and the supplied
115
+ * numeric or named mode and flags. Omitted fields stay omitted;
116
+ * {@link ox#Frame.(toTuple:function)} supplies their defaults when encoding.
117
+ *
118
+ * @example
119
+ * ### Basic Usage
120
+ *
121
+ * Construct a verification frame that approves execution and payment.
122
+ *
123
+ * ```ts twoslash
124
+ * import { Frame } from 'ox'
125
+ *
126
+ * const frame = Frame.from({
127
+ * flags: 'approveExecutionAndPayment',
128
+ * gas: 50_000n,
129
+ * mode: 'verify'
130
+ * })
131
+ * ```
132
+ *
133
+ * @param frame - The frame object to convert.
134
+ * @returns The validated frame.
135
+ */
136
+ export declare function from<const frame extends Frame>(frame: frame | Frame): frame;
137
+ export declare namespace from {
138
+ type ErrorType = assert.ErrorType;
139
+ }
140
+ /**
141
+ * Converts an RPC frame to a frame.
142
+ *
143
+ * @example
144
+ * ### Basic Usage
145
+ *
146
+ * ```ts twoslash
147
+ * import { Frame } from 'ox'
148
+ *
149
+ * const frame = Frame.fromRpc({
150
+ * data: '0x',
151
+ * executionGasLimit: '0xc350',
152
+ * flags: 3,
153
+ * mode: 1,
154
+ * stateGasLimit: '0x0',
155
+ * value: '0x0'
156
+ * })
157
+ * ```
158
+ *
159
+ * @param frame - The value to convert.
160
+ * @returns The converted value.
161
+ */
162
+ export declare function fromRpc(frame: Rpc): Frame;
163
+ export declare namespace fromRpc {
164
+ type ErrorType = from.ErrorType | Hex.toBigInt.ErrorType;
165
+ }
166
+ /**
167
+ * Converts a frame to its JSON-RPC representation.
168
+ *
169
+ * @example
170
+ * ### Basic Usage
171
+ *
172
+ * ```ts twoslash
173
+ * import { Frame } from 'ox'
174
+ *
175
+ * const frame = Frame.from({ gas: 50_000n, mode: 'verify' })
176
+ * const rpc = Frame.toRpc(frame)
177
+ * ```
178
+ *
179
+ * @param frame - The value to convert.
180
+ * @returns The converted value.
181
+ */
182
+ export declare function toRpc(frame: toRpc.Input): Rpc;
183
+ export declare namespace toRpc {
184
+ type Input = Frame<Hex.Hex | bigint | number>;
185
+ type ErrorType = Hex.fromNumber.ErrorType | Errors.GlobalErrorType;
186
+ }
187
+ /**
188
+ * Converts a {@link ox#Frame.Tuple} to a {@link ox#Frame.Frame}.
189
+ *
190
+ * Returns numeric mode and flags. An empty target becomes an omitted `to`.
191
+ * Integer fields must use minimal whole-byte encodings, with empty bytes for zero.
192
+ *
193
+ * @example
194
+ * ### Basic Usage
195
+ *
196
+ * Decode a frame tuple with separate execution and state gas limits.
197
+ *
198
+ * ```ts twoslash
199
+ * import { Frame } from 'ox'
200
+ *
201
+ * const frame = Frame.fromTuple([
202
+ * '0x01',
203
+ * '0x03',
204
+ * '0x',
205
+ * ['0xc350', '0x'],
206
+ * '0x',
207
+ * '0x'
208
+ * ])
209
+ * // @log: {
210
+ * // @log: data: '0x',
211
+ * // @log: flags: 3,
212
+ * // @log: gas: 50000n,
213
+ * // @log: mode: 1,
214
+ * // @log: stateGas: 0n,
215
+ * // @log: value: 0n
216
+ * // @log: }
217
+ * ```
218
+ *
219
+ * @param tuple - The frame tuple to convert.
220
+ * @returns The decoded frame.
221
+ */
222
+ export declare function fromTuple(tuple: Tuple): Frame;
223
+ export declare namespace fromTuple {
224
+ type ErrorType = assert.ErrorType | Hex.toNumber.ErrorType | Hex.toBigInt.ErrorType;
225
+ }
226
+ /**
227
+ * Converts a {@link ox#Frame.Frame} to its RLP-ready {@link ox#Frame.Tuple}.
228
+ *
229
+ * Named mode and flags are encoded as integers. An omitted target and zero integer
230
+ * fields are encoded as empty bytes. Omitted mode and flags default to zero;
231
+ * omitted gas limits and value default to `0n`, and data defaults to `'0x'`.
232
+ *
233
+ * @example
234
+ * ### Basic Usage
235
+ *
236
+ * Encode a verification frame in the field order required by EIP-8141.
237
+ *
238
+ * ```ts twoslash
239
+ * import { Frame } from 'ox'
240
+ *
241
+ * const tuple = Frame.toTuple({
242
+ * flags: 'approveExecutionAndPayment',
243
+ * gas: 50_000n,
244
+ * mode: 'verify'
245
+ * })
246
+ * // @log: ['0x01', '0x03', '0x', ['0xc350', '0x'], '0x', '0x']
247
+ * ```
248
+ *
249
+ * @param frame - The frame to convert.
250
+ * @returns The encoded frame tuple.
251
+ */
252
+ export declare function toTuple(frame: Frame): Tuple;
253
+ export declare namespace toTuple {
254
+ type ErrorType = assert.ErrorType | Bytes.fromNumber.ErrorType | Hex.fromBytes.ErrorType;
255
+ }
256
+ /**
257
+ * Returns whether a {@link ox#Frame.Frame} satisfies frame-local constraints.
258
+ *
259
+ * Performs the same checks as {@link ox#Frame.(assert:function)}, returning `false`
260
+ * instead of throwing when the frame is invalid.
261
+ *
262
+ * @example
263
+ * ### Basic Usage
264
+ *
265
+ * Check whether a frame is structurally valid.
266
+ *
267
+ * ```ts twoslash
268
+ * import { Frame } from 'ox'
269
+ *
270
+ * const valid = Frame.validate({
271
+ * flags: 'approveExecutionAndPayment',
272
+ * gas: 50_000n,
273
+ * mode: 'verify'
274
+ * })
275
+ * // @log: true
276
+ * ```
277
+ *
278
+ * @param frame - The frame to validate.
279
+ * @returns Whether the frame satisfies frame-local constraints.
280
+ */
281
+ export declare function validate(frame: Frame): boolean;
282
+ export declare namespace validate {
283
+ type ErrorType = Errors.GlobalErrorType;
284
+ }
285
+ /** Thrown when an EIP-8141 frame is structurally invalid. */
286
+ export declare class InvalidError extends Errors.BaseError {
287
+ readonly name = "Frame.InvalidError";
288
+ constructor(details: string);
289
+ }
290
+ //# sourceMappingURL=Frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Frame.d.ts","sourceRoot":"","sources":["../../src/core/Frame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAG/B,8BAA8B;AAC9B,MAAM,MAAM,KAAK,CAAC,UAAU,GAAG,MAAM,IAAI;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,GAAG,SAAS,CAAA;IAC1B;;;OAGG;IACH,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K,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAgC7C;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,KAAK,SAAS,GACV,MAAM,CAAC,SAAS,GAChB,GAAG,CAAC,QAAQ,CAAC,SAAS,GACtB,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAiB3C;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAK,SAAS,GACV,MAAM,CAAC,SAAS,GAChB,KAAK,CAAC,UAAU,CAAC,SAAS,GAC1B,GAAG,CAAC,SAAS,CAAC,SAAS,CAAA;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAO9C;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,KAAK,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACxC;AAED,6DAA6D;AAC7D,qBAAa,YAAa,SAAQ,MAAM,CAAC,SAAS;IAChD,SAAkB,IAAI,wBAAuB;gBAEjC,OAAO,EAAE,MAAM;CAG5B"}
@@ -0,0 +1,306 @@
1
+ import * as Address from './Address.js';
2
+ import * as Bytes from './Bytes.js';
3
+ import * as Errors from './Errors.js';
4
+ import * as Hex from './Hex.js';
5
+ import * as Quantity from './internal/quantity.js';
6
+ /** Frame execution modes. */
7
+ export const modes = { default: 0, sender: 2, verify: 1 };
8
+ /** Approval and atomic batching flags. */
9
+ export const flags = {
10
+ approveExecution: 2,
11
+ approveExecutionAndPayment: 3,
12
+ approvePayment: 1,
13
+ atomicBatch: 4,
14
+ none: 0,
15
+ };
16
+ /**
17
+ * Asserts that a {@link ox#Frame.Frame} satisfies frame-local constraints.
18
+ *
19
+ * Sender-dependent approval, batch adjacency, expiry, and transaction-wide gas
20
+ * constraints require the enclosing transaction.
21
+ *
22
+ * @example
23
+ * ### Basic Usage
24
+ *
25
+ * Check a verification frame before including it in a transaction.
26
+ *
27
+ * ```ts twoslash
28
+ * import { Frame } from 'ox'
29
+ *
30
+ * Frame.assert({
31
+ * flags: 'approveExecutionAndPayment',
32
+ * gas: 50_000n,
33
+ * mode: 'verify'
34
+ * })
35
+ * ```
36
+ *
37
+ * @param frame - The frame to assert.
38
+ */
39
+ export function assert(frame) {
40
+ const { data = '0x', flags: flagsValue = 0, gas = 0n, mode: modeValue = 0, stateGas = 0n, value = 0n, } = frame;
41
+ const mode = typeof modeValue === 'string' ? modes[modeValue] : modeValue;
42
+ if (!Number.isInteger(mode) || mode < 0 || mode > 2)
43
+ throw new InvalidError('mode must be a supported name or 0, 1, or 2.');
44
+ const flags_ = typeof flagsValue === 'string' ? flags[flagsValue] : flagsValue;
45
+ if (!Number.isInteger(flags_) || flags_ < 0 || flags_ > 7)
46
+ throw new InvalidError('flags must be a supported name or an integer from 0 to 7.');
47
+ if (flags_ & flags.atomicBatch) {
48
+ if (mode === modes.verify)
49
+ throw new InvalidError('VERIFY frames cannot belong to an atomic batch.');
50
+ if (flags_ & flags.approveExecutionAndPayment)
51
+ throw new InvalidError('Atomic batch frames cannot approve execution or payment.');
52
+ }
53
+ if (frame.to !== undefined)
54
+ Address.assert(frame.to, { strict: false });
55
+ for (const [field, limit] of [
56
+ ['gas', gas],
57
+ ['stateGas', stateGas],
58
+ ])
59
+ if (typeof limit !== 'bigint' || limit < 0n || limit >= 2n ** 64n)
60
+ throw new InvalidError(`${field} must be an unsigned 64-bit integer.`);
61
+ if (gas + stateGas >= 2n ** 64n)
62
+ throw new InvalidError('Combined frame gas must be less than 2^64.');
63
+ if (typeof value !== 'bigint' || value < 0n || value >= 2n ** 256n)
64
+ throw new InvalidError('value must be an unsigned 256-bit integer.');
65
+ if (mode !== modes.sender && value !== 0n)
66
+ throw new InvalidError('Only SENDER frames can transfer value.');
67
+ Hex.assert(data, { strict: true });
68
+ if (data.length % 2 !== 0)
69
+ throw new InvalidError('data must contain whole bytes.');
70
+ }
71
+ /**
72
+ * Coerces a frame object into a {@link ox#Frame.Frame}.
73
+ *
74
+ * Validates the frame and returns a copy, preserving literal types and the supplied
75
+ * numeric or named mode and flags. Omitted fields stay omitted;
76
+ * {@link ox#Frame.(toTuple:function)} supplies their defaults when encoding.
77
+ *
78
+ * @example
79
+ * ### Basic Usage
80
+ *
81
+ * Construct a verification frame that approves execution and payment.
82
+ *
83
+ * ```ts twoslash
84
+ * import { Frame } from 'ox'
85
+ *
86
+ * const frame = Frame.from({
87
+ * flags: 'approveExecutionAndPayment',
88
+ * gas: 50_000n,
89
+ * mode: 'verify'
90
+ * })
91
+ * ```
92
+ *
93
+ * @param frame - The frame object to convert.
94
+ * @returns The validated frame.
95
+ */
96
+ export function from(frame) {
97
+ assert(frame);
98
+ return { ...frame };
99
+ }
100
+ /**
101
+ * Converts an RPC frame to a frame.
102
+ *
103
+ * @example
104
+ * ### Basic Usage
105
+ *
106
+ * ```ts twoslash
107
+ * import { Frame } from 'ox'
108
+ *
109
+ * const frame = Frame.fromRpc({
110
+ * data: '0x',
111
+ * executionGasLimit: '0xc350',
112
+ * flags: 3,
113
+ * mode: 1,
114
+ * stateGasLimit: '0x0',
115
+ * value: '0x0'
116
+ * })
117
+ * ```
118
+ *
119
+ * @param frame - The value to convert.
120
+ * @returns The converted value.
121
+ */
122
+ export function fromRpc(frame) {
123
+ return from({
124
+ data: frame.data,
125
+ flags: frame.flags,
126
+ gas: Hex.toBigInt(frame.executionGasLimit),
127
+ mode: frame.mode,
128
+ stateGas: Hex.toBigInt(frame.stateGasLimit),
129
+ ...(frame.target == null ? {} : { to: frame.target }),
130
+ value: Hex.toBigInt(frame.value),
131
+ });
132
+ }
133
+ /**
134
+ * Converts a frame to its JSON-RPC representation.
135
+ *
136
+ * @example
137
+ * ### Basic Usage
138
+ *
139
+ * ```ts twoslash
140
+ * import { Frame } from 'ox'
141
+ *
142
+ * const frame = Frame.from({ gas: 50_000n, mode: 'verify' })
143
+ * const rpc = Frame.toRpc(frame)
144
+ * ```
145
+ *
146
+ * @param frame - The value to convert.
147
+ * @returns The converted value.
148
+ */
149
+ export function toRpc(frame) {
150
+ const { flags: flags_ = 0, mode = 0 } = frame;
151
+ return {
152
+ data: frame.data ?? '0x',
153
+ executionGasLimit: Quantity.fromNumberish(frame.gas ?? 0n),
154
+ flags: typeof flags_ === 'string' ? flags[flags_] : flags_,
155
+ mode: typeof mode === 'string' ? modes[mode] : mode,
156
+ stateGasLimit: Quantity.fromNumberish(frame.stateGas ?? 0n),
157
+ ...(frame.to === undefined ? {} : { target: frame.to }),
158
+ value: Quantity.fromNumberish(frame.value ?? 0n),
159
+ };
160
+ }
161
+ /**
162
+ * Converts a {@link ox#Frame.Tuple} to a {@link ox#Frame.Frame}.
163
+ *
164
+ * Returns numeric mode and flags. An empty target becomes an omitted `to`.
165
+ * Integer fields must use minimal whole-byte encodings, with empty bytes for zero.
166
+ *
167
+ * @example
168
+ * ### Basic Usage
169
+ *
170
+ * Decode a frame tuple with separate execution and state gas limits.
171
+ *
172
+ * ```ts twoslash
173
+ * import { Frame } from 'ox'
174
+ *
175
+ * const frame = Frame.fromTuple([
176
+ * '0x01',
177
+ * '0x03',
178
+ * '0x',
179
+ * ['0xc350', '0x'],
180
+ * '0x',
181
+ * '0x'
182
+ * ])
183
+ * // @log: {
184
+ * // @log: data: '0x',
185
+ * // @log: flags: 3,
186
+ * // @log: gas: 50000n,
187
+ * // @log: mode: 1,
188
+ * // @log: stateGas: 0n,
189
+ * // @log: value: 0n
190
+ * // @log: }
191
+ * ```
192
+ *
193
+ * @param tuple - The frame tuple to convert.
194
+ * @returns The decoded frame.
195
+ */
196
+ export function fromTuple(tuple) {
197
+ if (!Array.isArray(tuple) ||
198
+ tuple.length !== 6 ||
199
+ !Array.isArray(tuple[3]) ||
200
+ tuple[3].length !== 2)
201
+ throw new InvalidError('Expected [mode, flags, target, [execution, state], value, data].');
202
+ const [mode, flags, target, [execution, state], value, data] = tuple;
203
+ Hex.assert(target, { strict: true });
204
+ Hex.assert(data, { strict: true });
205
+ const quantities = [mode, flags, execution, state, value];
206
+ for (const quantity of quantities) {
207
+ Hex.assert(quantity, { strict: true });
208
+ if (quantity.length % 2 !== 0 || quantity.startsWith('0x00'))
209
+ throw new InvalidError('Integers must use minimal whole-byte encodings, with empty bytes for zero.');
210
+ }
211
+ const frame = {
212
+ ...(target === '0x' ? {} : { to: target }),
213
+ data,
214
+ flags: flags === '0x' ? 0 : Hex.toNumber(flags),
215
+ gas: execution === '0x' ? 0n : Hex.toBigInt(execution),
216
+ mode: mode === '0x' ? 0 : Hex.toNumber(mode),
217
+ stateGas: state === '0x' ? 0n : Hex.toBigInt(state),
218
+ value: value === '0x' ? 0n : Hex.toBigInt(value),
219
+ };
220
+ assert(frame);
221
+ return frame;
222
+ }
223
+ /**
224
+ * Converts a {@link ox#Frame.Frame} to its RLP-ready {@link ox#Frame.Tuple}.
225
+ *
226
+ * Named mode and flags are encoded as integers. An omitted target and zero integer
227
+ * fields are encoded as empty bytes. Omitted mode and flags default to zero;
228
+ * omitted gas limits and value default to `0n`, and data defaults to `'0x'`.
229
+ *
230
+ * @example
231
+ * ### Basic Usage
232
+ *
233
+ * Encode a verification frame in the field order required by EIP-8141.
234
+ *
235
+ * ```ts twoslash
236
+ * import { Frame } from 'ox'
237
+ *
238
+ * const tuple = Frame.toTuple({
239
+ * flags: 'approveExecutionAndPayment',
240
+ * gas: 50_000n,
241
+ * mode: 'verify'
242
+ * })
243
+ * // @log: ['0x01', '0x03', '0x', ['0xc350', '0x'], '0x', '0x']
244
+ * ```
245
+ *
246
+ * @param frame - The frame to convert.
247
+ * @returns The encoded frame tuple.
248
+ */
249
+ export function toTuple(frame) {
250
+ assert(frame);
251
+ const mode = typeof frame.mode === 'string' ? modes[frame.mode] : (frame.mode ?? 0);
252
+ const flags_ = typeof frame.flags === 'string' ? flags[frame.flags] : (frame.flags ?? 0);
253
+ return [
254
+ mode ? Hex.fromBytes(Bytes.fromNumber(mode)) : '0x',
255
+ flags_ ? Hex.fromBytes(Bytes.fromNumber(flags_)) : '0x',
256
+ frame.to ?? '0x',
257
+ [
258
+ frame.gas ? Hex.fromBytes(Bytes.fromNumber(frame.gas)) : '0x',
259
+ frame.stateGas ? Hex.fromBytes(Bytes.fromNumber(frame.stateGas)) : '0x',
260
+ ],
261
+ frame.value ? Hex.fromBytes(Bytes.fromNumber(frame.value)) : '0x',
262
+ frame.data ?? '0x',
263
+ ];
264
+ }
265
+ /**
266
+ * Returns whether a {@link ox#Frame.Frame} satisfies frame-local constraints.
267
+ *
268
+ * Performs the same checks as {@link ox#Frame.(assert:function)}, returning `false`
269
+ * instead of throwing when the frame is invalid.
270
+ *
271
+ * @example
272
+ * ### Basic Usage
273
+ *
274
+ * Check whether a frame is structurally valid.
275
+ *
276
+ * ```ts twoslash
277
+ * import { Frame } from 'ox'
278
+ *
279
+ * const valid = Frame.validate({
280
+ * flags: 'approveExecutionAndPayment',
281
+ * gas: 50_000n,
282
+ * mode: 'verify'
283
+ * })
284
+ * // @log: true
285
+ * ```
286
+ *
287
+ * @param frame - The frame to validate.
288
+ * @returns Whether the frame satisfies frame-local constraints.
289
+ */
290
+ export function validate(frame) {
291
+ try {
292
+ assert(frame);
293
+ return true;
294
+ }
295
+ catch {
296
+ return false;
297
+ }
298
+ }
299
+ /** Thrown when an EIP-8141 frame is structurally invalid. */
300
+ export class InvalidError extends Errors.BaseError {
301
+ name = 'Frame.InvalidError';
302
+ constructor(details) {
303
+ super('Invalid frame.', { details });
304
+ }
305
+ }
306
+ //# sourceMappingURL=Frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Frame.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