viem 2.48.2 → 2.48.4

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 (78) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/_cjs/errors/version.js +1 -1
  3. package/_cjs/tempo/Addresses.js +2 -1
  4. package/_cjs/tempo/Addresses.js.map +1 -1
  5. package/_cjs/tempo/Decorator.js +7 -0
  6. package/_cjs/tempo/Decorator.js.map +1 -1
  7. package/_cjs/tempo/actions/index.js +2 -1
  8. package/_cjs/tempo/actions/index.js.map +1 -1
  9. package/_cjs/tempo/actions/virtualAddress.js +95 -0
  10. package/_cjs/tempo/actions/virtualAddress.js.map +1 -0
  11. package/_cjs/tempo/index.js +7 -2
  12. package/_cjs/tempo/index.js.map +1 -1
  13. package/_esm/errors/version.js +1 -1
  14. package/_esm/tempo/Addresses.js +1 -0
  15. package/_esm/tempo/Addresses.js.map +1 -1
  16. package/_esm/tempo/Decorator.js +7 -0
  17. package/_esm/tempo/Decorator.js.map +1 -1
  18. package/_esm/tempo/actions/accessKey.js +10 -10
  19. package/_esm/tempo/actions/amm.js +14 -14
  20. package/_esm/tempo/actions/dex.js +34 -34
  21. package/_esm/tempo/actions/faucet.js +2 -2
  22. package/_esm/tempo/actions/fee.js +10 -10
  23. package/_esm/tempo/actions/index.js +1 -0
  24. package/_esm/tempo/actions/index.js.map +1 -1
  25. package/_esm/tempo/actions/nonce.js +2 -2
  26. package/_esm/tempo/actions/policy.js +18 -18
  27. package/_esm/tempo/actions/reward.js +14 -14
  28. package/_esm/tempo/actions/token.js +61 -61
  29. package/_esm/tempo/actions/validator.js +27 -27
  30. package/_esm/tempo/actions/virtualAddress.js +228 -0
  31. package/_esm/tempo/actions/virtualAddress.js.map +1 -0
  32. package/_esm/tempo/index.js +3 -3
  33. package/_esm/tempo/index.js.map +1 -1
  34. package/_types/errors/version.d.ts +1 -1
  35. package/_types/tempo/Addresses.d.ts +1 -0
  36. package/_types/tempo/Addresses.d.ts.map +1 -1
  37. package/_types/tempo/Decorator.d.ts +101 -1
  38. package/_types/tempo/Decorator.d.ts.map +1 -1
  39. package/_types/tempo/actions/accessKey.d.ts +10 -10
  40. package/_types/tempo/actions/amm.d.ts +14 -14
  41. package/_types/tempo/actions/dex.d.ts +34 -34
  42. package/_types/tempo/actions/faucet.d.ts +2 -2
  43. package/_types/tempo/actions/fee.d.ts +10 -10
  44. package/_types/tempo/actions/index.d.ts +1 -0
  45. package/_types/tempo/actions/index.d.ts.map +1 -1
  46. package/_types/tempo/actions/nonce.d.ts +2 -2
  47. package/_types/tempo/actions/policy.d.ts +18 -18
  48. package/_types/tempo/actions/reward.d.ts +14 -14
  49. package/_types/tempo/actions/token.d.ts +61 -61
  50. package/_types/tempo/actions/validator.d.ts +27 -27
  51. package/_types/tempo/actions/virtualAddress.d.ts +350 -0
  52. package/_types/tempo/actions/virtualAddress.d.ts.map +1 -0
  53. package/_types/tempo/index.d.ts +2 -2
  54. package/_types/tempo/index.d.ts.map +1 -1
  55. package/errors/version.ts +1 -1
  56. package/package.json +2 -2
  57. package/tempo/Addresses.ts +1 -0
  58. package/tempo/Decorator.ts +125 -1
  59. package/tempo/actions/accessKey.ts +10 -10
  60. package/tempo/actions/amm.ts +14 -14
  61. package/tempo/actions/dex.ts +34 -34
  62. package/tempo/actions/faucet.ts +2 -2
  63. package/tempo/actions/fee.ts +10 -10
  64. package/tempo/actions/index.ts +1 -0
  65. package/tempo/actions/nonce.ts +2 -2
  66. package/tempo/actions/policy.ts +18 -18
  67. package/tempo/actions/reward.ts +14 -14
  68. package/tempo/actions/token.ts +61 -61
  69. package/tempo/actions/validator.ts +27 -27
  70. package/tempo/actions/virtualAddress.ts +337 -0
  71. package/tempo/index.ts +10 -3
  72. package/_cjs/tempo/Secp256k1.js +0 -6
  73. package/_cjs/tempo/Secp256k1.js.map +0 -1
  74. package/_esm/tempo/Secp256k1.js +0 -3
  75. package/_esm/tempo/Secp256k1.js.map +0 -1
  76. package/_types/tempo/Secp256k1.d.ts +0 -2
  77. package/_types/tempo/Secp256k1.d.ts.map +0 -1
  78. package/tempo/Secp256k1.ts +0 -2
@@ -16,7 +16,7 @@ import { defineCall } from '../internal/utils.js';
16
16
  *
17
17
  * const client = createClient({
18
18
  * account: privateKeyToAccount('0x...'),
19
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
19
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
20
20
  * transport: http(),
21
21
  * })
22
22
  *
@@ -68,7 +68,7 @@ export async function add(client, parameters) {
68
68
  * import { Actions } from 'viem/tempo'
69
69
  *
70
70
  * const client = createClient({
71
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
71
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
72
72
  * transport: http(),
73
73
  * }).extend(walletActions)
74
74
  *
@@ -117,7 +117,7 @@ export async function add(client, parameters) {
117
117
  *
118
118
  * const client = createClient({
119
119
  * account: privateKeyToAccount('0x...'),
120
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
120
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
121
121
  * transport: http(),
122
122
  * })
123
123
  *
@@ -154,7 +154,7 @@ export async function addSync(client, parameters) {
154
154
  *
155
155
  * const client = createClient({
156
156
  * account: privateKeyToAccount('0x...'),
157
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
157
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
158
158
  * transport: http(),
159
159
  * })
160
160
  *
@@ -196,7 +196,7 @@ export async function changeOwner(client, parameters) {
196
196
  * import { Actions } from 'viem/tempo'
197
197
  *
198
198
  * const client = createClient({
199
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
199
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
200
200
  * transport: http(),
201
201
  * }).extend(walletActions)
202
202
  *
@@ -235,7 +235,7 @@ export async function changeOwner(client, parameters) {
235
235
  *
236
236
  * const client = createClient({
237
237
  * account: privateKeyToAccount('0x...'),
238
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
238
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
239
239
  * transport: http(),
240
240
  * })
241
241
  *
@@ -268,7 +268,7 @@ export async function changeOwnerSync(client, parameters) {
268
268
  *
269
269
  * const client = createClient({
270
270
  * account: privateKeyToAccount('0x...'),
271
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
271
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
272
272
  * transport: http(),
273
273
  * })
274
274
  *
@@ -311,7 +311,7 @@ export async function changeStatus(client, parameters) {
311
311
  * import { Actions } from 'viem/tempo'
312
312
  *
313
313
  * const client = createClient({
314
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
314
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
315
315
  * transport: http(),
316
316
  * }).extend(walletActions)
317
317
  *
@@ -351,7 +351,7 @@ export async function changeStatus(client, parameters) {
351
351
  *
352
352
  * const client = createClient({
353
353
  * account: privateKeyToAccount('0x...'),
354
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
354
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
355
355
  * transport: http(),
356
356
  * })
357
357
  *
@@ -383,7 +383,7 @@ export async function changeStatusSync(client, parameters) {
383
383
  * import { Actions } from 'viem/tempo'
384
384
  *
385
385
  * const client = createClient({
386
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
386
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
387
387
  * transport: http(),
388
388
  * })
389
389
  *
@@ -416,7 +416,7 @@ export async function getNextFullDkgCeremony(client, parameters = {}) {
416
416
  * import { Actions } from 'viem/tempo'
417
417
  *
418
418
  * const client = createClient({
419
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
419
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
420
420
  * transport: http(),
421
421
  * })
422
422
  *
@@ -447,7 +447,7 @@ export async function getNextFullDkgCeremony(client, parameters = {}) {
447
447
  * import { Actions } from 'viem/tempo'
448
448
  *
449
449
  * const client = createClient({
450
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
450
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
451
451
  * transport: http(),
452
452
  * })
453
453
  *
@@ -480,7 +480,7 @@ export async function getOwner(client, parameters = {}) {
480
480
  * import { Actions } from 'viem/tempo'
481
481
  *
482
482
  * const client = createClient({
483
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
483
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
484
484
  * transport: http(),
485
485
  * })
486
486
  *
@@ -511,7 +511,7 @@ export async function getOwner(client, parameters = {}) {
511
511
  * import { Actions } from 'viem/tempo'
512
512
  *
513
513
  * const client = createClient({
514
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
514
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
515
515
  * transport: http(),
516
516
  * })
517
517
  *
@@ -547,7 +547,7 @@ export async function get(client, parameters) {
547
547
  * import { Actions } from 'viem/tempo'
548
548
  *
549
549
  * const client = createClient({
550
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
550
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
551
551
  * transport: http(),
552
552
  * })
553
553
  *
@@ -582,7 +582,7 @@ export async function get(client, parameters) {
582
582
  * import { Actions } from 'viem/tempo'
583
583
  *
584
584
  * const client = createClient({
585
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
585
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
586
586
  * transport: http(),
587
587
  * })
588
588
  *
@@ -618,7 +618,7 @@ export async function getByIndex(client, parameters) {
618
618
  * import { Actions } from 'viem/tempo'
619
619
  *
620
620
  * const client = createClient({
621
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
621
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
622
622
  * transport: http(),
623
623
  * })
624
624
  *
@@ -654,7 +654,7 @@ export async function getByIndex(client, parameters) {
654
654
  * import { Actions } from 'viem/tempo'
655
655
  *
656
656
  * const client = createClient({
657
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
657
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
658
658
  * transport: http(),
659
659
  * })
660
660
  *
@@ -687,7 +687,7 @@ export async function getCount(client, parameters = {}) {
687
687
  * import { Actions } from 'viem/tempo'
688
688
  *
689
689
  * const client = createClient({
690
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
690
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
691
691
  * transport: http(),
692
692
  * })
693
693
  *
@@ -718,7 +718,7 @@ export async function getCount(client, parameters = {}) {
718
718
  * import { Actions } from 'viem/tempo'
719
719
  *
720
720
  * const client = createClient({
721
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
721
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
722
722
  * transport: http(),
723
723
  * })
724
724
  *
@@ -751,7 +751,7 @@ export async function list(client, parameters = {}) {
751
751
  * import { Actions } from 'viem/tempo'
752
752
  *
753
753
  * const client = createClient({
754
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
754
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
755
755
  * transport: http(),
756
756
  * })
757
757
  *
@@ -784,7 +784,7 @@ export async function list(client, parameters = {}) {
784
784
  *
785
785
  * const client = createClient({
786
786
  * account: privateKeyToAccount('0x...'),
787
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
787
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
788
788
  * transport: http(),
789
789
  * })
790
790
  *
@@ -826,7 +826,7 @@ export async function setNextFullDkgCeremony(client, parameters) {
826
826
  * import { Actions } from 'viem/tempo'
827
827
  *
828
828
  * const client = createClient({
829
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
829
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
830
830
  * transport: http(),
831
831
  * }).extend(walletActions)
832
832
  *
@@ -865,7 +865,7 @@ export async function setNextFullDkgCeremony(client, parameters) {
865
865
  *
866
866
  * const client = createClient({
867
867
  * account: privateKeyToAccount('0x...'),
868
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
868
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
869
869
  * transport: http(),
870
870
  * })
871
871
  *
@@ -898,7 +898,7 @@ export async function setNextFullDkgCeremonySync(client, parameters) {
898
898
  *
899
899
  * const client = createClient({
900
900
  * account: privateKeyToAccount('0x...'),
901
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
901
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
902
902
  * transport: http(),
903
903
  * })
904
904
  *
@@ -948,7 +948,7 @@ export async function update(client, parameters) {
948
948
  * import { Actions } from 'viem/tempo'
949
949
  *
950
950
  * const client = createClient({
951
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
951
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
952
952
  * transport: http(),
953
953
  * }).extend(walletActions)
954
954
  *
@@ -990,7 +990,7 @@ export async function update(client, parameters) {
990
990
  *
991
991
  * const client = createClient({
992
992
  * account: privateKeyToAccount('0x...'),
993
- * chain: tempo({ feeToken: '0x20c0000000000000000000000000000000000001' }),
993
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' }),
994
994
  * transport: http(),
995
995
  * })
996
996
  *
@@ -0,0 +1,228 @@
1
+ import * as Hex from 'ox/Hex';
2
+ import { readContract } from '../../actions/public/readContract.js';
3
+ import { writeContract } from '../../actions/wallet/writeContract.js';
4
+ import { writeContractSync } from '../../actions/wallet/writeContractSync.js';
5
+ import { zeroAddress } from '../../constants/address.js';
6
+ import { parseEventLogs } from '../../utils/abi/parseEventLogs.js';
7
+ import * as Abis from '../Abis.js';
8
+ import * as Addresses from '../Addresses.js';
9
+ import { defineCall } from '../internal/utils.js';
10
+ /**
11
+ * Gets the master address for a given master ID.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * import { createClient, http } from 'viem'
16
+ * import { tempo } from 'viem/chains'
17
+ * import { Actions } from 'viem/tempo'
18
+ *
19
+ * const client = createClient({
20
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' })
21
+ * transport: http(),
22
+ * })
23
+ *
24
+ * const address = await Actions.virtualAddress.getMasterAddress(client, {
25
+ * masterId: '0xdeadbeef',
26
+ * })
27
+ * ```
28
+ *
29
+ * @param client - Client.
30
+ * @param parameters - Parameters.
31
+ * @returns The master address, or null if unregistered.
32
+ */
33
+ export async function getMasterAddress(client, parameters) {
34
+ const address = await readContract(client, {
35
+ ...parameters,
36
+ ...getMasterAddress.call({ masterId: parameters.masterId }),
37
+ });
38
+ if (address === zeroAddress)
39
+ return null;
40
+ return address;
41
+ }
42
+ (function (getMasterAddress) {
43
+ /**
44
+ * Defines a call to the `getMaster` function.
45
+ *
46
+ * @param args - Arguments.
47
+ * @returns The call.
48
+ */
49
+ function call(args) {
50
+ const { masterId } = args;
51
+ return defineCall({
52
+ address: Addresses.addressRegistry,
53
+ abi: Abis.addressRegistry,
54
+ args: [masterId],
55
+ functionName: 'getMaster',
56
+ });
57
+ }
58
+ getMasterAddress.call = call;
59
+ })(getMasterAddress || (getMasterAddress = {}));
60
+ /**
61
+ * Resolves a virtual address to its master address.
62
+ *
63
+ * - Non-virtual addresses are returned unchanged.
64
+ * - Virtual addresses with a registered master return the master address.
65
+ * - Virtual addresses with an unregistered master return null.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * import { createClient, http } from 'viem'
70
+ * import { tempo } from 'viem/chains'
71
+ * import { Actions } from 'viem/tempo'
72
+ *
73
+ * const client = createClient({
74
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' })
75
+ * transport: http(),
76
+ * })
77
+ *
78
+ * const recipient = await Actions.virtualAddress.resolve(client, {
79
+ * address: '0x...',
80
+ * })
81
+ * ```
82
+ *
83
+ * @param client - Client.
84
+ * @param parameters - Parameters.
85
+ * @returns The resolved address, or null if virtual and unregistered.
86
+ */
87
+ export async function resolve(client, parameters) {
88
+ if (!isVirtual(parameters.address))
89
+ return parameters.address;
90
+ const masterId = Hex.slice(parameters.address, 0, 4);
91
+ return getMasterAddress(client, { ...parameters, masterId });
92
+ }
93
+ /**
94
+ * Registers a virtual master address.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * import { createClient, http } from 'viem'
99
+ * import { tempo } from 'viem/chains'
100
+ * import { Actions } from 'viem/tempo'
101
+ * import { privateKeyToAccount } from 'viem/accounts'
102
+ *
103
+ * const client = createClient({
104
+ * account: privateKeyToAccount('0x...'),
105
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' })
106
+ * transport: http(),
107
+ * })
108
+ *
109
+ * const hash = await Actions.virtualAddress.registerMaster(client, {
110
+ * salt: '0x...',
111
+ * })
112
+ * ```
113
+ *
114
+ * @param client - Client.
115
+ * @param parameters - Parameters.
116
+ * @returns The transaction hash.
117
+ */
118
+ export async function registerMaster(client, parameters) {
119
+ return registerMaster.inner(writeContract, client, parameters);
120
+ }
121
+ (function (registerMaster) {
122
+ /** @internal */
123
+ async function inner(action, client, parameters) {
124
+ const { salt, ...rest } = parameters;
125
+ const call = registerMaster.call({ salt });
126
+ return (await action(client, {
127
+ ...rest,
128
+ ...call,
129
+ }));
130
+ }
131
+ registerMaster.inner = inner;
132
+ /**
133
+ * Defines a call to the `registerVirtualMaster` function.
134
+ *
135
+ * Can be passed as a parameter to:
136
+ * - [`estimateContractGas`](https://viem.sh/docs/contract/estimateContractGas): estimate the gas cost of the call
137
+ * - [`simulateContract`](https://viem.sh/docs/contract/simulateContract): simulate the call
138
+ * - [`sendCalls`](https://viem.sh/docs/actions/wallet/sendCalls): send multiple calls
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * import { createClient, http, walletActions } from 'viem'
143
+ * import { tempo } from 'viem/chains'
144
+ * import { Actions } from 'viem/tempo'
145
+ *
146
+ * const client = createClient({
147
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' })
148
+ * transport: http(),
149
+ * }).extend(walletActions)
150
+ *
151
+ * const { result } = await client.sendCalls({
152
+ * calls: [
153
+ * Actions.virtualAddress.registerMaster.call({
154
+ * salt: '0x...',
155
+ * }),
156
+ * ]
157
+ * })
158
+ * ```
159
+ *
160
+ * @param args - Arguments.
161
+ * @returns The call.
162
+ */
163
+ function call(args) {
164
+ const { salt } = args;
165
+ return defineCall({
166
+ address: Addresses.addressRegistry,
167
+ abi: Abis.addressRegistry,
168
+ functionName: 'registerVirtualMaster',
169
+ args: [salt],
170
+ });
171
+ }
172
+ registerMaster.call = call;
173
+ function extractEvent(logs) {
174
+ const [log] = parseEventLogs({
175
+ abi: Abis.addressRegistry,
176
+ logs,
177
+ eventName: 'MasterRegistered',
178
+ strict: true,
179
+ });
180
+ if (!log)
181
+ throw new Error('`MasterRegistered` event not found.');
182
+ return log;
183
+ }
184
+ registerMaster.extractEvent = extractEvent;
185
+ })(registerMaster || (registerMaster = {}));
186
+ /**
187
+ * Registers a virtual master address and waits for confirmation.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import { createClient, http } from 'viem'
192
+ * import { tempo } from 'viem/chains'
193
+ * import { Actions } from 'viem/tempo'
194
+ * import { privateKeyToAccount } from 'viem/accounts'
195
+ *
196
+ * const client = createClient({
197
+ * account: privateKeyToAccount('0x...'),
198
+ * chain: tempo.extend({ feeToken: '0x20c0000000000000000000000000000000000001' })
199
+ * transport: http(),
200
+ * })
201
+ *
202
+ * const { receipt, masterId, masterAddress } = await Actions.virtualAddress.registerMasterSync(client, {
203
+ * salt: '0x...',
204
+ * })
205
+ * ```
206
+ *
207
+ * @param client - Client.
208
+ * @param parameters - Parameters.
209
+ * @returns The transaction receipt and extracted event data.
210
+ */
211
+ export async function registerMasterSync(client, parameters) {
212
+ const { throwOnReceiptRevert = true, ...rest } = parameters;
213
+ const receipt = await registerMaster.inner(writeContractSync, client, {
214
+ ...rest,
215
+ throwOnReceiptRevert,
216
+ });
217
+ const { args } = registerMaster.extractEvent(receipt.logs);
218
+ return {
219
+ ...args,
220
+ receipt,
221
+ };
222
+ }
223
+ const virtualMagic = '0xfdfdfdfdfdfdfdfdfdfd';
224
+ /** @internal */
225
+ function isVirtual(address) {
226
+ return Hex.slice(address, 4, 14).toLowerCase() === virtualMagic;
227
+ }
228
+ //# sourceMappingURL=virtualAddress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtualAddress.js","sourceRoot":"","sources":["../../../tempo/actions/virtualAddress.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAA;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAA;AAEnE,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAG7E,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAKxD,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAClE,OAAO,KAAK,IAAI,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,SAAS,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,U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,cAAc,KAAd,cAAc,QAqF9B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAItC,MAAyC,EACzC,UAAyD;IAEzD,MAAM,EAAE,oBAAoB,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,UAAU,CAAA;IAC3D,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,iBAAiB,EAAE,MAAM,EAAE;QACpE,GAAG,IAAI;QACP,oBAAoB;KACZ,CAAC,CAAA;IACX,MAAM,EAAE,IAAI,EAAE,GAAG,cAAc,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1D,OAAO;QACL,GAAG,IAAI;QACP,OAAO;KACC,CAAA;AACZ,CAAC;AAwBD,MAAM,YAAY,GAAG,wBAAwB,CAAA;AAE7C,gBAAgB;AAChB,SAAS,SAAS,CAAC,OAAe;IAChC,OAAO,GAAG,CAAC,KAAK,CAAC,OAAkB,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,KAAK,YAAY,CAAA;AAC5E,CAAC"}
@@ -1,5 +1,6 @@
1
- // biome-ignore lint/performance/noBarrelFile: _
2
- export { Period, TempoAddress, Tick, TokenId } from 'ox/tempo';
1
+ // biome-ignore lint/performance/noBarrelFile: entrypoint module
2
+ export { Bytes, PublicKey, Secp256k1 } from 'ox';
3
+ export { Period, TempoAddress, Tick, TokenId, VirtualAddress, VirtualMaster, } from 'ox/tempo';
3
4
  export * as Abis from './Abis.js';
4
5
  export * as Account from './Account.js';
5
6
  export * as Addresses from './Addresses.js';
@@ -10,7 +11,6 @@ export * as Expiry from './Expiry.js';
10
11
  export * as Formatters from './Formatters.js';
11
12
  export * as Hardfork from './Hardfork.js';
12
13
  export * as P256 from './P256.js';
13
- export * as Secp256k1 from './Secp256k1.js';
14
14
  export * as Storage from './Storage.js';
15
15
  export * as TokenIds from './TokenIds.js';
16
16
  export * as Transaction from './Transaction.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":"AAWA,gDAAgD;AAChD,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAC9D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAEL,SAAS,IAAI,YAAY,GAC1B,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AA8BzC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/E,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../tempo/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAYhD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,IAAI,EACJ,OAAO,EACP,cAAc,EACd,aAAa,GACd,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAC7C,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAEL,SAAS,IAAI,YAAY,GAC1B,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AA8BzC,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAA;AAC/C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/E,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAA"}
@@ -1,2 +1,2 @@
1
- export declare const version = "2.48.2";
1
+ export declare const version = "2.48.4";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1,6 +1,7 @@
1
1
  export declare const accountImplementation = "0x7702c00000000000000000000000000000000000";
2
2
  export declare const accountKeychain = "0xaAAAaaAA00000000000000000000000000000000";
3
3
  export declare const accountRegistrar = "0x7702ac0000000000000000000000000000000000";
4
+ export declare const addressRegistry = "0xfdc0000000000000000000000000000000000000";
4
5
  export declare const feeManager = "0xfeec000000000000000000000000000000000000";
5
6
  export declare const nonceManager = "0x4e4F4E4345000000000000000000000000000000";
6
7
  export declare const pathUsd = "0x20c0000000000000000000000000000000000000";
@@ -1 +1 @@
1
- {"version":3,"file":"Addresses.d.ts","sourceRoot":"","sources":["../../tempo/Addresses.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,+CACY,CAAA;AAC9C,eAAO,MAAM,eAAe,+CAA+C,CAAA;AAC3E,eAAO,MAAM,gBAAgB,+CAA+C,CAAA;AAC5E,eAAO,MAAM,UAAU,+CAA+C,CAAA;AACtE,eAAO,MAAM,YAAY,+CAA+C,CAAA;AACxE,eAAO,MAAM,OAAO,+CAA+C,CAAA;AACnE,eAAO,MAAM,aAAa,+CAA+C,CAAA;AACzE,eAAO,MAAM,YAAY,+CAA+C,CAAA;AACxE,eAAO,MAAM,cAAc,+CAA+C,CAAA;AAC1E,eAAO,MAAM,SAAS,+CAA+C,CAAA;AACrE,eAAO,MAAM,UAAU,+CAA+C,CAAA"}
1
+ {"version":3,"file":"Addresses.d.ts","sourceRoot":"","sources":["../../tempo/Addresses.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,+CACY,CAAA;AAC9C,eAAO,MAAM,eAAe,+CAA+C,CAAA;AAC3E,eAAO,MAAM,gBAAgB,+CAA+C,CAAA;AAC5E,eAAO,MAAM,eAAe,+CAA+C,CAAA;AAC3E,eAAO,MAAM,UAAU,+CAA+C,CAAA;AACtE,eAAO,MAAM,YAAY,+CAA+C,CAAA;AACxE,eAAO,MAAM,OAAO,+CAA+C,CAAA;AACnE,eAAO,MAAM,aAAa,+CAA+C,CAAA;AACzE,eAAO,MAAM,YAAY,+CAA+C,CAAA;AACxE,eAAO,MAAM,cAAc,+CAA+C,CAAA;AAC1E,eAAO,MAAM,SAAS,+CAA+C,CAAA;AACrE,eAAO,MAAM,UAAU,+CAA+C,CAAA"}
@@ -14,6 +14,7 @@ import * as rewardActions from './actions/reward.js';
14
14
  import * as simulateActions from './actions/simulate.js';
15
15
  import * as tokenActions from './actions/token.js';
16
16
  import * as validatorActions from './actions/validator.js';
17
+ import * as virtualAddressActions from './actions/virtualAddress.js';
17
18
  import * as zoneActions from './actions/zone.js';
18
19
  export type Decorator<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = {
19
20
  accessKey: {
@@ -244,7 +245,7 @@ export type Decorator<chain extends Chain | undefined = Chain | undefined, accou
244
245
  * import { tempoActions } from 'viem/tempo'
245
246
  *
246
247
  * const client = createClient({
247
- * chain: tempo({ feeToken: '0x20c...001' }),
248
+ * chain: tempo.extend({ feeToken: '0x20c...001' }),
248
249
  * transport: http(),
249
250
  * }).extend(tempoActions())
250
251
  *
@@ -3533,6 +3534,105 @@ export type Decorator<chain extends Chain | undefined = Chain | undefined, accou
3533
3534
  */
3534
3535
  updateSync: (parameters: validatorActions.updateSync.Parameters<chain, account>) => Promise<validatorActions.updateSync.ReturnValue>;
3535
3536
  };
3537
+ virtualAddress: {
3538
+ /**
3539
+ * Gets the registered master address for a given master ID.
3540
+ *
3541
+ * @example
3542
+ * ```ts
3543
+ * import { createClient, http } from 'viem'
3544
+ * import { tempo } from 'viem/chains'
3545
+ * import { tempoActions } from 'viem/tempo'
3546
+ *
3547
+ * const client = createClient({
3548
+ * chain: tempo,
3549
+ * transport: http(),
3550
+ * }).extend(tempoActions())
3551
+ *
3552
+ * const master = await client.virtualAddress.getMasterAddress({
3553
+ * masterId: '0x58e21090',
3554
+ * })
3555
+ * ```
3556
+ *
3557
+ * @param parameters - Parameters.
3558
+ * @returns The master address, or null if unregistered.
3559
+ */
3560
+ getMasterAddress: (parameters: virtualAddressActions.getMasterAddress.Parameters) => Promise<virtualAddressActions.getMasterAddress.ReturnValue>;
3561
+ /**
3562
+ * Registers the caller as a virtual address master.
3563
+ *
3564
+ * @example
3565
+ * ```ts
3566
+ * import { createClient, http } from 'viem'
3567
+ * import { privateKeyToAccount } from 'viem/accounts'
3568
+ * import { tempo } from 'viem/chains'
3569
+ * import { tempoActions } from 'viem/tempo'
3570
+ *
3571
+ * const client = createClient({
3572
+ * account: privateKeyToAccount('0x...'),
3573
+ * chain: tempo,
3574
+ * transport: http(),
3575
+ * }).extend(tempoActions())
3576
+ *
3577
+ * const hash = await client.virtualAddress.registerMaster({
3578
+ * salt: '0x...',
3579
+ * })
3580
+ * ```
3581
+ *
3582
+ * @param parameters - Parameters.
3583
+ * @returns The transaction hash.
3584
+ */
3585
+ registerMaster: (parameters: virtualAddressActions.registerMaster.Parameters<chain, account>) => Promise<virtualAddressActions.registerMaster.ReturnValue>;
3586
+ /**
3587
+ * Registers the caller as a virtual address master and waits for confirmation.
3588
+ *
3589
+ * @example
3590
+ * ```ts
3591
+ * import { createClient, http } from 'viem'
3592
+ * import { privateKeyToAccount } from 'viem/accounts'
3593
+ * import { tempo } from 'viem/chains'
3594
+ * import { tempoActions } from 'viem/tempo'
3595
+ *
3596
+ * const client = createClient({
3597
+ * account: privateKeyToAccount('0x...'),
3598
+ * chain: tempo,
3599
+ * transport: http(),
3600
+ * }).extend(tempoActions())
3601
+ *
3602
+ * const { receipt, masterId, masterAddress } =
3603
+ * await client.virtualAddress.registerMasterSync({
3604
+ * salt: '0x...',
3605
+ * })
3606
+ * ```
3607
+ *
3608
+ * @param parameters - Parameters.
3609
+ * @returns The transaction receipt and event data.
3610
+ */
3611
+ registerMasterSync: (parameters: virtualAddressActions.registerMasterSync.Parameters<chain, account>) => Promise<virtualAddressActions.registerMasterSync.ReturnValue>;
3612
+ /**
3613
+ * Resolves an address to its effective recipient.
3614
+ *
3615
+ * @example
3616
+ * ```ts
3617
+ * import { createClient, http } from 'viem'
3618
+ * import { tempo } from 'viem/chains'
3619
+ * import { tempoActions } from 'viem/tempo'
3620
+ *
3621
+ * const client = createClient({
3622
+ * chain: tempo,
3623
+ * transport: http(),
3624
+ * }).extend(tempoActions())
3625
+ *
3626
+ * const recipient = await client.virtualAddress.resolve({
3627
+ * address: '0x58e21090fdfdfdfdfdfdfdfdfdfd010203040506',
3628
+ * })
3629
+ * ```
3630
+ *
3631
+ * @param parameters - Parameters.
3632
+ * @returns The resolved address, or null if virtual and unregistered.
3633
+ */
3634
+ resolve: (parameters: virtualAddressActions.resolve.Parameters) => Promise<virtualAddressActions.resolve.ReturnValue>;
3635
+ };
3536
3636
  zone: {
3537
3637
  /**
3538
3638
  * Deposits tokens into a zone.