ox 0.9.16 → 0.10.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 +27 -0
- package/README.md +4 -4
- package/TxEnvelope/package.json +6 -0
- package/TxEnvelopeEip1559/package.json +6 -0
- package/TxEnvelopeEip2930/package.json +6 -0
- package/TxEnvelopeEip4844/package.json +6 -0
- package/TxEnvelopeEip7702/package.json +6 -0
- package/TxEnvelopeLegacy/package.json +6 -0
- package/_cjs/core/{TransactionEnvelope.js → TxEnvelope.js} +1 -1
- package/_cjs/core/TxEnvelope.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeEip1559.js → TxEnvelopeEip1559.js} +2 -2
- package/_cjs/core/TxEnvelopeEip1559.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeEip2930.js → TxEnvelopeEip2930.js} +2 -2
- package/_cjs/core/TxEnvelopeEip2930.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeEip4844.js → TxEnvelopeEip4844.js} +4 -4
- package/_cjs/core/TxEnvelopeEip4844.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeEip7702.js → TxEnvelopeEip7702.js} +4 -4
- package/_cjs/core/TxEnvelopeEip7702.js.map +1 -0
- package/_cjs/core/{TransactionEnvelopeLegacy.js → TxEnvelopeLegacy.js} +2 -2
- package/_cjs/core/TxEnvelopeLegacy.js.map +1 -0
- package/_cjs/core/WebAuthnP256.js +1 -1
- package/_cjs/core/WebAuthnP256.js.map +1 -1
- package/_cjs/erc8021/Attribution.js +36 -6
- package/_cjs/erc8021/Attribution.js.map +1 -1
- package/_cjs/index.docs.js +1 -0
- package/_cjs/index.docs.js.map +1 -1
- package/_cjs/index.js +7 -7
- package/_cjs/index.js.map +1 -1
- package/_cjs/tempo/AuthorizationTempo.js +101 -0
- package/_cjs/tempo/AuthorizationTempo.js.map +1 -0
- package/_cjs/tempo/KeyAuthorization.js +123 -0
- package/_cjs/tempo/KeyAuthorization.js.map +1 -0
- package/_cjs/tempo/PoolId.js +10 -0
- package/_cjs/tempo/PoolId.js.map +1 -0
- package/_cjs/tempo/SignatureEnvelope.js +394 -0
- package/_cjs/tempo/SignatureEnvelope.js.map +1 -0
- package/_cjs/tempo/Tick.js +77 -0
- package/_cjs/tempo/Tick.js.map +1 -0
- package/_cjs/tempo/TokenId.js +28 -0
- package/_cjs/tempo/TokenId.js.map +1 -0
- package/_cjs/tempo/TokenRole.js +26 -0
- package/_cjs/tempo/TokenRole.js.map +1 -0
- package/_cjs/tempo/Transaction.js +80 -0
- package/_cjs/tempo/Transaction.js.map +1 -0
- package/_cjs/tempo/TransactionReceipt.js +26 -0
- package/_cjs/tempo/TransactionReceipt.js.map +1 -0
- package/_cjs/tempo/TransactionRequest.js +53 -0
- package/_cjs/tempo/TransactionRequest.js.map +1 -0
- package/_cjs/tempo/TxEnvelopeTempo.js +267 -0
- package/_cjs/tempo/TxEnvelopeTempo.js.map +1 -0
- package/_cjs/tempo/index.js +15 -0
- package/_cjs/tempo/index.js.map +1 -0
- package/_cjs/version.js +1 -1
- package/_esm/core/Blobs.js +8 -8
- package/_esm/core/{TransactionEnvelope.js → TxEnvelope.js} +11 -11
- package/_esm/core/TxEnvelope.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeEip1559.js → TxEnvelopeEip1559.js} +42 -42
- package/_esm/core/TxEnvelopeEip1559.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeEip2930.js → TxEnvelopeEip2930.js} +43 -43
- package/_esm/core/TxEnvelopeEip2930.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeEip4844.js → TxEnvelopeEip4844.js} +42 -42
- package/_esm/core/TxEnvelopeEip4844.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeEip7702.js → TxEnvelopeEip7702.js} +40 -40
- package/_esm/core/TxEnvelopeEip7702.js.map +1 -0
- package/_esm/core/{TransactionEnvelopeLegacy.js → TxEnvelopeLegacy.js} +42 -42
- package/_esm/core/TxEnvelopeLegacy.js.map +1 -0
- package/_esm/core/WebAuthnP256.js +1 -1
- package/_esm/core/WebAuthnP256.js.map +1 -1
- package/_esm/erc8021/Attribution.js +58 -13
- package/_esm/erc8021/Attribution.js.map +1 -1
- package/_esm/index.docs.js +1 -0
- package/_esm/index.docs.js.map +1 -1
- package/_esm/index.js +192 -192
- package/_esm/index.js.map +1 -1
- package/_esm/tempo/AuthorizationTempo.js +664 -0
- package/_esm/tempo/AuthorizationTempo.js.map +1 -0
- package/_esm/tempo/KeyAuthorization.js +426 -0
- package/_esm/tempo/KeyAuthorization.js.map +1 -0
- package/_esm/tempo/PoolId.js +28 -0
- package/_esm/tempo/PoolId.js.map +1 -0
- package/_esm/tempo/SignatureEnvelope.js +660 -0
- package/_esm/tempo/SignatureEnvelope.js.map +1 -0
- package/_esm/tempo/Tick.js +147 -0
- package/_esm/tempo/Tick.js.map +1 -0
- package/_esm/tempo/TokenId.js +71 -0
- package/_esm/tempo/TokenId.js.map +1 -0
- package/_esm/tempo/TokenRole.js +40 -0
- package/_esm/tempo/TokenRole.js.map +1 -0
- package/_esm/tempo/Transaction.js +167 -0
- package/_esm/tempo/Transaction.js.map +1 -0
- package/_esm/tempo/TransactionReceipt.js +138 -0
- package/_esm/tempo/TransactionReceipt.js.map +1 -0
- package/_esm/tempo/TransactionRequest.js +99 -0
- package/_esm/tempo/TransactionRequest.js.map +1 -0
- package/_esm/tempo/TxEnvelopeTempo.js +607 -0
- package/_esm/tempo/TxEnvelopeTempo.js.map +1 -0
- package/_esm/tempo/index.js +298 -0
- package/_esm/tempo/index.js.map +1 -0
- package/_esm/version.js +1 -1
- package/_types/core/Blobs.d.ts +8 -8
- package/_types/core/{TransactionEnvelope.d.ts → TxEnvelope.d.ts} +11 -11
- package/_types/core/TxEnvelope.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeEip1559.d.ts → TxEnvelopeEip1559.d.ts} +54 -54
- package/_types/core/TxEnvelopeEip1559.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeEip2930.d.ts → TxEnvelopeEip2930.d.ts} +55 -55
- package/_types/core/TxEnvelopeEip2930.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeEip4844.d.ts → TxEnvelopeEip4844.d.ts} +54 -54
- package/_types/core/TxEnvelopeEip4844.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeEip7702.d.ts → TxEnvelopeEip7702.d.ts} +49 -49
- package/_types/core/TxEnvelopeEip7702.d.ts.map +1 -0
- package/_types/core/{TransactionEnvelopeLegacy.d.ts → TxEnvelopeLegacy.d.ts} +54 -54
- package/_types/core/TxEnvelopeLegacy.d.ts.map +1 -0
- package/_types/core/WebAuthnP256.d.ts +1 -1
- package/_types/core/WebAuthnP256.d.ts.map +1 -1
- package/_types/erc8021/Attribution.d.ts +20 -6
- package/_types/erc8021/Attribution.d.ts.map +1 -1
- package/_types/index.d.ts +192 -192
- package/_types/index.d.ts.map +1 -1
- package/_types/index.docs.d.ts +1 -0
- package/_types/index.docs.d.ts.map +1 -1
- package/_types/tempo/AuthorizationTempo.d.ts +688 -0
- package/_types/tempo/AuthorizationTempo.d.ts.map +1 -0
- package/_types/tempo/KeyAuthorization.d.ts +437 -0
- package/_types/tempo/KeyAuthorization.d.ts.map +1 -0
- package/_types/tempo/PoolId.d.ts +33 -0
- package/_types/tempo/PoolId.d.ts.map +1 -0
- package/_types/tempo/SignatureEnvelope.d.ts +438 -0
- package/_types/tempo/SignatureEnvelope.d.ts.map +1 -0
- package/_types/tempo/Tick.d.ts +120 -0
- package/_types/tempo/Tick.d.ts.map +1 -0
- package/_types/tempo/TokenId.d.ts +55 -0
- package/_types/tempo/TokenId.d.ts.map +1 -0
- package/_types/tempo/TokenRole.d.ts +29 -0
- package/_types/tempo/TokenRole.d.ts.map +1 -0
- package/_types/tempo/Transaction.d.ts +208 -0
- package/_types/tempo/Transaction.d.ts.map +1 -0
- package/_types/tempo/TransactionReceipt.d.ts +165 -0
- package/_types/tempo/TransactionReceipt.d.ts.map +1 -0
- package/_types/tempo/TransactionRequest.d.ts +89 -0
- package/_types/tempo/TransactionRequest.d.ts.map +1 -0
- package/_types/tempo/TxEnvelopeTempo.d.ts +551 -0
- package/_types/tempo/TxEnvelopeTempo.d.ts.map +1 -0
- package/_types/tempo/index.d.ts +300 -0
- package/_types/tempo/index.d.ts.map +1 -0
- package/_types/version.d.ts +1 -1
- package/core/Blobs.ts +8 -8
- package/core/{TransactionEnvelope.ts → TxEnvelope.ts} +10 -10
- package/core/{TransactionEnvelopeEip1559.ts → TxEnvelopeEip1559.ts} +60 -69
- package/core/{TransactionEnvelopeEip2930.ts → TxEnvelopeEip2930.ts} +61 -72
- package/core/{TransactionEnvelopeEip4844.ts → TxEnvelopeEip4844.ts} +62 -71
- package/core/{TransactionEnvelopeEip7702.ts → TxEnvelopeEip7702.ts} +58 -67
- package/core/{TransactionEnvelopeLegacy.ts → TxEnvelopeLegacy.ts} +59 -68
- package/core/WebAuthnP256.ts +3 -1
- package/erc8021/Attribution.ts +77 -15
- package/index.docs.ts +1 -0
- package/index.ts +192 -195
- package/package.json +91 -31
- package/tempo/AuthorizationTempo/package.json +6 -0
- package/tempo/AuthorizationTempo.test.ts +1293 -0
- package/tempo/AuthorizationTempo.ts +884 -0
- package/tempo/KeyAuthorization/package.json +6 -0
- package/tempo/KeyAuthorization.test.ts +1373 -0
- package/tempo/KeyAuthorization.ts +622 -0
- package/tempo/PoolId/package.json +6 -0
- package/tempo/PoolId.test.ts +33 -0
- package/tempo/PoolId.ts +42 -0
- package/tempo/SignatureEnvelope/package.json +6 -0
- package/tempo/SignatureEnvelope.test.ts +1877 -0
- package/tempo/SignatureEnvelope.ts +973 -0
- package/tempo/Tick/package.json +6 -0
- package/tempo/Tick.test.ts +281 -0
- package/tempo/Tick.ts +186 -0
- package/tempo/TokenId/package.json +6 -0
- package/tempo/TokenId.test.ts +40 -0
- package/tempo/TokenId.ts +80 -0
- package/tempo/TokenRole/package.json +6 -0
- package/tempo/TokenRole.test.ts +16 -0
- package/tempo/TokenRole.ts +45 -0
- package/tempo/Transaction/package.json +6 -0
- package/tempo/Transaction.test.ts +523 -0
- package/tempo/Transaction.ts +339 -0
- package/tempo/TransactionReceipt/package.json +6 -0
- package/tempo/TransactionReceipt.ts +200 -0
- package/tempo/TransactionRequest/package.json +6 -0
- package/tempo/TransactionRequest.ts +160 -0
- package/tempo/TxEnvelopeTempo/package.json +6 -0
- package/tempo/TxEnvelopeTempo.test.ts +1371 -0
- package/tempo/TxEnvelopeTempo.ts +972 -0
- package/tempo/e2e.test.ts +1387 -0
- package/tempo/index.ts +308 -0
- package/tempo/package.json +6 -0
- package/version.ts +1 -1
- package/TransactionEnvelope/package.json +0 -6
- package/TransactionEnvelopeEip1559/package.json +0 -6
- package/TransactionEnvelopeEip2930/package.json +0 -6
- package/TransactionEnvelopeEip4844/package.json +0 -6
- package/TransactionEnvelopeEip7702/package.json +0 -6
- package/TransactionEnvelopeLegacy/package.json +0 -6
- package/_cjs/core/TransactionEnvelope.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeEip1559.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeEip2930.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeEip4844.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeEip7702.js.map +0 -1
- package/_cjs/core/TransactionEnvelopeLegacy.js.map +0 -1
- package/_esm/core/TransactionEnvelope.js.map +0 -1
- package/_esm/core/TransactionEnvelopeEip1559.js.map +0 -1
- package/_esm/core/TransactionEnvelopeEip2930.js.map +0 -1
- package/_esm/core/TransactionEnvelopeEip4844.js.map +0 -1
- package/_esm/core/TransactionEnvelopeEip7702.js.map +0 -1
- package/_esm/core/TransactionEnvelopeLegacy.js.map +0 -1
- package/_types/core/TransactionEnvelope.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeEip1559.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeEip2930.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeEip4844.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeEip7702.d.ts.map +0 -1
- package/_types/core/TransactionEnvelopeLegacy.d.ts.map +0 -1
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/** @entrypointCategory Tempo */
|
|
2
|
+
export type {};
|
|
3
|
+
/**
|
|
4
|
+
* Utilities for Tempo-flavoured EIP-7702 authorizations.
|
|
5
|
+
*
|
|
6
|
+
* Tempo extends EIP-7702 to support more signature types (secp256k1, P256, and WebAuthn),
|
|
7
|
+
* enabling passkey-based account delegation. Authorizations delegate an account to a specified
|
|
8
|
+
* implementation contract.
|
|
9
|
+
*
|
|
10
|
+
* [Tempo Authorization Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#tempo-authorization-list)
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts twoslash
|
|
14
|
+
* import { Secp256k1 } from 'ox'
|
|
15
|
+
* import { AuthorizationTempo } from 'ox/tempo'
|
|
16
|
+
*
|
|
17
|
+
* const authorization = AuthorizationTempo.from({
|
|
18
|
+
* address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
|
|
19
|
+
* chainId: 1,
|
|
20
|
+
* nonce: 40n,
|
|
21
|
+
* })
|
|
22
|
+
*
|
|
23
|
+
* const payload = AuthorizationTempo.getSignPayload(authorization)
|
|
24
|
+
*
|
|
25
|
+
* const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
|
|
26
|
+
*
|
|
27
|
+
* const authorization_signed = AuthorizationTempo.from(
|
|
28
|
+
* authorization,
|
|
29
|
+
* { signature }
|
|
30
|
+
* )
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @category Reference
|
|
34
|
+
*/
|
|
35
|
+
export * as AuthorizationTempo from './AuthorizationTempo.js';
|
|
36
|
+
/**
|
|
37
|
+
* Tempo key authorization utilities for provisioning and signing access keys.
|
|
38
|
+
*
|
|
39
|
+
* Access keys allow a root key (e.g., a passkey) to delegate transaction signing to secondary
|
|
40
|
+
* keys with customizable permissions including expiry timestamps and per-TIP-20 token spending
|
|
41
|
+
* limits. This enables a user to sign transactions without repeated passkey prompts.
|
|
42
|
+
*
|
|
43
|
+
* [Access Keys Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#access-keys)
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts twoslash
|
|
47
|
+
* import { KeyAuthorization, SignatureEnvelope } from 'ox/tempo'
|
|
48
|
+
* import { Address, Secp256k1, WebCryptoP256, Value } from 'ox'
|
|
49
|
+
*
|
|
50
|
+
* const keyPair = await WebCryptoP256.createKeyPair()
|
|
51
|
+
* const address = Address.fromPublicKey(keyPair.publicKey)
|
|
52
|
+
*
|
|
53
|
+
* const authorization = KeyAuthorization.from({
|
|
54
|
+
* address,
|
|
55
|
+
* expiry: 1234567890,
|
|
56
|
+
* type: 'p256',
|
|
57
|
+
* limits: [{
|
|
58
|
+
* token: '0x20c0000000000000000000000000000000000001',
|
|
59
|
+
* limit: Value.from('10', 6),
|
|
60
|
+
* }],
|
|
61
|
+
* })
|
|
62
|
+
*
|
|
63
|
+
* const privateKey = '0x...'
|
|
64
|
+
* const payload = KeyAuthorization.getSignPayload(authorization)
|
|
65
|
+
* const signature = SignatureEnvelope.from(
|
|
66
|
+
* Secp256k1.sign({ payload, privateKey }),
|
|
67
|
+
* )
|
|
68
|
+
*
|
|
69
|
+
* KeyAuthorization.from(authorization, { signature })
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* @category Reference
|
|
73
|
+
*/
|
|
74
|
+
export * as KeyAuthorization from './KeyAuthorization.js';
|
|
75
|
+
/**
|
|
76
|
+
* Pool ID utilities for computing pool identifiers from token pairs.
|
|
77
|
+
*
|
|
78
|
+
* Pool IDs are deterministic keys derived from two token addresses (order-independent)
|
|
79
|
+
* used to identify trading pairs on Tempo's enshrined stablecoin DEX.
|
|
80
|
+
*
|
|
81
|
+
* [Stablecoin DEX Specification](https://docs.tempo.xyz/protocol/exchange/spec)
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts twoslash
|
|
85
|
+
* import { PoolId } from 'ox/tempo'
|
|
86
|
+
*
|
|
87
|
+
* const poolId = PoolId.from({
|
|
88
|
+
* userToken: 1n,
|
|
89
|
+
* validatorToken: 2n,
|
|
90
|
+
* })
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @category Reference
|
|
94
|
+
*/
|
|
95
|
+
export * as PoolId from './PoolId.js';
|
|
96
|
+
/**
|
|
97
|
+
* Signature envelope utilities for secp256k1, P256, WebAuthn, and keychain signatures.
|
|
98
|
+
*
|
|
99
|
+
* Tempo transactions support multiple signature types: secp256k1 (65 bytes), P256 for passkeys
|
|
100
|
+
* (type `0x01`), WebAuthn (type `0x02`), and Keychain for access keys (type `0x03`).
|
|
101
|
+
*
|
|
102
|
+
* [Signature Types Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#signature-types)
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts twoslash
|
|
106
|
+
* import { Secp256k1 } from 'ox'
|
|
107
|
+
* import { SignatureEnvelope } from 'ox/tempo'
|
|
108
|
+
*
|
|
109
|
+
* const privateKey = Secp256k1.randomPrivateKey()
|
|
110
|
+
* const signature = Secp256k1.sign({ payload: '0xdeadbeef', privateKey })
|
|
111
|
+
*
|
|
112
|
+
* const envelope = SignatureEnvelope.from(signature)
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @category Reference
|
|
116
|
+
*/
|
|
117
|
+
export * as SignatureEnvelope from './SignatureEnvelope.js';
|
|
118
|
+
/**
|
|
119
|
+
* Tick-based pricing utilities for DEX price conversions.
|
|
120
|
+
*
|
|
121
|
+
* Prices on Tempo's stablecoin DEX are discretized into integer ticks with a tick size of 0.1 bps
|
|
122
|
+
* (where `price = PRICE_SCALE + tick` and `PRICE_SCALE = 100_000`). Orders must be placed at ticks
|
|
123
|
+
* divisible by `TICK_SPACING = 10` (1 bp grid), within bounds of ±2000 ticks (±2%).
|
|
124
|
+
*
|
|
125
|
+
* [Stablecoin DEX Pricing](https://docs.tempo.xyz/protocol/exchange/spec#key-concepts)
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```ts twoslash
|
|
129
|
+
* import { Tick } from 'ox/tempo'
|
|
130
|
+
*
|
|
131
|
+
* const price = Tick.toPrice(100) // "1.001" (0.1% above 1.0)
|
|
132
|
+
* const tick = Tick.fromPrice('0.999') // -100
|
|
133
|
+
* ```
|
|
134
|
+
*
|
|
135
|
+
* @category Reference
|
|
136
|
+
*/
|
|
137
|
+
export * as Tick from './Tick.js';
|
|
138
|
+
/**
|
|
139
|
+
* TIP-20 token ID utilities for converting between token IDs and addresses.
|
|
140
|
+
*
|
|
141
|
+
* TIP-20 is Tempo's native token standard for stablecoins with deterministic addresses
|
|
142
|
+
* derived from sequential token IDs. TIP-20 extends ERC-20 with payment features like
|
|
143
|
+
* configurable fee tokens, transfer memos, and built-in role-based access control.
|
|
144
|
+
*
|
|
145
|
+
* [TIP-20 Token Standard](https://docs.tempo.xyz/protocol/tip20/overview)
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```ts twoslash
|
|
149
|
+
* import { TokenId } from 'ox/tempo'
|
|
150
|
+
*
|
|
151
|
+
* const tokenId = TokenId.from(1n)
|
|
152
|
+
* const address = TokenId.toAddress(1n)
|
|
153
|
+
* // '0x20c0000000000000000000000000000000000001'
|
|
154
|
+
* ```
|
|
155
|
+
*
|
|
156
|
+
* @category Reference
|
|
157
|
+
*/
|
|
158
|
+
export * as TokenId from './TokenId.js';
|
|
159
|
+
/**
|
|
160
|
+
* Token role utilities for serializing role identifiers to keccak256 hashes.
|
|
161
|
+
*
|
|
162
|
+
* TIP-20 includes a built-in RBAC system with roles like `ISSUER_ROLE` (mint/burn),
|
|
163
|
+
* `PAUSE_ROLE`/`UNPAUSE_ROLE` (emergency controls), and `BURN_BLOCKED_ROLE` (compliance).
|
|
164
|
+
*
|
|
165
|
+
* [TIP-20 RBAC](https://docs.tempo.xyz/protocol/tip20/overview#role-based-access-control-rbac)
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts twoslash
|
|
169
|
+
* import { TokenRole } from 'ox/tempo'
|
|
170
|
+
*
|
|
171
|
+
* const hash = TokenRole.serialize('issuer')
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @category Reference
|
|
175
|
+
*/
|
|
176
|
+
export * as TokenRole from './TokenRole.js';
|
|
177
|
+
/**
|
|
178
|
+
* Utilities for converting between RPC and structured transaction formats.
|
|
179
|
+
*
|
|
180
|
+
* Tempo Transactions (type `0x76`) are a new EIP-2718 transaction type with native support
|
|
181
|
+
* for passkeys, call batching, fee sponsorship, parallelizable nonces, and scheduled execution.
|
|
182
|
+
*
|
|
183
|
+
* [Tempo Transactions](https://docs.tempo.xyz/protocol/transactions)
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts twoslash
|
|
187
|
+
* // @noErrors
|
|
188
|
+
* import { Transaction } from 'ox/tempo'
|
|
189
|
+
*
|
|
190
|
+
* const transaction = Transaction.fromRpc({
|
|
191
|
+
* hash: '0x353fdfc38a2f26115daadee9f5b8392ce62b84f410957967e2ed56b35338cdd0',
|
|
192
|
+
* nonce: '0x357',
|
|
193
|
+
* blockHash:
|
|
194
|
+
* '0xc350d807505fb835650f0013632c5515592987ba169bbc6626d9fc54d91f0f0b',
|
|
195
|
+
* blockNumber: '0x12f296f',
|
|
196
|
+
* calls: [
|
|
197
|
+
* {
|
|
198
|
+
* input: '0xdeadbeef',
|
|
199
|
+
* to: '0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad',
|
|
200
|
+
* value: '0x9b6e64a8ec60000',
|
|
201
|
+
* },
|
|
202
|
+
* ],
|
|
203
|
+
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
204
|
+
* transactionIndex: '0x2',
|
|
205
|
+
* from: '0x814e5e0e31016b9a7f138c76b7e7b2bb5c1ab6a6',
|
|
206
|
+
* value: '0x9b6e64a8ec60000',
|
|
207
|
+
* gas: '0x43f5d',
|
|
208
|
+
* maxFeePerGas: '0x2ca6ae494',
|
|
209
|
+
* maxPriorityFeePerGas: '0x41cc3c0',
|
|
210
|
+
* input:
|
|
211
|
+
* '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000006643504700000000000000000000000000000000000000000000000000000000000000040b080604000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002800000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec600000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000009b6e64a8ec60000000000000000000000000000000000000000000000000000019124bb5ae978c000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b80000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b8000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c00000000000000000000000000000000000000000000000000000000000000190000000000000000000000000000000000000000000000000000000000000060000000000000000000000000c56c7a0eaa804f854b536a5f3d5f49d2ec4b12b800000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000190240001b9872b',
|
|
212
|
+
* signature: {
|
|
213
|
+
* r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
|
|
214
|
+
* s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
|
|
215
|
+
* type: 'secp256k1',
|
|
216
|
+
* yParity: '0x0',
|
|
217
|
+
* },
|
|
218
|
+
* chainId: '0x1',
|
|
219
|
+
* accessList: [],
|
|
220
|
+
* type: '0x76',
|
|
221
|
+
* })
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* @category Reference
|
|
225
|
+
*/
|
|
226
|
+
export * as Transaction from './Transaction.js';
|
|
227
|
+
/**
|
|
228
|
+
* Utilities for working with Tempo transaction receipts.
|
|
229
|
+
*
|
|
230
|
+
* Tempo receipts include additional fields like `feePayer` (the address that paid fees)
|
|
231
|
+
* and `feeToken` (the TIP-20 token used for fee payment).
|
|
232
|
+
*
|
|
233
|
+
* [Tempo Transactions](https://docs.tempo.xyz/protocol/transactions)
|
|
234
|
+
*
|
|
235
|
+
* @example
|
|
236
|
+
* ```ts twoslash
|
|
237
|
+
* import { TransactionReceipt } from 'ox/tempo'
|
|
238
|
+
*
|
|
239
|
+
* const receipt = TransactionReceipt.fromRpc({
|
|
240
|
+
* status: '0x1',
|
|
241
|
+
* feePayer: '0x...',
|
|
242
|
+
* feeToken: '0x20c0000000000000000000000000000000000001',
|
|
243
|
+
* // ... other fields
|
|
244
|
+
* } as any)
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
247
|
+
* @category Reference
|
|
248
|
+
*/
|
|
249
|
+
export * as TransactionReceipt from './TransactionReceipt.js';
|
|
250
|
+
/**
|
|
251
|
+
* Utilities for preparing RPC-formatted transaction requests.
|
|
252
|
+
*
|
|
253
|
+
* Convert structured transaction requests to RPC format for submission to Tempo nodes,
|
|
254
|
+
* including support for batched calls and fee token specification.
|
|
255
|
+
*
|
|
256
|
+
* [Tempo Transactions](https://docs.tempo.xyz/protocol/transactions)
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```ts twoslash
|
|
260
|
+
* import { TransactionRequest } from 'ox/tempo'
|
|
261
|
+
*
|
|
262
|
+
* const request = TransactionRequest.toRpc({
|
|
263
|
+
* calls: [{ to: '0xcafebabecafebabecafebabecafebabecafebabe', data: '0xdeadbeef' }],
|
|
264
|
+
* feeToken: '0x20c0000000000000000000000000000000000000',
|
|
265
|
+
* })
|
|
266
|
+
* ```
|
|
267
|
+
*
|
|
268
|
+
* @category Reference
|
|
269
|
+
*/
|
|
270
|
+
export * as TransactionRequest from './TransactionRequest.js';
|
|
271
|
+
/**
|
|
272
|
+
* Utilities for instantiating, serializing, and hashing Tempo transaction envelopes.
|
|
273
|
+
*
|
|
274
|
+
* Create, sign, and serialize Tempo transactions with support for configurable fee tokens,
|
|
275
|
+
* call batching, fee sponsorship, access keys, and scheduled execution via `validAfter`/`validBefore`.
|
|
276
|
+
*
|
|
277
|
+
* [Tempo Transaction Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction)
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```ts twoslash
|
|
281
|
+
* import { Secp256k1, Value } from 'ox'
|
|
282
|
+
* import { TxEnvelopeTempo } from 'ox/tempo'
|
|
283
|
+
*
|
|
284
|
+
* const envelope = TxEnvelopeTempo.from({
|
|
285
|
+
* chainId: 1,
|
|
286
|
+
* calls: [{ to: '0x0000000000000000000000000000000000000000', data: '0xdeadbeef' }],
|
|
287
|
+
* maxFeePerGas: Value.fromGwei('10'),
|
|
288
|
+
* })
|
|
289
|
+
*
|
|
290
|
+
* const payload = TxEnvelopeTempo.getSignPayload(envelope)
|
|
291
|
+
* const signature = Secp256k1.sign({ payload, privateKey: '0x...' })
|
|
292
|
+
*
|
|
293
|
+
* const envelope_signed = TxEnvelopeTempo.from(envelope, { signature })
|
|
294
|
+
* const envelope_serialized = TxEnvelopeTempo.serialize(envelope_signed)
|
|
295
|
+
* ```
|
|
296
|
+
*
|
|
297
|
+
* @category Reference
|
|
298
|
+
*/
|
|
299
|
+
export * as TxEnvelopeTempo from './TxEnvelopeTempo.js';
|
|
300
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,YAAY,EAAE,CAAA;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA"}
|
package/_types/version.d.ts
CHANGED
package/core/Blobs.ts
CHANGED
|
@@ -52,7 +52,7 @@ export type BlobSidecar<
|
|
|
52
52
|
* @example
|
|
53
53
|
* ```ts twoslash
|
|
54
54
|
* // @noErrors
|
|
55
|
-
* import { Blobs } from '
|
|
55
|
+
* import { Blobs } from 'ox'
|
|
56
56
|
* import { kzg } from './kzg'
|
|
57
57
|
*
|
|
58
58
|
* const blobs = Blobs.from('0xdeadbeef')
|
|
@@ -68,7 +68,7 @@ export type BlobSidecar<
|
|
|
68
68
|
*
|
|
69
69
|
* ```ts twoslash
|
|
70
70
|
* // @noErrors
|
|
71
|
-
* import { Blobs } from '
|
|
71
|
+
* import { Blobs } from 'ox'
|
|
72
72
|
* import { kzg } from './kzg'
|
|
73
73
|
*
|
|
74
74
|
* const blobs = Blobs.from('0xdeadbeef')
|
|
@@ -86,7 +86,7 @@ export type BlobSidecar<
|
|
|
86
86
|
*
|
|
87
87
|
* ```ts twoslash
|
|
88
88
|
* // @noErrors
|
|
89
|
-
* import { Blobs } from '
|
|
89
|
+
* import { Blobs } from 'ox'
|
|
90
90
|
* import { kzg } from './kzg'
|
|
91
91
|
*
|
|
92
92
|
* const blobs = Blobs.from('0xdeadbeef')
|
|
@@ -162,7 +162,7 @@ export declare namespace commitmentsToVersionedHashes {
|
|
|
162
162
|
*
|
|
163
163
|
* ```ts twoslash
|
|
164
164
|
* // @noErrors
|
|
165
|
-
* import { Blobs } from '
|
|
165
|
+
* import { Blobs } from 'ox'
|
|
166
166
|
* import { kzg } from './kzg'
|
|
167
167
|
*
|
|
168
168
|
* const blobs = Blobs.from('0xdeadbeef')
|
|
@@ -180,7 +180,7 @@ export declare namespace commitmentsToVersionedHashes {
|
|
|
180
180
|
*
|
|
181
181
|
* ```ts twoslash
|
|
182
182
|
* // @noErrors
|
|
183
|
-
* import { Blobs } from '
|
|
183
|
+
* import { Blobs } from 'ox'
|
|
184
184
|
* import { kzg } from './kzg'
|
|
185
185
|
*
|
|
186
186
|
* const blobs = Blobs.from('0xdeadbeef')
|
|
@@ -368,7 +368,7 @@ export declare namespace from {
|
|
|
368
368
|
*
|
|
369
369
|
* ```ts twoslash
|
|
370
370
|
* // @noErrors
|
|
371
|
-
* import { Blobs } from '
|
|
371
|
+
* import { Blobs } from 'ox'
|
|
372
372
|
* import { kzg } from './kzg'
|
|
373
373
|
*
|
|
374
374
|
* const blobs = Blobs.from('0xdeadbeef')
|
|
@@ -386,7 +386,7 @@ export declare namespace from {
|
|
|
386
386
|
*
|
|
387
387
|
* ```ts twoslash
|
|
388
388
|
* // @noErrors
|
|
389
|
-
* import { Blobs } from '
|
|
389
|
+
* import { Blobs } from 'ox'
|
|
390
390
|
* import { kzg } from './kzg'
|
|
391
391
|
*
|
|
392
392
|
* const blobs = Blobs.from('0xdeadbeef')
|
|
@@ -662,7 +662,7 @@ export declare namespace toBytes {
|
|
|
662
662
|
* @example
|
|
663
663
|
* ```ts twoslash
|
|
664
664
|
* // @noErrors
|
|
665
|
-
* import { Blobs } from '
|
|
665
|
+
* import { Blobs } from 'ox'
|
|
666
666
|
* import { kzg } from './kzg'
|
|
667
667
|
*
|
|
668
668
|
* const blobs = Blobs.from('0xdeadbeef')
|
|
@@ -55,9 +55,9 @@ export type BaseSigned<type extends string = string> = Base<type, true>
|
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
57
|
* ```ts twoslash
|
|
58
|
-
* import {
|
|
58
|
+
* import { TxEnvelopeEip1559 } from 'ox'
|
|
59
59
|
*
|
|
60
|
-
*
|
|
60
|
+
* TxEnvelopeEip1559.assert({
|
|
61
61
|
* maxFeePerGas: 2n ** 256n - 1n + 1n,
|
|
62
62
|
* chainId: 1,
|
|
63
63
|
* })
|
|
@@ -84,9 +84,9 @@ export class FeeCapTooHighError extends Errors.BaseError {
|
|
|
84
84
|
*
|
|
85
85
|
* @example
|
|
86
86
|
* ```ts twoslash
|
|
87
|
-
* import {
|
|
87
|
+
* import { TxEnvelopeLegacy } from 'ox'
|
|
88
88
|
*
|
|
89
|
-
*
|
|
89
|
+
* TxEnvelopeLegacy.assert({
|
|
90
90
|
* gasPrice: 2n ** 256n - 1n + 1n,
|
|
91
91
|
* chainId: 1,
|
|
92
92
|
* })
|
|
@@ -113,9 +113,9 @@ export class GasPriceTooHighError extends Errors.BaseError {
|
|
|
113
113
|
*
|
|
114
114
|
* @example
|
|
115
115
|
* ```ts twoslash
|
|
116
|
-
* import {
|
|
116
|
+
* import { TxEnvelopeEip1559 } from 'ox'
|
|
117
117
|
*
|
|
118
|
-
*
|
|
118
|
+
* TxEnvelopeEip1559.assert({ chainId: 0 })
|
|
119
119
|
* // @error: TransactionEnvelope.InvalidChainIdError: Chain ID "0" is invalid.
|
|
120
120
|
* ```
|
|
121
121
|
*/
|
|
@@ -135,9 +135,9 @@ export class InvalidChainIdError extends Errors.BaseError {
|
|
|
135
135
|
*
|
|
136
136
|
* @example
|
|
137
137
|
* ```ts twoslash
|
|
138
|
-
* import {
|
|
138
|
+
* import { TxEnvelopeEip1559 } from 'ox'
|
|
139
139
|
*
|
|
140
|
-
*
|
|
140
|
+
* TxEnvelopeEip1559.deserialize('0x02c0')
|
|
141
141
|
* // @error: TransactionEnvelope.InvalidSerializedError: Invalid serialized transaction of type "eip1559" was provided.
|
|
142
142
|
* // @error: Serialized Transaction: "0x02c0"
|
|
143
143
|
* // @error: Missing Attributes: chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList
|
|
@@ -171,9 +171,9 @@ export class InvalidSerializedError extends Errors.BaseError {
|
|
|
171
171
|
*
|
|
172
172
|
* @example
|
|
173
173
|
* ```ts twoslash
|
|
174
|
-
* import {
|
|
174
|
+
* import { TxEnvelopeEip1559 } from 'ox'
|
|
175
175
|
*
|
|
176
|
-
*
|
|
176
|
+
* TxEnvelopeEip1559.assert({
|
|
177
177
|
* chainId: 1,
|
|
178
178
|
* maxFeePerGas: 10n,
|
|
179
179
|
* maxPriorityFeePerGas: 11n,
|