ox 0.14.16 → 0.14.18

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 (60) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/_cjs/tempo/TransactionRequest.js +10 -1
  3. package/_cjs/tempo/TransactionRequest.js.map +1 -1
  4. package/_cjs/tempo/VirtualAddress.js +70 -0
  5. package/_cjs/tempo/VirtualAddress.js.map +1 -0
  6. package/_cjs/tempo/VirtualMaster.js +99 -0
  7. package/_cjs/tempo/VirtualMaster.js.map +1 -0
  8. package/_cjs/tempo/ZoneId.js +13 -0
  9. package/_cjs/tempo/ZoneId.js.map +1 -0
  10. package/_cjs/tempo/ZoneRpcAuthentication.js +101 -0
  11. package/_cjs/tempo/ZoneRpcAuthentication.js.map +1 -0
  12. package/_cjs/tempo/index.js +5 -1
  13. package/_cjs/tempo/index.js.map +1 -1
  14. package/_cjs/version.js +1 -1
  15. package/_esm/tempo/TransactionRequest.js +10 -1
  16. package/_esm/tempo/TransactionRequest.js.map +1 -1
  17. package/_esm/tempo/VirtualAddress.js +154 -0
  18. package/_esm/tempo/VirtualAddress.js.map +1 -0
  19. package/_esm/tempo/VirtualMaster.js +200 -0
  20. package/_esm/tempo/VirtualMaster.js.map +1 -0
  21. package/_esm/tempo/ZoneId.js +47 -0
  22. package/_esm/tempo/ZoneId.js.map +1 -0
  23. package/_esm/tempo/ZoneRpcAuthentication.js +256 -0
  24. package/_esm/tempo/ZoneRpcAuthentication.js.map +1 -0
  25. package/_esm/tempo/index.js +107 -0
  26. package/_esm/tempo/index.js.map +1 -1
  27. package/_esm/version.js +1 -1
  28. package/_types/core/RpcSchema.d.ts +0 -2
  29. package/_types/core/RpcSchema.d.ts.map +1 -1
  30. package/_types/tempo/TransactionRequest.d.ts +6 -4
  31. package/_types/tempo/TransactionRequest.d.ts.map +1 -1
  32. package/_types/tempo/VirtualAddress.d.ts +129 -0
  33. package/_types/tempo/VirtualAddress.d.ts.map +1 -0
  34. package/_types/tempo/VirtualMaster.d.ts +155 -0
  35. package/_types/tempo/VirtualMaster.d.ts.map +1 -0
  36. package/_types/tempo/ZoneId.d.ts +50 -0
  37. package/_types/tempo/ZoneId.d.ts.map +1 -0
  38. package/_types/tempo/ZoneRpcAuthentication.d.ts +268 -0
  39. package/_types/tempo/ZoneRpcAuthentication.d.ts.map +1 -0
  40. package/_types/tempo/index.d.ts +107 -0
  41. package/_types/tempo/index.d.ts.map +1 -1
  42. package/_types/version.d.ts +1 -1
  43. package/core/RpcSchema.ts +0 -2
  44. package/package.json +21 -1
  45. package/tempo/TransactionRequest.test.ts +26 -2
  46. package/tempo/TransactionRequest.ts +17 -7
  47. package/tempo/VirtualAddress/package.json +6 -0
  48. package/tempo/VirtualAddress.test.ts +88 -0
  49. package/tempo/VirtualAddress.ts +201 -0
  50. package/tempo/VirtualMaster/package.json +6 -0
  51. package/tempo/VirtualMaster.test.ts +127 -0
  52. package/tempo/VirtualMaster.ts +303 -0
  53. package/tempo/ZoneId/package.json +6 -0
  54. package/tempo/ZoneId.test.ts +42 -0
  55. package/tempo/ZoneId.ts +58 -0
  56. package/tempo/ZoneRpcAuthentication/package.json +6 -0
  57. package/tempo/ZoneRpcAuthentication.test.ts +226 -0
  58. package/tempo/ZoneRpcAuthentication.ts +423 -0
  59. package/tempo/index.ts +107 -8
  60. package/version.ts +1 -1
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,110 @@ export * as TransactionRequest from './TransactionRequest.js'
377
369
  * @category Reference
378
370
  */
379
371
  export * as TxEnvelopeTempo from './TxEnvelopeTempo.js'
372
+ /**
373
+ * TIP-1022 virtual address encoding and parsing utilities.
374
+ *
375
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
376
+ *
377
+ * Virtual addresses reserve the following 20-byte layout:
378
+ * `[4-byte masterId][10-byte VIRTUAL_MAGIC][6-byte userTag]`.
379
+ * These helpers only operate on the reserved byte layout and do not query
380
+ * onchain registration state.
381
+ *
382
+ * @example
383
+ * ```ts twoslash
384
+ * import { TempoAddress, VirtualAddress } from 'ox/tempo'
385
+ *
386
+ * const masterId = '0x58e21090' // derived when the master registers
387
+ * const userTag = '0x010203040506' // operator-defined deposit identifier
388
+ *
389
+ * const address = VirtualAddress.from({
390
+ * masterId,
391
+ * userTag,
392
+ * })
393
+ *
394
+ * const tempoAddress = TempoAddress.format(address) // optional display format
395
+ * ```
396
+ *
397
+ * @category Reference
398
+ */
399
+ export * as VirtualAddress from './VirtualAddress.js'
400
+ /**
401
+ * TIP-1022 master registration utilities.
402
+ *
403
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
404
+ *
405
+ * These utilities expose deterministic hashing and bounded salt mining helpers for
406
+ * `registerVirtualMaster(bytes32 salt)` without introducing any extra hashing dependency.
407
+ *
408
+ * @example
409
+ * ```ts twoslash
410
+ * import { VirtualMaster } from 'ox/tempo'
411
+ *
412
+ * const registration = {
413
+ * address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
414
+ * salt: '0x00000000000000000000000000000000000000000000000000000000abf52baf',
415
+ * }
416
+ *
417
+ * const registrationHash = VirtualMaster.getRegistrationHash(registration) // keccak256(address || salt)
418
+ * const masterId = VirtualMaster.getMasterId(registration) // bytes [4:8] of the hash
419
+ * ```
420
+ *
421
+ * @category Reference
422
+ */
423
+ export * as VirtualMaster from './VirtualMaster.js'
424
+ /**
425
+ * Zone ID utilities for converting between zone IDs and zone chain IDs.
426
+ *
427
+ * Zone chain IDs are deterministically derived from zone IDs using the formula
428
+ * `421_700_000 + zoneId`. This module provides helpers to convert between them.
429
+ *
430
+ * @example
431
+ * ```ts twoslash
432
+ * import { ZoneId } from 'ox/tempo'
433
+ *
434
+ * const zoneId = ZoneId.fromChainId(421_700_026)
435
+ * // @log: 26
436
+ *
437
+ * const chainId = ZoneId.toChainId(26)
438
+ * // @log: 421700026
439
+ * ```
440
+ *
441
+ * @category Reference
442
+ */
443
+ export * as ZoneId from './ZoneId.js'
444
+ /**
445
+ * Zone RPC authentication token utilities for private zone RPC access.
446
+ *
447
+ * Zone RPC authentication tokens are short-lived, read-only credentials used in
448
+ * the `X-Authorization-Token` header when talking to private zone RPC endpoints.
449
+ * They reuse Tempo's multi-signature model, so secp256k1, P256, WebAuthn, and
450
+ * keychain access-key signatures all share the same wire format as Tempo
451
+ * transaction signatures.
452
+ *
453
+ * [Zone RPC Specification](https://docs.tempo.xyz/protocol/privacy/rpc#authorization-tokens)
454
+ *
455
+ * @example
456
+ * ```ts twoslash
457
+ * import { Secp256k1 } from 'ox'
458
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
459
+ *
460
+ * const authentication = ZoneRpcAuthentication.from({
461
+ * chainId: 4217000026,
462
+ * expiresAt: 1711235160,
463
+ * issuedAt: 1711234560,
464
+ * zoneId: 26,
465
+ * zonePortal: 'tempox0x0f1b0cedd7e8226e39ecb161f522c8b1ac45e9c8',
466
+ * })
467
+ *
468
+ * const signature = Secp256k1.sign({
469
+ * payload: ZoneRpcAuthentication.getSignPayload(authentication),
470
+ * privateKey: '0x...',
471
+ * })
472
+ *
473
+ * const token = ZoneRpcAuthentication.serialize(authentication, { signature })
474
+ * ```
475
+ *
476
+ * @category Reference
477
+ */
478
+ 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.18'