@tokenops/sdk 1.5.1 → 1.6.0
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.
- package/CHANGELOG.md +158 -2
- package/SECURITY.md +7 -1
- package/dist/{chunk-67OV5CX2.cjs → chunk-2RNW4MIJ.cjs} +18 -0
- package/dist/{chunk-KLKI352M.cjs → chunk-43RFBQ73.cjs} +29 -29
- package/dist/{chunk-ZA673I3O.js → chunk-46T67CE2.js} +1 -1
- package/dist/{chunk-6BMP4ICG.js → chunk-4KJ66YRH.js} +61 -3
- package/dist/{chunk-JYOTGRSO.cjs → chunk-4ZCXK4VI.cjs} +68 -8
- package/dist/{chunk-SG65XWH7.js → chunk-6WSNS3UV.js} +1 -1
- package/dist/{chunk-V2PXZVBF.cjs → chunk-7G7UOQV4.cjs} +4 -4
- package/dist/{chunk-WENHUPZC.cjs → chunk-AYGRYDBX.cjs} +35 -36
- package/dist/{chunk-2NCLOQ56.cjs → chunk-BD4LZBVF.cjs} +85 -9
- package/dist/{chunk-5X5WL5CU.cjs → chunk-BK7YIVLK.cjs} +110 -149
- package/dist/{chunk-W7IGCOVL.cjs → chunk-CBRL2PJA.cjs} +12 -11
- package/dist/{chunk-ORFTDNFZ.js → chunk-CNP4L3GF.js} +4 -4
- package/dist/{chunk-QBJ7O2B4.js → chunk-DRSPMIZ7.js} +11 -1
- package/dist/{chunk-C7BRZXJA.cjs → chunk-EUKPOXWR.cjs} +15 -16
- package/dist/{chunk-YQIBBEFJ.js → chunk-HETNKZEE.js} +1 -1
- package/dist/{chunk-ODLTEGHB.js → chunk-KSDSXJ34.js} +1 -1
- package/dist/{chunk-TIUKIY5V.cjs → chunk-LBWRFZR3.cjs} +58 -40
- package/dist/{chunk-WMACINXO.js → chunk-NFW7AUEX.js} +1 -1
- package/dist/{chunk-4WPGQSNT.cjs → chunk-OL6SHN3D.cjs} +3 -3
- package/dist/{chunk-AOP6HMPW.js → chunk-PD7ME2BT.js} +75 -2
- package/dist/{chunk-2PWNH3UE.js → chunk-QET3Q4JP.js} +65 -9
- package/dist/{chunk-XGGTQQFH.js → chunk-QKKBBH7I.js} +2 -2
- package/dist/{chunk-6R4KNAPK.js → chunk-S2XD75JM.js} +10 -3
- package/dist/{chunk-MCRBVJGZ.cjs → chunk-SPGSO5SO.cjs} +29 -22
- package/dist/{chunk-FAXIIH5R.cjs → chunk-SYHNZSZZ.cjs} +3 -3
- package/dist/{chunk-IXLO7GO5.js → chunk-TN65XNTI.js} +47 -83
- package/dist/chunk-U57COLUE.js +56 -0
- package/dist/{chunk-DUZIIRPF.js → chunk-UE5XK2SY.js} +27 -9
- package/dist/{chunk-TEBM66WA.cjs → chunk-UJS4N2XM.cjs} +12 -12
- package/dist/{chunk-OXTLPTO3.js → chunk-V5D7BHW3.js} +4 -5
- package/dist/{chunk-NTZY6IB7.js → chunk-VHSNYUYV.js} +5 -4
- package/dist/{chunk-JK4XMMKM.cjs → chunk-VR3FREBX.cjs} +3 -3
- package/dist/{chunk-T46YXSBP.cjs → chunk-WO72UBQD.cjs} +11 -11
- package/dist/chunk-WOEETTH7.cjs +59 -0
- package/dist/{chunk-IJFQ5L4I.js → chunk-WTK6JDSI.js} +4 -5
- package/dist/{chunk-PUPKNW3R.cjs → chunk-WUXUWTFW.cjs} +3 -3
- package/dist/{chunk-PFXURMBZ.cjs → chunk-YFIWCYHC.cjs} +112 -54
- package/dist/{chunk-ZWXJTBZO.js → chunk-YPYCWLYP.js} +1 -1
- package/dist/core/addresses.d.ts +1 -1
- package/dist/core/errors.d.ts +1 -1
- package/dist/fhe/index.cjs +84 -64
- package/dist/fhe/index.d.cts +1 -0
- package/dist/fhe/index.d.ts +1 -0
- package/dist/fhe/index.js +21 -9
- package/dist/fhe/mock-erc7984.d.ts +4 -4
- package/dist/fhe/operators.d.ts +142 -2
- package/dist/fhe/react/index.cjs +21 -8
- package/dist/fhe/react/index.d.cts +2 -0
- package/dist/fhe/react/index.d.ts +2 -0
- package/dist/fhe/react/index.js +8 -3
- package/dist/fhe/react/useEnsureOperator.d.ts +56 -0
- package/dist/fhe/react/useIsOperator.d.ts +54 -0
- package/dist/fhe/sepolia-encryptor-web.d.ts +18 -3
- package/dist/fhe-airdrop/advanced/index.cjs +8 -9
- package/dist/fhe-airdrop/advanced/index.js +6 -7
- package/dist/fhe-airdrop/advanced/react/index.cjs +13 -14
- package/dist/fhe-airdrop/advanced/react/index.js +9 -10
- package/dist/fhe-airdrop/airdrop.d.ts +7 -0
- package/dist/fhe-airdrop/index.cjs +66 -67
- package/dist/fhe-airdrop/index.js +7 -8
- package/dist/fhe-airdrop/react/index.cjs +148 -137
- package/dist/fhe-airdrop/react/index.d.cts +3 -1
- package/dist/fhe-airdrop/react/index.d.ts +3 -1
- package/dist/fhe-airdrop/react/index.js +16 -14
- package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +17 -11
- package/dist/fhe-airdrop/react/useClaim.d.ts +8 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +1 -1
- package/dist/fhe-airdrop/types.d.ts +14 -3
- package/dist/fhe-disperse/errors.d.ts +55 -0
- package/dist/fhe-disperse/index.cjs +74 -67
- package/dist/fhe-disperse/index.d.cts +1 -1
- package/dist/fhe-disperse/index.d.ts +1 -1
- package/dist/fhe-disperse/index.js +8 -9
- package/dist/fhe-disperse/react/index.cjs +105 -88
- package/dist/fhe-disperse/react/index.d.cts +3 -1
- package/dist/fhe-disperse/react/index.d.ts +3 -1
- package/dist/fhe-disperse/react/index.js +12 -11
- package/dist/fhe-vesting/advanced/index.cjs +8 -9
- package/dist/fhe-vesting/advanced/index.js +6 -7
- package/dist/fhe-vesting/advanced/react/index.cjs +14 -15
- package/dist/fhe-vesting/advanced/react/index.js +11 -12
- package/dist/fhe-vesting/index.cjs +75 -76
- package/dist/fhe-vesting/index.js +9 -10
- package/dist/fhe-vesting/manager.d.ts +19 -0
- package/dist/fhe-vesting/react/index.cjs +245 -227
- package/dist/fhe-vesting/react/index.d.cts +6 -4
- package/dist/fhe-vesting/react/index.d.ts +6 -4
- package/dist/fhe-vesting/react/index.js +27 -21
- package/dist/fhe-vesting/react/useAccessClaimableAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessSettledAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessTotalAllocation.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessVestedAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAdminGetClaimableAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetSettledAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetTotalAllocation.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetVestedAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +8 -0
- package/dist/fhe-vesting/react/useClaim.d.ts +1 -1
- package/dist/fhe-vesting/react/useDiscloseHandleToParty.d.ts +1 -1
- package/dist/fhe-vesting/react/useManagerDiscloseHandleToParty.d.ts +1 -1
- package/dist/fhe-vesting/react/usePartialClaim.d.ts +1 -1
- package/dist/fhe-vesting/react/useVestingInfo.d.ts +1 -1
- package/dist/fhe-vesting/types.d.ts +12 -1
- package/dist/index.cjs +87 -88
- package/dist/index.js +2 -3
- package/dist/testnet-faucet/index.cjs +55 -56
- package/dist/testnet-faucet/index.js +5 -6
- package/dist/testnet-faucet/react/index.cjs +53 -54
- package/dist/testnet-faucet/react/index.js +7 -8
- package/package.json +13 -8
- package/dist/chunk-66IHPTOK.cjs +0 -20
- package/dist/chunk-KWFFIJYX.js +0 -11
- package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +0 -27
- package/dist/fhe-airdrop/react/useGetClaimAmount.d.ts +0 -30
- package/dist/fhe-vesting/react/useGetClaimableAmount.d.ts +0 -13
- package/dist/fhe-vesting/react/useGetSettledAmount.d.ts +0 -14
- package/dist/fhe-vesting/react/useGetTotalAllocation.d.ts +0 -13
- package/dist/fhe-vesting/react/useGetVestedAmount.d.ts +0 -25
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkAYGRYDBX_cjs = require('../../chunk-AYGRYDBX.cjs');
|
|
3
4
|
var chunkZQUE2B3Q_cjs = require('../../chunk-ZQUE2B3Q.cjs');
|
|
4
|
-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
|
|
7
|
-
require('../../chunk-
|
|
5
|
+
require('../../chunk-43RFBQ73.cjs');
|
|
6
|
+
var chunkWUXUWTFW_cjs = require('../../chunk-WUXUWTFW.cjs');
|
|
7
|
+
require('../../chunk-VR3FREBX.cjs');
|
|
8
|
+
var chunk2RNW4MIJ_cjs = require('../../chunk-2RNW4MIJ.cjs');
|
|
8
9
|
require('../../chunk-VJKZWYYJ.cjs');
|
|
9
|
-
require('../../chunk-66IHPTOK.cjs');
|
|
10
|
-
var chunk67OV5CX2_cjs = require('../../chunk-67OV5CX2.cjs');
|
|
11
10
|
var reactQuery = require('@tanstack/react-query');
|
|
12
11
|
var react = require('react');
|
|
13
12
|
var wagmi = require('wagmi');
|
|
@@ -15,10 +14,10 @@ var wagmi = require('wagmi');
|
|
|
15
14
|
var TESTNET_FAUCET_KEY = "tokenops-sdk";
|
|
16
15
|
var TESTNET_FAUCET_NAMESPACE = "testnet-faucet";
|
|
17
16
|
function tryResolveSingletonAddress(override, chainId) {
|
|
18
|
-
if (chainId !== void 0 && !
|
|
17
|
+
if (chainId !== void 0 && !chunkAYGRYDBX_cjs.isTestnetFaucetChainId(chainId)) return void 0;
|
|
19
18
|
if (override) return override;
|
|
20
19
|
if (chainId === void 0) return void 0;
|
|
21
|
-
return
|
|
20
|
+
return chunkWUXUWTFW_cjs.getConfidentialTestTokenAddress(chainId);
|
|
22
21
|
}
|
|
23
22
|
function useMemoFaucetClient(opts = {}) {
|
|
24
23
|
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
@@ -29,7 +28,7 @@ function useMemoFaucetClient(opts = {}) {
|
|
|
29
28
|
const client = react.useMemo(() => {
|
|
30
29
|
if (!publicClient) return void 0;
|
|
31
30
|
if (!resolvedAddress) return void 0;
|
|
32
|
-
return
|
|
31
|
+
return chunkAYGRYDBX_cjs.createTestnetFaucetClient({
|
|
33
32
|
publicClient,
|
|
34
33
|
...walletClient ? { walletClient } : {},
|
|
35
34
|
...opts.address ? { address: resolvedAddress } : {},
|
|
@@ -46,21 +45,21 @@ function useMemoFaucetClient(opts = {}) {
|
|
|
46
45
|
};
|
|
47
46
|
}
|
|
48
47
|
function computeSingletonResolutionError(override, chainId) {
|
|
49
|
-
if (chainId !== void 0 && !
|
|
50
|
-
return new
|
|
48
|
+
if (chainId !== void 0 && !chunkAYGRYDBX_cjs.isTestnetFaucetChainId(chainId)) {
|
|
49
|
+
return new chunk2RNW4MIJ_cjs.UnsupportedChainError(chainId);
|
|
51
50
|
}
|
|
52
51
|
if (override) return void 0;
|
|
53
52
|
if (chainId === void 0) {
|
|
54
|
-
return new
|
|
53
|
+
return new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
|
|
55
54
|
reason: "chain-id-missing",
|
|
56
55
|
product: "testnetFaucet",
|
|
57
56
|
contract: "confidentialTestToken",
|
|
58
57
|
clientLabel: "TestnetFaucetClient"
|
|
59
58
|
});
|
|
60
59
|
}
|
|
61
|
-
const resolved =
|
|
60
|
+
const resolved = chunkWUXUWTFW_cjs.getConfidentialTestTokenAddress(chainId);
|
|
62
61
|
if (!resolved) {
|
|
63
|
-
return new
|
|
62
|
+
return new chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError({
|
|
64
63
|
reason: "registry-not-deployed",
|
|
65
64
|
product: "testnetFaucet",
|
|
66
65
|
contract: "confidentialTestToken",
|
|
@@ -199,7 +198,7 @@ function useMintConfidential(options = {}) {
|
|
|
199
198
|
return reactQuery.useMutation({
|
|
200
199
|
mutationFn: async (args) => {
|
|
201
200
|
if (!client) {
|
|
202
|
-
throw resolutionError ?? new
|
|
201
|
+
throw resolutionError ?? new chunk2RNW4MIJ_cjs.MissingClientError("useMintConfidential", "testnet-faucet");
|
|
203
202
|
}
|
|
204
203
|
return client.mintConfidential(args);
|
|
205
204
|
}
|
|
@@ -210,7 +209,7 @@ function useMintUnderlying(options = {}) {
|
|
|
210
209
|
return reactQuery.useMutation({
|
|
211
210
|
mutationFn: async (args) => {
|
|
212
211
|
if (!client) {
|
|
213
|
-
throw resolutionError ?? new
|
|
212
|
+
throw resolutionError ?? new chunk2RNW4MIJ_cjs.MissingClientError("useMintUnderlying", "testnet-faucet");
|
|
214
213
|
}
|
|
215
214
|
return client.mintUnderlying(args);
|
|
216
215
|
}
|
|
@@ -219,155 +218,155 @@ function useMintUnderlying(options = {}) {
|
|
|
219
218
|
|
|
220
219
|
Object.defineProperty(exports, "FaucetSupplyExhaustedError", {
|
|
221
220
|
enumerable: true,
|
|
222
|
-
get: function () { return
|
|
221
|
+
get: function () { return chunkAYGRYDBX_cjs.FaucetSupplyExhaustedError; }
|
|
223
222
|
});
|
|
224
223
|
Object.defineProperty(exports, "AccessDeniedError", {
|
|
225
224
|
enumerable: true,
|
|
226
|
-
get: function () { return
|
|
225
|
+
get: function () { return chunk2RNW4MIJ_cjs.AccessDeniedError; }
|
|
227
226
|
});
|
|
228
227
|
Object.defineProperty(exports, "AlreadyInitializedError", {
|
|
229
228
|
enumerable: true,
|
|
230
|
-
get: function () { return
|
|
229
|
+
get: function () { return chunk2RNW4MIJ_cjs.AlreadyInitializedError; }
|
|
231
230
|
});
|
|
232
231
|
Object.defineProperty(exports, "BatchTooLargeError", {
|
|
233
232
|
enumerable: true,
|
|
234
|
-
get: function () { return
|
|
233
|
+
get: function () { return chunk2RNW4MIJ_cjs.BatchTooLargeError; }
|
|
235
234
|
});
|
|
236
235
|
Object.defineProperty(exports, "ContractRevertError", {
|
|
237
236
|
enumerable: true,
|
|
238
|
-
get: function () { return
|
|
237
|
+
get: function () { return chunk2RNW4MIJ_cjs.ContractRevertError; }
|
|
239
238
|
});
|
|
240
239
|
Object.defineProperty(exports, "DecryptionFailedError", {
|
|
241
240
|
enumerable: true,
|
|
242
|
-
get: function () { return
|
|
241
|
+
get: function () { return chunk2RNW4MIJ_cjs.DecryptionFailedError; }
|
|
243
242
|
});
|
|
244
243
|
Object.defineProperty(exports, "DeploymentAddressUnavailableError", {
|
|
245
244
|
enumerable: true,
|
|
246
|
-
get: function () { return
|
|
245
|
+
get: function () { return chunk2RNW4MIJ_cjs.DeploymentAddressUnavailableError; }
|
|
247
246
|
});
|
|
248
247
|
Object.defineProperty(exports, "EncryptionFailedError", {
|
|
249
248
|
enumerable: true,
|
|
250
|
-
get: function () { return
|
|
249
|
+
get: function () { return chunk2RNW4MIJ_cjs.EncryptionFailedError; }
|
|
251
250
|
});
|
|
252
251
|
Object.defineProperty(exports, "FeatureDisabledError", {
|
|
253
252
|
enumerable: true,
|
|
254
|
-
get: function () { return
|
|
253
|
+
get: function () { return chunk2RNW4MIJ_cjs.FeatureDisabledError; }
|
|
255
254
|
});
|
|
256
255
|
Object.defineProperty(exports, "FheHandleNotAllowedError", {
|
|
257
256
|
enumerable: true,
|
|
258
|
-
get: function () { return
|
|
257
|
+
get: function () { return chunk2RNW4MIJ_cjs.FheHandleNotAllowedError; }
|
|
259
258
|
});
|
|
260
259
|
Object.defineProperty(exports, "InsufficientBalanceError", {
|
|
261
260
|
enumerable: true,
|
|
262
|
-
get: function () { return
|
|
261
|
+
get: function () { return chunk2RNW4MIJ_cjs.InsufficientBalanceError; }
|
|
263
262
|
});
|
|
264
263
|
Object.defineProperty(exports, "InsufficientFeeError", {
|
|
265
264
|
enumerable: true,
|
|
266
|
-
get: function () { return
|
|
265
|
+
get: function () { return chunk2RNW4MIJ_cjs.InsufficientFeeError; }
|
|
267
266
|
});
|
|
268
267
|
Object.defineProperty(exports, "InsufficientGasFundsError", {
|
|
269
268
|
enumerable: true,
|
|
270
|
-
get: function () { return
|
|
269
|
+
get: function () { return chunk2RNW4MIJ_cjs.InsufficientGasFundsError; }
|
|
271
270
|
});
|
|
272
271
|
Object.defineProperty(exports, "InvalidArgumentError", {
|
|
273
272
|
enumerable: true,
|
|
274
|
-
get: function () { return
|
|
273
|
+
get: function () { return chunk2RNW4MIJ_cjs.InvalidArgumentError; }
|
|
275
274
|
});
|
|
276
275
|
Object.defineProperty(exports, "InvalidSignatureError", {
|
|
277
276
|
enumerable: true,
|
|
278
|
-
get: function () { return
|
|
277
|
+
get: function () { return chunk2RNW4MIJ_cjs.InvalidSignatureError; }
|
|
279
278
|
});
|
|
280
279
|
Object.defineProperty(exports, "MissingAccountError", {
|
|
281
280
|
enumerable: true,
|
|
282
|
-
get: function () { return
|
|
281
|
+
get: function () { return chunk2RNW4MIJ_cjs.MissingAccountError; }
|
|
283
282
|
});
|
|
284
283
|
Object.defineProperty(exports, "MissingClientError", {
|
|
285
284
|
enumerable: true,
|
|
286
|
-
get: function () { return
|
|
285
|
+
get: function () { return chunk2RNW4MIJ_cjs.MissingClientError; }
|
|
287
286
|
});
|
|
288
287
|
Object.defineProperty(exports, "MissingEncryptorError", {
|
|
289
288
|
enumerable: true,
|
|
290
|
-
get: function () { return
|
|
289
|
+
get: function () { return chunk2RNW4MIJ_cjs.MissingEncryptorError; }
|
|
291
290
|
});
|
|
292
291
|
Object.defineProperty(exports, "MissingPublicClientError", {
|
|
293
292
|
enumerable: true,
|
|
294
|
-
get: function () { return
|
|
293
|
+
get: function () { return chunk2RNW4MIJ_cjs.MissingPublicClientError; }
|
|
295
294
|
});
|
|
296
295
|
Object.defineProperty(exports, "MissingWalletClientError", {
|
|
297
296
|
enumerable: true,
|
|
298
|
-
get: function () { return
|
|
297
|
+
get: function () { return chunk2RNW4MIJ_cjs.MissingWalletClientError; }
|
|
299
298
|
});
|
|
300
299
|
Object.defineProperty(exports, "NetworkError", {
|
|
301
300
|
enumerable: true,
|
|
302
|
-
get: function () { return
|
|
301
|
+
get: function () { return chunk2RNW4MIJ_cjs.NetworkError; }
|
|
303
302
|
});
|
|
304
303
|
Object.defineProperty(exports, "OperatorNotApprovedError", {
|
|
305
304
|
enumerable: true,
|
|
306
|
-
get: function () { return
|
|
305
|
+
get: function () { return chunk2RNW4MIJ_cjs.OperatorNotApprovedError; }
|
|
307
306
|
});
|
|
308
307
|
Object.defineProperty(exports, "PausedError", {
|
|
309
308
|
enumerable: true,
|
|
310
|
-
get: function () { return
|
|
309
|
+
get: function () { return chunk2RNW4MIJ_cjs.PausedError; }
|
|
311
310
|
});
|
|
312
311
|
Object.defineProperty(exports, "ReceiptEventAmbiguousError", {
|
|
313
312
|
enumerable: true,
|
|
314
|
-
get: function () { return
|
|
313
|
+
get: function () { return chunk2RNW4MIJ_cjs.ReceiptEventAmbiguousError; }
|
|
315
314
|
});
|
|
316
315
|
Object.defineProperty(exports, "ReceiptEventNotFoundError", {
|
|
317
316
|
enumerable: true,
|
|
318
|
-
get: function () { return
|
|
317
|
+
get: function () { return chunk2RNW4MIJ_cjs.ReceiptEventNotFoundError; }
|
|
319
318
|
});
|
|
320
319
|
Object.defineProperty(exports, "ReentrancyError", {
|
|
321
320
|
enumerable: true,
|
|
322
|
-
get: function () { return
|
|
321
|
+
get: function () { return chunk2RNW4MIJ_cjs.ReentrancyError; }
|
|
323
322
|
});
|
|
324
323
|
Object.defineProperty(exports, "RelayerUnreachableError", {
|
|
325
324
|
enumerable: true,
|
|
326
|
-
get: function () { return
|
|
325
|
+
get: function () { return chunk2RNW4MIJ_cjs.RelayerUnreachableError; }
|
|
327
326
|
});
|
|
328
327
|
Object.defineProperty(exports, "SigningFailedError", {
|
|
329
328
|
enumerable: true,
|
|
330
|
-
get: function () { return
|
|
329
|
+
get: function () { return chunk2RNW4MIJ_cjs.SigningFailedError; }
|
|
331
330
|
});
|
|
332
331
|
Object.defineProperty(exports, "TokenOpsContractError", {
|
|
333
332
|
enumerable: true,
|
|
334
|
-
get: function () { return
|
|
333
|
+
get: function () { return chunk2RNW4MIJ_cjs.TokenOpsContractError; }
|
|
335
334
|
});
|
|
336
335
|
Object.defineProperty(exports, "TokenOpsSdkError", {
|
|
337
336
|
enumerable: true,
|
|
338
|
-
get: function () { return
|
|
337
|
+
get: function () { return chunk2RNW4MIJ_cjs.TokenOpsSdkError; }
|
|
339
338
|
});
|
|
340
339
|
Object.defineProperty(exports, "TransferFailedError", {
|
|
341
340
|
enumerable: true,
|
|
342
|
-
get: function () { return
|
|
341
|
+
get: function () { return chunk2RNW4MIJ_cjs.TransferFailedError; }
|
|
343
342
|
});
|
|
344
343
|
Object.defineProperty(exports, "UnknownWriteFailureError", {
|
|
345
344
|
enumerable: true,
|
|
346
|
-
get: function () { return
|
|
345
|
+
get: function () { return chunk2RNW4MIJ_cjs.UnknownWriteFailureError; }
|
|
347
346
|
});
|
|
348
347
|
Object.defineProperty(exports, "UnsupportedChainError", {
|
|
349
348
|
enumerable: true,
|
|
350
|
-
get: function () { return
|
|
349
|
+
get: function () { return chunk2RNW4MIJ_cjs.UnsupportedChainError; }
|
|
351
350
|
});
|
|
352
351
|
Object.defineProperty(exports, "UserDecryptNotAllowedError", {
|
|
353
352
|
enumerable: true,
|
|
354
|
-
get: function () { return
|
|
353
|
+
get: function () { return chunk2RNW4MIJ_cjs.UserDecryptNotAllowedError; }
|
|
355
354
|
});
|
|
356
355
|
Object.defineProperty(exports, "UserRejectedSignatureError", {
|
|
357
356
|
enumerable: true,
|
|
358
|
-
get: function () { return
|
|
357
|
+
get: function () { return chunk2RNW4MIJ_cjs.UserRejectedSignatureError; }
|
|
359
358
|
});
|
|
360
359
|
Object.defineProperty(exports, "WalletChainMismatchError", {
|
|
361
360
|
enumerable: true,
|
|
362
|
-
get: function () { return
|
|
361
|
+
get: function () { return chunk2RNW4MIJ_cjs.WalletChainMismatchError; }
|
|
363
362
|
});
|
|
364
363
|
Object.defineProperty(exports, "WalletRejectedError", {
|
|
365
364
|
enumerable: true,
|
|
366
|
-
get: function () { return
|
|
365
|
+
get: function () { return chunk2RNW4MIJ_cjs.WalletRejectedError; }
|
|
367
366
|
});
|
|
368
367
|
Object.defineProperty(exports, "isTokenOpsSdkError", {
|
|
369
368
|
enumerable: true,
|
|
370
|
-
get: function () { return
|
|
369
|
+
get: function () { return chunk2RNW4MIJ_cjs.isTokenOpsSdkError; }
|
|
371
370
|
});
|
|
372
371
|
exports.TESTNET_FAUCET_KEY = TESTNET_FAUCET_KEY;
|
|
373
372
|
exports.TESTNET_FAUCET_NAMESPACE = TESTNET_FAUCET_NAMESPACE;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
+
import { createTestnetFaucetClient, isTestnetFaucetChainId } from '../../chunk-WTK6JDSI.js';
|
|
2
|
+
export { FaucetSupplyExhaustedError } from '../../chunk-WTK6JDSI.js';
|
|
1
3
|
import { useWagmiAccount } from '../../chunk-FT4LNBOS.js';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import '../../chunk-6WSNS3UV.js';
|
|
5
|
+
import { getConfidentialTestTokenAddress } from '../../chunk-QKKBBH7I.js';
|
|
6
|
+
import '../../chunk-46T67CE2.js';
|
|
7
|
+
import { MissingClientError, UnsupportedChainError, DeploymentAddressUnavailableError } from '../../chunk-DRSPMIZ7.js';
|
|
8
|
+
export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, OperatorNotApprovedError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsContractError, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-DRSPMIZ7.js';
|
|
7
9
|
import '../../chunk-Q2GP5UDC.js';
|
|
8
|
-
import '../../chunk-KWFFIJYX.js';
|
|
9
|
-
import { MissingClientError, UnsupportedChainError, DeploymentAddressUnavailableError } from '../../chunk-QBJ7O2B4.js';
|
|
10
|
-
export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, OperatorNotApprovedError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsContractError, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-QBJ7O2B4.js';
|
|
11
10
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
12
11
|
import { useMemo } from 'react';
|
|
13
12
|
import { usePublicClient, useWalletClient } from 'wagmi';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenops/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Typed viem-first SDK for TokenOps FHEVM contracts (confidential vesting, confidential airdrops, confidential disperse, plus a testnet faucet for the ERC-7984 test-token pair TTT + CTTT) — consumed by tokenops-app (Next.js) and tokenops-api (Express).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
"test:watch": "vitest",
|
|
268
268
|
"test:coverage": "vitest run --coverage",
|
|
269
269
|
"test:unit": "vitest run src",
|
|
270
|
-
"test:hooks": "vitest run src/core/wagmi-compat.test.ts test/fhe-vesting/react test/fhe-airdrop/react test/fhe-disperse/react test/testnet-faucet/react",
|
|
270
|
+
"test:hooks": "vitest run src/core/wagmi-compat.test.ts test/fhe-vesting/react test/fhe-airdrop/react test/fhe-disperse/react test/testnet-faucet/react test/fhe/react test/react",
|
|
271
271
|
"test:local": "vitest run test",
|
|
272
272
|
"test:local-all": "./scripts/run-local-fhevm-tests.sh",
|
|
273
273
|
"test:sepolia": "vitest run test --reporter=verbose",
|
|
@@ -316,25 +316,30 @@
|
|
|
316
316
|
"overrides": {
|
|
317
317
|
"@types/react": "19.2.15",
|
|
318
318
|
"@types/react-dom": "19.2.3",
|
|
319
|
-
"axios@<1.
|
|
319
|
+
"axios@<1.18.0": "^1.18.0",
|
|
320
320
|
"form-data@<4.0.6": "^4.0.6",
|
|
321
321
|
"dompurify@<3.4.11": "^3.4.11",
|
|
322
322
|
"ws@>=8.0.0 <8.20.1": "^8.21.0",
|
|
323
323
|
"ws@>=7.0.0 <7.5.11": "^7.5.11",
|
|
324
|
-
"postcss
|
|
324
|
+
"postcss@<8.5.18": "8.5.23",
|
|
325
325
|
"esbuild@<0.28.1": "^0.28.1",
|
|
326
326
|
"vite@<6.4.3": "^6.4.3",
|
|
327
|
-
"hono@<4.12.
|
|
328
|
-
"js-yaml@<4.
|
|
327
|
+
"hono@<4.12.27": "^4.12.27",
|
|
328
|
+
"js-yaml@<4.3.0": "^4.3.0",
|
|
329
329
|
"uuid@<11.1.1": "^11.1.1",
|
|
330
330
|
"linkifyjs@<4.3.2": "^4.3.3",
|
|
331
|
+
"linkify-it@<5.0.2": "^5.0.2",
|
|
332
|
+
"fast-uri@>=3.0.0 <3.1.4": "^3.1.4",
|
|
333
|
+
"brace-expansion@<1.1.16": "^1.1.16",
|
|
334
|
+
"brace-expansion@>=2.0.0 <2.1.3": "^2.1.3",
|
|
335
|
+
"brace-expansion@>=3.0.0 <5.0.8": "^5.0.8",
|
|
331
336
|
"@privy-io/js-sdk-core@<0.56.0": "^0.56.4"
|
|
332
337
|
}
|
|
333
338
|
},
|
|
334
339
|
"devDependencies": {
|
|
335
340
|
"@commitlint/cli": "^20.0.0",
|
|
336
341
|
"@commitlint/config-conventional": "^20.0.0",
|
|
337
|
-
"@eslint/js": "^
|
|
342
|
+
"@eslint/js": "^10.0.1",
|
|
338
343
|
"@fhevm/mock-utils": "^0.4.2",
|
|
339
344
|
"@microsoft/api-extractor": "^7.58.7",
|
|
340
345
|
"@tanstack/react-query": "^5.100.11",
|
|
@@ -344,7 +349,7 @@
|
|
|
344
349
|
"@types/react-dom": "^18.3.7",
|
|
345
350
|
"@vitest/coverage-v8": "^3.2.6",
|
|
346
351
|
"@zama-fhe/sdk": "^3.0.0",
|
|
347
|
-
"eslint": "^
|
|
352
|
+
"eslint": "^10.8.0",
|
|
348
353
|
"eslint-config-prettier": "^10.0.0",
|
|
349
354
|
"ethers": "^6.16.0",
|
|
350
355
|
"happy-dom": "^20.9.0",
|
package/dist/chunk-66IHPTOK.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// src/core/brands.ts
|
|
4
|
-
var asEncryptedHandle = (h) => h;
|
|
5
|
-
var asExternalInputProof = (h) => h;
|
|
6
|
-
var asTxHash = (h) => h;
|
|
7
|
-
var asVestingId = (h) => h;
|
|
8
|
-
var asAirdropId = (h) => h;
|
|
9
|
-
var asDisperseId = (h) => h;
|
|
10
|
-
var asRole = (h) => h;
|
|
11
|
-
var asSignature = (h) => h;
|
|
12
|
-
|
|
13
|
-
exports.asAirdropId = asAirdropId;
|
|
14
|
-
exports.asDisperseId = asDisperseId;
|
|
15
|
-
exports.asEncryptedHandle = asEncryptedHandle;
|
|
16
|
-
exports.asExternalInputProof = asExternalInputProof;
|
|
17
|
-
exports.asRole = asRole;
|
|
18
|
-
exports.asSignature = asSignature;
|
|
19
|
-
exports.asTxHash = asTxHash;
|
|
20
|
-
exports.asVestingId = asVestingId;
|
package/dist/chunk-KWFFIJYX.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
// src/core/brands.ts
|
|
2
|
-
var asEncryptedHandle = (h) => h;
|
|
3
|
-
var asExternalInputProof = (h) => h;
|
|
4
|
-
var asTxHash = (h) => h;
|
|
5
|
-
var asVestingId = (h) => h;
|
|
6
|
-
var asAirdropId = (h) => h;
|
|
7
|
-
var asDisperseId = (h) => h;
|
|
8
|
-
var asRole = (h) => h;
|
|
9
|
-
var asSignature = (h) => h;
|
|
10
|
-
|
|
11
|
-
export { asAirdropId, asDisperseId, asEncryptedHandle, asExternalInputProof, asRole, asSignature, asTxHash, asVestingId };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { TxHash } from "../../core/brands.js";
|
|
3
|
-
import type { ClaimArgs } from "../airdrop.js";
|
|
4
|
-
import { type AirdropHookOptions } from "./_shared.js";
|
|
5
|
-
/**
|
|
6
|
-
* Claim tokens from an airdrop using an EIP-712 admin signature. The SDK
|
|
7
|
-
* encrypts the plaintext `amount` into an `externalEuint64` and submits it
|
|
8
|
-
* with an input proof — callers never handle ciphertext. Attaches `GAS_FEE()`
|
|
9
|
-
* ETH automatically unless `args.value` is set.
|
|
10
|
-
*
|
|
11
|
-
* **Encryptor resolution.** The hook-level `encryptor` (from
|
|
12
|
-
* {@link AirdropHookOptions}) is forwarded lazily to the SDK client. You can
|
|
13
|
-
* also pass `encryptor` per-mutation via `args.encryptor` to override it. If
|
|
14
|
-
* neither is present, the SDK throws `Missing encryptor — pass encryptor…`
|
|
15
|
-
* verbatim.
|
|
16
|
-
*
|
|
17
|
-
* After a successful claim, invalidate
|
|
18
|
-
* `useAirdropIsSignatureClaimed({ user, encryptedAmountHandle })` and any
|
|
19
|
-
* UI counts you computed off it.
|
|
20
|
-
*
|
|
21
|
-
* **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* const claim = useAirdropClaim({ address: airdropAddress, encryptor: () => useZamaSDK().relayer });
|
|
25
|
-
* claim.mutate({ amount: 1_000_000n, signature });
|
|
26
|
-
*/
|
|
27
|
-
export declare function useAirdropClaim(options: AirdropHookOptions): UseMutationResult<TxHash, Error, ClaimArgs>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { EncryptedViewResult, GetClaimAmountArgs } from "../airdrop.js";
|
|
3
|
-
import { type AirdropHookOptions } from "./_shared.js";
|
|
4
|
-
/**
|
|
5
|
-
* **Submits a transaction (costs gas) to grant the caller decrypt access to
|
|
6
|
-
* the claim amount as an `euint64` handle.** The handle is granted persistent
|
|
7
|
-
* ACL on-chain via `FHE.allow(handle, msg.sender)`; the SDK extracts it from
|
|
8
|
-
* the receipt's `ACL.Allowed` event (NOT from simulation — that returns a
|
|
9
|
-
* divergent, ACL-less handle; see CLAUDE.md Pitfall #1).
|
|
10
|
-
*
|
|
11
|
-
* Pass `data.handle` to the Zama relayer's `userDecrypt` to obtain the
|
|
12
|
-
* plaintext amount. The handle is only valid after the tx lands.
|
|
13
|
-
*
|
|
14
|
-
* Does **not** consume the claim (the `claimedSignatures` bit is not set).
|
|
15
|
-
* Call {@link useClaim} when the user is ready to transfer tokens.
|
|
16
|
-
*
|
|
17
|
-
* Submits the admin-issued `{ encryptedInput, signature }` pair verbatim. The
|
|
18
|
-
* SDK does NOT re-encrypt — the signature commits to the exact handle.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // `encryptedInput` + `signature` are the admin-issued payload delivered to
|
|
22
|
-
* // the recipient (same pair the recipient passes to `useClaim`). Sourced
|
|
23
|
-
* // from your server API or, for admin-dashboard flows, by combining
|
|
24
|
-
* // `encryptUint64({ userAddress: recipient, ... })` with
|
|
25
|
-
* // `useSignClaimAuthorization`.
|
|
26
|
-
* const view = useGetClaimAmount({ address: airdropAddress });
|
|
27
|
-
* view.mutate({ encryptedInput, signature });
|
|
28
|
-
* // view.data → { handle: "0x...", hash: "0x..." }
|
|
29
|
-
*/
|
|
30
|
-
export declare function useGetClaimAmount(options: AirdropHookOptions): UseMutationResult<EncryptedViewResult, Error, GetClaimAmountArgs>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { Account, Address, Hex } from "viem";
|
|
3
|
-
import type { EncryptedViewResult } from "../manager.js";
|
|
4
|
-
import { type ManagerHookOptions } from "./_shared.js";
|
|
5
|
-
export interface UseGetClaimableAmountArgs {
|
|
6
|
-
vestingId: Hex;
|
|
7
|
-
account?: Account | Address;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* **Submits a transaction** to read the currently-claimable amount as an
|
|
11
|
-
* `euint128` handle. Pass `data.handle` to the Zama relayer's `userDecrypt`.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useGetClaimableAmount(options: ManagerHookOptions): UseMutationResult<EncryptedViewResult, Error, UseGetClaimableAmountArgs>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { Account, Address, Hex } from "viem";
|
|
3
|
-
import type { EncryptedViewResult } from "../manager.js";
|
|
4
|
-
import { type ManagerHookOptions } from "./_shared.js";
|
|
5
|
-
export interface UseGetSettledAmountArgs {
|
|
6
|
-
vestingId: Hex;
|
|
7
|
-
account?: Account | Address;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* **Submits a transaction** to read the already-claimed (settled) amount of a
|
|
11
|
-
* vesting as an `euint128` handle. Pass `data.handle` to the Zama relayer's
|
|
12
|
-
* `userDecrypt`.
|
|
13
|
-
*/
|
|
14
|
-
export declare function useGetSettledAmount(options: ManagerHookOptions): UseMutationResult<EncryptedViewResult, Error, UseGetSettledAmountArgs>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { Account, Address, Hex } from "viem";
|
|
3
|
-
import type { EncryptedViewResult } from "../manager.js";
|
|
4
|
-
import { type ManagerHookOptions } from "./_shared.js";
|
|
5
|
-
export interface UseGetTotalAllocationArgs {
|
|
6
|
-
vestingId: Hex;
|
|
7
|
-
account?: Account | Address;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* **Submits a transaction** to read the total allocation of a vesting as an
|
|
11
|
-
* `euint128` handle. Pass `data.handle` to the Zama relayer's `userDecrypt`.
|
|
12
|
-
*/
|
|
13
|
-
export declare function useGetTotalAllocation(options: ManagerHookOptions): UseMutationResult<EncryptedViewResult, Error, UseGetTotalAllocationArgs>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { Account, Address, Hex } from "viem";
|
|
3
|
-
import type { EncryptedViewResult } from "../manager.js";
|
|
4
|
-
import { type ManagerHookOptions } from "./_shared.js";
|
|
5
|
-
export interface UseGetVestedAmountArgs {
|
|
6
|
-
vestingId: Hex;
|
|
7
|
-
/** Unix timestamp (seconds) — `Math.floor(Date.now() / 1000)` for "now". */
|
|
8
|
-
timestamp: number;
|
|
9
|
-
account?: Account | Address;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* **Submits a transaction** to read the vested amount at a given timestamp as
|
|
13
|
-
* an `euint128` handle. The contract performs `FHE.allow(handle, msg.sender)`
|
|
14
|
-
* so persistent ACL is granted to the caller; the SDK parses the handle from
|
|
15
|
-
* the receipt's `ACL.Allowed` event (NOT from simulation — that returns a
|
|
16
|
-
* different, ACL-less handle).
|
|
17
|
-
*
|
|
18
|
-
* Pass `data.handle` to the Zama relayer's `userDecrypt` to get the plaintext.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const getVested = useGetVestedAmount({ address: managerAddress });
|
|
22
|
-
* getVested.mutate({ vestingId, timestamp: Math.floor(Date.now() / 1000) });
|
|
23
|
-
* // getVested.data → { handle: "0x...", hash: "0x..." }
|
|
24
|
-
*/
|
|
25
|
-
export declare function useGetVestedAmount(options: ManagerHookOptions): UseMutationResult<EncryptedViewResult, Error, UseGetVestedAmountArgs>;
|