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.
Files changed (216) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +4 -4
  3. package/TxEnvelope/package.json +6 -0
  4. package/TxEnvelopeEip1559/package.json +6 -0
  5. package/TxEnvelopeEip2930/package.json +6 -0
  6. package/TxEnvelopeEip4844/package.json +6 -0
  7. package/TxEnvelopeEip7702/package.json +6 -0
  8. package/TxEnvelopeLegacy/package.json +6 -0
  9. package/_cjs/core/{TransactionEnvelope.js → TxEnvelope.js} +1 -1
  10. package/_cjs/core/TxEnvelope.js.map +1 -0
  11. package/_cjs/core/{TransactionEnvelopeEip1559.js → TxEnvelopeEip1559.js} +2 -2
  12. package/_cjs/core/TxEnvelopeEip1559.js.map +1 -0
  13. package/_cjs/core/{TransactionEnvelopeEip2930.js → TxEnvelopeEip2930.js} +2 -2
  14. package/_cjs/core/TxEnvelopeEip2930.js.map +1 -0
  15. package/_cjs/core/{TransactionEnvelopeEip4844.js → TxEnvelopeEip4844.js} +4 -4
  16. package/_cjs/core/TxEnvelopeEip4844.js.map +1 -0
  17. package/_cjs/core/{TransactionEnvelopeEip7702.js → TxEnvelopeEip7702.js} +4 -4
  18. package/_cjs/core/TxEnvelopeEip7702.js.map +1 -0
  19. package/_cjs/core/{TransactionEnvelopeLegacy.js → TxEnvelopeLegacy.js} +2 -2
  20. package/_cjs/core/TxEnvelopeLegacy.js.map +1 -0
  21. package/_cjs/core/WebAuthnP256.js +1 -1
  22. package/_cjs/core/WebAuthnP256.js.map +1 -1
  23. package/_cjs/erc8021/Attribution.js +36 -6
  24. package/_cjs/erc8021/Attribution.js.map +1 -1
  25. package/_cjs/index.docs.js +1 -0
  26. package/_cjs/index.docs.js.map +1 -1
  27. package/_cjs/index.js +7 -7
  28. package/_cjs/index.js.map +1 -1
  29. package/_cjs/tempo/AuthorizationTempo.js +101 -0
  30. package/_cjs/tempo/AuthorizationTempo.js.map +1 -0
  31. package/_cjs/tempo/KeyAuthorization.js +123 -0
  32. package/_cjs/tempo/KeyAuthorization.js.map +1 -0
  33. package/_cjs/tempo/PoolId.js +10 -0
  34. package/_cjs/tempo/PoolId.js.map +1 -0
  35. package/_cjs/tempo/SignatureEnvelope.js +394 -0
  36. package/_cjs/tempo/SignatureEnvelope.js.map +1 -0
  37. package/_cjs/tempo/Tick.js +77 -0
  38. package/_cjs/tempo/Tick.js.map +1 -0
  39. package/_cjs/tempo/TokenId.js +28 -0
  40. package/_cjs/tempo/TokenId.js.map +1 -0
  41. package/_cjs/tempo/TokenRole.js +26 -0
  42. package/_cjs/tempo/TokenRole.js.map +1 -0
  43. package/_cjs/tempo/Transaction.js +80 -0
  44. package/_cjs/tempo/Transaction.js.map +1 -0
  45. package/_cjs/tempo/TransactionReceipt.js +26 -0
  46. package/_cjs/tempo/TransactionReceipt.js.map +1 -0
  47. package/_cjs/tempo/TransactionRequest.js +53 -0
  48. package/_cjs/tempo/TransactionRequest.js.map +1 -0
  49. package/_cjs/tempo/TxEnvelopeTempo.js +267 -0
  50. package/_cjs/tempo/TxEnvelopeTempo.js.map +1 -0
  51. package/_cjs/tempo/index.js +15 -0
  52. package/_cjs/tempo/index.js.map +1 -0
  53. package/_cjs/version.js +1 -1
  54. package/_esm/core/Blobs.js +8 -8
  55. package/_esm/core/{TransactionEnvelope.js → TxEnvelope.js} +11 -11
  56. package/_esm/core/TxEnvelope.js.map +1 -0
  57. package/_esm/core/{TransactionEnvelopeEip1559.js → TxEnvelopeEip1559.js} +42 -42
  58. package/_esm/core/TxEnvelopeEip1559.js.map +1 -0
  59. package/_esm/core/{TransactionEnvelopeEip2930.js → TxEnvelopeEip2930.js} +43 -43
  60. package/_esm/core/TxEnvelopeEip2930.js.map +1 -0
  61. package/_esm/core/{TransactionEnvelopeEip4844.js → TxEnvelopeEip4844.js} +42 -42
  62. package/_esm/core/TxEnvelopeEip4844.js.map +1 -0
  63. package/_esm/core/{TransactionEnvelopeEip7702.js → TxEnvelopeEip7702.js} +40 -40
  64. package/_esm/core/TxEnvelopeEip7702.js.map +1 -0
  65. package/_esm/core/{TransactionEnvelopeLegacy.js → TxEnvelopeLegacy.js} +42 -42
  66. package/_esm/core/TxEnvelopeLegacy.js.map +1 -0
  67. package/_esm/core/WebAuthnP256.js +1 -1
  68. package/_esm/core/WebAuthnP256.js.map +1 -1
  69. package/_esm/erc8021/Attribution.js +58 -13
  70. package/_esm/erc8021/Attribution.js.map +1 -1
  71. package/_esm/index.docs.js +1 -0
  72. package/_esm/index.docs.js.map +1 -1
  73. package/_esm/index.js +192 -192
  74. package/_esm/index.js.map +1 -1
  75. package/_esm/tempo/AuthorizationTempo.js +664 -0
  76. package/_esm/tempo/AuthorizationTempo.js.map +1 -0
  77. package/_esm/tempo/KeyAuthorization.js +426 -0
  78. package/_esm/tempo/KeyAuthorization.js.map +1 -0
  79. package/_esm/tempo/PoolId.js +28 -0
  80. package/_esm/tempo/PoolId.js.map +1 -0
  81. package/_esm/tempo/SignatureEnvelope.js +660 -0
  82. package/_esm/tempo/SignatureEnvelope.js.map +1 -0
  83. package/_esm/tempo/Tick.js +147 -0
  84. package/_esm/tempo/Tick.js.map +1 -0
  85. package/_esm/tempo/TokenId.js +71 -0
  86. package/_esm/tempo/TokenId.js.map +1 -0
  87. package/_esm/tempo/TokenRole.js +40 -0
  88. package/_esm/tempo/TokenRole.js.map +1 -0
  89. package/_esm/tempo/Transaction.js +167 -0
  90. package/_esm/tempo/Transaction.js.map +1 -0
  91. package/_esm/tempo/TransactionReceipt.js +138 -0
  92. package/_esm/tempo/TransactionReceipt.js.map +1 -0
  93. package/_esm/tempo/TransactionRequest.js +99 -0
  94. package/_esm/tempo/TransactionRequest.js.map +1 -0
  95. package/_esm/tempo/TxEnvelopeTempo.js +607 -0
  96. package/_esm/tempo/TxEnvelopeTempo.js.map +1 -0
  97. package/_esm/tempo/index.js +298 -0
  98. package/_esm/tempo/index.js.map +1 -0
  99. package/_esm/version.js +1 -1
  100. package/_types/core/Blobs.d.ts +8 -8
  101. package/_types/core/{TransactionEnvelope.d.ts → TxEnvelope.d.ts} +11 -11
  102. package/_types/core/TxEnvelope.d.ts.map +1 -0
  103. package/_types/core/{TransactionEnvelopeEip1559.d.ts → TxEnvelopeEip1559.d.ts} +54 -54
  104. package/_types/core/TxEnvelopeEip1559.d.ts.map +1 -0
  105. package/_types/core/{TransactionEnvelopeEip2930.d.ts → TxEnvelopeEip2930.d.ts} +55 -55
  106. package/_types/core/TxEnvelopeEip2930.d.ts.map +1 -0
  107. package/_types/core/{TransactionEnvelopeEip4844.d.ts → TxEnvelopeEip4844.d.ts} +54 -54
  108. package/_types/core/TxEnvelopeEip4844.d.ts.map +1 -0
  109. package/_types/core/{TransactionEnvelopeEip7702.d.ts → TxEnvelopeEip7702.d.ts} +49 -49
  110. package/_types/core/TxEnvelopeEip7702.d.ts.map +1 -0
  111. package/_types/core/{TransactionEnvelopeLegacy.d.ts → TxEnvelopeLegacy.d.ts} +54 -54
  112. package/_types/core/TxEnvelopeLegacy.d.ts.map +1 -0
  113. package/_types/core/WebAuthnP256.d.ts +1 -1
  114. package/_types/core/WebAuthnP256.d.ts.map +1 -1
  115. package/_types/erc8021/Attribution.d.ts +20 -6
  116. package/_types/erc8021/Attribution.d.ts.map +1 -1
  117. package/_types/index.d.ts +192 -192
  118. package/_types/index.d.ts.map +1 -1
  119. package/_types/index.docs.d.ts +1 -0
  120. package/_types/index.docs.d.ts.map +1 -1
  121. package/_types/tempo/AuthorizationTempo.d.ts +688 -0
  122. package/_types/tempo/AuthorizationTempo.d.ts.map +1 -0
  123. package/_types/tempo/KeyAuthorization.d.ts +437 -0
  124. package/_types/tempo/KeyAuthorization.d.ts.map +1 -0
  125. package/_types/tempo/PoolId.d.ts +33 -0
  126. package/_types/tempo/PoolId.d.ts.map +1 -0
  127. package/_types/tempo/SignatureEnvelope.d.ts +438 -0
  128. package/_types/tempo/SignatureEnvelope.d.ts.map +1 -0
  129. package/_types/tempo/Tick.d.ts +120 -0
  130. package/_types/tempo/Tick.d.ts.map +1 -0
  131. package/_types/tempo/TokenId.d.ts +55 -0
  132. package/_types/tempo/TokenId.d.ts.map +1 -0
  133. package/_types/tempo/TokenRole.d.ts +29 -0
  134. package/_types/tempo/TokenRole.d.ts.map +1 -0
  135. package/_types/tempo/Transaction.d.ts +208 -0
  136. package/_types/tempo/Transaction.d.ts.map +1 -0
  137. package/_types/tempo/TransactionReceipt.d.ts +165 -0
  138. package/_types/tempo/TransactionReceipt.d.ts.map +1 -0
  139. package/_types/tempo/TransactionRequest.d.ts +89 -0
  140. package/_types/tempo/TransactionRequest.d.ts.map +1 -0
  141. package/_types/tempo/TxEnvelopeTempo.d.ts +551 -0
  142. package/_types/tempo/TxEnvelopeTempo.d.ts.map +1 -0
  143. package/_types/tempo/index.d.ts +300 -0
  144. package/_types/tempo/index.d.ts.map +1 -0
  145. package/_types/version.d.ts +1 -1
  146. package/core/Blobs.ts +8 -8
  147. package/core/{TransactionEnvelope.ts → TxEnvelope.ts} +10 -10
  148. package/core/{TransactionEnvelopeEip1559.ts → TxEnvelopeEip1559.ts} +60 -69
  149. package/core/{TransactionEnvelopeEip2930.ts → TxEnvelopeEip2930.ts} +61 -72
  150. package/core/{TransactionEnvelopeEip4844.ts → TxEnvelopeEip4844.ts} +62 -71
  151. package/core/{TransactionEnvelopeEip7702.ts → TxEnvelopeEip7702.ts} +58 -67
  152. package/core/{TransactionEnvelopeLegacy.ts → TxEnvelopeLegacy.ts} +59 -68
  153. package/core/WebAuthnP256.ts +3 -1
  154. package/erc8021/Attribution.ts +77 -15
  155. package/index.docs.ts +1 -0
  156. package/index.ts +192 -195
  157. package/package.json +91 -31
  158. package/tempo/AuthorizationTempo/package.json +6 -0
  159. package/tempo/AuthorizationTempo.test.ts +1293 -0
  160. package/tempo/AuthorizationTempo.ts +884 -0
  161. package/tempo/KeyAuthorization/package.json +6 -0
  162. package/tempo/KeyAuthorization.test.ts +1373 -0
  163. package/tempo/KeyAuthorization.ts +622 -0
  164. package/tempo/PoolId/package.json +6 -0
  165. package/tempo/PoolId.test.ts +33 -0
  166. package/tempo/PoolId.ts +42 -0
  167. package/tempo/SignatureEnvelope/package.json +6 -0
  168. package/tempo/SignatureEnvelope.test.ts +1877 -0
  169. package/tempo/SignatureEnvelope.ts +973 -0
  170. package/tempo/Tick/package.json +6 -0
  171. package/tempo/Tick.test.ts +281 -0
  172. package/tempo/Tick.ts +186 -0
  173. package/tempo/TokenId/package.json +6 -0
  174. package/tempo/TokenId.test.ts +40 -0
  175. package/tempo/TokenId.ts +80 -0
  176. package/tempo/TokenRole/package.json +6 -0
  177. package/tempo/TokenRole.test.ts +16 -0
  178. package/tempo/TokenRole.ts +45 -0
  179. package/tempo/Transaction/package.json +6 -0
  180. package/tempo/Transaction.test.ts +523 -0
  181. package/tempo/Transaction.ts +339 -0
  182. package/tempo/TransactionReceipt/package.json +6 -0
  183. package/tempo/TransactionReceipt.ts +200 -0
  184. package/tempo/TransactionRequest/package.json +6 -0
  185. package/tempo/TransactionRequest.ts +160 -0
  186. package/tempo/TxEnvelopeTempo/package.json +6 -0
  187. package/tempo/TxEnvelopeTempo.test.ts +1371 -0
  188. package/tempo/TxEnvelopeTempo.ts +972 -0
  189. package/tempo/e2e.test.ts +1387 -0
  190. package/tempo/index.ts +308 -0
  191. package/tempo/package.json +6 -0
  192. package/version.ts +1 -1
  193. package/TransactionEnvelope/package.json +0 -6
  194. package/TransactionEnvelopeEip1559/package.json +0 -6
  195. package/TransactionEnvelopeEip2930/package.json +0 -6
  196. package/TransactionEnvelopeEip4844/package.json +0 -6
  197. package/TransactionEnvelopeEip7702/package.json +0 -6
  198. package/TransactionEnvelopeLegacy/package.json +0 -6
  199. package/_cjs/core/TransactionEnvelope.js.map +0 -1
  200. package/_cjs/core/TransactionEnvelopeEip1559.js.map +0 -1
  201. package/_cjs/core/TransactionEnvelopeEip2930.js.map +0 -1
  202. package/_cjs/core/TransactionEnvelopeEip4844.js.map +0 -1
  203. package/_cjs/core/TransactionEnvelopeEip7702.js.map +0 -1
  204. package/_cjs/core/TransactionEnvelopeLegacy.js.map +0 -1
  205. package/_esm/core/TransactionEnvelope.js.map +0 -1
  206. package/_esm/core/TransactionEnvelopeEip1559.js.map +0 -1
  207. package/_esm/core/TransactionEnvelopeEip2930.js.map +0 -1
  208. package/_esm/core/TransactionEnvelopeEip4844.js.map +0 -1
  209. package/_esm/core/TransactionEnvelopeEip7702.js.map +0 -1
  210. package/_esm/core/TransactionEnvelopeLegacy.js.map +0 -1
  211. package/_types/core/TransactionEnvelope.d.ts.map +0 -1
  212. package/_types/core/TransactionEnvelopeEip1559.d.ts.map +0 -1
  213. package/_types/core/TransactionEnvelopeEip2930.d.ts.map +0 -1
  214. package/_types/core/TransactionEnvelopeEip4844.d.ts.map +0 -1
  215. package/_types/core/TransactionEnvelopeEip7702.d.ts.map +0 -1
  216. package/_types/core/TransactionEnvelopeLegacy.d.ts.map +0 -1
@@ -0,0 +1,437 @@
1
+ import type * as Address from '../core/Address.js';
2
+ import type * as Errors from '../core/Errors.js';
3
+ import * as Hash from '../core/Hash.js';
4
+ import * as Hex from '../core/Hex.js';
5
+ import type { Compute } from '../core/internal/types.js';
6
+ import * as Rlp from '../core/Rlp.js';
7
+ import * as SignatureEnvelope from './SignatureEnvelope.js';
8
+ /**
9
+ * Key authorization for provisioning access keys.
10
+ *
11
+ * Access keys allow a root key (e.g., a passkey) to delegate transaction signing to secondary
12
+ * keys with customizable permissions including expiry timestamps and per-TIP-20 token spending
13
+ * limits. This enables a user to sign transactions without repeated passkey prompts.
14
+ *
15
+ * The root key signs a `KeyAuthorization` to grant an access key permission to sign transactions
16
+ * on its behalf. The authorization is attached to a transaction (which can be signed by the access
17
+ * key itself), and the protocol validates the authorization before storing the key in the
18
+ * AccountKeychain precompile.
19
+ *
20
+ * Key authorization fields:
21
+ * - `address`: Address derived from the access key's public key (the "key ID")
22
+ * - `chainId`: Chain ID for replay protection (0 = valid on any chain)
23
+ * - `expiry`: Unix timestamp when the key expires (undefined = never expires)
24
+ * - `limits`: Per-TIP-20 token spending limits (only applies to `transfer()` and `approve()` calls)
25
+ * - `type`: Key type (`secp256k1`, `p256`, or `webAuthn`)
26
+ *
27
+ * [Access Keys Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#access-keys)
28
+ */
29
+ export type KeyAuthorization<signed extends boolean = boolean, bigintType = bigint, numberType = number> = {
30
+ /** Address derived from the public key of the key type. */
31
+ address: Address.Address;
32
+ /** Chain ID for replay protection (0 = valid on any chain). */
33
+ chainId?: bigintType | undefined;
34
+ /** Unix timestamp when key expires (0 = never expires). */
35
+ expiry?: numberType | undefined;
36
+ /** TIP20 spending limits for this key. */
37
+ limits?: readonly TokenLimit<bigintType>[] | undefined;
38
+ /** Key type. (secp256k1, P256, WebAuthn). */
39
+ type: SignatureEnvelope.Type;
40
+ } & (signed extends true ? {
41
+ signature: SignatureEnvelope.SignatureEnvelope<bigintType, numberType>;
42
+ } : {
43
+ signature?: SignatureEnvelope.SignatureEnvelope<bigintType, numberType> | undefined;
44
+ });
45
+ /** RPC representation of an {@link ox#KeyAuthorization.KeyAuthorization}. */
46
+ export type Rpc = Omit<KeyAuthorization<false, Hex.Hex, Hex.Hex>, 'address' | 'signature' | 'type'> & {
47
+ keyId: Address.Address;
48
+ keyType: SignatureEnvelope.Type;
49
+ signature: SignatureEnvelope.SignatureEnvelopeRpc;
50
+ };
51
+ /** Signed representation of a Key Authorization. */
52
+ export type Signed<bigintType = bigint, numberType = number> = KeyAuthorization<true, bigintType, numberType>;
53
+ type BaseTuple = readonly [
54
+ chainId: Hex.Hex,
55
+ keyType: Hex.Hex,
56
+ keyId: Address.Address
57
+ ];
58
+ /** Tuple representation of a Key Authorization. */
59
+ export type Tuple<signed extends boolean = boolean> = signed extends true ? readonly [
60
+ authorization: BaseTuple | readonly [...BaseTuple, expiry: Hex.Hex] | readonly [
61
+ ...BaseTuple,
62
+ expiry: Hex.Hex,
63
+ limits: readonly [token: Address.Address, limit: Hex.Hex][]
64
+ ],
65
+ signature: Hex.Hex
66
+ ] : readonly [
67
+ authorization: BaseTuple | readonly [...BaseTuple, expiry: Hex.Hex] | readonly [
68
+ ...BaseTuple,
69
+ expiry: Hex.Hex,
70
+ limits: readonly [token: Address.Address, limit: Hex.Hex][]
71
+ ]
72
+ ];
73
+ /**
74
+ * Token spending limit for access keys.
75
+ *
76
+ * Defines a per-TIP-20 token spending limit for an access key. Limits deplete as tokens
77
+ * are spent and can be updated by the root key via `updateSpendingLimit()`.
78
+ *
79
+ * [Access Keys Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#access-keys)
80
+ */
81
+ export type TokenLimit<bigintType = bigint> = {
82
+ /** Address of the TIP-20 token. */
83
+ token: Address.Address;
84
+ /** Maximum spending amount for this token (enforced over the key's lifetime). */
85
+ limit: bigintType;
86
+ };
87
+ /**
88
+ * Converts a Key Authorization object into a typed {@link ox#KeyAuthorization.KeyAuthorization}.
89
+ *
90
+ * Use this to create an unsigned key authorization, then sign it with the root key using
91
+ * {@link ox#KeyAuthorization.(getSignPayload:function)} and attach the signature. The signed authorization
92
+ * can be included in a {@link ox#TxEnvelopeTempo.TxEnvelopeTempo} via the
93
+ * `keyAuthorization` field to provision the access key on-chain.
94
+ *
95
+ * [Access Keys Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#access-keys)
96
+ *
97
+ * @example
98
+ * ### Secp256k1 Key
99
+ *
100
+ * Standard Ethereum ECDSA key using the secp256k1 curve.
101
+ *
102
+ * ```ts twoslash
103
+ * import { Address, Secp256k1, Value } from 'ox'
104
+ * import { KeyAuthorization } from 'ox/tempo'
105
+ *
106
+ * const privateKey = Secp256k1.randomPrivateKey()
107
+ * const address = Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey }))
108
+ *
109
+ * const authorization = KeyAuthorization.from({
110
+ * address,
111
+ * expiry: 1234567890,
112
+ * type: 'secp256k1',
113
+ * limits: [{
114
+ * token: '0x20c0000000000000000000000000000000000001',
115
+ * limit: Value.from('10', 6),
116
+ * }],
117
+ * })
118
+ * ```
119
+ *
120
+ * @example
121
+ * ### WebCryptoP256 Key
122
+ *
123
+ * ```ts twoslash
124
+ * import { Address, WebCryptoP256, Value } from 'ox'
125
+ * import { KeyAuthorization } from 'ox/tempo'
126
+ *
127
+ * const keyPair = await WebCryptoP256.createKeyPair()
128
+ * const address = Address.fromPublicKey(keyPair.publicKey)
129
+ *
130
+ * const authorization = KeyAuthorization.from({
131
+ * address,
132
+ * expiry: 1234567890,
133
+ * type: 'p256',
134
+ * limits: [{
135
+ * token: '0x20c0000000000000000000000000000000000001',
136
+ * limit: Value.from('10', 6),
137
+ * }],
138
+ * })
139
+ * ```
140
+ *
141
+ * @example
142
+ * ### Attaching Signatures (Secp256k1)
143
+ *
144
+ * Attach a signature to a Key Authorization using a Secp256k1 private key to
145
+ * authorize another Secp256k1 key on the account.
146
+ *
147
+ * ```ts twoslash
148
+ * import { Address, Secp256k1, Value } from 'ox'
149
+ * import { KeyAuthorization } from 'ox/tempo'
150
+ *
151
+ * const privateKey = '0x...'
152
+ * const address = Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey }))
153
+ *
154
+ * const authorization = KeyAuthorization.from({
155
+ * address,
156
+ * expiry: 1234567890,
157
+ * type: 'secp256k1',
158
+ * limits: [{
159
+ * token: '0x20c0000000000000000000000000000000000001',
160
+ * limit: Value.from('10', 6),
161
+ * }],
162
+ * })
163
+ *
164
+ * const rootPrivateKey = '0x...'
165
+ * const signature = Secp256k1.sign({
166
+ * payload: KeyAuthorization.getSignPayload(authorization),
167
+ * privateKey: rootPrivateKey,
168
+ * })
169
+ *
170
+ * const authorization_signed = KeyAuthorization.from(authorization, { signature })
171
+ * ```
172
+ *
173
+ * @example
174
+ * ### Attaching Signatures (WebAuthn)
175
+ *
176
+ * Attach a signature to a Key Authorization using a WebAuthn credential to
177
+ * authorize a new WebCryptoP256 key on the account.
178
+ *
179
+ * ```ts twoslash
180
+ * // @noErrors
181
+ * import { Address, Value, WebCryptoP256, WebAuthnP256 } from 'ox'
182
+ * import { KeyAuthorization, SignatureEnvelope } from 'ox/tempo'
183
+ *
184
+ * const keyPair = await WebCryptoP256.createKeyPair()
185
+ * const address = Address.fromPublicKey(keyPair.publicKey)
186
+ *
187
+ * const authorization = KeyAuthorization.from({
188
+ * address,
189
+ * expiry: 1234567890,
190
+ * type: 'p256',
191
+ * limits: [{
192
+ * token: '0x20c0000000000000000000000000000000000001',
193
+ * limit: Value.from('10', 6),
194
+ * }],
195
+ * })
196
+ *
197
+ * const credential = await WebAuthnP256.createCredential({ name: 'Example' })
198
+ *
199
+ * const { metadata, signature } = await WebAuthnP256.sign({
200
+ * challenge: KeyAuthorization.getSignPayload(authorization),
201
+ * credentialId: credential.id,
202
+ * })
203
+ *
204
+ * const signatureEnvelope = SignatureEnvelope.from({ // [!code focus]
205
+ * signature, // [!code focus]
206
+ * publicKey: credential.publicKey, // [!code focus]
207
+ * metadata, // [!code focus]
208
+ * })
209
+ * const authorization_signed = KeyAuthorization.from(
210
+ * authorization,
211
+ * { signature: signatureEnvelope }, // [!code focus]
212
+ * )
213
+ * ```
214
+ *
215
+ * @param authorization - A Key Authorization tuple in object format.
216
+ * @param options - Key Authorization options.
217
+ * @returns The {@link ox#KeyAuthorization.KeyAuthorization}.
218
+ */
219
+ export declare function from<const authorization extends KeyAuthorization | Rpc, const signature extends SignatureEnvelope.from.Value | undefined = undefined>(authorization: authorization | KeyAuthorization, options?: from.Options<signature>): from.ReturnType<authorization, signature>;
220
+ export declare namespace from {
221
+ type Options<signature extends SignatureEnvelope.from.Value | undefined = SignatureEnvelope.from.Value | undefined> = {
222
+ /** The {@link ox#SignatureEnvelope.SignatureEnvelope} to attach to the Key Authorization. */
223
+ signature?: signature | SignatureEnvelope.SignatureEnvelope | undefined;
224
+ };
225
+ type ReturnType<authorization extends KeyAuthorization | Rpc = KeyAuthorization, signature extends SignatureEnvelope.from.Value | undefined = SignatureEnvelope.from.Value | undefined> = Compute<authorization extends Rpc ? Signed : authorization & (signature extends SignatureEnvelope.from.Value ? {
226
+ signature: SignatureEnvelope.from.ReturnValue<signature>;
227
+ } : {})>;
228
+ type ErrorType = Errors.GlobalErrorType;
229
+ }
230
+ /**
231
+ * Converts an {@link ox#AuthorizationTempo.Rpc} to an {@link ox#AuthorizationTempo.AuthorizationTempo}.
232
+ *
233
+ * @example
234
+ * ```ts twoslash
235
+ * import { KeyAuthorization } from 'ox/tempo'
236
+ *
237
+ * const keyAuthorization = KeyAuthorization.fromRpc({
238
+ * expiry: '0x174876e800',
239
+ * keyId: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
240
+ * keyType: 'secp256k1',
241
+ * limits: [{ token: '0x20c0000000000000000000000000000000000001', limit: '0xf4240' }],
242
+ * signature: {
243
+ * type: 'secp256k1',
244
+ * r: '0x635dc2033e60185bb36709c29c75d64ea51dfbd91c32ef4be198e4ceb169fb4d',
245
+ * s: '0x50c2667ac4c771072746acfdcf1f1483336dcca8bd2df47cd83175dbe60f0540',
246
+ * yParity: '0x0'
247
+ * },
248
+ * })
249
+ * ```
250
+ *
251
+ * @param authorization - The RPC-formatted Key Authorization.
252
+ * @returns A signed {@link ox#AuthorizationTempo.AuthorizationTempo}.
253
+ */
254
+ export declare function fromRpc(authorization: Rpc): Signed;
255
+ export declare namespace fromRpc {
256
+ type ErrorType = Errors.GlobalErrorType;
257
+ }
258
+ /**
259
+ * Converts an {@link ox#KeyAuthorization.Tuple} to an {@link ox#KeyAuthorization.KeyAuthorization}.
260
+ *
261
+ * @example
262
+ * ```ts twoslash
263
+ * import { KeyAuthorization } from 'ox/tempo'
264
+ *
265
+ * const authorization = KeyAuthorization.fromTuple([
266
+ * [
267
+ * '0x',
268
+ * '0x00',
269
+ * '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
270
+ * '0x174876e800',
271
+ * [['0x20c0000000000000000000000000000000000001', '0xf4240']],
272
+ * ],
273
+ * '0x01a068a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b907e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064',
274
+ * ])
275
+ * ```
276
+ *
277
+ * @example
278
+ * Unsigned Key Authorization tuple (no signature):
279
+ *
280
+ * ```ts twoslash
281
+ * import { KeyAuthorization } from 'ox/tempo'
282
+ *
283
+ * const authorization = KeyAuthorization.fromTuple([
284
+ * [
285
+ * '0x',
286
+ * '0x00',
287
+ * '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
288
+ * '0x174876e800',
289
+ * [['0x20c0000000000000000000000000000000000001', '0xf4240']],
290
+ * ],
291
+ * ])
292
+ * ```
293
+ *
294
+ * @param tuple - The Key Authorization tuple.
295
+ * @returns The {@link ox#KeyAuthorization.KeyAuthorization}.
296
+ */
297
+ export declare function fromTuple<const tuple extends Tuple>(tuple: tuple): fromTuple.ReturnType<tuple>;
298
+ export declare namespace fromTuple {
299
+ type ReturnType<authorization extends Tuple = Tuple> = Compute<KeyAuthorization<authorization extends Tuple<true> ? true : false>>;
300
+ type ErrorType = Errors.GlobalErrorType;
301
+ }
302
+ /**
303
+ * Computes the sign payload for an {@link ox#KeyAuthorization.KeyAuthorization}.
304
+ *
305
+ * The root key must sign this payload to authorize the access key. The resulting signature
306
+ * is attached to the key authorization via {@link ox#KeyAuthorization.(from:function)} with the
307
+ * `signature` option.
308
+ *
309
+ * [Access Keys Specification](https://docs.tempo.xyz/protocol/transactions/spec-tempo-transaction#access-keys)
310
+ *
311
+ * @example
312
+ * ```ts twoslash
313
+ * import { Address, Secp256k1, Value } from 'ox'
314
+ * import { KeyAuthorization } from 'ox/tempo'
315
+ *
316
+ * const privateKey = '0x...'
317
+ * const address = Address.fromPublicKey(Secp256k1.getPublicKey({ privateKey }))
318
+ *
319
+ * const authorization = KeyAuthorization.from({
320
+ * address,
321
+ * expiry: 1234567890,
322
+ * type: 'secp256k1',
323
+ * limits: [{
324
+ * token: '0x20c0000000000000000000000000000000000001',
325
+ * limit: Value.from('10', 6),
326
+ * }],
327
+ * })
328
+ *
329
+ * const payload = KeyAuthorization.getSignPayload(authorization) // [!code focus]
330
+ * ```
331
+ *
332
+ * @param authorization - The {@link ox#KeyAuthorization.KeyAuthorization}.
333
+ * @returns The sign payload.
334
+ */
335
+ export declare function getSignPayload(authorization: KeyAuthorization): Hex.Hex;
336
+ export declare namespace getSignPayload {
337
+ type ErrorType = hash.ErrorType | Errors.GlobalErrorType;
338
+ }
339
+ /**
340
+ * Computes the hash for an {@link ox#KeyAuthorization.KeyAuthorization}.
341
+ *
342
+ * @example
343
+ * ```ts twoslash
344
+ * import { KeyAuthorization } from 'ox/tempo'
345
+ * import { Value } from 'ox'
346
+ *
347
+ * const authorization = KeyAuthorization.from({
348
+ * expiry: 1234567890,
349
+ * address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
350
+ * type: 'secp256k1',
351
+ * limits: [{
352
+ * token: '0x20c0000000000000000000000000000000000001',
353
+ * limit: Value.from('10', 6)
354
+ * }],
355
+ * })
356
+ *
357
+ * const hash = KeyAuthorization.hash(authorization) // [!code focus]
358
+ * ```
359
+ *
360
+ * @param authorization - The {@link ox#KeyAuthorization.KeyAuthorization}.
361
+ * @returns The hash.
362
+ */
363
+ export declare function hash(authorization: KeyAuthorization): Hex.Hex;
364
+ export declare namespace hash {
365
+ type ErrorType = toTuple.ErrorType | Hash.keccak256.ErrorType | Hex.concat.ErrorType | Rlp.fromHex.ErrorType | Errors.GlobalErrorType;
366
+ }
367
+ /**
368
+ * Converts an {@link ox#KeyAuthorization.KeyAuthorization} to an {@link ox#KeyAuthorization.Rpc}.
369
+ *
370
+ * @example
371
+ * ```ts twoslash
372
+ * import { KeyAuthorization } from 'ox/tempo'
373
+ * import { Value } from 'ox'
374
+ *
375
+ * const authorization = KeyAuthorization.toRpc({
376
+ * expiry: 1234567890,
377
+ * address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
378
+ * type: 'secp256k1',
379
+ * limits: [{
380
+ * token: '0x20c0000000000000000000000000000000000001',
381
+ * limit: Value.from('10', 6)
382
+ * }],
383
+ * signature: {
384
+ * type: 'secp256k1',
385
+ * signature: {
386
+ * r: 44944627813007772897391531230081695102703289123332187696115181104739239197517n,
387
+ * s: 36528503505192438307355164441104001310566505351980369085208178712678799181120n,
388
+ * yParity: 0,
389
+ * },
390
+ * },
391
+ * })
392
+ * ```
393
+ *
394
+ * @param authorization - A Key Authorization.
395
+ * @returns An RPC-formatted Key Authorization.
396
+ */
397
+ export declare function toRpc(authorization: Signed): Rpc;
398
+ export declare namespace toRpc {
399
+ type ErrorType = Errors.GlobalErrorType;
400
+ }
401
+ /**
402
+ * Converts an {@link ox#KeyAuthorization.KeyAuthorization} to an {@link ox#KeyAuthorization.Tuple}.
403
+ *
404
+ * @example
405
+ * ```ts twoslash
406
+ * import { KeyAuthorization } from 'ox/tempo'
407
+ * import { Value } from 'ox'
408
+ *
409
+ * const authorization = KeyAuthorization.from({
410
+ * expiry: 1234567890,
411
+ * address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
412
+ * type: 'secp256k1',
413
+ * limits: [{
414
+ * token: '0x20c0000000000000000000000000000000000001',
415
+ * limit: Value.from('10', 6)
416
+ * }],
417
+ * })
418
+ *
419
+ * const tuple = KeyAuthorization.toTuple(authorization) // [!code focus]
420
+ * // @log: [
421
+ * // @log: '0x174876e800',
422
+ * // @log: [['0x20c0000000000000000000000000000000000001', '0xf4240']],
423
+ * // @log: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
424
+ * // @log: 'secp256k1',
425
+ * // @log: ]
426
+ * ```
427
+ *
428
+ * @param authorization - The {@link ox#KeyAuthorization.KeyAuthorization}.
429
+ * @returns A Tempo Key Authorization tuple.
430
+ */
431
+ export declare function toTuple<const authorization extends KeyAuthorization>(authorization: authorization): toTuple.ReturnType<authorization>;
432
+ export declare namespace toTuple {
433
+ type ReturnType<authorization extends KeyAuthorization = KeyAuthorization> = Compute<Tuple<authorization extends KeyAuthorization<true> ? true : false>>;
434
+ type ErrorType = Errors.GlobalErrorType;
435
+ }
436
+ export {};
437
+ //# sourceMappingURL=KeyAuthorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KeyAuthorization.d.ts","sourceRoot":"","sources":["../../tempo/KeyAuthorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,gBAAgB,CAC1B,MAAM,SAAS,OAAO,GAAG,OAAO,EAChC,UAAU,GAAG,MAAM,EACnB,UAAU,GAAG,MAAM,IACjB;IACF,2DAA2D;IAC3D,OAAO,EAAE,OAAO,CAAC,OAAO,CAAA;IACxB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAChC,2DAA2D;IAC3D,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAC/B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,SAAS,UAAU,CAAC,UAAU,CAAC,EAAE,GAAG,SAAS,CAAA;IACtD,6CAA6C;IAC7C,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAA;CAC7B,GAAG,CAAC,MAAM,SAAS,IAAI,GACpB;IAAE,SAAS,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;CAAE,GAC1E;IACE,SAAS,CAAC,E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,GAAG,MAAM,CAAC,eAAe,CAAA;CACzD;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,IAAI,CAAC,aAAa,EAAE,gBAAgB,GAAG,GAAG,CAAC,GAAG,CAI7D;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,KAAK,SAAS,GACV,OAAO,CAAC,SAAS,GACjB,IAAI,CAAC,SAAS,CAAC,SAAS,GACxB,GAAG,CAAC,MAAM,CAAC,SAAS,GACpB,GAAG,CAAC,OAAO,CAAC,SAAS,GACrB,MAAM,CAAC,eAAe,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,KAAK,CAAC,aAAa,EAAE,MAAM,GAAG,GAAG,CAqBhD;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,KAAK,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACxC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,OAAO,CAAC,KAAK,CAAC,aAAa,SAAS,gBAAgB,EAClE,aAAa,EAAE,aAAa,GAC3B,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC,CA0BnC;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAK,UAAU,CAAC,aAAa,SAAS,gBAAgB,GAAG,gBAAgB,IACvE,OAAO,CAAC,KAAK,CAAC,aAAa,SAAS,gBAAgB,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,CAAC,CAAA;IAE7E,KAAK,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACxC"}
@@ -0,0 +1,33 @@
1
+ import * as Hex from '../core/Hex.js';
2
+ import * as TokenId from './TokenId.js';
3
+ /**
4
+ * Converts a user token and validator token to a pool ID.
5
+ *
6
+ * Pool IDs are deterministic keys derived from two token addresses (order-independent)
7
+ * used to identify trading pairs on Tempo's enshrined stablecoin DEX.
8
+ *
9
+ * [Stablecoin DEX Specification](https://docs.tempo.xyz/protocol/exchange/spec)
10
+ *
11
+ * @example
12
+ * ```ts twoslash
13
+ * import { PoolId } from 'ox/tempo'
14
+ *
15
+ * const poolId = PoolId.from({
16
+ * userToken: 1n,
17
+ * validatorToken: 2n,
18
+ * })
19
+ * ```
20
+ *
21
+ * @param value - User token and validator token.
22
+ * @returns The pool ID.
23
+ */
24
+ export declare function from(value: from.Value): Hex.Hex;
25
+ export declare namespace from {
26
+ type Value = {
27
+ /** User token. */
28
+ userToken: TokenId.TokenIdOrAddress;
29
+ /** Validator token. */
30
+ validatorToken: TokenId.TokenIdOrAddress;
31
+ };
32
+ }
33
+ //# sourceMappingURL=PoolId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PoolId.d.ts","sourceRoot":"","sources":["../../tempo/PoolId.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAO/C;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,KAAY,KAAK,GAAG;QAClB,kBAAkB;QAClB,SAAS,EAAE,OAAO,CAAC,gBAAgB,CAAA;QACnC,uBAAuB;QACvB,cAAc,EAAE,OAAO,CAAC,gBAAgB,CAAA;KACzC,CAAA;CACF"}