@tokenops/sdk 1.0.0 → 1.5.1

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 (162) hide show
  1. package/README.md +120 -26
  2. package/dist/{chunk-5SGMJADP.cjs → chunk-2NCLOQ56.cjs} +9 -9
  3. package/dist/{chunk-QIHZVLIK.js → chunk-2PWNH3UE.js} +35 -6
  4. package/dist/{chunk-T5LVV3KY.cjs → chunk-4WPGQSNT.cjs} +3 -3
  5. package/dist/{chunk-SUOG3BQS.cjs → chunk-5X5WL5CU.cjs} +266 -103
  6. package/dist/{chunk-56UI7LUR.cjs → chunk-67OV5CX2.cjs} +19 -0
  7. package/dist/{chunk-WRCUDSUJ.js → chunk-6BMP4ICG.js} +2 -2
  8. package/dist/{chunk-XXXDQSHE.js → chunk-6R4KNAPK.js} +5 -3
  9. package/dist/{chunk-XSNLAS5M.js → chunk-AOP6HMPW.js} +1 -1
  10. package/dist/{chunk-62DF53UQ.cjs → chunk-C7BRZXJA.cjs} +19 -21
  11. package/dist/{chunk-UOG4PJL5.js → chunk-DUZIIRPF.js} +181 -14
  12. package/dist/{chunk-Q7ARQSUH.cjs → chunk-FAXIIH5R.cjs} +3 -3
  13. package/dist/chunk-FT4LNBOS.js +11 -0
  14. package/dist/chunk-IJFQ5L4I.js +2171 -0
  15. package/dist/{chunk-52TC6BF7.js → chunk-IXLO7GO5.js} +210 -47
  16. package/dist/{chunk-CQIPRNS7.cjs → chunk-JK4XMMKM.cjs} +3 -3
  17. package/dist/{chunk-ITQ7WKVC.cjs → chunk-JYOTGRSO.cjs} +8 -8
  18. package/dist/{chunk-VDXVNZCO.cjs → chunk-KLKI352M.cjs} +85 -29
  19. package/dist/{chunk-5SA2HF2W.cjs → chunk-MCRBVJGZ.cjs} +24 -22
  20. package/dist/{chunk-ECT3NL2L.js → chunk-NTZY6IB7.js} +4 -4
  21. package/dist/{chunk-ZHFLRKFY.js → chunk-ODLTEGHB.js} +1 -1
  22. package/dist/{chunk-HGXNRR25.js → chunk-ORFTDNFZ.js} +4 -4
  23. package/dist/{chunk-72YGZEQE.js → chunk-OXTLPTO3.js} +9 -11
  24. package/dist/{chunk-HTOMTEA3.cjs → chunk-PFXURMBZ.cjs} +77 -48
  25. package/dist/{chunk-OLDGMKW2.cjs → chunk-PUPKNW3R.cjs} +35 -2
  26. package/dist/{chunk-IVE3QEGD.js → chunk-QBJ7O2B4.js} +18 -1
  27. package/dist/{chunk-JFLEEXKP.js → chunk-SG65XWH7.js} +58 -2
  28. package/dist/{chunk-K6MFFDBJ.cjs → chunk-T46YXSBP.cjs} +11 -11
  29. package/dist/{chunk-NS44KBV5.cjs → chunk-TEBM66WA.cjs} +12 -12
  30. package/dist/{chunk-6ECAHP5O.cjs → chunk-TIUKIY5V.cjs} +200 -33
  31. package/dist/{chunk-QCA7O2Q5.cjs → chunk-V2PXZVBF.cjs} +4 -4
  32. package/dist/{chunk-JFR5J4FL.cjs → chunk-W7IGCOVL.cjs} +11 -11
  33. package/dist/chunk-WENHUPZC.cjs +2180 -0
  34. package/dist/{chunk-ZXCOJY2Z.js → chunk-WMACINXO.js} +1 -1
  35. package/dist/{chunk-COPFW5Z4.js → chunk-XGGTQQFH.js} +31 -2
  36. package/dist/{chunk-CMRETRZO.js → chunk-YQIBBEFJ.js} +1 -1
  37. package/dist/{chunk-BE2AIZ3K.js → chunk-ZA673I3O.js} +1 -1
  38. package/dist/chunk-ZQUE2B3Q.cjs +33 -0
  39. package/dist/{chunk-FYQ2UW4T.js → chunk-ZWXJTBZO.js} +1 -1
  40. package/dist/core/addresses.d.ts +22 -0
  41. package/dist/core/errors.d.ts +41 -1
  42. package/dist/core/revert-mapper.d.ts +77 -0
  43. package/dist/core/telemetry.d.ts +0 -3
  44. package/dist/core/wagmi-compat.d.ts +40 -0
  45. package/dist/fhe/index.cjs +112 -66
  46. package/dist/fhe/index.d.cts +1 -1
  47. package/dist/fhe/index.d.ts +1 -1
  48. package/dist/fhe/index.js +50 -8
  49. package/dist/fhe/operators.d.ts +1 -1
  50. package/dist/fhe/react/index.cjs +7 -7
  51. package/dist/fhe/react/index.js +2 -2
  52. package/dist/fhe/sepolia-encryptor-web.d.ts +27 -1
  53. package/dist/fhe/sepolia-encryptor.d.ts +38 -0
  54. package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +3 -3
  55. package/dist/fhe-airdrop/advanced/index.cjs +9 -8
  56. package/dist/fhe-airdrop/advanced/index.d.cts +2 -2
  57. package/dist/fhe-airdrop/advanced/index.d.ts +2 -2
  58. package/dist/fhe-airdrop/advanced/index.js +7 -6
  59. package/dist/fhe-airdrop/advanced/react/index.cjs +14 -13
  60. package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -1
  61. package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -1
  62. package/dist/fhe-airdrop/advanced/react/index.js +10 -9
  63. package/dist/fhe-airdrop/airdrop.d.ts +2 -0
  64. package/dist/fhe-airdrop/encryption.d.ts +8 -0
  65. package/dist/fhe-airdrop/factory.d.ts +94 -11
  66. package/dist/fhe-airdrop/index.cjs +61 -57
  67. package/dist/fhe-airdrop/index.d.cts +3 -3
  68. package/dist/fhe-airdrop/index.d.ts +3 -3
  69. package/dist/fhe-airdrop/index.js +7 -7
  70. package/dist/fhe-airdrop/react/index.cjs +163 -133
  71. package/dist/fhe-airdrop/react/index.d.cts +4 -3
  72. package/dist/fhe-airdrop/react/index.d.ts +4 -3
  73. package/dist/fhe-airdrop/react/index.js +38 -13
  74. package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +2 -0
  75. package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
  76. package/dist/fhe-airdrop/react/useClaim.d.ts +2 -0
  77. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +8 -0
  78. package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +8 -0
  79. package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +8 -0
  80. package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -0
  81. package/dist/fhe-airdrop/types.d.ts +45 -0
  82. package/dist/fhe-disperse/encryption.d.ts +8 -0
  83. package/dist/fhe-disperse/index.cjs +69 -65
  84. package/dist/fhe-disperse/index.d.cts +1 -1
  85. package/dist/fhe-disperse/index.d.ts +1 -1
  86. package/dist/fhe-disperse/index.js +8 -8
  87. package/dist/fhe-disperse/react/index.cjs +90 -86
  88. package/dist/fhe-disperse/react/index.d.cts +1 -1
  89. package/dist/fhe-disperse/react/index.d.ts +1 -1
  90. package/dist/fhe-disperse/react/index.js +10 -10
  91. package/dist/fhe-disperse/react/useCalculateFee.d.ts +7 -0
  92. package/dist/fhe-disperse/react/useDisperse.d.ts +9 -0
  93. package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +7 -0
  94. package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +7 -0
  95. package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +8 -2
  96. package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +6 -0
  97. package/dist/fhe-disperse/singleton.d.ts +29 -0
  98. package/dist/fhe-disperse/subtotals.d.ts +6 -0
  99. package/dist/fhe-vesting/advanced/factory-advanced.d.ts +2 -2
  100. package/dist/fhe-vesting/advanced/index.cjs +8 -8
  101. package/dist/fhe-vesting/advanced/index.d.cts +2 -2
  102. package/dist/fhe-vesting/advanced/index.d.ts +2 -2
  103. package/dist/fhe-vesting/advanced/index.js +6 -6
  104. package/dist/fhe-vesting/advanced/react/index.cjs +15 -14
  105. package/dist/fhe-vesting/advanced/react/index.d.cts +1 -1
  106. package/dist/fhe-vesting/advanced/react/index.d.ts +1 -1
  107. package/dist/fhe-vesting/advanced/react/index.js +12 -11
  108. package/dist/fhe-vesting/encryption.d.ts +8 -0
  109. package/dist/fhe-vesting/factory.d.ts +6 -8
  110. package/dist/fhe-vesting/index.cjs +79 -75
  111. package/dist/fhe-vesting/index.d.cts +2 -2
  112. package/dist/fhe-vesting/index.d.ts +2 -2
  113. package/dist/fhe-vesting/index.js +9 -9
  114. package/dist/fhe-vesting/manager.d.ts +101 -3
  115. package/dist/fhe-vesting/react/index.cjs +241 -219
  116. package/dist/fhe-vesting/react/index.d.cts +3 -2
  117. package/dist/fhe-vesting/react/index.d.ts +3 -2
  118. package/dist/fhe-vesting/react/index.js +29 -12
  119. package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
  120. package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +2 -0
  121. package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
  122. package/dist/fhe-vesting/react/useClaim.d.ts +2 -0
  123. package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
  124. package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +7 -1
  125. package/dist/fhe-vesting/react/usePartialClaim.d.ts +8 -0
  126. package/dist/fhe-vesting/react/usePreflightCreateVesting.d.ts +37 -0
  127. package/dist/fhe-vesting/react/useVestingClaim.d.ts +2 -0
  128. package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +6 -0
  129. package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
  130. package/dist/fhe-vesting/types.d.ts +34 -2
  131. package/dist/index.cjs +73 -49
  132. package/dist/index.d.cts +1 -1
  133. package/dist/index.d.ts +1 -1
  134. package/dist/index.js +2 -2
  135. package/dist/testnet-faucet/abis/confidential-test-token.d.ts +1039 -0
  136. package/dist/testnet-faucet/abis/index.d.ts +2 -0
  137. package/dist/testnet-faucet/abis/test-token.d.ts +253 -0
  138. package/dist/testnet-faucet/errors.d.ts +21 -0
  139. package/dist/testnet-faucet/faucet.d.ts +173 -0
  140. package/dist/testnet-faucet/index.cjs +212 -0
  141. package/dist/testnet-faucet/index.d.cts +8 -0
  142. package/dist/testnet-faucet/index.d.ts +8 -0
  143. package/dist/testnet-faucet/index.js +7 -0
  144. package/dist/testnet-faucet/react/_shared.d.ts +61 -0
  145. package/dist/testnet-faucet/react/index.cjs +384 -0
  146. package/dist/testnet-faucet/react/index.d.cts +39 -0
  147. package/dist/testnet-faucet/react/index.d.ts +39 -0
  148. package/dist/testnet-faucet/react/index.js +220 -0
  149. package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +25 -0
  150. package/dist/testnet-faucet/react/useFaucetDecimals.d.ts +9 -0
  151. package/dist/testnet-faucet/react/useFaucetMetadata.d.ts +14 -0
  152. package/dist/testnet-faucet/react/useFaucetRate.d.ts +11 -0
  153. package/dist/testnet-faucet/react/useInferredTotalSupply.d.ts +11 -0
  154. package/dist/testnet-faucet/react/useMaxTotalSupply.d.ts +10 -0
  155. package/dist/testnet-faucet/react/useMintConfidential.d.ts +35 -0
  156. package/dist/testnet-faucet/react/useMintUnderlying.d.ts +31 -0
  157. package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +19 -0
  158. package/dist/testnet-faucet/react/useUnderlyingDecimals.d.ts +9 -0
  159. package/dist/testnet-faucet/react/useUnderlyingTokenAddress.d.ts +12 -0
  160. package/dist/testnet-faucet/types.d.ts +92 -0
  161. package/dist/testnet-faucet/validate.d.ts +44 -0
  162. package/package.json +79 -30
@@ -0,0 +1,2171 @@
1
+ import { SDK_VERSION, isContractRevert, mapContractRevert } from './chunk-SG65XWH7.js';
2
+ import { getConfidentialTestTokenAddress, getTestTokenAddress } from './chunk-XGGTQQFH.js';
3
+ import { normaliseAddress } from './chunk-ZA673I3O.js';
4
+ import { withTelemetry } from './chunk-Q2GP5UDC.js';
5
+ import { asEncryptedHandle, asTxHash } from './chunk-KWFFIJYX.js';
6
+ import { TokenOpsSdkError, UnsupportedChainError, DeploymentAddressUnavailableError, TokenOpsContractError, ReceiptEventNotFoundError, ReceiptEventAmbiguousError, MissingWalletClientError, MissingAccountError, InvalidArgumentError } from './chunk-QBJ7O2B4.js';
7
+ import { sepolia } from 'viem/chains';
8
+ import { parseEventLogs } from 'viem';
9
+
10
+ // src/testnet-faucet/abis/confidential-test-token.ts
11
+ var confidentialTokenopsTestTokenAbi = [
12
+ {
13
+ inputs: [],
14
+ stateMutability: "nonpayable",
15
+ type: "constructor"
16
+ },
17
+ {
18
+ inputs: [
19
+ {
20
+ internalType: "address",
21
+ name: "target",
22
+ type: "address"
23
+ }
24
+ ],
25
+ name: "AddressEmptyCode",
26
+ type: "error"
27
+ },
28
+ {
29
+ inputs: [
30
+ {
31
+ internalType: "address",
32
+ name: "implementation",
33
+ type: "address"
34
+ }
35
+ ],
36
+ name: "ERC1967InvalidImplementation",
37
+ type: "error"
38
+ },
39
+ {
40
+ inputs: [],
41
+ name: "ERC1967NonPayable",
42
+ type: "error"
43
+ },
44
+ {
45
+ inputs: [
46
+ {
47
+ internalType: "address",
48
+ name: "receiver",
49
+ type: "address"
50
+ }
51
+ ],
52
+ name: "ERC7984InvalidReceiver",
53
+ type: "error"
54
+ },
55
+ {
56
+ inputs: [
57
+ {
58
+ internalType: "address",
59
+ name: "receiver",
60
+ type: "address"
61
+ }
62
+ ],
63
+ name: "ERC7984InvalidReceiver",
64
+ type: "error"
65
+ },
66
+ {
67
+ inputs: [
68
+ {
69
+ internalType: "address",
70
+ name: "sender",
71
+ type: "address"
72
+ }
73
+ ],
74
+ name: "ERC7984InvalidSender",
75
+ type: "error"
76
+ },
77
+ {
78
+ inputs: [],
79
+ name: "ERC7984TotalSupplyOverflow",
80
+ type: "error"
81
+ },
82
+ {
83
+ inputs: [
84
+ {
85
+ internalType: "address",
86
+ name: "caller",
87
+ type: "address"
88
+ }
89
+ ],
90
+ name: "ERC7984UnauthorizedCaller",
91
+ type: "error"
92
+ },
93
+ {
94
+ inputs: [
95
+ {
96
+ internalType: "address",
97
+ name: "holder",
98
+ type: "address"
99
+ },
100
+ {
101
+ internalType: "address",
102
+ name: "spender",
103
+ type: "address"
104
+ }
105
+ ],
106
+ name: "ERC7984UnauthorizedSpender",
107
+ type: "error"
108
+ },
109
+ {
110
+ inputs: [
111
+ {
112
+ internalType: "euint64",
113
+ name: "amount",
114
+ type: "bytes32"
115
+ },
116
+ {
117
+ internalType: "address",
118
+ name: "user",
119
+ type: "address"
120
+ }
121
+ ],
122
+ name: "ERC7984UnauthorizedUseOfEncryptedAmount",
123
+ type: "error"
124
+ },
125
+ {
126
+ inputs: [
127
+ {
128
+ internalType: "address",
129
+ name: "holder",
130
+ type: "address"
131
+ }
132
+ ],
133
+ name: "ERC7984ZeroBalance",
134
+ type: "error"
135
+ },
136
+ {
137
+ inputs: [],
138
+ name: "FailedCall",
139
+ type: "error"
140
+ },
141
+ {
142
+ inputs: [],
143
+ name: "InvalidInitialization",
144
+ type: "error"
145
+ },
146
+ {
147
+ inputs: [],
148
+ name: "InvalidKMSSignatures",
149
+ type: "error"
150
+ },
151
+ {
152
+ inputs: [
153
+ {
154
+ internalType: "bytes32",
155
+ name: "unwrapRequestId",
156
+ type: "bytes32"
157
+ }
158
+ ],
159
+ name: "InvalidUnwrapRequest",
160
+ type: "error"
161
+ },
162
+ {
163
+ inputs: [],
164
+ name: "NotInitializing",
165
+ type: "error"
166
+ },
167
+ {
168
+ inputs: [
169
+ {
170
+ internalType: "address",
171
+ name: "owner",
172
+ type: "address"
173
+ }
174
+ ],
175
+ name: "OwnableInvalidOwner",
176
+ type: "error"
177
+ },
178
+ {
179
+ inputs: [
180
+ {
181
+ internalType: "address",
182
+ name: "account",
183
+ type: "address"
184
+ }
185
+ ],
186
+ name: "OwnableUnauthorizedAccount",
187
+ type: "error"
188
+ },
189
+ {
190
+ inputs: [
191
+ {
192
+ internalType: "uint8",
193
+ name: "bits",
194
+ type: "uint8"
195
+ },
196
+ {
197
+ internalType: "uint256",
198
+ name: "value",
199
+ type: "uint256"
200
+ }
201
+ ],
202
+ name: "SafeCastOverflowedUintDowncast",
203
+ type: "error"
204
+ },
205
+ {
206
+ inputs: [
207
+ {
208
+ internalType: "address",
209
+ name: "token",
210
+ type: "address"
211
+ }
212
+ ],
213
+ name: "SafeERC20FailedOperation",
214
+ type: "error"
215
+ },
216
+ {
217
+ inputs: [
218
+ {
219
+ internalType: "bytes32",
220
+ name: "handle",
221
+ type: "bytes32"
222
+ },
223
+ {
224
+ internalType: "address",
225
+ name: "sender",
226
+ type: "address"
227
+ }
228
+ ],
229
+ name: "SenderNotAllowedToUseHandle",
230
+ type: "error"
231
+ },
232
+ {
233
+ inputs: [],
234
+ name: "UUPSUnauthorizedCallContext",
235
+ type: "error"
236
+ },
237
+ {
238
+ inputs: [
239
+ {
240
+ internalType: "bytes32",
241
+ name: "slot",
242
+ type: "bytes32"
243
+ }
244
+ ],
245
+ name: "UUPSUnsupportedProxiableUUID",
246
+ type: "error"
247
+ },
248
+ {
249
+ inputs: [],
250
+ name: "ZamaProtocolUnsupported",
251
+ type: "error"
252
+ },
253
+ {
254
+ anonymous: false,
255
+ inputs: [
256
+ {
257
+ indexed: true,
258
+ internalType: "euint64",
259
+ name: "encryptedAmount",
260
+ type: "bytes32"
261
+ },
262
+ {
263
+ indexed: true,
264
+ internalType: "address",
265
+ name: "requester",
266
+ type: "address"
267
+ }
268
+ ],
269
+ name: "AmountDiscloseRequested",
270
+ type: "event"
271
+ },
272
+ {
273
+ anonymous: false,
274
+ inputs: [
275
+ {
276
+ indexed: true,
277
+ internalType: "euint64",
278
+ name: "encryptedAmount",
279
+ type: "bytes32"
280
+ },
281
+ {
282
+ indexed: false,
283
+ internalType: "uint64",
284
+ name: "amount",
285
+ type: "uint64"
286
+ }
287
+ ],
288
+ name: "AmountDisclosed",
289
+ type: "event"
290
+ },
291
+ {
292
+ anonymous: false,
293
+ inputs: [
294
+ {
295
+ indexed: true,
296
+ internalType: "address",
297
+ name: "to",
298
+ type: "address"
299
+ },
300
+ {
301
+ indexed: false,
302
+ internalType: "uint256",
303
+ name: "underlyingMinted",
304
+ type: "uint256"
305
+ },
306
+ {
307
+ indexed: false,
308
+ internalType: "euint64",
309
+ name: "encryptedAmount",
310
+ type: "bytes32"
311
+ }
312
+ ],
313
+ name: "ConfidentialMint",
314
+ type: "event"
315
+ },
316
+ {
317
+ anonymous: false,
318
+ inputs: [
319
+ {
320
+ indexed: true,
321
+ internalType: "address",
322
+ name: "from",
323
+ type: "address"
324
+ },
325
+ {
326
+ indexed: true,
327
+ internalType: "address",
328
+ name: "to",
329
+ type: "address"
330
+ },
331
+ {
332
+ indexed: true,
333
+ internalType: "euint64",
334
+ name: "amount",
335
+ type: "bytes32"
336
+ }
337
+ ],
338
+ name: "ConfidentialTransfer",
339
+ type: "event"
340
+ },
341
+ {
342
+ anonymous: false,
343
+ inputs: [
344
+ {
345
+ indexed: false,
346
+ internalType: "uint64",
347
+ name: "version",
348
+ type: "uint64"
349
+ }
350
+ ],
351
+ name: "Initialized",
352
+ type: "event"
353
+ },
354
+ {
355
+ anonymous: false,
356
+ inputs: [
357
+ {
358
+ indexed: true,
359
+ internalType: "address",
360
+ name: "holder",
361
+ type: "address"
362
+ },
363
+ {
364
+ indexed: true,
365
+ internalType: "address",
366
+ name: "operator",
367
+ type: "address"
368
+ },
369
+ {
370
+ indexed: false,
371
+ internalType: "uint48",
372
+ name: "until",
373
+ type: "uint48"
374
+ }
375
+ ],
376
+ name: "OperatorSet",
377
+ type: "event"
378
+ },
379
+ {
380
+ anonymous: false,
381
+ inputs: [
382
+ {
383
+ indexed: true,
384
+ internalType: "address",
385
+ name: "previousOwner",
386
+ type: "address"
387
+ },
388
+ {
389
+ indexed: true,
390
+ internalType: "address",
391
+ name: "newOwner",
392
+ type: "address"
393
+ }
394
+ ],
395
+ name: "OwnershipTransferStarted",
396
+ type: "event"
397
+ },
398
+ {
399
+ anonymous: false,
400
+ inputs: [
401
+ {
402
+ indexed: true,
403
+ internalType: "address",
404
+ name: "previousOwner",
405
+ type: "address"
406
+ },
407
+ {
408
+ indexed: true,
409
+ internalType: "address",
410
+ name: "newOwner",
411
+ type: "address"
412
+ }
413
+ ],
414
+ name: "OwnershipTransferred",
415
+ type: "event"
416
+ },
417
+ {
418
+ anonymous: false,
419
+ inputs: [
420
+ {
421
+ indexed: false,
422
+ internalType: "bytes32[]",
423
+ name: "handlesList",
424
+ type: "bytes32[]"
425
+ },
426
+ {
427
+ indexed: false,
428
+ internalType: "bytes",
429
+ name: "abiEncodedCleartexts",
430
+ type: "bytes"
431
+ }
432
+ ],
433
+ name: "PublicDecryptionVerified",
434
+ type: "event"
435
+ },
436
+ {
437
+ anonymous: false,
438
+ inputs: [
439
+ {
440
+ indexed: true,
441
+ internalType: "address",
442
+ name: "receiver",
443
+ type: "address"
444
+ },
445
+ {
446
+ indexed: true,
447
+ internalType: "bytes32",
448
+ name: "unwrapRequestId",
449
+ type: "bytes32"
450
+ },
451
+ {
452
+ indexed: false,
453
+ internalType: "euint64",
454
+ name: "encryptedAmount",
455
+ type: "bytes32"
456
+ },
457
+ {
458
+ indexed: false,
459
+ internalType: "uint64",
460
+ name: "cleartextAmount",
461
+ type: "uint64"
462
+ }
463
+ ],
464
+ name: "UnwrapFinalized",
465
+ type: "event"
466
+ },
467
+ {
468
+ anonymous: false,
469
+ inputs: [
470
+ {
471
+ indexed: true,
472
+ internalType: "address",
473
+ name: "receiver",
474
+ type: "address"
475
+ },
476
+ {
477
+ indexed: true,
478
+ internalType: "bytes32",
479
+ name: "unwrapRequestId",
480
+ type: "bytes32"
481
+ },
482
+ {
483
+ indexed: false,
484
+ internalType: "euint64",
485
+ name: "amount",
486
+ type: "bytes32"
487
+ }
488
+ ],
489
+ name: "UnwrapRequested",
490
+ type: "event"
491
+ },
492
+ {
493
+ anonymous: false,
494
+ inputs: [
495
+ {
496
+ indexed: true,
497
+ internalType: "address",
498
+ name: "implementation",
499
+ type: "address"
500
+ }
501
+ ],
502
+ name: "Upgraded",
503
+ type: "event"
504
+ },
505
+ {
506
+ anonymous: false,
507
+ inputs: [
508
+ {
509
+ indexed: true,
510
+ internalType: "address",
511
+ name: "to",
512
+ type: "address"
513
+ },
514
+ {
515
+ indexed: false,
516
+ internalType: "uint256",
517
+ name: "roundedAmount",
518
+ type: "uint256"
519
+ },
520
+ {
521
+ indexed: false,
522
+ internalType: "euint64",
523
+ name: "encryptedWrappedAmount",
524
+ type: "bytes32"
525
+ }
526
+ ],
527
+ name: "Wrap",
528
+ type: "event"
529
+ },
530
+ {
531
+ inputs: [],
532
+ name: "UPGRADE_INTERFACE_VERSION",
533
+ outputs: [
534
+ {
535
+ internalType: "string",
536
+ name: "",
537
+ type: "string"
538
+ }
539
+ ],
540
+ stateMutability: "view",
541
+ type: "function"
542
+ },
543
+ {
544
+ inputs: [],
545
+ name: "acceptOwnership",
546
+ outputs: [],
547
+ stateMutability: "nonpayable",
548
+ type: "function"
549
+ },
550
+ {
551
+ inputs: [
552
+ {
553
+ internalType: "address",
554
+ name: "account",
555
+ type: "address"
556
+ }
557
+ ],
558
+ name: "confidentialBalanceOf",
559
+ outputs: [
560
+ {
561
+ internalType: "euint64",
562
+ name: "",
563
+ type: "bytes32"
564
+ }
565
+ ],
566
+ stateMutability: "view",
567
+ type: "function"
568
+ },
569
+ {
570
+ inputs: [],
571
+ name: "confidentialProtocolId",
572
+ outputs: [
573
+ {
574
+ internalType: "uint256",
575
+ name: "",
576
+ type: "uint256"
577
+ }
578
+ ],
579
+ stateMutability: "view",
580
+ type: "function"
581
+ },
582
+ {
583
+ inputs: [],
584
+ name: "confidentialTotalSupply",
585
+ outputs: [
586
+ {
587
+ internalType: "euint64",
588
+ name: "",
589
+ type: "bytes32"
590
+ }
591
+ ],
592
+ stateMutability: "view",
593
+ type: "function"
594
+ },
595
+ {
596
+ inputs: [
597
+ {
598
+ internalType: "address",
599
+ name: "to",
600
+ type: "address"
601
+ },
602
+ {
603
+ internalType: "externalEuint64",
604
+ name: "encryptedAmount",
605
+ type: "bytes32"
606
+ },
607
+ {
608
+ internalType: "bytes",
609
+ name: "inputProof",
610
+ type: "bytes"
611
+ }
612
+ ],
613
+ name: "confidentialTransfer",
614
+ outputs: [
615
+ {
616
+ internalType: "euint64",
617
+ name: "",
618
+ type: "bytes32"
619
+ }
620
+ ],
621
+ stateMutability: "nonpayable",
622
+ type: "function"
623
+ },
624
+ {
625
+ inputs: [
626
+ {
627
+ internalType: "address",
628
+ name: "to",
629
+ type: "address"
630
+ },
631
+ {
632
+ internalType: "euint64",
633
+ name: "amount",
634
+ type: "bytes32"
635
+ }
636
+ ],
637
+ name: "confidentialTransfer",
638
+ outputs: [
639
+ {
640
+ internalType: "euint64",
641
+ name: "",
642
+ type: "bytes32"
643
+ }
644
+ ],
645
+ stateMutability: "nonpayable",
646
+ type: "function"
647
+ },
648
+ {
649
+ inputs: [
650
+ {
651
+ internalType: "address",
652
+ name: "to",
653
+ type: "address"
654
+ },
655
+ {
656
+ internalType: "euint64",
657
+ name: "amount",
658
+ type: "bytes32"
659
+ },
660
+ {
661
+ internalType: "bytes",
662
+ name: "data",
663
+ type: "bytes"
664
+ }
665
+ ],
666
+ name: "confidentialTransferAndCall",
667
+ outputs: [
668
+ {
669
+ internalType: "euint64",
670
+ name: "transferred",
671
+ type: "bytes32"
672
+ }
673
+ ],
674
+ stateMutability: "nonpayable",
675
+ type: "function"
676
+ },
677
+ {
678
+ inputs: [
679
+ {
680
+ internalType: "address",
681
+ name: "to",
682
+ type: "address"
683
+ },
684
+ {
685
+ internalType: "externalEuint64",
686
+ name: "encryptedAmount",
687
+ type: "bytes32"
688
+ },
689
+ {
690
+ internalType: "bytes",
691
+ name: "inputProof",
692
+ type: "bytes"
693
+ },
694
+ {
695
+ internalType: "bytes",
696
+ name: "data",
697
+ type: "bytes"
698
+ }
699
+ ],
700
+ name: "confidentialTransferAndCall",
701
+ outputs: [
702
+ {
703
+ internalType: "euint64",
704
+ name: "transferred",
705
+ type: "bytes32"
706
+ }
707
+ ],
708
+ stateMutability: "nonpayable",
709
+ type: "function"
710
+ },
711
+ {
712
+ inputs: [
713
+ {
714
+ internalType: "address",
715
+ name: "from",
716
+ type: "address"
717
+ },
718
+ {
719
+ internalType: "address",
720
+ name: "to",
721
+ type: "address"
722
+ },
723
+ {
724
+ internalType: "externalEuint64",
725
+ name: "encryptedAmount",
726
+ type: "bytes32"
727
+ },
728
+ {
729
+ internalType: "bytes",
730
+ name: "inputProof",
731
+ type: "bytes"
732
+ }
733
+ ],
734
+ name: "confidentialTransferFrom",
735
+ outputs: [
736
+ {
737
+ internalType: "euint64",
738
+ name: "transferred",
739
+ type: "bytes32"
740
+ }
741
+ ],
742
+ stateMutability: "nonpayable",
743
+ type: "function"
744
+ },
745
+ {
746
+ inputs: [
747
+ {
748
+ internalType: "address",
749
+ name: "from",
750
+ type: "address"
751
+ },
752
+ {
753
+ internalType: "address",
754
+ name: "to",
755
+ type: "address"
756
+ },
757
+ {
758
+ internalType: "euint64",
759
+ name: "amount",
760
+ type: "bytes32"
761
+ }
762
+ ],
763
+ name: "confidentialTransferFrom",
764
+ outputs: [
765
+ {
766
+ internalType: "euint64",
767
+ name: "transferred",
768
+ type: "bytes32"
769
+ }
770
+ ],
771
+ stateMutability: "nonpayable",
772
+ type: "function"
773
+ },
774
+ {
775
+ inputs: [
776
+ {
777
+ internalType: "address",
778
+ name: "from",
779
+ type: "address"
780
+ },
781
+ {
782
+ internalType: "address",
783
+ name: "to",
784
+ type: "address"
785
+ },
786
+ {
787
+ internalType: "externalEuint64",
788
+ name: "encryptedAmount",
789
+ type: "bytes32"
790
+ },
791
+ {
792
+ internalType: "bytes",
793
+ name: "inputProof",
794
+ type: "bytes"
795
+ },
796
+ {
797
+ internalType: "bytes",
798
+ name: "data",
799
+ type: "bytes"
800
+ }
801
+ ],
802
+ name: "confidentialTransferFromAndCall",
803
+ outputs: [
804
+ {
805
+ internalType: "euint64",
806
+ name: "transferred",
807
+ type: "bytes32"
808
+ }
809
+ ],
810
+ stateMutability: "nonpayable",
811
+ type: "function"
812
+ },
813
+ {
814
+ inputs: [
815
+ {
816
+ internalType: "address",
817
+ name: "from",
818
+ type: "address"
819
+ },
820
+ {
821
+ internalType: "address",
822
+ name: "to",
823
+ type: "address"
824
+ },
825
+ {
826
+ internalType: "euint64",
827
+ name: "amount",
828
+ type: "bytes32"
829
+ },
830
+ {
831
+ internalType: "bytes",
832
+ name: "data",
833
+ type: "bytes"
834
+ }
835
+ ],
836
+ name: "confidentialTransferFromAndCall",
837
+ outputs: [
838
+ {
839
+ internalType: "euint64",
840
+ name: "transferred",
841
+ type: "bytes32"
842
+ }
843
+ ],
844
+ stateMutability: "nonpayable",
845
+ type: "function"
846
+ },
847
+ {
848
+ inputs: [],
849
+ name: "contractURI",
850
+ outputs: [
851
+ {
852
+ internalType: "string",
853
+ name: "",
854
+ type: "string"
855
+ }
856
+ ],
857
+ stateMutability: "view",
858
+ type: "function"
859
+ },
860
+ {
861
+ inputs: [],
862
+ name: "decimals",
863
+ outputs: [
864
+ {
865
+ internalType: "uint8",
866
+ name: "",
867
+ type: "uint8"
868
+ }
869
+ ],
870
+ stateMutability: "view",
871
+ type: "function"
872
+ },
873
+ {
874
+ inputs: [
875
+ {
876
+ internalType: "euint64",
877
+ name: "encryptedAmount",
878
+ type: "bytes32"
879
+ },
880
+ {
881
+ internalType: "uint64",
882
+ name: "cleartextAmount",
883
+ type: "uint64"
884
+ },
885
+ {
886
+ internalType: "bytes",
887
+ name: "decryptionProof",
888
+ type: "bytes"
889
+ }
890
+ ],
891
+ name: "discloseEncryptedAmount",
892
+ outputs: [],
893
+ stateMutability: "nonpayable",
894
+ type: "function"
895
+ },
896
+ {
897
+ inputs: [
898
+ {
899
+ internalType: "bytes32",
900
+ name: "unwrapRequestId",
901
+ type: "bytes32"
902
+ },
903
+ {
904
+ internalType: "uint64",
905
+ name: "unwrapAmountCleartext",
906
+ type: "uint64"
907
+ },
908
+ {
909
+ internalType: "bytes",
910
+ name: "decryptionProof",
911
+ type: "bytes"
912
+ }
913
+ ],
914
+ name: "finalizeUnwrap",
915
+ outputs: [],
916
+ stateMutability: "nonpayable",
917
+ type: "function"
918
+ },
919
+ {
920
+ inputs: [],
921
+ name: "inferredTotalSupply",
922
+ outputs: [
923
+ {
924
+ internalType: "uint256",
925
+ name: "",
926
+ type: "uint256"
927
+ }
928
+ ],
929
+ stateMutability: "view",
930
+ type: "function"
931
+ },
932
+ {
933
+ inputs: [
934
+ {
935
+ internalType: "string",
936
+ name: "name_",
937
+ type: "string"
938
+ },
939
+ {
940
+ internalType: "string",
941
+ name: "symbol_",
942
+ type: "string"
943
+ },
944
+ {
945
+ internalType: "string",
946
+ name: "contractURI_",
947
+ type: "string"
948
+ },
949
+ {
950
+ internalType: "contract IERC20",
951
+ name: "underlying_",
952
+ type: "address"
953
+ },
954
+ {
955
+ internalType: "address",
956
+ name: "owner_",
957
+ type: "address"
958
+ }
959
+ ],
960
+ name: "initialize",
961
+ outputs: [],
962
+ stateMutability: "nonpayable",
963
+ type: "function"
964
+ },
965
+ {
966
+ inputs: [
967
+ {
968
+ internalType: "address",
969
+ name: "holder",
970
+ type: "address"
971
+ },
972
+ {
973
+ internalType: "address",
974
+ name: "spender",
975
+ type: "address"
976
+ }
977
+ ],
978
+ name: "isOperator",
979
+ outputs: [
980
+ {
981
+ internalType: "bool",
982
+ name: "",
983
+ type: "bool"
984
+ }
985
+ ],
986
+ stateMutability: "view",
987
+ type: "function"
988
+ },
989
+ {
990
+ inputs: [],
991
+ name: "maxTotalSupply",
992
+ outputs: [
993
+ {
994
+ internalType: "uint256",
995
+ name: "",
996
+ type: "uint256"
997
+ }
998
+ ],
999
+ stateMutability: "view",
1000
+ type: "function"
1001
+ },
1002
+ {
1003
+ inputs: [
1004
+ {
1005
+ internalType: "address",
1006
+ name: "to",
1007
+ type: "address"
1008
+ },
1009
+ {
1010
+ internalType: "uint64",
1011
+ name: "amount",
1012
+ type: "uint64"
1013
+ }
1014
+ ],
1015
+ name: "mint",
1016
+ outputs: [
1017
+ {
1018
+ internalType: "euint64",
1019
+ name: "minted",
1020
+ type: "bytes32"
1021
+ }
1022
+ ],
1023
+ stateMutability: "nonpayable",
1024
+ type: "function"
1025
+ },
1026
+ {
1027
+ inputs: [],
1028
+ name: "name",
1029
+ outputs: [
1030
+ {
1031
+ internalType: "string",
1032
+ name: "",
1033
+ type: "string"
1034
+ }
1035
+ ],
1036
+ stateMutability: "view",
1037
+ type: "function"
1038
+ },
1039
+ {
1040
+ inputs: [
1041
+ {
1042
+ internalType: "address",
1043
+ name: "",
1044
+ type: "address"
1045
+ },
1046
+ {
1047
+ internalType: "address",
1048
+ name: "from",
1049
+ type: "address"
1050
+ },
1051
+ {
1052
+ internalType: "uint256",
1053
+ name: "amount",
1054
+ type: "uint256"
1055
+ },
1056
+ {
1057
+ internalType: "bytes",
1058
+ name: "data",
1059
+ type: "bytes"
1060
+ }
1061
+ ],
1062
+ name: "onTransferReceived",
1063
+ outputs: [
1064
+ {
1065
+ internalType: "bytes4",
1066
+ name: "",
1067
+ type: "bytes4"
1068
+ }
1069
+ ],
1070
+ stateMutability: "nonpayable",
1071
+ type: "function"
1072
+ },
1073
+ {
1074
+ inputs: [],
1075
+ name: "owner",
1076
+ outputs: [
1077
+ {
1078
+ internalType: "address",
1079
+ name: "",
1080
+ type: "address"
1081
+ }
1082
+ ],
1083
+ stateMutability: "view",
1084
+ type: "function"
1085
+ },
1086
+ {
1087
+ inputs: [],
1088
+ name: "pendingOwner",
1089
+ outputs: [
1090
+ {
1091
+ internalType: "address",
1092
+ name: "",
1093
+ type: "address"
1094
+ }
1095
+ ],
1096
+ stateMutability: "view",
1097
+ type: "function"
1098
+ },
1099
+ {
1100
+ inputs: [],
1101
+ name: "proxiableUUID",
1102
+ outputs: [
1103
+ {
1104
+ internalType: "bytes32",
1105
+ name: "",
1106
+ type: "bytes32"
1107
+ }
1108
+ ],
1109
+ stateMutability: "view",
1110
+ type: "function"
1111
+ },
1112
+ {
1113
+ inputs: [],
1114
+ name: "rate",
1115
+ outputs: [
1116
+ {
1117
+ internalType: "uint256",
1118
+ name: "",
1119
+ type: "uint256"
1120
+ }
1121
+ ],
1122
+ stateMutability: "view",
1123
+ type: "function"
1124
+ },
1125
+ {
1126
+ inputs: [],
1127
+ name: "renounceOwnership",
1128
+ outputs: [],
1129
+ stateMutability: "nonpayable",
1130
+ type: "function"
1131
+ },
1132
+ {
1133
+ inputs: [
1134
+ {
1135
+ internalType: "euint64",
1136
+ name: "encryptedAmount",
1137
+ type: "bytes32"
1138
+ }
1139
+ ],
1140
+ name: "requestDiscloseEncryptedAmount",
1141
+ outputs: [],
1142
+ stateMutability: "nonpayable",
1143
+ type: "function"
1144
+ },
1145
+ {
1146
+ inputs: [
1147
+ {
1148
+ internalType: "address",
1149
+ name: "operator",
1150
+ type: "address"
1151
+ },
1152
+ {
1153
+ internalType: "uint48",
1154
+ name: "until",
1155
+ type: "uint48"
1156
+ }
1157
+ ],
1158
+ name: "setOperator",
1159
+ outputs: [],
1160
+ stateMutability: "nonpayable",
1161
+ type: "function"
1162
+ },
1163
+ {
1164
+ inputs: [
1165
+ {
1166
+ internalType: "bytes4",
1167
+ name: "interfaceId",
1168
+ type: "bytes4"
1169
+ }
1170
+ ],
1171
+ name: "supportsInterface",
1172
+ outputs: [
1173
+ {
1174
+ internalType: "bool",
1175
+ name: "",
1176
+ type: "bool"
1177
+ }
1178
+ ],
1179
+ stateMutability: "view",
1180
+ type: "function"
1181
+ },
1182
+ {
1183
+ inputs: [],
1184
+ name: "symbol",
1185
+ outputs: [
1186
+ {
1187
+ internalType: "string",
1188
+ name: "",
1189
+ type: "string"
1190
+ }
1191
+ ],
1192
+ stateMutability: "view",
1193
+ type: "function"
1194
+ },
1195
+ {
1196
+ inputs: [
1197
+ {
1198
+ internalType: "address",
1199
+ name: "newOwner",
1200
+ type: "address"
1201
+ }
1202
+ ],
1203
+ name: "transferOwnership",
1204
+ outputs: [],
1205
+ stateMutability: "nonpayable",
1206
+ type: "function"
1207
+ },
1208
+ {
1209
+ inputs: [],
1210
+ name: "underlying",
1211
+ outputs: [
1212
+ {
1213
+ internalType: "address",
1214
+ name: "",
1215
+ type: "address"
1216
+ }
1217
+ ],
1218
+ stateMutability: "view",
1219
+ type: "function"
1220
+ },
1221
+ {
1222
+ inputs: [
1223
+ {
1224
+ internalType: "address",
1225
+ name: "from",
1226
+ type: "address"
1227
+ },
1228
+ {
1229
+ internalType: "address",
1230
+ name: "to",
1231
+ type: "address"
1232
+ },
1233
+ {
1234
+ internalType: "externalEuint64",
1235
+ name: "encryptedAmount",
1236
+ type: "bytes32"
1237
+ },
1238
+ {
1239
+ internalType: "bytes",
1240
+ name: "inputProof",
1241
+ type: "bytes"
1242
+ }
1243
+ ],
1244
+ name: "unwrap",
1245
+ outputs: [
1246
+ {
1247
+ internalType: "bytes32",
1248
+ name: "",
1249
+ type: "bytes32"
1250
+ }
1251
+ ],
1252
+ stateMutability: "nonpayable",
1253
+ type: "function"
1254
+ },
1255
+ {
1256
+ inputs: [
1257
+ {
1258
+ internalType: "address",
1259
+ name: "from",
1260
+ type: "address"
1261
+ },
1262
+ {
1263
+ internalType: "address",
1264
+ name: "to",
1265
+ type: "address"
1266
+ },
1267
+ {
1268
+ internalType: "euint64",
1269
+ name: "amount",
1270
+ type: "bytes32"
1271
+ }
1272
+ ],
1273
+ name: "unwrap",
1274
+ outputs: [
1275
+ {
1276
+ internalType: "bytes32",
1277
+ name: "",
1278
+ type: "bytes32"
1279
+ }
1280
+ ],
1281
+ stateMutability: "nonpayable",
1282
+ type: "function"
1283
+ },
1284
+ {
1285
+ inputs: [
1286
+ {
1287
+ internalType: "bytes32",
1288
+ name: "unwrapRequestId",
1289
+ type: "bytes32"
1290
+ }
1291
+ ],
1292
+ name: "unwrapAmount",
1293
+ outputs: [
1294
+ {
1295
+ internalType: "euint64",
1296
+ name: "",
1297
+ type: "bytes32"
1298
+ }
1299
+ ],
1300
+ stateMutability: "view",
1301
+ type: "function"
1302
+ },
1303
+ {
1304
+ inputs: [
1305
+ {
1306
+ internalType: "bytes32",
1307
+ name: "unwrapRequestId",
1308
+ type: "bytes32"
1309
+ }
1310
+ ],
1311
+ name: "unwrapRequester",
1312
+ outputs: [
1313
+ {
1314
+ internalType: "address",
1315
+ name: "",
1316
+ type: "address"
1317
+ }
1318
+ ],
1319
+ stateMutability: "view",
1320
+ type: "function"
1321
+ },
1322
+ {
1323
+ inputs: [
1324
+ {
1325
+ internalType: "address",
1326
+ name: "newImplementation",
1327
+ type: "address"
1328
+ },
1329
+ {
1330
+ internalType: "bytes",
1331
+ name: "data",
1332
+ type: "bytes"
1333
+ }
1334
+ ],
1335
+ name: "upgradeToAndCall",
1336
+ outputs: [],
1337
+ stateMutability: "payable",
1338
+ type: "function"
1339
+ },
1340
+ {
1341
+ inputs: [
1342
+ {
1343
+ internalType: "address",
1344
+ name: "to",
1345
+ type: "address"
1346
+ },
1347
+ {
1348
+ internalType: "uint256",
1349
+ name: "amount",
1350
+ type: "uint256"
1351
+ }
1352
+ ],
1353
+ name: "wrap",
1354
+ outputs: [
1355
+ {
1356
+ internalType: "euint64",
1357
+ name: "",
1358
+ type: "bytes32"
1359
+ }
1360
+ ],
1361
+ stateMutability: "nonpayable",
1362
+ type: "function"
1363
+ }
1364
+ ];
1365
+
1366
+ // src/testnet-faucet/abis/test-token.ts
1367
+ var tokenopsTestTokenAbi = [
1368
+ {
1369
+ inputs: [],
1370
+ stateMutability: "nonpayable",
1371
+ type: "constructor"
1372
+ },
1373
+ {
1374
+ inputs: [
1375
+ {
1376
+ internalType: "address",
1377
+ name: "spender",
1378
+ type: "address"
1379
+ },
1380
+ {
1381
+ internalType: "uint256",
1382
+ name: "allowance",
1383
+ type: "uint256"
1384
+ },
1385
+ {
1386
+ internalType: "uint256",
1387
+ name: "needed",
1388
+ type: "uint256"
1389
+ }
1390
+ ],
1391
+ name: "ERC20InsufficientAllowance",
1392
+ type: "error"
1393
+ },
1394
+ {
1395
+ inputs: [
1396
+ {
1397
+ internalType: "address",
1398
+ name: "sender",
1399
+ type: "address"
1400
+ },
1401
+ {
1402
+ internalType: "uint256",
1403
+ name: "balance",
1404
+ type: "uint256"
1405
+ },
1406
+ {
1407
+ internalType: "uint256",
1408
+ name: "needed",
1409
+ type: "uint256"
1410
+ }
1411
+ ],
1412
+ name: "ERC20InsufficientBalance",
1413
+ type: "error"
1414
+ },
1415
+ {
1416
+ inputs: [
1417
+ {
1418
+ internalType: "address",
1419
+ name: "approver",
1420
+ type: "address"
1421
+ }
1422
+ ],
1423
+ name: "ERC20InvalidApprover",
1424
+ type: "error"
1425
+ },
1426
+ {
1427
+ inputs: [
1428
+ {
1429
+ internalType: "address",
1430
+ name: "receiver",
1431
+ type: "address"
1432
+ }
1433
+ ],
1434
+ name: "ERC20InvalidReceiver",
1435
+ type: "error"
1436
+ },
1437
+ {
1438
+ inputs: [
1439
+ {
1440
+ internalType: "address",
1441
+ name: "sender",
1442
+ type: "address"
1443
+ }
1444
+ ],
1445
+ name: "ERC20InvalidSender",
1446
+ type: "error"
1447
+ },
1448
+ {
1449
+ inputs: [
1450
+ {
1451
+ internalType: "address",
1452
+ name: "spender",
1453
+ type: "address"
1454
+ }
1455
+ ],
1456
+ name: "ERC20InvalidSpender",
1457
+ type: "error"
1458
+ },
1459
+ {
1460
+ anonymous: false,
1461
+ inputs: [
1462
+ {
1463
+ indexed: true,
1464
+ internalType: "address",
1465
+ name: "owner",
1466
+ type: "address"
1467
+ },
1468
+ {
1469
+ indexed: true,
1470
+ internalType: "address",
1471
+ name: "spender",
1472
+ type: "address"
1473
+ },
1474
+ {
1475
+ indexed: false,
1476
+ internalType: "uint256",
1477
+ name: "value",
1478
+ type: "uint256"
1479
+ }
1480
+ ],
1481
+ name: "Approval",
1482
+ type: "event"
1483
+ },
1484
+ {
1485
+ anonymous: false,
1486
+ inputs: [
1487
+ {
1488
+ indexed: true,
1489
+ internalType: "address",
1490
+ name: "from",
1491
+ type: "address"
1492
+ },
1493
+ {
1494
+ indexed: true,
1495
+ internalType: "address",
1496
+ name: "to",
1497
+ type: "address"
1498
+ },
1499
+ {
1500
+ indexed: false,
1501
+ internalType: "uint256",
1502
+ name: "value",
1503
+ type: "uint256"
1504
+ }
1505
+ ],
1506
+ name: "Transfer",
1507
+ type: "event"
1508
+ },
1509
+ {
1510
+ inputs: [
1511
+ {
1512
+ internalType: "address",
1513
+ name: "owner",
1514
+ type: "address"
1515
+ },
1516
+ {
1517
+ internalType: "address",
1518
+ name: "spender",
1519
+ type: "address"
1520
+ }
1521
+ ],
1522
+ name: "allowance",
1523
+ outputs: [
1524
+ {
1525
+ internalType: "uint256",
1526
+ name: "",
1527
+ type: "uint256"
1528
+ }
1529
+ ],
1530
+ stateMutability: "view",
1531
+ type: "function"
1532
+ },
1533
+ {
1534
+ inputs: [
1535
+ {
1536
+ internalType: "address",
1537
+ name: "spender",
1538
+ type: "address"
1539
+ },
1540
+ {
1541
+ internalType: "uint256",
1542
+ name: "value",
1543
+ type: "uint256"
1544
+ }
1545
+ ],
1546
+ name: "approve",
1547
+ outputs: [
1548
+ {
1549
+ internalType: "bool",
1550
+ name: "",
1551
+ type: "bool"
1552
+ }
1553
+ ],
1554
+ stateMutability: "nonpayable",
1555
+ type: "function"
1556
+ },
1557
+ {
1558
+ inputs: [
1559
+ {
1560
+ internalType: "address",
1561
+ name: "account",
1562
+ type: "address"
1563
+ }
1564
+ ],
1565
+ name: "balanceOf",
1566
+ outputs: [
1567
+ {
1568
+ internalType: "uint256",
1569
+ name: "",
1570
+ type: "uint256"
1571
+ }
1572
+ ],
1573
+ stateMutability: "view",
1574
+ type: "function"
1575
+ },
1576
+ {
1577
+ inputs: [],
1578
+ name: "decimals",
1579
+ outputs: [
1580
+ {
1581
+ internalType: "uint8",
1582
+ name: "",
1583
+ type: "uint8"
1584
+ }
1585
+ ],
1586
+ stateMutability: "view",
1587
+ type: "function"
1588
+ },
1589
+ {
1590
+ inputs: [
1591
+ {
1592
+ internalType: "address",
1593
+ name: "to",
1594
+ type: "address"
1595
+ },
1596
+ {
1597
+ internalType: "uint256",
1598
+ name: "amount",
1599
+ type: "uint256"
1600
+ }
1601
+ ],
1602
+ name: "mint",
1603
+ outputs: [],
1604
+ stateMutability: "nonpayable",
1605
+ type: "function"
1606
+ },
1607
+ {
1608
+ inputs: [],
1609
+ name: "name",
1610
+ outputs: [
1611
+ {
1612
+ internalType: "string",
1613
+ name: "",
1614
+ type: "string"
1615
+ }
1616
+ ],
1617
+ stateMutability: "view",
1618
+ type: "function"
1619
+ },
1620
+ {
1621
+ inputs: [],
1622
+ name: "symbol",
1623
+ outputs: [
1624
+ {
1625
+ internalType: "string",
1626
+ name: "",
1627
+ type: "string"
1628
+ }
1629
+ ],
1630
+ stateMutability: "view",
1631
+ type: "function"
1632
+ },
1633
+ {
1634
+ inputs: [],
1635
+ name: "totalSupply",
1636
+ outputs: [
1637
+ {
1638
+ internalType: "uint256",
1639
+ name: "",
1640
+ type: "uint256"
1641
+ }
1642
+ ],
1643
+ stateMutability: "view",
1644
+ type: "function"
1645
+ },
1646
+ {
1647
+ inputs: [
1648
+ {
1649
+ internalType: "address",
1650
+ name: "to",
1651
+ type: "address"
1652
+ },
1653
+ {
1654
+ internalType: "uint256",
1655
+ name: "value",
1656
+ type: "uint256"
1657
+ }
1658
+ ],
1659
+ name: "transfer",
1660
+ outputs: [
1661
+ {
1662
+ internalType: "bool",
1663
+ name: "",
1664
+ type: "bool"
1665
+ }
1666
+ ],
1667
+ stateMutability: "nonpayable",
1668
+ type: "function"
1669
+ },
1670
+ {
1671
+ inputs: [
1672
+ {
1673
+ internalType: "address",
1674
+ name: "from",
1675
+ type: "address"
1676
+ },
1677
+ {
1678
+ internalType: "address",
1679
+ name: "to",
1680
+ type: "address"
1681
+ },
1682
+ {
1683
+ internalType: "uint256",
1684
+ name: "value",
1685
+ type: "uint256"
1686
+ }
1687
+ ],
1688
+ name: "transferFrom",
1689
+ outputs: [
1690
+ {
1691
+ internalType: "bool",
1692
+ name: "",
1693
+ type: "bool"
1694
+ }
1695
+ ],
1696
+ stateMutability: "nonpayable",
1697
+ type: "function"
1698
+ }
1699
+ ];
1700
+
1701
+ // src/testnet-faucet/errors.ts
1702
+ var FaucetSupplyExhaustedError = class extends TokenOpsSdkError {
1703
+ name = "FaucetSupplyExhaustedError";
1704
+ constructor(args) {
1705
+ super(
1706
+ `${args.method}: the confidential faucet's backing is saturated (max total supply reached). Unwrap existing CTTT to free capacity, or mint a smaller amount.`,
1707
+ {
1708
+ code: "TOKENOPS_FAUCET_SUPPLY_EXHAUSTED",
1709
+ cause: args.cause,
1710
+ context: { method: args.method, contractAddress: args.contractAddress }
1711
+ }
1712
+ );
1713
+ }
1714
+ };
1715
+ var TESTNET_FAUCET_SUPPORTED_CHAIN_IDS = [sepolia.id, 31337];
1716
+ function isTestnetFaucetChainId(chainId) {
1717
+ return TESTNET_FAUCET_SUPPORTED_CHAIN_IDS.includes(chainId);
1718
+ }
1719
+ function assertTestnetFaucetChain(chainId) {
1720
+ if (chainId === void 0) return;
1721
+ if (!isTestnetFaucetChainId(chainId)) {
1722
+ throw new UnsupportedChainError(chainId);
1723
+ }
1724
+ }
1725
+ var UINT64_MAX = (1n << 64n) - 1n;
1726
+ var UINT256_MAX = (1n << 256n) - 1n;
1727
+ function assertUint64Amount(value, argument, method) {
1728
+ if (typeof value !== "bigint") {
1729
+ throw new InvalidArgumentError({
1730
+ method,
1731
+ argument,
1732
+ reason: "amount must be a bigint",
1733
+ value: String(value)
1734
+ });
1735
+ }
1736
+ if (value <= 0n) {
1737
+ throw new InvalidArgumentError({
1738
+ method,
1739
+ argument,
1740
+ reason: "amount must be greater than zero",
1741
+ value: value.toString()
1742
+ });
1743
+ }
1744
+ if (value > UINT64_MAX) {
1745
+ throw new InvalidArgumentError({
1746
+ method,
1747
+ argument,
1748
+ reason: `amount exceeds uint64 max (${UINT64_MAX.toString()})`,
1749
+ value: value.toString()
1750
+ });
1751
+ }
1752
+ }
1753
+ function assertUint256Amount(value, argument, method) {
1754
+ if (typeof value !== "bigint") {
1755
+ throw new InvalidArgumentError({
1756
+ method,
1757
+ argument,
1758
+ reason: "amount must be a bigint",
1759
+ value: String(value)
1760
+ });
1761
+ }
1762
+ if (value <= 0n) {
1763
+ throw new InvalidArgumentError({
1764
+ method,
1765
+ argument,
1766
+ reason: "amount must be greater than zero",
1767
+ value: value.toString()
1768
+ });
1769
+ }
1770
+ if (value > UINT256_MAX) {
1771
+ throw new InvalidArgumentError({
1772
+ method,
1773
+ argument,
1774
+ reason: "amount exceeds uint256 max",
1775
+ value: value.toString()
1776
+ });
1777
+ }
1778
+ }
1779
+ function assertNonZeroRecipient(input, argument, method) {
1780
+ const normalised = normaliseAddress(input);
1781
+ if (/^0x0{40}$/i.test(normalised)) {
1782
+ throw new InvalidArgumentError({
1783
+ method,
1784
+ argument,
1785
+ reason: "recipient must not be the zero address",
1786
+ value: normalised
1787
+ });
1788
+ }
1789
+ return normalised;
1790
+ }
1791
+ var faucetProductMapper = (name, _args, ctx) => {
1792
+ switch (name) {
1793
+ case "ERC7984TotalSupplyOverflow":
1794
+ return new FaucetSupplyExhaustedError({
1795
+ method: ctx.method,
1796
+ contractAddress: ctx.contractAddress
1797
+ });
1798
+ case "ERC7984InvalidReceiver":
1799
+ case "ERC20InvalidReceiver":
1800
+ return new InvalidArgumentError({
1801
+ method: ctx.method,
1802
+ argument: "to",
1803
+ reason: "recipient must not be the zero address"
1804
+ });
1805
+ default:
1806
+ return void 0;
1807
+ }
1808
+ };
1809
+ var TestnetFaucetClient = class {
1810
+ publicClient;
1811
+ walletClient;
1812
+ /** The `ConfidentialTokenopsTestToken` (CTTT) proxy address this client targets. */
1813
+ address;
1814
+ #chainId;
1815
+ #cttAddressIsOverride = false;
1816
+ #telemetry;
1817
+ #cachedUnderlying;
1818
+ constructor(config) {
1819
+ this.publicClient = config.publicClient;
1820
+ this.walletClient = config.walletClient;
1821
+ this.#telemetry = config.telemetry;
1822
+ const chainId = config.chainId ?? config.publicClient.chain?.id;
1823
+ this.#chainId = chainId;
1824
+ assertTestnetFaucetChain(chainId);
1825
+ const addressOverride = config.address ? normaliseAddress(config.address) : void 0;
1826
+ const resolved = addressOverride ?? (chainId === void 0 ? void 0 : getConfidentialTestTokenAddress(chainId));
1827
+ if (!resolved) {
1828
+ throw new DeploymentAddressUnavailableError({
1829
+ reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
1830
+ product: "testnetFaucet",
1831
+ contract: "confidentialTestToken",
1832
+ chainId,
1833
+ clientLabel: "TestnetFaucetClient"
1834
+ });
1835
+ }
1836
+ this.address = resolved;
1837
+ this.#cttAddressIsOverride = !!addressOverride;
1838
+ this.#telemetry?.event("testnet-faucet.client.init", {
1839
+ chainId: chainId ?? null,
1840
+ hasWallet: !!this.walletClient,
1841
+ sdkVersion: SDK_VERSION
1842
+ });
1843
+ }
1844
+ // ============================================================
1845
+ // READ METHODS
1846
+ // ============================================================
1847
+ /**
1848
+ * Resolve the underlying `TokenopsTestToken` (TTT) address.
1849
+ *
1850
+ * Resolution order: registry entry for the chain → the wrapper's own
1851
+ * `underlying()` getter (read once, cached). The wrapper is the authoritative
1852
+ * source, so this works even on a local deployment where only the CTTT
1853
+ * address was supplied.
1854
+ *
1855
+ * The registry shortcut is only taken for the canonical (registry) CTTT. If
1856
+ * the CTTT `address` was overridden, the registry is skipped and the custom
1857
+ * wrapper's own authoritative `underlying()` is read — otherwise a custom
1858
+ * CTTT on a registry chain would silently pair with the canonical TTT. The
1859
+ * backing token is never consumer-supplied: a faucet client always pairs the
1860
+ * CTTT with the TTT that the CTTT itself reports.
1861
+ */
1862
+ async underlyingToken() {
1863
+ if (this.#cachedUnderlying) return this.#cachedUnderlying;
1864
+ const fromRegistry = this.#cttAddressIsOverride || this.#chainId === void 0 ? void 0 : getTestTokenAddress(this.#chainId);
1865
+ const resolved = fromRegistry ?? await this.#readCtt("underlying");
1866
+ this.#cachedUnderlying = normaliseAddress(resolved);
1867
+ return this.#cachedUnderlying;
1868
+ }
1869
+ /**
1870
+ * Read the encrypted confidential balance handle for `account` (defaults to
1871
+ * the wallet's account).
1872
+ *
1873
+ * Returns the `euint64` ciphertext handle. The account holds persistent ACL
1874
+ * on its own balance, so pass this handle — together with the CTTT contract
1875
+ * address ({@link address}) and the account's signer — to the Zama relayer's
1876
+ * `userDecrypt` to obtain the plaintext. The SDK is the producer side only;
1877
+ * it does not call `userDecrypt`.
1878
+ *
1879
+ * @returns the `bytes32` balance handle (an {@link EncryptedHandle}). A
1880
+ * never-credited account reads back the zero handle.
1881
+ */
1882
+ async confidentialBalanceOf(account) {
1883
+ const who = this.#resolveReadAddress(account, "confidentialBalanceOf");
1884
+ const handle = await this.#readCtt("confidentialBalanceOf", [who]);
1885
+ return asEncryptedHandle(handle);
1886
+ }
1887
+ /**
1888
+ * Read the plaintext underlying `TokenopsTestToken` (TTT) balance for
1889
+ * `account` (defaults to the wallet's account), in TTT 18-decimal base units.
1890
+ */
1891
+ async underlyingBalanceOf(account) {
1892
+ const who = this.#resolveReadAddress(account, "underlyingBalanceOf");
1893
+ return this.#readTtt("balanceOf", [who]);
1894
+ }
1895
+ /**
1896
+ * Decimal-conversion rate between underlying and confidential units:
1897
+ * `1` CTTT 6-decimal unit is backed by `rate` TTT 18-decimal base units
1898
+ * (`10^(18-6) = 10^12`).
1899
+ */
1900
+ async rate() {
1901
+ return this.#readCtt("rate");
1902
+ }
1903
+ /** Decimals of the confidential token (CTTT) — `6`. */
1904
+ async decimals() {
1905
+ return this.#readCtt("decimals");
1906
+ }
1907
+ /** Decimals of the underlying token (TTT) — `18`. */
1908
+ async underlyingDecimals() {
1909
+ return this.#readTtt("decimals");
1910
+ }
1911
+ /**
1912
+ * The wrapper's inferred total supply: underlying held in custody divided by
1913
+ * `rate`, an upper bound on the confidential total supply. In CTTT 6-decimal
1914
+ * units.
1915
+ */
1916
+ async inferredTotalSupply() {
1917
+ return this.#readCtt("inferredTotalSupply");
1918
+ }
1919
+ /** Max confidential total supply the wrapper supports (`type(uint64).max`). */
1920
+ async maxTotalSupply() {
1921
+ return this.#readCtt("maxTotalSupply");
1922
+ }
1923
+ /**
1924
+ * Consolidated faucet metadata — both tokens' name/symbol/decimals/address,
1925
+ * the conversion `rate`, and the `maxTotalSupply` ceiling — in a single
1926
+ * parallel read. Handy for rendering a faucet panel.
1927
+ */
1928
+ async getMetadata() {
1929
+ const underlyingAddress = await this.underlyingToken();
1930
+ const [cName, cSymbol, cDecimals, rate, maxTotalSupply, uName, uSymbol, uDecimals] = await Promise.all([
1931
+ this.#readCtt("name"),
1932
+ this.#readCtt("symbol"),
1933
+ this.#readCtt("decimals"),
1934
+ this.#readCtt("rate"),
1935
+ this.#readCtt("maxTotalSupply"),
1936
+ this.#readTtt("name"),
1937
+ this.#readTtt("symbol"),
1938
+ this.#readTtt("decimals")
1939
+ ]);
1940
+ return {
1941
+ confidential: { address: this.address, name: cName, symbol: cSymbol, decimals: cDecimals },
1942
+ underlying: {
1943
+ address: underlyingAddress,
1944
+ name: uName,
1945
+ symbol: uSymbol,
1946
+ decimals: uDecimals
1947
+ },
1948
+ rate,
1949
+ maxTotalSupply
1950
+ };
1951
+ }
1952
+ // ============================================================
1953
+ // WRITE METHODS
1954
+ // ============================================================
1955
+ /**
1956
+ * Mint confidential test tokens (CTTT) to `to`, fully backed by freshly
1957
+ * minted underlying TTT held in custody.
1958
+ *
1959
+ * **This is the confidential faucet.** Open and permissionless — anyone can
1960
+ * mint any `uint64` amount. The amount is PUBLIC (plaintext calldata +
1961
+ * `ConfidentialMint` event); only the recipient's aggregated balance and
1962
+ * later confidential transfers are private.
1963
+ *
1964
+ * @returns `{ hash, to, amount, underlyingMinted, handle }` decoded from the
1965
+ * `ConfidentialMint` event. To read the recipient's plaintext balance,
1966
+ * call {@link confidentialBalanceOf} and user-decrypt it.
1967
+ * @throws {InvalidArgumentError} for a zero recipient or out-of-range amount.
1968
+ * @throws {FaucetSupplyExhaustedError} if the wrapper's backing ceiling is reached.
1969
+ * @throws {ReceiptEventNotFoundError} if no `ConfidentialMint` event is found.
1970
+ */
1971
+ async mintConfidential(args) {
1972
+ return withTelemetry(this.#telemetry, "testnet-faucet.mintConfidential", async () => {
1973
+ const wallet = this.#requireWallet("mintConfidential");
1974
+ const account = this.#resolveAccount(wallet, args.account, "mintConfidential");
1975
+ const to = assertNonZeroRecipient(
1976
+ args.to ?? accountAddress(account),
1977
+ "to",
1978
+ "mintConfidential"
1979
+ );
1980
+ assertUint64Amount(args.amount, "amount", "mintConfidential");
1981
+ const target = this.#cttTarget();
1982
+ await this.#preflightWrite(target, "mintConfidential", "mint", [to, args.amount], account);
1983
+ let hash;
1984
+ try {
1985
+ hash = await wallet.writeContract({
1986
+ address: target.address,
1987
+ abi: target.abi,
1988
+ functionName: "mint",
1989
+ args: [to, args.amount],
1990
+ account,
1991
+ chain: wallet.chain
1992
+ });
1993
+ } catch (err) {
1994
+ throw this.#mapRevert(target, "mintConfidential", err, void 0, accountAddress(account));
1995
+ }
1996
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
1997
+ if (receipt.status !== "success") {
1998
+ throw new TokenOpsContractError(`mintConfidential: transaction ${hash} reverted`, {
1999
+ contract: "ConfidentialTokenopsTestToken",
2000
+ call: "mint",
2001
+ tx: hash
2002
+ });
2003
+ }
2004
+ const events = parseEventLogs({
2005
+ abi: confidentialTokenopsTestTokenAbi,
2006
+ eventName: "ConfidentialMint",
2007
+ logs: receipt.logs
2008
+ });
2009
+ const ours = events.filter((ev2) => ev2.address.toLowerCase() === this.address.toLowerCase());
2010
+ if (ours.length === 0) {
2011
+ throw new ReceiptEventNotFoundError({
2012
+ method: "mintConfidential",
2013
+ eventName: "ConfidentialMint",
2014
+ contractAddress: this.address,
2015
+ txHash: hash
2016
+ });
2017
+ }
2018
+ if (ours.length > 1) {
2019
+ throw new ReceiptEventAmbiguousError({
2020
+ method: "mintConfidential",
2021
+ eventName: "ConfidentialMint",
2022
+ contractAddress: this.address,
2023
+ txHash: hash,
2024
+ count: ours.length
2025
+ });
2026
+ }
2027
+ const ev = ours[0];
2028
+ return {
2029
+ hash: asTxHash(hash),
2030
+ to: ev.args.to,
2031
+ amount: args.amount,
2032
+ underlyingMinted: ev.args.underlyingMinted,
2033
+ handle: asEncryptedHandle(ev.args.encryptedAmount)
2034
+ };
2035
+ });
2036
+ }
2037
+ /**
2038
+ * Mint standard (non-confidential) ERC-20 test tokens (TTT) to `to`.
2039
+ *
2040
+ * Open and permissionless. Use this when you want plain TTT — e.g. to then
2041
+ * `approve` + `wrap` it into CTTT through the standard ERC-7984 flow.
2042
+ *
2043
+ * @returns `{ hash, to, amount }`.
2044
+ * @throws {InvalidArgumentError} for a zero recipient or out-of-range amount.
2045
+ */
2046
+ async mintUnderlying(args) {
2047
+ return withTelemetry(this.#telemetry, "testnet-faucet.mintUnderlying", async () => {
2048
+ const wallet = this.#requireWallet("mintUnderlying");
2049
+ const account = this.#resolveAccount(wallet, args.account, "mintUnderlying");
2050
+ const to = assertNonZeroRecipient(args.to ?? accountAddress(account), "to", "mintUnderlying");
2051
+ assertUint256Amount(args.amount, "amount", "mintUnderlying");
2052
+ const target = {
2053
+ address: await this.underlyingToken(),
2054
+ abi: tokenopsTestTokenAbi
2055
+ };
2056
+ await this.#preflightWrite(target, "mintUnderlying", "mint", [to, args.amount], account);
2057
+ let hash;
2058
+ try {
2059
+ hash = await wallet.writeContract({
2060
+ address: target.address,
2061
+ abi: target.abi,
2062
+ functionName: "mint",
2063
+ args: [to, args.amount],
2064
+ account,
2065
+ chain: wallet.chain
2066
+ });
2067
+ } catch (err) {
2068
+ throw this.#mapRevert(target, "mintUnderlying", err, void 0, accountAddress(account));
2069
+ }
2070
+ const receipt = await this.publicClient.waitForTransactionReceipt({ hash });
2071
+ if (receipt.status !== "success") {
2072
+ throw new TokenOpsContractError(`mintUnderlying: transaction ${hash} reverted`, {
2073
+ contract: "TokenopsTestToken",
2074
+ call: "mint",
2075
+ tx: hash
2076
+ });
2077
+ }
2078
+ return { hash: asTxHash(hash), to, amount: args.amount };
2079
+ });
2080
+ }
2081
+ // ============================================================
2082
+ // INTERNAL HELPERS
2083
+ // ============================================================
2084
+ #cttTarget() {
2085
+ return { address: this.address, abi: confidentialTokenopsTestTokenAbi };
2086
+ }
2087
+ #requireWallet(method) {
2088
+ if (!this.walletClient) {
2089
+ throw new MissingWalletClientError(method);
2090
+ }
2091
+ return this.walletClient;
2092
+ }
2093
+ #resolveAccount(wallet, override, method) {
2094
+ const acct = override ?? wallet.account;
2095
+ if (!acct) {
2096
+ throw new MissingAccountError(method);
2097
+ }
2098
+ return acct;
2099
+ }
2100
+ /**
2101
+ * Resolve the address a read targets. Uses the explicit `override` if given,
2102
+ * else the wallet's account address. Throws {@link MissingAccountError} when
2103
+ * neither is available (a read-only client must be told whose balance to read).
2104
+ */
2105
+ #resolveReadAddress(override, method) {
2106
+ if (override) return normaliseAddress(override);
2107
+ const acct = this.walletClient?.account?.address;
2108
+ if (!acct) {
2109
+ throw new MissingAccountError(method);
2110
+ }
2111
+ return acct;
2112
+ }
2113
+ async #readCtt(functionName, args = []) {
2114
+ const result = await this.publicClient.readContract({
2115
+ address: this.address,
2116
+ abi: confidentialTokenopsTestTokenAbi,
2117
+ functionName,
2118
+ args
2119
+ });
2120
+ return result;
2121
+ }
2122
+ async #readTtt(functionName, args = []) {
2123
+ const address = await this.underlyingToken();
2124
+ const result = await this.publicClient.readContract({
2125
+ address,
2126
+ abi: tokenopsTestTokenAbi,
2127
+ functionName,
2128
+ args
2129
+ });
2130
+ return result;
2131
+ }
2132
+ /**
2133
+ * Pre-flight a write via `simulateContract` purely to surface typed reverts.
2134
+ * The simulate's return value is discarded; only its revert-decoding side
2135
+ * effect matters (so role/state/overflow reverts classify into typed SDK
2136
+ * errors instead of `UnknownWriteFailureError` on wallet transports).
2137
+ */
2138
+ async #preflightWrite(target, method, functionName, args, account) {
2139
+ try {
2140
+ await this.publicClient.simulateContract({
2141
+ address: target.address,
2142
+ abi: target.abi,
2143
+ functionName,
2144
+ args,
2145
+ account
2146
+ });
2147
+ } catch (err) {
2148
+ if (isContractRevert(err)) {
2149
+ throw this.#mapRevert(target, method, err, void 0, accountAddress(account));
2150
+ }
2151
+ }
2152
+ }
2153
+ #mapRevert(target, method, err, productContext, account) {
2154
+ return mapContractRevert(err, {
2155
+ method,
2156
+ contractAddress: target.address,
2157
+ abi: target.abi,
2158
+ productMapper: faucetProductMapper,
2159
+ productContext,
2160
+ account
2161
+ });
2162
+ }
2163
+ };
2164
+ function createTestnetFaucetClient(config) {
2165
+ return new TestnetFaucetClient(config);
2166
+ }
2167
+ function accountAddress(account) {
2168
+ return typeof account === "string" ? account : account.address;
2169
+ }
2170
+
2171
+ export { FaucetSupplyExhaustedError, TESTNET_FAUCET_SUPPORTED_CHAIN_IDS, TestnetFaucetClient, assertTestnetFaucetChain, confidentialTokenopsTestTokenAbi, createTestnetFaucetClient, isTestnetFaucetChainId, tokenopsTestTokenAbi };