ox 1.8.1 → 1.8.4
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 +53 -0
- package/dist/core/Frame.d.ts +23 -20
- package/dist/core/Frame.d.ts.map +1 -1
- package/dist/core/Frame.js +28 -23
- package/dist/core/Frame.js.map +1 -1
- package/dist/core/FrameReceipt.d.ts +23 -14
- package/dist/core/FrameReceipt.d.ts.map +1 -1
- package/dist/core/FrameReceipt.js +15 -11
- package/dist/core/FrameReceipt.js.map +1 -1
- package/dist/core/FrameRequest.d.ts +50 -0
- package/dist/core/FrameRequest.d.ts.map +1 -0
- package/dist/core/FrameRequest.js +59 -0
- package/dist/core/FrameRequest.js.map +1 -0
- package/dist/core/FrameSignature.d.ts +17 -16
- package/dist/core/FrameSignature.d.ts.map +1 -1
- package/dist/core/FrameSignature.js +38 -21
- package/dist/core/FrameSignature.js.map +1 -1
- package/dist/core/Siwe.d.ts.map +1 -1
- package/dist/core/Siwe.js +3 -3
- package/dist/core/Siwe.js.map +1 -1
- package/dist/core/Transaction.d.ts +7 -4
- package/dist/core/Transaction.d.ts.map +1 -1
- package/dist/core/Transaction.js +8 -0
- package/dist/core/Transaction.js.map +1 -1
- package/dist/core/TransactionRequest.d.ts +8 -5
- package/dist/core/TransactionRequest.d.ts.map +1 -1
- package/dist/core/TransactionRequest.js +11 -3
- package/dist/core/TransactionRequest.js.map +1 -1
- package/dist/core/TxEnvelope.d.ts +4 -2
- package/dist/core/TxEnvelope.d.ts.map +1 -1
- package/dist/core/TxEnvelope.js +11 -2
- package/dist/core/TxEnvelope.js.map +1 -1
- package/dist/core/TxEnvelopeEip8141.d.ts +22 -11
- package/dist/core/TxEnvelopeEip8141.d.ts.map +1 -1
- package/dist/core/TxEnvelopeEip8141.js +45 -16
- package/dist/core/TxEnvelopeEip8141.js.map +1 -1
- package/dist/core/internal/frameNonce.d.ts +10 -0
- package/dist/core/internal/frameNonce.d.ts.map +1 -0
- package/dist/core/internal/frameNonce.js +45 -0
- package/dist/core/internal/frameNonce.js.map +1 -0
- package/dist/core/internal/rpcSchemas/eth.d.ts +16 -4
- package/dist/core/internal/rpcSchemas/eth.d.ts.map +1 -1
- package/dist/index.d.ts +21 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -5
- package/dist/index.js.map +1 -1
- package/dist/zod/Block.d.ts +52 -37
- package/dist/zod/Block.d.ts.map +1 -1
- package/dist/zod/Frame.d.ts +14 -14
- package/dist/zod/Frame.js +5 -5
- package/dist/zod/Frame.js.map +1 -1
- package/dist/zod/FrameReceipt.d.ts +42 -2
- package/dist/zod/FrameReceipt.d.ts.map +1 -1
- package/dist/zod/FrameReceipt.js +11 -1
- package/dist/zod/FrameReceipt.js.map +1 -1
- package/dist/zod/FrameRequest.d.ts +40 -0
- package/dist/zod/FrameRequest.d.ts.map +1 -0
- package/dist/zod/FrameRequest.js +37 -0
- package/dist/zod/FrameRequest.js.map +1 -0
- package/dist/zod/FrameSignature.d.ts +21 -13
- package/dist/zod/FrameSignature.d.ts.map +1 -1
- package/dist/zod/FrameSignature.js +10 -7
- package/dist/zod/FrameSignature.js.map +1 -1
- package/dist/zod/RpcSchema.d.ts +470 -265
- package/dist/zod/RpcSchema.d.ts.map +1 -1
- package/dist/zod/Transaction.d.ts +104 -74
- package/dist/zod/Transaction.d.ts.map +1 -1
- package/dist/zod/Transaction.js +22 -15
- package/dist/zod/Transaction.js.map +1 -1
- package/dist/zod/TransactionEnvelope.d.ts +60 -34
- package/dist/zod/TransactionEnvelope.d.ts.map +1 -1
- package/dist/zod/TransactionReceipt.d.ts +42 -2
- package/dist/zod/TransactionReceipt.d.ts.map +1 -1
- package/dist/zod/TransactionRequest.d.ts +31 -21
- 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 +44 -25
- package/dist/zod/TxEnvelopeEip8141.d.ts.map +1 -1
- package/dist/zod/TxEnvelopeEip8141.js +2 -0
- package/dist/zod/TxEnvelopeEip8141.js.map +1 -1
- package/dist/zod/internal/Frame.d.ts +8 -0
- package/dist/zod/internal/Frame.d.ts.map +1 -1
- package/dist/zod/internal/Frame.js +29 -0
- package/dist/zod/internal/Frame.js.map +1 -1
- package/dist/zod/internal/rpcSchemas/Eth.d.ts +472 -267
- package/dist/zod/internal/rpcSchemas/Eth.d.ts.map +1 -1
- package/dist/zod/internal/rpcSchemas/Eth.js +9 -0
- package/dist/zod/internal/rpcSchemas/Eth.js.map +1 -1
- package/dist/zod/internal/rpcSchemas/Wallet.d.ts +51 -21
- package/dist/zod/internal/rpcSchemas/Wallet.d.ts.map +1 -1
- package/dist/zod/tempo/RpcSchemaTempo.d.ts +68 -48
- package/dist/zod/tempo/RpcSchemaTempo.d.ts.map +1 -1
- package/dist/zod/tempo/Transaction.d.ts +52 -37
- package/dist/zod/tempo/Transaction.d.ts.map +1 -1
- package/dist/zod/z.d.ts +1 -0
- package/dist/zod/z.d.ts.map +1 -1
- package/dist/zod/z.js +1 -0
- package/dist/zod/z.js.map +1 -1
- package/package.json +11 -1
- package/src/core/Frame.ts +41 -33
- package/src/core/FrameReceipt.ts +30 -16
- package/src/core/FrameRequest.ts +78 -0
- package/src/core/FrameSignature.ts +64 -34
- package/src/core/Siwe.ts +21 -13
- package/src/core/Transaction.ts +52 -24
- package/src/core/TransactionRequest.ts +21 -7
- package/src/core/TxEnvelope.ts +16 -3
- package/src/core/TxEnvelopeEip8141.ts +69 -21
- package/src/core/_test/AbiConstructor.test.ts +2 -0
- package/src/core/_test/Frame.test-d.ts +16 -7
- package/src/core/_test/Frame.test.ts +52 -24
- package/src/core/_test/FrameReceipt.test.ts +15 -9
- package/src/core/_test/FrameRequest.test-d.ts +16 -0
- package/src/core/_test/FrameRequest.test.ts +41 -0
- package/src/core/_test/FrameRpc.test.ts +131 -0
- package/src/core/_test/FrameSignature.test-d.ts +20 -0
- package/src/core/_test/FrameSignature.test.ts +132 -11
- package/src/core/_test/RpcSchema.test-d.ts +45 -0
- package/src/core/_test/Siwe.test.ts +147 -0
- package/src/core/_test/TransactionEnvelope.test-d.ts +27 -0
- package/src/core/_test/TransactionEnvelope.test.ts +27 -1
- package/src/core/_test/TransactionReceipt.test.ts +32 -6
- package/src/core/_test/TransactionRequest.test-d.ts +10 -1
- package/src/core/_test/TransactionRequest.test.ts +31 -2
- package/src/core/_test/TxEnvelopeEip8141.test-d.ts +29 -2
- package/src/core/_test/TxEnvelopeEip8141.test.ts +548 -55
- package/src/core/_test/index.test.ts +1 -0
- package/src/core/internal/frameNonce.ts +61 -0
- package/src/core/internal/rpcSchemas/eth.ts +13 -4
- package/src/index.ts +22 -5
- package/src/version.ts +1 -1
- package/src/zod/Frame.ts +5 -5
- package/src/zod/FrameReceipt.ts +11 -1
- package/src/zod/FrameRequest.ts +46 -0
- package/src/zod/FrameSignature.ts +10 -7
- package/src/zod/Transaction.ts +46 -27
- package/src/zod/TransactionRequest.ts +33 -18
- package/src/zod/TxEnvelopeEip8141.ts +2 -0
- package/src/zod/_test/Frame.test.ts +13 -11
- package/src/zod/_test/FrameReceipt.test.ts +11 -4
- package/src/zod/_test/FrameRequest.test-d.ts +15 -0
- package/src/zod/_test/FrameRequest.test.ts +44 -0
- package/src/zod/_test/FrameSignature.test.ts +73 -9
- package/src/zod/_test/RpcSchema.test.ts +106 -0
- package/src/zod/_test/TransactionRequest.test.ts +61 -0
- package/src/zod/_test/TxEnvelopeEip8141.nonce.test.ts +174 -0
- package/src/zod/_test/TxEnvelopeEip8141.test-d.ts +29 -0
- package/src/zod/_test/TxEnvelopeEip8141.test.ts +3 -3
- package/src/zod/internal/Frame.ts +45 -0
- package/src/zod/internal/rpcSchemas/Eth.ts +20 -0
- package/src/zod/z.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# ox
|
|
2
2
|
|
|
3
|
+
## 1.8.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#489](https://github.com/wevm/ox/pull/489) [`277594a`](https://github.com/wevm/ox/commit/277594a1f489dd612bc25cfb73006c9050a61f7c) Thanks [@jxom](https://github.com/jxom)! - Added EIP-8250 keyed frame nonces with shared `nonce` sequences while preserving the original EIP-8141 encoding when `nonceKeys` is omitted.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { TxEnvelopeEip8141 } from "ox";
|
|
11
|
+
|
|
12
|
+
const envelope = TxEnvelopeEip8141.from({
|
|
13
|
+
chainId: 1,
|
|
14
|
+
sender: "0x1111111111111111111111111111111111111111",
|
|
15
|
+
frames: [{ mode: "sender", executionGas: 50_000n }],
|
|
16
|
+
nonceKeys: [1n, 2n],
|
|
17
|
+
nonce: 0n,
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 1.8.3
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- [#482](https://github.com/wevm/ox/pull/482) [`9d2ab90`](https://github.com/wevm/ox/commit/9d2ab900d397066d036ddedef655d1a9da26a014) Thanks [@jxom](https://github.com/jxom)! - Fixed empty protocol signature placeholders in frame signature validation, encoding, and transaction signing payloads.
|
|
26
|
+
|
|
27
|
+
## 1.8.2
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [`03eb47a`](https://github.com/wevm/ox/commit/03eb47a4c5d87b52215cbf345a95da854add9f26) Thanks [@jxom](https://github.com/jxom)! - Renamed `Frame.gas` to `Frame.executionGas`.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { Frame } from "ox";
|
|
35
|
+
|
|
36
|
+
Frame.from({ executionGas: 50_000n, stateGas: 1_000n });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- [#480](https://github.com/wevm/ox/pull/480) [`1ae6d07`](https://github.com/wevm/ox/commit/1ae6d078ee65b56983b6a5b9c4e7210aa38d3e37) Thanks [@jxom](https://github.com/jxom)! - Aligned to the frame transaction spec.
|
|
40
|
+
|
|
41
|
+
- [#471](https://github.com/wevm/ox/pull/471) [`1270b42`](https://github.com/wevm/ox/commit/1270b4279a48acea5f2e397c19fa252342f30f90) Thanks [@jxom](https://github.com/jxom)! - Added hex signature support for secp256k1 and P256 frame signature entries.
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { FrameSignature, Signature } from "ox";
|
|
45
|
+
|
|
46
|
+
declare const signature: Signature.Signature;
|
|
47
|
+
|
|
48
|
+
FrameSignature.from({
|
|
49
|
+
scheme: "secp256k1",
|
|
50
|
+
signature: Signature.toHex(signature),
|
|
51
|
+
});
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
- [#477](https://github.com/wevm/ox/pull/477) [`10075a8`](https://github.com/wevm/ox/commit/10075a8971ffd73d2345f3a1bda97bb1df5b6cac) Thanks [@jxom](https://github.com/jxom)! - Fixed `Siwe.parseMessage` losing or truncating resources when `Resources:` appeared in another message field or resource.
|
|
55
|
+
|
|
3
56
|
## 1.8.1
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
package/dist/core/Frame.d.ts
CHANGED
|
@@ -9,16 +9,16 @@ export type Frame<bigintType = bigint> = {
|
|
|
9
9
|
* @default '0x'
|
|
10
10
|
*/
|
|
11
11
|
data?: Hex.Hex | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Execution gas budget.
|
|
14
|
+
* @default 0n
|
|
15
|
+
*/
|
|
16
|
+
executionGas?: bigintType | undefined;
|
|
12
17
|
/**
|
|
13
18
|
* Approval scope and atomic batching bits.
|
|
14
19
|
* @default 0
|
|
15
20
|
*/
|
|
16
21
|
flags?: Flags | undefined;
|
|
17
|
-
/**
|
|
18
|
-
* Execution gas budget.
|
|
19
|
-
* @default 0n
|
|
20
|
-
*/
|
|
21
|
-
gas?: bigintType | undefined;
|
|
22
22
|
/**
|
|
23
23
|
* Execution context: default, verify, or sender.
|
|
24
24
|
* @default 0
|
|
@@ -42,13 +42,13 @@ export type Rpc = {
|
|
|
42
42
|
/** Frame calldata. */
|
|
43
43
|
data: Hex.Hex;
|
|
44
44
|
/** Execution gas budget. */
|
|
45
|
-
|
|
45
|
+
executionGas: Hex.Hex;
|
|
46
46
|
/** Approval scope and batching bits. */
|
|
47
|
-
flags:
|
|
47
|
+
flags: Hex.Hex;
|
|
48
48
|
/** Execution mode. */
|
|
49
|
-
mode:
|
|
49
|
+
mode: Hex.Hex;
|
|
50
50
|
/** State gas budget. */
|
|
51
|
-
|
|
51
|
+
stateGas: Hex.Hex;
|
|
52
52
|
/** Target address; absent for the transaction sender. */
|
|
53
53
|
target?: Address.Address | null | undefined;
|
|
54
54
|
/** Value transferred in wei. */
|
|
@@ -96,8 +96,8 @@ export type Tuple = readonly [
|
|
|
96
96
|
* import { Frame } from 'ox'
|
|
97
97
|
*
|
|
98
98
|
* Frame.assert({
|
|
99
|
+
* executionGas: 50_000n,
|
|
99
100
|
* flags: 'approveExecutionAndPayment',
|
|
100
|
-
* gas: 50_000n,
|
|
101
101
|
* mode: 'verify'
|
|
102
102
|
* })
|
|
103
103
|
* ```
|
|
@@ -124,8 +124,8 @@ export declare namespace assert {
|
|
|
124
124
|
* import { Frame } from 'ox'
|
|
125
125
|
*
|
|
126
126
|
* const frame = Frame.from({
|
|
127
|
+
* executionGas: 50_000n,
|
|
127
128
|
* flags: 'approveExecutionAndPayment',
|
|
128
|
-
* gas: 50_000n,
|
|
129
129
|
* mode: 'verify'
|
|
130
130
|
* })
|
|
131
131
|
* ```
|
|
@@ -148,10 +148,10 @@ export declare namespace from {
|
|
|
148
148
|
*
|
|
149
149
|
* const frame = Frame.fromRpc({
|
|
150
150
|
* data: '0x',
|
|
151
|
-
*
|
|
152
|
-
* flags:
|
|
153
|
-
* mode:
|
|
154
|
-
*
|
|
151
|
+
* executionGas: '0xc350',
|
|
152
|
+
* flags: '0x3',
|
|
153
|
+
* mode: '0x1',
|
|
154
|
+
* stateGas: '0x0',
|
|
155
155
|
* value: '0x0'
|
|
156
156
|
* })
|
|
157
157
|
* ```
|
|
@@ -161,7 +161,7 @@ export declare namespace from {
|
|
|
161
161
|
*/
|
|
162
162
|
export declare function fromRpc(frame: Rpc): Frame;
|
|
163
163
|
export declare namespace fromRpc {
|
|
164
|
-
type ErrorType = from.ErrorType | Hex.toBigInt.ErrorType;
|
|
164
|
+
type ErrorType = from.ErrorType | Hex.toBigInt.ErrorType | Hex.toNumber.ErrorType;
|
|
165
165
|
}
|
|
166
166
|
/**
|
|
167
167
|
* Converts a frame to its JSON-RPC representation.
|
|
@@ -172,7 +172,10 @@ export declare namespace fromRpc {
|
|
|
172
172
|
* ```ts twoslash
|
|
173
173
|
* import { Frame } from 'ox'
|
|
174
174
|
*
|
|
175
|
-
* const frame = Frame.from({
|
|
175
|
+
* const frame = Frame.from({
|
|
176
|
+
* executionGas: 50_000n,
|
|
177
|
+
* mode: 'verify'
|
|
178
|
+
* })
|
|
176
179
|
* const rpc = Frame.toRpc(frame)
|
|
177
180
|
* ```
|
|
178
181
|
*
|
|
@@ -208,8 +211,8 @@ export declare namespace toRpc {
|
|
|
208
211
|
* ])
|
|
209
212
|
* // @log: {
|
|
210
213
|
* // @log: data: '0x',
|
|
214
|
+
* // @log: executionGas: 50000n,
|
|
211
215
|
* // @log: flags: 3,
|
|
212
|
-
* // @log: gas: 50000n,
|
|
213
216
|
* // @log: mode: 1,
|
|
214
217
|
* // @log: stateGas: 0n,
|
|
215
218
|
* // @log: value: 0n
|
|
@@ -239,8 +242,8 @@ export declare namespace fromTuple {
|
|
|
239
242
|
* import { Frame } from 'ox'
|
|
240
243
|
*
|
|
241
244
|
* const tuple = Frame.toTuple({
|
|
245
|
+
* executionGas: 50_000n,
|
|
242
246
|
* flags: 'approveExecutionAndPayment',
|
|
243
|
-
* gas: 50_000n,
|
|
244
247
|
* mode: 'verify'
|
|
245
248
|
* })
|
|
246
249
|
* // @log: ['0x01', '0x03', '0x', ['0xc350', '0x'], '0x', '0x']
|
|
@@ -268,8 +271,8 @@ export declare namespace toTuple {
|
|
|
268
271
|
* import { Frame } from 'ox'
|
|
269
272
|
*
|
|
270
273
|
* const valid = Frame.validate({
|
|
274
|
+
* executionGas: 50_000n,
|
|
271
275
|
* flags: 'approveExecutionAndPayment',
|
|
272
|
-
* gas: 50_000n,
|
|
273
276
|
* mode: 'verify'
|
|
274
277
|
* })
|
|
275
278
|
* // @log: true
|
package/dist/core/Frame.d.ts.map
CHANGED
|
@@ -1 +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,
|
|
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,YAAY,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IACrC;;;OAGG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,KAAK,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,CAmB3C;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"}
|
package/dist/core/Frame.js
CHANGED
|
@@ -28,8 +28,8 @@ export const flags = {
|
|
|
28
28
|
* import { Frame } from 'ox'
|
|
29
29
|
*
|
|
30
30
|
* Frame.assert({
|
|
31
|
+
* executionGas: 50_000n,
|
|
31
32
|
* flags: 'approveExecutionAndPayment',
|
|
32
|
-
* gas: 50_000n,
|
|
33
33
|
* mode: 'verify'
|
|
34
34
|
* })
|
|
35
35
|
* ```
|
|
@@ -37,7 +37,7 @@ export const flags = {
|
|
|
37
37
|
* @param frame - The frame to assert.
|
|
38
38
|
*/
|
|
39
39
|
export function assert(frame) {
|
|
40
|
-
const { data = '0x', flags: flagsValue = 0,
|
|
40
|
+
const { data = '0x', executionGas = 0n, flags: flagsValue = 0, mode: modeValue = 0, stateGas = 0n, value = 0n, } = frame;
|
|
41
41
|
const mode = typeof modeValue === 'string' ? modes[modeValue] : modeValue;
|
|
42
42
|
if (!Number.isInteger(mode) || mode < 0 || mode > 2)
|
|
43
43
|
throw new InvalidError('mode must be a supported name or 0, 1, or 2.');
|
|
@@ -53,12 +53,12 @@ export function assert(frame) {
|
|
|
53
53
|
if (frame.to !== undefined)
|
|
54
54
|
Address.assert(frame.to, { strict: false });
|
|
55
55
|
for (const [field, limit] of [
|
|
56
|
-
['
|
|
56
|
+
['executionGas', executionGas],
|
|
57
57
|
['stateGas', stateGas],
|
|
58
58
|
])
|
|
59
59
|
if (typeof limit !== 'bigint' || limit < 0n || limit >= 2n ** 64n)
|
|
60
60
|
throw new InvalidError(`${field} must be an unsigned 64-bit integer.`);
|
|
61
|
-
if (
|
|
61
|
+
if (executionGas + stateGas >= 2n ** 64n)
|
|
62
62
|
throw new InvalidError('Combined frame gas must be less than 2^64.');
|
|
63
63
|
if (typeof value !== 'bigint' || value < 0n || value >= 2n ** 256n)
|
|
64
64
|
throw new InvalidError('value must be an unsigned 256-bit integer.');
|
|
@@ -84,8 +84,8 @@ export function assert(frame) {
|
|
|
84
84
|
* import { Frame } from 'ox'
|
|
85
85
|
*
|
|
86
86
|
* const frame = Frame.from({
|
|
87
|
+
* executionGas: 50_000n,
|
|
87
88
|
* flags: 'approveExecutionAndPayment',
|
|
88
|
-
* gas: 50_000n,
|
|
89
89
|
* mode: 'verify'
|
|
90
90
|
* })
|
|
91
91
|
* ```
|
|
@@ -108,10 +108,10 @@ export function from(frame) {
|
|
|
108
108
|
*
|
|
109
109
|
* const frame = Frame.fromRpc({
|
|
110
110
|
* data: '0x',
|
|
111
|
-
*
|
|
112
|
-
* flags:
|
|
113
|
-
* mode:
|
|
114
|
-
*
|
|
111
|
+
* executionGas: '0xc350',
|
|
112
|
+
* flags: '0x3',
|
|
113
|
+
* mode: '0x1',
|
|
114
|
+
* stateGas: '0x0',
|
|
115
115
|
* value: '0x0'
|
|
116
116
|
* })
|
|
117
117
|
* ```
|
|
@@ -122,10 +122,10 @@ export function from(frame) {
|
|
|
122
122
|
export function fromRpc(frame) {
|
|
123
123
|
return from({
|
|
124
124
|
data: frame.data,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
mode: frame.mode,
|
|
128
|
-
stateGas: Hex.toBigInt(frame.
|
|
125
|
+
executionGas: Hex.toBigInt(frame.executionGas),
|
|
126
|
+
flags: Hex.toNumber(frame.flags),
|
|
127
|
+
mode: Hex.toNumber(frame.mode),
|
|
128
|
+
stateGas: Hex.toBigInt(frame.stateGas),
|
|
129
129
|
...(frame.target == null ? {} : { to: frame.target }),
|
|
130
130
|
value: Hex.toBigInt(frame.value),
|
|
131
131
|
});
|
|
@@ -139,7 +139,10 @@ export function fromRpc(frame) {
|
|
|
139
139
|
* ```ts twoslash
|
|
140
140
|
* import { Frame } from 'ox'
|
|
141
141
|
*
|
|
142
|
-
* const frame = Frame.from({
|
|
142
|
+
* const frame = Frame.from({
|
|
143
|
+
* executionGas: 50_000n,
|
|
144
|
+
* mode: 'verify'
|
|
145
|
+
* })
|
|
143
146
|
* const rpc = Frame.toRpc(frame)
|
|
144
147
|
* ```
|
|
145
148
|
*
|
|
@@ -150,10 +153,10 @@ export function toRpc(frame) {
|
|
|
150
153
|
const { flags: flags_ = 0, mode = 0 } = frame;
|
|
151
154
|
return {
|
|
152
155
|
data: frame.data ?? '0x',
|
|
153
|
-
|
|
154
|
-
flags: typeof flags_ === 'string' ? flags[flags_] : flags_,
|
|
155
|
-
mode: typeof mode === 'string' ? modes[mode] : mode,
|
|
156
|
-
|
|
156
|
+
executionGas: Quantity.fromNumberish(frame.executionGas ?? 0n),
|
|
157
|
+
flags: Hex.fromNumber(typeof flags_ === 'string' ? flags[flags_] : flags_),
|
|
158
|
+
mode: Hex.fromNumber(typeof mode === 'string' ? modes[mode] : mode),
|
|
159
|
+
stateGas: Quantity.fromNumberish(frame.stateGas ?? 0n),
|
|
157
160
|
...(frame.to === undefined ? {} : { target: frame.to }),
|
|
158
161
|
value: Quantity.fromNumberish(frame.value ?? 0n),
|
|
159
162
|
};
|
|
@@ -182,8 +185,8 @@ export function toRpc(frame) {
|
|
|
182
185
|
* ])
|
|
183
186
|
* // @log: {
|
|
184
187
|
* // @log: data: '0x',
|
|
188
|
+
* // @log: executionGas: 50000n,
|
|
185
189
|
* // @log: flags: 3,
|
|
186
|
-
* // @log: gas: 50000n,
|
|
187
190
|
* // @log: mode: 1,
|
|
188
191
|
* // @log: stateGas: 0n,
|
|
189
192
|
* // @log: value: 0n
|
|
@@ -211,8 +214,8 @@ export function fromTuple(tuple) {
|
|
|
211
214
|
const frame = {
|
|
212
215
|
...(target === '0x' ? {} : { to: target }),
|
|
213
216
|
data,
|
|
217
|
+
executionGas: execution === '0x' ? 0n : Hex.toBigInt(execution),
|
|
214
218
|
flags: flags === '0x' ? 0 : Hex.toNumber(flags),
|
|
215
|
-
gas: execution === '0x' ? 0n : Hex.toBigInt(execution),
|
|
216
219
|
mode: mode === '0x' ? 0 : Hex.toNumber(mode),
|
|
217
220
|
stateGas: state === '0x' ? 0n : Hex.toBigInt(state),
|
|
218
221
|
value: value === '0x' ? 0n : Hex.toBigInt(value),
|
|
@@ -236,8 +239,8 @@ export function fromTuple(tuple) {
|
|
|
236
239
|
* import { Frame } from 'ox'
|
|
237
240
|
*
|
|
238
241
|
* const tuple = Frame.toTuple({
|
|
242
|
+
* executionGas: 50_000n,
|
|
239
243
|
* flags: 'approveExecutionAndPayment',
|
|
240
|
-
* gas: 50_000n,
|
|
241
244
|
* mode: 'verify'
|
|
242
245
|
* })
|
|
243
246
|
* // @log: ['0x01', '0x03', '0x', ['0xc350', '0x'], '0x', '0x']
|
|
@@ -255,7 +258,9 @@ export function toTuple(frame) {
|
|
|
255
258
|
flags_ ? Hex.fromBytes(Bytes.fromNumber(flags_)) : '0x',
|
|
256
259
|
frame.to ?? '0x',
|
|
257
260
|
[
|
|
258
|
-
frame.
|
|
261
|
+
frame.executionGas
|
|
262
|
+
? Hex.fromBytes(Bytes.fromNumber(frame.executionGas))
|
|
263
|
+
: '0x',
|
|
259
264
|
frame.stateGas ? Hex.fromBytes(Bytes.fromNumber(frame.stateGas)) : '0x',
|
|
260
265
|
],
|
|
261
266
|
frame.value ? Hex.fromBytes(Bytes.fromNumber(frame.value)) : '0x',
|
|
@@ -277,8 +282,8 @@ export function toTuple(frame) {
|
|
|
277
282
|
* import { Frame } from 'ox'
|
|
278
283
|
*
|
|
279
284
|
* const valid = Frame.validate({
|
|
285
|
+
* executionGas: 50_000n,
|
|
280
286
|
* flags: 'approveExecutionAndPayment',
|
|
281
|
-
* gas: 50_000n,
|
|
282
287
|
* mode: 'verify'
|
|
283
288
|
* })
|
|
284
289
|
* // @log: true
|
package/dist/core/Frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Frame.js","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;AAC/B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AAwDlD,6BAA6B;AAC7B,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAW,CAAA;AAKlE,0CAA0C;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,gBAAgB,EAAE,CA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U,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;gBACrD,CAAC,CAAC,IAAI;YACR,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;SACxE;QACD,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI;QACjE,KAAK,CAAC,IAAI,IAAI,IAAI;KACnB,CAAA;AACH,CAAC;AASD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAY;IACnC,IAAI,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,CAAA;QACb,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAMD,6DAA6D;AAC7D,MAAM,OAAO,YAAa,SAAQ,MAAM,CAAC,SAAS;IAC9B,IAAI,GAAG,oBAAoB,CAAA;IAE7C,YAAY,OAAe;QACzB,KAAK,CAAC,gBAAgB,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;IACtC,CAAC;CACF"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type * as Errors from './Errors.js';
|
|
2
2
|
import * as Hex from './Hex.js';
|
|
3
3
|
import type * as Log from './Log.js';
|
|
4
|
-
|
|
4
|
+
import type { Compute, ExactPartial } from './internal/types.js';
|
|
5
|
+
type FrameLog = Compute<Pick<Log.Rpc, 'address' | 'data' | 'topics'> & ExactPartial<Omit<Log.Rpc, 'address' | 'data' | 'topics'>>>;
|
|
6
|
+
/** Receipt for one frame. */
|
|
5
7
|
export type FrameReceipt<bigintType = bigint> = {
|
|
6
8
|
/** Execution gas used before transaction-level refunds. */
|
|
9
|
+
executionGasUsed: bigintType;
|
|
10
|
+
/** Total execution and state gas used. */
|
|
7
11
|
gasUsed: bigintType;
|
|
8
12
|
/** Logs emitted by this frame. */
|
|
9
|
-
logs: readonly
|
|
13
|
+
logs: readonly FrameLog[];
|
|
10
14
|
/** Final state gas after refills and rollbacks. */
|
|
11
15
|
stateGasUsed: bigintType;
|
|
12
16
|
/** Frame execution result. */
|
|
@@ -16,8 +20,10 @@ export type FrameReceipt<bigintType = bigint> = {
|
|
|
16
20
|
export type Rpc = {
|
|
17
21
|
/** Execution gas used. */
|
|
18
22
|
executionGasUsed: Hex.Hex;
|
|
23
|
+
/** Total execution and state gas used. */
|
|
24
|
+
gasUsed: Hex.Hex;
|
|
19
25
|
/** Logs emitted by this frame. */
|
|
20
|
-
logs: readonly
|
|
26
|
+
logs: readonly FrameLog[];
|
|
21
27
|
/** Final state gas used. */
|
|
22
28
|
stateGasUsed: Hex.Hex;
|
|
23
29
|
/** Zero for failure, one for success, or two for a skipped frame. */
|
|
@@ -25,19 +31,19 @@ export type Rpc = {
|
|
|
25
31
|
};
|
|
26
32
|
/** Frame execution status. */
|
|
27
33
|
export type Status = 'reverted' | 'skipped' | 'success';
|
|
28
|
-
/**
|
|
29
|
-
export type RpcStatus =
|
|
34
|
+
/** Hex JSON-RPC frame execution status. */
|
|
35
|
+
export type RpcStatus = '0x0' | '0x1' | '0x2';
|
|
30
36
|
/** RPC status to status mapping. */
|
|
31
37
|
export declare const fromRpcStatus: {
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
38
|
+
readonly '0x0': "reverted";
|
|
39
|
+
readonly '0x1': "success";
|
|
40
|
+
readonly '0x2': "skipped";
|
|
35
41
|
};
|
|
36
42
|
/** Status to RPC status mapping. */
|
|
37
43
|
export declare const toRpcStatus: {
|
|
38
|
-
readonly reverted:
|
|
39
|
-
readonly skipped:
|
|
40
|
-
readonly success:
|
|
44
|
+
readonly reverted: "0x0";
|
|
45
|
+
readonly skipped: "0x2";
|
|
46
|
+
readonly success: "0x1";
|
|
41
47
|
};
|
|
42
48
|
/**
|
|
43
49
|
* Converts an RPC frame receipt to a {@link ox#FrameReceipt.FrameReceipt}.
|
|
@@ -50,9 +56,10 @@ export declare const toRpcStatus: {
|
|
|
50
56
|
*
|
|
51
57
|
* const receipt = FrameReceipt.fromRpc({
|
|
52
58
|
* executionGasUsed: '0x5208',
|
|
59
|
+
* gasUsed: '0x5208',
|
|
53
60
|
* logs: [],
|
|
54
61
|
* stateGasUsed: '0x0',
|
|
55
|
-
* status:
|
|
62
|
+
* status: '0x1'
|
|
56
63
|
* })
|
|
57
64
|
* ```
|
|
58
65
|
*
|
|
@@ -74,19 +81,21 @@ export declare namespace fromRpc {
|
|
|
74
81
|
*
|
|
75
82
|
* const receipt = FrameReceipt.fromRpc({
|
|
76
83
|
* executionGasUsed: '0x5208',
|
|
84
|
+
* gasUsed: '0x5208',
|
|
77
85
|
* logs: [],
|
|
78
86
|
* stateGasUsed: '0x0',
|
|
79
|
-
* status:
|
|
87
|
+
* status: '0x1'
|
|
80
88
|
* })
|
|
81
89
|
* const rpc = FrameReceipt.toRpc(receipt)
|
|
82
90
|
* ```
|
|
83
91
|
*
|
|
84
92
|
* @param receipt - The frame receipt. Gas accepts hex, bigint, or number values.
|
|
85
|
-
* @returns The RPC frame receipt with hex gas and a
|
|
93
|
+
* @returns The RPC frame receipt with hex gas and a hex status.
|
|
86
94
|
*/
|
|
87
95
|
export declare function toRpc(receipt: toRpc.Input): Rpc;
|
|
88
96
|
export declare namespace toRpc {
|
|
89
97
|
type Input = FrameReceipt<Hex.Hex | bigint | number>;
|
|
90
98
|
type ErrorType = Hex.fromNumber.ErrorType | Errors.GlobalErrorType;
|
|
91
99
|
}
|
|
100
|
+
export {};
|
|
92
101
|
//# sourceMappingURL=FrameReceipt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameReceipt.d.ts","sourceRoot":"","sources":["../../src/core/FrameReceipt.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BAA4B;IAC5B,YAAY,EAAE,GAAG,CAAC,GAAG,CAAA;IACrB,qEAAqE;IACrE,MAAM,EAAE,SAAS,CAAA;CAClB,CAAA;AAED,8BAA8B;AAC9B,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,CAAA;AAEvD,2CAA2C;AAC3C,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAA;AAE7C,oCAAoC;AACpC,eAAO,MAAM,aAAa;;;;CAIhB,CAAA;AAEV,oCAAoC;AACpC,eAAO,MAAM,WAAW;;;;CAId,CAAA;AAEV;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,GAAG,YAAY,CAQlD;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAK,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACjE;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,GAAG,GAAG,CAQ/C;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,KAAK,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC,CAAA;IAEpD,KAAK,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACnE"}
|
|
@@ -2,15 +2,15 @@ import * as Hex from './Hex.js';
|
|
|
2
2
|
import * as Quantity from './internal/quantity.js';
|
|
3
3
|
/** RPC status to status mapping. */
|
|
4
4
|
export const fromRpcStatus = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
'0x0': 'reverted',
|
|
6
|
+
'0x1': 'success',
|
|
7
|
+
'0x2': 'skipped',
|
|
8
8
|
};
|
|
9
9
|
/** Status to RPC status mapping. */
|
|
10
10
|
export const toRpcStatus = {
|
|
11
|
-
reverted:
|
|
12
|
-
skipped:
|
|
13
|
-
success:
|
|
11
|
+
reverted: '0x0',
|
|
12
|
+
skipped: '0x2',
|
|
13
|
+
success: '0x1',
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Converts an RPC frame receipt to a {@link ox#FrameReceipt.FrameReceipt}.
|
|
@@ -23,9 +23,10 @@ export const toRpcStatus = {
|
|
|
23
23
|
*
|
|
24
24
|
* const receipt = FrameReceipt.fromRpc({
|
|
25
25
|
* executionGasUsed: '0x5208',
|
|
26
|
+
* gasUsed: '0x5208',
|
|
26
27
|
* logs: [],
|
|
27
28
|
* stateGasUsed: '0x0',
|
|
28
|
-
* status:
|
|
29
|
+
* status: '0x1'
|
|
29
30
|
* })
|
|
30
31
|
* ```
|
|
31
32
|
*
|
|
@@ -34,7 +35,8 @@ export const toRpcStatus = {
|
|
|
34
35
|
*/
|
|
35
36
|
export function fromRpc(receipt) {
|
|
36
37
|
return {
|
|
37
|
-
|
|
38
|
+
executionGasUsed: Hex.toBigInt(receipt.executionGasUsed),
|
|
39
|
+
gasUsed: Hex.toBigInt(receipt.gasUsed),
|
|
38
40
|
logs: receipt.logs,
|
|
39
41
|
stateGasUsed: Hex.toBigInt(receipt.stateGasUsed),
|
|
40
42
|
status: fromRpcStatus[receipt.status],
|
|
@@ -51,19 +53,21 @@ export function fromRpc(receipt) {
|
|
|
51
53
|
*
|
|
52
54
|
* const receipt = FrameReceipt.fromRpc({
|
|
53
55
|
* executionGasUsed: '0x5208',
|
|
56
|
+
* gasUsed: '0x5208',
|
|
54
57
|
* logs: [],
|
|
55
58
|
* stateGasUsed: '0x0',
|
|
56
|
-
* status:
|
|
59
|
+
* status: '0x1'
|
|
57
60
|
* })
|
|
58
61
|
* const rpc = FrameReceipt.toRpc(receipt)
|
|
59
62
|
* ```
|
|
60
63
|
*
|
|
61
64
|
* @param receipt - The frame receipt. Gas accepts hex, bigint, or number values.
|
|
62
|
-
* @returns The RPC frame receipt with hex gas and a
|
|
65
|
+
* @returns The RPC frame receipt with hex gas and a hex status.
|
|
63
66
|
*/
|
|
64
67
|
export function toRpc(receipt) {
|
|
65
68
|
return {
|
|
66
|
-
executionGasUsed: Quantity.fromNumberish(receipt.
|
|
69
|
+
executionGasUsed: Quantity.fromNumberish(receipt.executionGasUsed),
|
|
70
|
+
gasUsed: Quantity.fromNumberish(receipt.gasUsed),
|
|
67
71
|
logs: receipt.logs,
|
|
68
72
|
stateGasUsed: Quantity.fromNumberish(receipt.stateGasUsed),
|
|
69
73
|
status: toRpcStatus[receipt.status],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameReceipt.js","sourceRoot":"","sources":["../../src/core/FrameReceipt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"FrameReceipt.js","sourceRoot":"","sources":["../../src/core/FrameReceipt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAA;AA2ClD,oCAAoC;AACpC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,KAAK,EAAE,UAAU;IACjB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACR,CAAA;AAEV,oCAAoC;AACpC,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,KAAK;CACN,CAAA;AAEV;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,OAAO,CAAC,OAAY;IAClC,OAAO;QACL,gBAAgB,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC;QACxD,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC;QACtC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC;QAChD,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;KACtC,CAAA;AACH,CAAC;AAMD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,KAAK,CAAC,OAAoB;IACxC,OAAO;QACL,gBAAgB,EAAE,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC;QAClE,OAAO,EAAE,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC;QAChD,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,YAAY,EAAE,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,YAAY,CAAC;QAC1D,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC;KACpC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as Frame from './Frame.js';
|
|
2
|
+
import type { Compute, PartialBy } from './internal/types.js';
|
|
3
|
+
/** A frame request whose omitted gas limits are estimated by the node. */
|
|
4
|
+
export type FrameRequest<bigintType = bigint> = Frame.Frame<bigintType>;
|
|
5
|
+
/** JSON-RPC frame request. Only the execution mode is required. */
|
|
6
|
+
export type Rpc = Compute<PartialBy<Frame.Rpc, Exclude<keyof Frame.Rpc, 'mode'>>>;
|
|
7
|
+
/**
|
|
8
|
+
* Converts an RPC frame request, preserving omitted gas limits for node estimation.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts twoslash
|
|
12
|
+
* import { FrameRequest } from 'ox'
|
|
13
|
+
*
|
|
14
|
+
* const frame = FrameRequest.fromRpc({
|
|
15
|
+
* mode: '0x2',
|
|
16
|
+
* stateGas: '0x0'
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param frame - The RPC frame request.
|
|
21
|
+
* @returns The decoded request with omitted gas limits preserved.
|
|
22
|
+
*/
|
|
23
|
+
export declare function fromRpc(frame: Rpc): FrameRequest;
|
|
24
|
+
export declare namespace fromRpc {
|
|
25
|
+
type ErrorType = Frame.fromRpc.ErrorType;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Converts a frame request to RPC fields without filling omitted gas limits.
|
|
29
|
+
*
|
|
30
|
+
* Explicit zero limits remain zero. Omitted mode, flags, value, and data use frame defaults.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts twoslash
|
|
34
|
+
* import { FrameRequest } from 'ox'
|
|
35
|
+
*
|
|
36
|
+
* const frame = FrameRequest.toRpc({
|
|
37
|
+
* mode: 'sender',
|
|
38
|
+
* stateGas: 0n
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param frame - The frame request. Gas and value accept hex, bigint, or number values.
|
|
43
|
+
* @returns The RPC request with omitted gas limits preserved.
|
|
44
|
+
*/
|
|
45
|
+
export declare function toRpc(frame: toRpc.Input): Rpc;
|
|
46
|
+
export declare namespace toRpc {
|
|
47
|
+
type Input = Frame.toRpc.Input;
|
|
48
|
+
type ErrorType = Frame.toRpc.ErrorType;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=FrameRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrameRequest.d.ts","sourceRoot":"","sources":["../../src/core/FrameRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE7D,0EAA0E;AAC1E,MAAM,MAAM,YAAY,CAAC,UAAU,GAAG,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;AAEvE,mEAAmE;AACnE,MAAM,MAAM,GAAG,GAAG,OAAO,CACvB,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CACvD,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,YAAY,CAchD;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAK,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAA;CACzC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,GAAG,CAO7C;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,KAAK,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAA;IAC9B,KAAK,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,SAAS,CAAA;CACvC"}
|