ox 0.14.16 → 0.14.17

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 (40) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/_cjs/tempo/TransactionRequest.js +10 -1
  3. package/_cjs/tempo/TransactionRequest.js.map +1 -1
  4. package/_cjs/tempo/ZoneId.js +13 -0
  5. package/_cjs/tempo/ZoneId.js.map +1 -0
  6. package/_cjs/tempo/ZoneRpcAuthentication.js +101 -0
  7. package/_cjs/tempo/ZoneRpcAuthentication.js.map +1 -0
  8. package/_cjs/tempo/index.js +3 -1
  9. package/_cjs/tempo/index.js.map +1 -1
  10. package/_cjs/version.js +1 -1
  11. package/_esm/tempo/TransactionRequest.js +10 -1
  12. package/_esm/tempo/TransactionRequest.js.map +1 -1
  13. package/_esm/tempo/ZoneId.js +47 -0
  14. package/_esm/tempo/ZoneId.js.map +1 -0
  15. package/_esm/tempo/ZoneRpcAuthentication.js +256 -0
  16. package/_esm/tempo/ZoneRpcAuthentication.js.map +1 -0
  17. package/_esm/tempo/index.js +55 -0
  18. package/_esm/tempo/index.js.map +1 -1
  19. package/_esm/version.js +1 -1
  20. package/_types/tempo/TransactionRequest.d.ts +6 -4
  21. package/_types/tempo/TransactionRequest.d.ts.map +1 -1
  22. package/_types/tempo/ZoneId.d.ts +50 -0
  23. package/_types/tempo/ZoneId.d.ts.map +1 -0
  24. package/_types/tempo/ZoneRpcAuthentication.d.ts +268 -0
  25. package/_types/tempo/ZoneRpcAuthentication.d.ts.map +1 -0
  26. package/_types/tempo/index.d.ts +55 -0
  27. package/_types/tempo/index.d.ts.map +1 -1
  28. package/_types/version.d.ts +1 -1
  29. package/package.json +11 -1
  30. package/tempo/TransactionRequest.test.ts +26 -2
  31. package/tempo/TransactionRequest.ts +17 -7
  32. package/tempo/ZoneId/package.json +6 -0
  33. package/tempo/ZoneId.test.ts +42 -0
  34. package/tempo/ZoneId.ts +58 -0
  35. package/tempo/ZoneRpcAuthentication/package.json +6 -0
  36. package/tempo/ZoneRpcAuthentication.test.ts +226 -0
  37. package/tempo/ZoneRpcAuthentication.ts +423 -0
  38. package/tempo/e2e.test.ts +2 -0
  39. package/tempo/index.ts +55 -8
  40. package/version.ts +1 -1
package/tempo/e2e.test.ts CHANGED
@@ -3,6 +3,7 @@ import {
3
3
  Address,
4
4
  Hex,
5
5
  P256,
6
+ RpcTransport,
6
7
  Secp256k1,
7
8
  Value,
8
9
  WebAuthnP256,
@@ -16,6 +17,7 @@ import {
16
17
  KeyAuthorization,
17
18
  Period,
18
19
  SignatureEnvelope,
20
+ ZoneRpcAuthentication,
19
21
  } from './index.js'
20
22
  import * as Transaction from './Transaction.js'
21
23
  import * as TransactionReceipt from './TransactionReceipt.js'
package/tempo/index.ts CHANGED
@@ -35,7 +35,6 @@ export type {}
35
35
  * @category Reference
36
36
  */
37
37
  export * as AuthorizationTempo from './AuthorizationTempo.js'
38
-
39
38
  /**
40
39
  * Tempo key authorization utilities for provisioning and signing access keys.
41
40
  *
@@ -76,7 +75,6 @@ export * as AuthorizationTempo from './AuthorizationTempo.js'
76
75
  * @category Reference
77
76
  */
78
77
  export * as KeyAuthorization from './KeyAuthorization.js'
79
-
80
78
  /**
81
79
  * Utilities for constructing period durations (in seconds) for recurring spending limits.
82
80
  *
@@ -128,7 +126,6 @@ export * as Period from './Period.js'
128
126
  * @category Reference
129
127
  */
130
128
  export * as PoolId from './PoolId.js'
131
-
132
129
  /**
133
130
  * Union of all JSON-RPC Methods for the `tempo_` namespace.
134
131
  *
@@ -171,7 +168,6 @@ export * as RpcSchemaTempo from './RpcSchemaTempo.js'
171
168
  * @category Reference
172
169
  */
173
170
  export * as SignatureEnvelope from './SignatureEnvelope.js'
174
-
175
171
  /**
176
172
  * Tempo address encoding/decoding utilities for human-readable addresses.
177
173
  *
@@ -191,7 +187,6 @@ export * as SignatureEnvelope from './SignatureEnvelope.js'
191
187
  * @category Reference
192
188
  */
193
189
  export * as TempoAddress from './TempoAddress.js'
194
-
195
190
  /**
196
191
  * Tick-based pricing utilities for DEX price conversions.
197
192
  *
@@ -212,7 +207,6 @@ export * as TempoAddress from './TempoAddress.js'
212
207
  * @category Reference
213
208
  */
214
209
  export * as Tick from './Tick.js'
215
-
216
210
  /**
217
211
  * TIP-20 token ID utilities for converting between token IDs and addresses.
218
212
  *
@@ -234,7 +228,6 @@ export * as Tick from './Tick.js'
234
228
  * @category Reference
235
229
  */
236
230
  export * as TokenId from './TokenId.js'
237
-
238
231
  /**
239
232
  * Token role utilities for serializing role identifiers to keccak256 hashes.
240
233
  *
@@ -253,7 +246,6 @@ export * as TokenId from './TokenId.js'
253
246
  * @category Reference
254
247
  */
255
248
  export * as TokenRole from './TokenRole.js'
256
-
257
249
  /**
258
250
  * Utilities for converting between RPC and structured transaction formats.
259
251
  *
@@ -377,3 +369,58 @@ export * as TransactionRequest from './TransactionRequest.js'
377
369
  * @category Reference
378
370
  */
379
371
  export * as TxEnvelopeTempo from './TxEnvelopeTempo.js'
372
+ /**
373
+ * Zone ID utilities for converting between zone IDs and zone chain IDs.
374
+ *
375
+ * Zone chain IDs are deterministically derived from zone IDs using the formula
376
+ * `421_700_000 + zoneId`. This module provides helpers to convert between them.
377
+ *
378
+ * @example
379
+ * ```ts twoslash
380
+ * import { ZoneId } from 'ox/tempo'
381
+ *
382
+ * const zoneId = ZoneId.fromChainId(421_700_026)
383
+ * // @log: 26
384
+ *
385
+ * const chainId = ZoneId.toChainId(26)
386
+ * // @log: 421700026
387
+ * ```
388
+ *
389
+ * @category Reference
390
+ */
391
+ export * as ZoneId from './ZoneId.js'
392
+ /**
393
+ * Zone RPC authentication token utilities for private zone RPC access.
394
+ *
395
+ * Zone RPC authentication tokens are short-lived, read-only credentials used in
396
+ * the `X-Authorization-Token` header when talking to private zone RPC endpoints.
397
+ * They reuse Tempo's multi-signature model, so secp256k1, P256, WebAuthn, and
398
+ * keychain access-key signatures all share the same wire format as Tempo
399
+ * transaction signatures.
400
+ *
401
+ * [Zone RPC Specification](https://docs.tempo.xyz/protocol/privacy/rpc#authorization-tokens)
402
+ *
403
+ * @example
404
+ * ```ts twoslash
405
+ * import { Secp256k1 } from 'ox'
406
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
407
+ *
408
+ * const authentication = ZoneRpcAuthentication.from({
409
+ * chainId: 4217000026,
410
+ * expiresAt: 1711235160,
411
+ * issuedAt: 1711234560,
412
+ * zoneId: 26,
413
+ * zonePortal: 'tempox0x0f1b0cedd7e8226e39ecb161f522c8b1ac45e9c8',
414
+ * })
415
+ *
416
+ * const signature = Secp256k1.sign({
417
+ * payload: ZoneRpcAuthentication.getSignPayload(authentication),
418
+ * privateKey: '0x...',
419
+ * })
420
+ *
421
+ * const token = ZoneRpcAuthentication.serialize(authentication, { signature })
422
+ * ```
423
+ *
424
+ * @category Reference
425
+ */
426
+ export * as ZoneRpcAuthentication from './ZoneRpcAuthentication.js'
package/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** @internal */
2
- export const version = '0.14.16'
2
+ export const version = '0.14.17'