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
@@ -1 +1 @@
1
- {"version":3,"file":"RpcSchema.d.ts","sourceRoot":"","sources":["../../core/RpcSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEhE,YAAY,EAAE,GAAG,EAAE,MAAM,8BAA8B,CAAA;AACvD,YAAY,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAAmB,CAAC,KAAK,CAAC,SAAS,MAAM,MAAM,IAAI,GACvE,IAAI,GACJ,KAAK,CAAA;AAET,gBAAgB;AAChB,KAAK,YAAY,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GACvE,EAAE,GACF,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA"}
@@ -16,20 +16,22 @@ type KeyType = 'secp256k1' | 'p256' | 'webAuthn';
16
16
  *
17
17
  * @see {@link https://docs.tempo.xyz/protocol/transactions}
18
18
  */
19
- export type TransactionRequest<bigintType = bigint, numberType = number, type extends string = string> = Compute<Omit<ox_TransactionRequest.TransactionRequest<bigintType, numberType, type>, 'authorizationList'> & {
19
+ export type TransactionRequest<bigintType = bigint, numberType = number, type extends string = string, addressType = TempoAddress.Address> = Compute<Omit<ox_TransactionRequest.TransactionRequest<bigintType, numberType, type>, 'authorizationList'> & {
20
20
  authorizationList?: AuthorizationTempo.ListSigned<bigintType, numberType> | undefined;
21
- calls?: readonly Call<bigintType, TempoAddress.Address>[] | undefined;
21
+ calls?: readonly Call<bigintType, addressType>[] | undefined;
22
22
  keyAuthorization?: KeyAuthorization.KeyAuthorization<true> | undefined;
23
23
  keyData?: Hex.Hex | undefined;
24
24
  keyType?: KeyType | undefined;
25
- feeToken?: TokenId.TokenIdOrAddress<TempoAddress.Address> | undefined;
25
+ feePayer?: boolean | undefined;
26
+ feeToken?: TokenId.TokenIdOrAddress<addressType> | undefined;
26
27
  nonceKey?: 'random' | bigintType | undefined;
27
28
  validBefore?: numberType | undefined;
28
29
  validAfter?: numberType | undefined;
29
30
  }>;
30
31
  /** RPC representation of a {@link ox#TransactionRequest.TransactionRequest}. */
31
- export type Rpc = Omit<TransactionRequest<Hex.Hex, Hex.Hex, string>, 'authorizationList' | 'keyAuthorization'> & {
32
+ export type Rpc = Omit<TransactionRequest<Hex.Hex, Hex.Hex, string, Hex.Hex>, 'authorizationList' | 'feeToken' | 'keyAuthorization'> & {
32
33
  authorizationList?: AuthorizationTempo.ListRpc | undefined;
34
+ feeToken?: Hex.Hex | undefined;
33
35
  keyAuthorization?: KeyAuthorization.Rpc | undefined;
34
36
  nonceKey?: Hex.Hex | undefined;
35
37
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionRequest.d.ts","sourceRoot":"","sources":["../../tempo/TransactionRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAA;AACtE,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AACzD,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAEhD,KAAK,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,CAAA;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,kBAAkB,CAC5B,UAAU,GAAG,MAAM,EACnB,UAAU,GAAG,MAAM,EACnB,IAAI,SAAS,MAAM,GAAG,MAAM,IAC1B,OAAO,CACT,IAAI,CACF,qBAAqB,CAAC,kBAAkB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,CAAC,EACtE,mBAAmB,CACpB,GAAG;IACF,iBAAiB,CAAC,EACd,kBAAkB,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,GACrD,SAAS,CAAA;IACb,KAAK,CAAC,EAAE,SAAS,IAAI,CAAC,UAAU,EAAE,YAA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AAS,GACjB,kBAAkB,CAAC,WAAW,CAAC,SAAS,GACxC,GAAG,CAAC,QAAQ,CAAC,SAAS,GACtB,GAAG,CAAC,QAAQ,CAAC,SAAS,GACtB,MAAM,CAAC,eAAe,CAAA;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,GAAG,CA6DtD;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,KAAY,SAAS,GACjB,kBAAkB,CAAC,SAAS,CAAC,SAAS,GACtC,GAAG,CAAC,UAAU,CAAC,SAAS,GACxB,MAAM,CAAC,eAAe,CAAA;CAC3B"}
@@ -0,0 +1,129 @@
1
+ import * as Address from '../core/Address.js';
2
+ import * as Bytes from '../core/Bytes.js';
3
+ import * as Errors from '../core/Errors.js';
4
+ import * as Hex from '../core/Hex.js';
5
+ import * as TempoAddress from './TempoAddress.js';
6
+ /** Fixed 10-byte marker used by TIP-1022 virtual addresses. */
7
+ export declare const magic: "0xfdfdfdfdfdfdfdfdfdfd";
8
+ /** A fixed-width virtual address component. */
9
+ export type Part = Hex.Hex | Bytes.Bytes | number | bigint;
10
+ /**
11
+ * Builds a TIP-1022 virtual address from a `masterId` and `userTag`.
12
+ *
13
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
14
+ *
15
+ * TIP-1022 encodes virtual addresses as:
16
+ * `[4-byte masterId][10-byte VIRTUAL_MAGIC][6-byte userTag]`
17
+ *
18
+ * @example
19
+ * ```ts twoslash
20
+ * import { VirtualAddress } from 'ox/tempo'
21
+ *
22
+ * const address = VirtualAddress.from({
23
+ * masterId: '0x58e21090',
24
+ * userTag: '0x010203040506',
25
+ * })
26
+ *
27
+ * address
28
+ * // @log: '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506'
29
+ * ```
30
+ *
31
+ * @param value - The virtual address parts.
32
+ * @returns The virtual address.
33
+ */
34
+ export declare function from(value: from.Value): Address.Address;
35
+ export declare namespace from {
36
+ type Value = {
37
+ /** 4-byte master identifier. */
38
+ masterId: Part;
39
+ /** 6-byte opaque user tag. */
40
+ userTag: Part;
41
+ };
42
+ type ErrorType = Address.from.ErrorType | Bytes.padLeft.ErrorType | Hex.assert.ErrorType | Hex.fromBytes.ErrorType | Hex.fromNumber.ErrorType | Hex.padLeft.ErrorType | Errors.GlobalErrorType;
43
+ }
44
+ /**
45
+ * Checks whether an address matches the TIP-1022 virtual address format.
46
+ *
47
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
48
+ *
49
+ * This only checks the reserved byte layout, not whether the `masterId`
50
+ * is registered onchain.
51
+ *
52
+ * @example
53
+ * ```ts twoslash
54
+ * import { VirtualAddress } from 'ox/tempo'
55
+ *
56
+ * const isVirtual = VirtualAddress.isVirtual(
57
+ * '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
58
+ * )
59
+ *
60
+ * isVirtual
61
+ * // @log: true
62
+ * ```
63
+ *
64
+ * @param address - Address to check.
65
+ * @returns `true` if the address matches the virtual-address layout.
66
+ */
67
+ export declare function isVirtual(address: string): boolean;
68
+ /**
69
+ * Parses a TIP-1022 virtual address into its `masterId` and `userTag` parts.
70
+ *
71
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
72
+ *
73
+ * @example
74
+ * ```ts twoslash
75
+ * import { VirtualAddress } from 'ox/tempo'
76
+ *
77
+ * const parsed = VirtualAddress.parse(
78
+ * '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
79
+ * )
80
+ *
81
+ * parsed
82
+ * // @log: { masterId: '0x58e21090', userTag: '0x010203040506' }
83
+ * ```
84
+ *
85
+ * @param address - The virtual address to parse.
86
+ * @returns The decoded virtual address components.
87
+ */
88
+ export declare function parse(address: string): parse.ReturnType;
89
+ export declare namespace parse {
90
+ type ReturnType = {
91
+ /** 4-byte master identifier. */
92
+ masterId: Hex.Hex;
93
+ /** 6-byte opaque user tag. */
94
+ userTag: Hex.Hex;
95
+ };
96
+ type ErrorType = Address.assert.ErrorType | InvalidMagicError | TempoAddress.parse.ErrorType | Errors.GlobalErrorType;
97
+ }
98
+ /**
99
+ * Validates that an address matches the TIP-1022 virtual address format.
100
+ *
101
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
102
+ *
103
+ * This only validates the reserved byte layout, not whether the `masterId`
104
+ * resolves to a registered master onchain.
105
+ *
106
+ * @example
107
+ * ```ts twoslash
108
+ * import { VirtualAddress } from 'ox/tempo'
109
+ *
110
+ * const valid = VirtualAddress.validate(
111
+ * '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
112
+ * )
113
+ *
114
+ * valid
115
+ * // @log: true
116
+ * ```
117
+ *
118
+ * @param address - Address to validate.
119
+ * @returns `true` if the address has a valid virtual-address layout.
120
+ */
121
+ export declare function validate(address: string): boolean;
122
+ /** Thrown when an address does not contain the TIP-1022 virtual marker. */
123
+ export declare class InvalidMagicError extends Errors.BaseError {
124
+ readonly name = "VirtualAddress.InvalidMagicError";
125
+ constructor({ address }: {
126
+ address: string;
127
+ });
128
+ }
129
+ //# sourceMappingURL=VirtualAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualAddress.d.ts","sourceRoot":"","sources":["../../tempo/VirtualAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD,+DAA+D;AAC/D,eAAO,MAAM,KAAK,0BAAoC,CAAA;AAEtD,+CAA+C;AAC/C,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,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OjD;AAED,2EAA2E;AAC3E,qBAAa,iBAAkB,SAAQ,MAAM,CAAC,SAAS;IACrD,SAAkB,IAAI,sCAAqC;gBAE/C,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;CAK7C"}
@@ -0,0 +1,155 @@
1
+ import * as Address from '../core/Address.js';
2
+ import * as Bytes from '../core/Bytes.js';
3
+ import * as Errors from '../core/Errors.js';
4
+ import * as Hash from '../core/Hash.js';
5
+ import * as Hex from '../core/Hex.js';
6
+ import * as TempoAddress from './TempoAddress.js';
7
+ /** A valid salt input for TIP-1022 master registration. */
8
+ export type Salt = Hex.Hex | Bytes.Bytes | number | bigint;
9
+ /**
10
+ * Computes the TIP-1022 registration hash for a master address and salt.
11
+ *
12
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
13
+ *
14
+ * The registration hash is `keccak256(masterAddress || salt)` where `salt`
15
+ * is encoded as a 32-byte value.
16
+ *
17
+ * Master addresses must satisfy TIP-1022 registration constraints: they cannot
18
+ * be the zero address, another virtual address, or a TIP-20 token address.
19
+ *
20
+ * @example
21
+ * ```ts twoslash
22
+ * import { VirtualMaster } from 'ox/tempo'
23
+ *
24
+ * const hash = VirtualMaster.getRegistrationHash({
25
+ * address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
26
+ * salt: '0x00000000000000000000000000000000000000000000000000000000abf52baf',
27
+ * })
28
+ *
29
+ * hash
30
+ * // @log: '0x0000000058e21090d8f4bee424b90cddc2378aefa1bbbfa1443631a929ae966d'
31
+ * ```
32
+ *
33
+ * @param value - Master address and salt.
34
+ * @returns The registration hash.
35
+ */
36
+ export declare function getRegistrationHash(value: getRegistrationHash.Value): Hex.Hex;
37
+ export declare namespace getRegistrationHash {
38
+ type Value = {
39
+ /** Master address. Accepts both hex and Tempo addresses. */
40
+ address: TempoAddress.Address;
41
+ /** 32-byte salt used for registration. */
42
+ salt: Salt;
43
+ };
44
+ type ErrorType = Address.assert.ErrorType | Bytes.padLeft.ErrorType | Errors.BaseError | Hash.keccak256.ErrorType | Hex.assert.ErrorType | Hex.fromBytes.ErrorType | Hex.fromNumber.ErrorType | Hex.padLeft.ErrorType | TempoAddress.parse.ErrorType | Errors.GlobalErrorType;
45
+ }
46
+ /**
47
+ * Derives the 4-byte TIP-1022 `masterId` from a master address and salt.
48
+ *
49
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
50
+ *
51
+ * This returns bytes `[4:8]` of the registration hash, regardless of whether the
52
+ * salt satisfies the proof-of-work requirement.
53
+ *
54
+ * Master addresses must satisfy TIP-1022 registration constraints: they cannot
55
+ * be the zero address, another virtual address, or a TIP-20 token address.
56
+ *
57
+ * @example
58
+ * ```ts twoslash
59
+ * import { VirtualMaster } from 'ox/tempo'
60
+ *
61
+ * const masterId = VirtualMaster.getMasterId({
62
+ * address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
63
+ * salt: '0x00000000000000000000000000000000000000000000000000000000abf52baf',
64
+ * })
65
+ *
66
+ * masterId
67
+ * // @log: '0x58e21090'
68
+ * ```
69
+ *
70
+ * @param value - Master address and salt.
71
+ * @returns The derived master identifier.
72
+ */
73
+ export declare function getMasterId(value: getMasterId.Value): Hex.Hex;
74
+ export declare namespace getMasterId {
75
+ type Value = getRegistrationHash.Value;
76
+ type ErrorType = getRegistrationHash.ErrorType | Errors.GlobalErrorType;
77
+ }
78
+ /**
79
+ * Validates that a salt satisfies the TIP-1022 32-bit proof-of-work requirement.
80
+ *
81
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
82
+ *
83
+ * Returns `false` for invalid master addresses, including the zero address,
84
+ * virtual addresses, and TIP-20 token addresses.
85
+ *
86
+ * @example
87
+ * ```ts twoslash
88
+ * import { VirtualMaster } from 'ox/tempo'
89
+ *
90
+ * const valid = VirtualMaster.validateSalt({
91
+ * address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
92
+ * salt: '0x00000000000000000000000000000000000000000000000000000000abf52baf',
93
+ * })
94
+ *
95
+ * valid
96
+ * // @log: true
97
+ * ```
98
+ *
99
+ * @param value - Master address and salt.
100
+ * @returns `true` if the first 4 bytes of the registration hash are zero.
101
+ */
102
+ export declare function validateSalt(value: validateSalt.Value): boolean;
103
+ export declare namespace validateSalt {
104
+ type Value = getRegistrationHash.Value;
105
+ }
106
+ /**
107
+ * Searches a bounded range of salts for the first value that satisfies TIP-1022 PoW.
108
+ *
109
+ * [TIP-1022](https://docs.tempo.xyz/protocol/tips/tip-1022)
110
+ *
111
+ * This is intentionally a small, deterministic primitive. It does not coordinate
112
+ * workers or async execution. Callers that need large searches can shard ranges
113
+ * externally.
114
+ *
115
+ * Master addresses must satisfy TIP-1022 registration constraints: they cannot
116
+ * be the zero address, another virtual address, or a TIP-20 token address.
117
+ *
118
+ * @example
119
+ * ```ts twoslash
120
+ * import { VirtualMaster } from 'ox/tempo'
121
+ *
122
+ * const result = VirtualMaster.mineSalt({
123
+ * address: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
124
+ * start: 0xabf52ba0n,
125
+ * count: 16,
126
+ * })
127
+ *
128
+ * result?.salt
129
+ * // @log: '0x00000000000000000000000000000000000000000000000000000000abf52baf'
130
+ * ```
131
+ *
132
+ * @param value - Search range parameters.
133
+ * @returns The first matching salt in the range, if any.
134
+ */
135
+ export declare function mineSalt(value: mineSalt.Value): mineSalt.ReturnType | undefined;
136
+ export declare namespace mineSalt {
137
+ type Value = {
138
+ /** Master address. Accepts both hex and Tempo addresses. */
139
+ address: TempoAddress.Address;
140
+ /** Number of consecutive salts to try. */
141
+ count: number;
142
+ /** Starting salt value. @default 0n */
143
+ start?: Salt | undefined;
144
+ };
145
+ type ReturnType = {
146
+ /** The 4-byte master identifier derived from the matching salt. */
147
+ masterId: Hex.Hex;
148
+ /** The matching registration hash. */
149
+ registrationHash: Hex.Hex;
150
+ /** The discovered 32-byte salt. */
151
+ salt: Hex.Hex;
152
+ };
153
+ type ErrorType = Address.assert.ErrorType | Bytes.fromHex.ErrorType | Bytes.padLeft.ErrorType | Errors.BaseError | Hash.keccak256.ErrorType | Hex.assert.ErrorType | Hex.fromBytes.ErrorType | Hex.fromNumber.ErrorType | Hex.padLeft.ErrorType | TempoAddress.parse.ErrorType | Errors.GlobalErrorType;
154
+ }
155
+ //# sourceMappingURL=VirtualMaster.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VirtualMaster.d.ts","sourceRoot":"","sources":["../../tempo/VirtualMaster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAC3C,OAAO,KAAK,IAAI,MAAM,iBAAiB,CAAA;AACvC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAA;AACrC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAMjD,2DAA2D;AAC3D,MAAM,MAAM,IAAI,GAAG,GAAG,CAAC,GAAG,GAAG,KAAK,CAAC,KAAK,GAAG,MAAM,GAAG,MAAM,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,mBAAmB,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,CAI7E;AAED,MAAM,CAAC,OAAO,WAAW,mBAAmB,CAAC;IAC3C,KAAK,KAAK,GAAG;QACX,4DAA4D;QAC5D,OAAO,EAAE,YAAY,CAAC,OAAO,CAAA;QAC7B,0CAA0C;QAC1C,IAAI,EAAE,IAAI,CAAA;KACX,CAAA;IAED,KAAK,SAAS,GACV,OAAO,CAAC,MAAM,CAAC,SAAS,GACxB,KAAK,CAAC,OAAO,CAAC,SAAS,GACvB,MAAM,CAAC,SAAS,GAChB,IAAI,CAAC,SAAS,CAAC,SAAS,GACxB,GAAG,CAAC,MAAM,CAAC,SAA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,mCAAmC;QACnC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAA;KACd,CAAA;IAED,KAAK,SAAS,GACV,OAAO,CAAC,MAAM,CAAC,SAAS,GACxB,KAAK,CAAC,OAAO,CAAC,SAAS,GACvB,KAAK,CAAC,OAAO,CAAC,SAAS,GACvB,MAAM,CAAC,SAAS,GAChB,IAAI,CAAC,SAAS,CAAC,SAAS,GACxB,GAAG,CAAC,MAAM,CAAC,SAAS,GACpB,GAAG,CAAC,SAAS,CAAC,SAAS,GACvB,GAAG,CAAC,UAAU,CAAC,SAAS,GACxB,GAAG,CAAC,OAAO,CAAC,SAAS,GACrB,YAAY,CAAC,KAAK,CAAC,SAAS,GAC5B,MAAM,CAAC,eAAe,CAAA;CAC3B"}
@@ -0,0 +1,50 @@
1
+ import type * as Errors from '../core/Errors.js';
2
+ /**
3
+ * Base offset for deriving zone chain IDs.
4
+ *
5
+ * Zone chain IDs are computed as `chainIdBase + zoneId`.
6
+ */
7
+ export declare const chainIdBase: 4217000000;
8
+ /**
9
+ * Derives a zone ID from a zone chain ID.
10
+ *
11
+ * Zone chain IDs follow the formula `4_217_000_000 + zoneId`, so a chain ID
12
+ * of `4217000006` corresponds to zone ID `6`.
13
+ *
14
+ * @example
15
+ * ```ts twoslash
16
+ * import { ZoneId } from 'ox/tempo'
17
+ *
18
+ * const zoneId = ZoneId.fromChainId(4_217_000_006)
19
+ * // @log: 6
20
+ * ```
21
+ *
22
+ * @param chainId - The zone chain ID.
23
+ * @returns The zone ID.
24
+ */
25
+ export declare function fromChainId(chainId: number): number;
26
+ export declare namespace fromChainId {
27
+ type ErrorType = Errors.GlobalErrorType;
28
+ }
29
+ /**
30
+ * Derives a zone chain ID from a zone ID.
31
+ *
32
+ * Zone chain IDs follow the formula `4_217_000_000 + zoneId`, so zone ID
33
+ * `6` corresponds to chain ID `4217000006`.
34
+ *
35
+ * @example
36
+ * ```ts twoslash
37
+ * import { ZoneId } from 'ox/tempo'
38
+ *
39
+ * const chainId = ZoneId.toChainId(6)
40
+ * // @log: 4217000006
41
+ * ```
42
+ *
43
+ * @param zoneId - The zone ID.
44
+ * @returns The zone chain ID.
45
+ */
46
+ export declare function toChainId(zoneId: number): number;
47
+ export declare namespace toChainId {
48
+ type ErrorType = Errors.GlobalErrorType;
49
+ }
50
+ //# sourceMappingURL=ZoneId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ZoneId.d.ts","sourceRoot":"","sources":["../../tempo/ZoneId.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,mBAAmB,CAAA;AAEhD;;;;GAIG;AACH,eAAO,MAAM,WAAW,YAAyB,CAAA;AAEjD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,MAAM,CAAC,OAAO,WAAW,WAAW,CAAC;IACnC,KAAK,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACxC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,MAAM,CAAC,OAAO,WAAW,SAAS,CAAC;IACjC,KAAK,SAAS,GAAG,MAAM,CAAC,eAAe,CAAA;CACxC"}
@@ -0,0 +1,268 @@
1
+ import * as Errors from '../core/Errors.js';
2
+ import * as Hash from '../core/Hash.js';
3
+ import * as Hex from '../core/Hex.js';
4
+ import type { Compute, PartialBy } from '../core/internal/types.js';
5
+ import * as SignatureEnvelope from './SignatureEnvelope.js';
6
+ import * as TempoAddress from './TempoAddress.js';
7
+ /**
8
+ * Header name used to transport Zone RPC authentication tokens.
9
+ */
10
+ export declare const headerName: "X-Authorization-Token";
11
+ /**
12
+ * 32-byte domain separator used when hashing Zone RPC authentication tokens.
13
+ */
14
+ export declare const magicBytes: "0x54656d706f5a6f6e655250430000000000000000000000000000000000000000";
15
+ /**
16
+ * Size, in bytes, of the fixed Zone RPC authentication fields.
17
+ */
18
+ export declare const fieldsSize: 29;
19
+ /** Current Zone RPC authentication version. */
20
+ export declare const version: 0;
21
+ /** Current Zone RPC authentication version. */
22
+ export type Version = typeof version;
23
+ /**
24
+ * Root type for a Tempo Zone RPC authentication token.
25
+ *
26
+ * Zone RPC authentication tokens are short-lived, read-only credentials used to
27
+ * authenticate requests to Tempo private zone RPC endpoints.
28
+ *
29
+ * [Zone RPC Specification](https://docs.tempo.xyz/protocol/privacy/rpc#authorization-tokens)
30
+ */
31
+ export type ZoneRpcAuthentication<signed extends boolean = boolean, bigintType = bigint, numberType = number> = Compute<{
32
+ /** Zone chain ID for replay protection. */
33
+ chainId: numberType;
34
+ /** Unix timestamp when the token expires. */
35
+ expiresAt: numberType;
36
+ /** Unix timestamp when the token was issued. */
37
+ issuedAt: numberType;
38
+ /** Zone RPC authentication version. Always `0` for the current spec. */
39
+ version: Version;
40
+ /** Numeric zone identifier. */
41
+ zoneId: numberType;
42
+ } & (signed extends true ? {
43
+ signature: SignatureEnvelope.SignatureEnvelope<bigintType, numberType>;
44
+ } : {
45
+ signature?: SignatureEnvelope.SignatureEnvelope<bigintType, numberType> | undefined;
46
+ })>;
47
+ /** Input type for a Zone RPC authentication token. */
48
+ export type Input = PartialBy<ZoneRpcAuthentication<false>, 'version'>;
49
+ /** 29-byte fixed Zone RPC authentication field suffix. */
50
+ export type Fields = Hex.Hex;
51
+ /** Hex-encoded serialized Zone RPC authentication token. */
52
+ export type Serialized = Hex.Hex;
53
+ /** Signed Zone RPC authentication token. */
54
+ export type Signed<bigintType = bigint, numberType = number> = ZoneRpcAuthentication<true, bigintType, numberType>;
55
+ /**
56
+ * Instantiates a typed Zone RPC authentication token.
57
+ *
58
+ * @example
59
+ * ```ts twoslash
60
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
61
+ *
62
+ * const authentication = ZoneRpcAuthentication.from({
63
+ * chainId: 4217000026,
64
+ * expiresAt: 1711235160,
65
+ * issuedAt: 1711234560,
66
+ * zoneId: 26,
67
+ * })
68
+ * ```
69
+ *
70
+ * @example
71
+ * ### Attaching Signatures
72
+ *
73
+ * ```ts twoslash
74
+ * import { Secp256k1 } from 'ox'
75
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
76
+ *
77
+ * const authentication = ZoneRpcAuthentication.from({
78
+ * chainId: 4217000026,
79
+ * expiresAt: 1711235160,
80
+ * issuedAt: 1711234560,
81
+ * zoneId: 26,
82
+ * })
83
+ *
84
+ * const signature = Secp256k1.sign({
85
+ * payload: ZoneRpcAuthentication.getSignPayload(authentication),
86
+ * privateKey: '0x...',
87
+ * })
88
+ *
89
+ * const authentication_signed = ZoneRpcAuthentication.from(authentication, {
90
+ * signature,
91
+ * })
92
+ * ```
93
+ *
94
+ * @param authentication - Zone RPC authentication token fields.
95
+ * @param options - Zone RPC authentication options.
96
+ * @returns The instantiated Zone RPC authentication token.
97
+ */
98
+ export declare function from<const authentication extends Input | ZoneRpcAuthentication, const signature extends SignatureEnvelope.from.Value | undefined = undefined>(authentication: authentication | ZoneRpcAuthentication, options?: from.Options<signature>): from.ReturnType<authentication, signature>;
99
+ export declare namespace from {
100
+ type Options<signature extends SignatureEnvelope.from.Value | undefined = SignatureEnvelope.from.Value | undefined> = {
101
+ /** The signature to attach to the authentication token. */
102
+ signature?: signature | SignatureEnvelope.SignatureEnvelope | undefined;
103
+ };
104
+ type ReturnType<authentication extends ZoneRpcAuthentication | Input = ZoneRpcAuthentication, signature extends SignatureEnvelope.from.Value | undefined = SignatureEnvelope.from.Value | undefined> = Compute<authentication & {
105
+ readonly version: Version;
106
+ } & (signature extends SignatureEnvelope.from.Value ? {
107
+ signature: SignatureEnvelope.from.ReturnValue<signature>;
108
+ } : {})>;
109
+ type ErrorType = Errors.GlobalErrorType;
110
+ }
111
+ /**
112
+ * Parses a serialized Zone RPC authentication token.
113
+ *
114
+ * The serialized format is `<signature><29-byte fields>`. The signature is parsed
115
+ * from the prefix and the fixed-length fields are parsed from the suffix.
116
+ *
117
+ * @example
118
+ * ```ts twoslash
119
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
120
+ *
121
+ * const authentication = ZoneRpcAuthentication.deserialize('0x...')
122
+ * ```
123
+ *
124
+ * @param serialized - The serialized Zone RPC authentication token.
125
+ * @returns The parsed Zone RPC authentication token.
126
+ */
127
+ export declare function deserialize(serialized: Serialized): Signed;
128
+ export declare namespace deserialize {
129
+ type ErrorType = InvalidSerializedError | SignatureEnvelope.CoercionError | SignatureEnvelope.InvalidSerializedError | Hex.size.ErrorType | Hex.slice.ErrorType | Hex.toNumber.ErrorType | Errors.GlobalErrorType;
130
+ }
131
+ /**
132
+ * Returns the 29-byte fixed field suffix for a Zone RPC authentication token.
133
+ *
134
+ * @example
135
+ * ```ts twoslash
136
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
137
+ *
138
+ * const fields = ZoneRpcAuthentication.getFields({
139
+ * chainId: 4217000026,
140
+ * expiresAt: 1711235160,
141
+ * issuedAt: 1711234560,
142
+ * zoneId: 26,
143
+ * })
144
+ * ```
145
+ *
146
+ * @param authentication - The Zone RPC authentication token.
147
+ * @returns The fixed 29-byte field suffix.
148
+ */
149
+ export declare function getFields(authentication: PartialBy<ZoneRpcAuthentication, 'version'>): Fields;
150
+ export declare namespace getFields {
151
+ type ErrorType = Hex.concat.ErrorType | Hex.fromNumber.ErrorType | Errors.GlobalErrorType;
152
+ }
153
+ /**
154
+ * Computes the sign payload for a Zone RPC authentication token.
155
+ *
156
+ * When `userAddress` is provided, the payload is wrapped as
157
+ * `keccak256(0x04 || authHash || userAddress)` to match V2 keychain signing.
158
+ *
159
+ * @example
160
+ * ```ts twoslash
161
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
162
+ *
163
+ * const authentication = ZoneRpcAuthentication.from({
164
+ * chainId: 4217000026,
165
+ * expiresAt: 1711235160,
166
+ * issuedAt: 1711234560,
167
+ * zoneId: 26,
168
+ * })
169
+ *
170
+ * const payload = ZoneRpcAuthentication.getSignPayload(authentication)
171
+ * ```
172
+ *
173
+ * @param authentication - The Zone RPC authentication token.
174
+ * @param options - Options.
175
+ * @returns The sign payload.
176
+ */
177
+ export declare function getSignPayload(authentication: PartialBy<ZoneRpcAuthentication, 'version'>, options?: getSignPayload.Options): Hex.Hex;
178
+ export declare namespace getSignPayload {
179
+ type Options = {
180
+ /**
181
+ * Root account address for keychain access-key signing.
182
+ *
183
+ * When provided, computes `keccak256(0x04 || authHash || userAddress)`
184
+ * instead of the raw `authHash`.
185
+ */
186
+ userAddress?: TempoAddress.Address | undefined;
187
+ };
188
+ type ErrorType = hash.ErrorType | Errors.GlobalErrorType;
189
+ }
190
+ /**
191
+ * Computes the raw authorization hash for a Zone RPC authentication token.
192
+ *
193
+ * The hash is `keccak256(magicBytes || fields)`.
194
+ *
195
+ * @example
196
+ * ```ts twoslash
197
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
198
+ *
199
+ * const authentication = ZoneRpcAuthentication.from({
200
+ * chainId: 4217000026,
201
+ * expiresAt: 1711235160,
202
+ * issuedAt: 1711234560,
203
+ * zoneId: 26,
204
+ * })
205
+ *
206
+ * const hash = ZoneRpcAuthentication.hash(authentication)
207
+ * ```
208
+ *
209
+ * @param authentication - The Zone RPC authentication token.
210
+ * @returns The authorization hash.
211
+ */
212
+ export declare function hash(authentication: PartialBy<ZoneRpcAuthentication, 'version'>): Hex.Hex;
213
+ export declare namespace hash {
214
+ type ErrorType = getFields.ErrorType | Hash.keccak256.ErrorType | Hex.concat.ErrorType | Errors.GlobalErrorType;
215
+ }
216
+ /**
217
+ * Serializes a Zone RPC authentication token to hex.
218
+ *
219
+ * The serialized format is `<signature><29-byte fields>`.
220
+ *
221
+ * @example
222
+ * ```ts twoslash
223
+ * import { Secp256k1 } from 'ox'
224
+ * import { ZoneRpcAuthentication } from 'ox/tempo'
225
+ *
226
+ * const authentication = ZoneRpcAuthentication.from({
227
+ * chainId: 4217000026,
228
+ * expiresAt: 1711235160,
229
+ * issuedAt: 1711234560,
230
+ * zoneId: 26,
231
+ * })
232
+ *
233
+ * const signature = Secp256k1.sign({
234
+ * payload: ZoneRpcAuthentication.getSignPayload(authentication),
235
+ * privateKey: '0x...',
236
+ * })
237
+ *
238
+ * const serialized = ZoneRpcAuthentication.serialize(authentication, {
239
+ * signature,
240
+ * })
241
+ * ```
242
+ *
243
+ * @param authentication - The Zone RPC authentication token.
244
+ * @param options - Serialization options.
245
+ * @returns The serialized authentication token.
246
+ */
247
+ export declare function serialize(authentication: PartialBy<ZoneRpcAuthentication, 'version'>, options?: serialize.Options): Serialized;
248
+ export declare namespace serialize {
249
+ type Options = {
250
+ /** Signature to attach to the serialized authentication token. */
251
+ signature?: SignatureEnvelope.from.Value | undefined;
252
+ };
253
+ type ErrorType = getFields.ErrorType | MissingSignatureError | SignatureEnvelope.CoercionError | Errors.GlobalErrorType;
254
+ }
255
+ /** Error thrown when a serialized authentication token cannot be deserialized. */
256
+ export declare class InvalidSerializedError extends Errors.BaseError {
257
+ readonly name = "ZoneRpcAuthentication.InvalidSerializedError";
258
+ constructor({ reason, serialized }: {
259
+ reason: string;
260
+ serialized: Hex.Hex;
261
+ });
262
+ }
263
+ /** Error thrown when serializing an authentication token without a signature. */
264
+ export declare class MissingSignatureError extends Errors.BaseError {
265
+ readonly name = "ZoneRpcAuthentication.MissingSignatureError";
266
+ constructor();
267
+ }
268
+ //# sourceMappingURL=ZoneRpcAuthentication.d.ts.map