@tokenops/sdk 2.0.0-alpha.1 → 2.0.0-alpha.3
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 +67 -2
- package/README.md +14 -8
- package/dist/{chunk-PUX5VXDB.cjs → chunk-4AWQJQXY.cjs} +1415 -69
- package/dist/{chunk-74QFZ5MK.js → chunk-4IB4IY5Y.js} +1 -1
- package/dist/{chunk-DZHYSUGY.js → chunk-6HCT4QIX.js} +12 -5
- package/dist/{chunk-FGEB7RMY.cjs → chunk-6XOAYDC6.cjs} +4 -4
- package/dist/{chunk-XAYGD4E4.cjs → chunk-AHU2HMNE.cjs} +3 -3
- package/dist/{chunk-6NAVMWZQ.js → chunk-BPIVVCSQ.js} +2 -2
- package/dist/{chunk-GKKDAW44.js → chunk-BXX5TETM.js} +1401 -59
- package/dist/{chunk-456VDDA3.js → chunk-GCJFAY4X.js} +78 -25
- package/dist/{chunk-CTED3MTR.cjs → chunk-GKYZQJGP.cjs} +82 -29
- package/dist/{chunk-JZLGCTGK.cjs → chunk-IEKTGJ4J.cjs} +2 -2
- package/dist/{chunk-6PXXGACR.cjs → chunk-JVNJSDQ4.cjs} +2 -2
- package/dist/{chunk-O5676ZWY.js → chunk-LEYYG4RF.js} +232 -6
- package/dist/{chunk-335Z2W67.js → chunk-NGU4JYIR.js} +1 -1
- package/dist/{chunk-5576FRT3.cjs → chunk-PG3WXT3K.cjs} +12 -5
- package/dist/{chunk-H5POPGOZ.js → chunk-PK6Q6J5F.js} +1 -1
- package/dist/chunk-TND5NDV7.cjs +263 -0
- package/dist/chunk-U3TBQRT7.js +253 -0
- package/dist/{chunk-EAJ7SYHE.js → chunk-WRWRA4TN.js} +1 -1
- package/dist/{chunk-JQYC66TO.cjs → chunk-YABHXJNH.cjs} +5 -5
- package/dist/{chunk-M4IT6DNJ.cjs → chunk-YTIYTV4K.cjs} +236 -4
- package/dist/core/addresses.d.ts +4 -4
- package/dist/core/errors.d.ts +1 -1
- package/dist/fhe/types.d.ts +2 -2
- package/dist/fhe-airdrop/abis/airdrop-base.d.ts +19 -0
- package/dist/fhe-airdrop/abis/ecdsa.d.ts +19 -0
- package/dist/fhe-airdrop/abis/factory.d.ts +113 -0
- package/dist/fhe-airdrop/abis/merkle.d.ts +43 -12
- package/dist/fhe-airdrop/advanced/index.cjs +4 -4
- package/dist/fhe-airdrop/advanced/index.js +1 -1
- package/dist/fhe-airdrop/advanced/react/index.cjs +620 -9
- package/dist/fhe-airdrop/advanced/react/index.d.cts +35 -0
- package/dist/fhe-airdrop/advanced/react/index.d.ts +35 -0
- package/dist/fhe-airdrop/advanced/react/index.js +590 -7
- package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
- package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +26 -0
- package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +37 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +37 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +48 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
- package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +29 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
- package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +55 -8
- package/dist/fhe-airdrop/campaign.d.ts +61 -20
- package/dist/fhe-airdrop/constants.d.ts +9 -1
- package/dist/fhe-airdrop/ecdsa.d.ts +13 -0
- package/dist/fhe-airdrop/errors.d.ts +87 -0
- package/dist/fhe-airdrop/factory.d.ts +62 -22
- package/dist/fhe-airdrop/guards.d.ts +133 -4
- package/dist/fhe-airdrop/index.cjs +86 -971
- package/dist/fhe-airdrop/index.d.cts +4 -4
- package/dist/fhe-airdrop/index.d.ts +4 -4
- package/dist/fhe-airdrop/index.js +8 -927
- package/dist/fhe-airdrop/merkle-tree.d.ts +32 -38
- package/dist/fhe-airdrop/merkle.d.ts +52 -31
- package/dist/fhe-airdrop/react/_shared.d.ts +13 -0
- package/dist/fhe-airdrop/react/index.cjs +997 -87
- package/dist/fhe-airdrop/react/index.d.cts +53 -4
- package/dist/fhe-airdrop/react/index.d.ts +53 -4
- package/dist/fhe-airdrop/react/index.js +887 -27
- package/dist/fhe-airdrop/react/keys.d.ts +98 -0
- package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
- package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
- package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +35 -0
- package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +33 -0
- package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
- package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
- package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
- package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
- package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
- package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
- package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
- package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
- package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
- package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
- package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
- package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
- package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +4 -3
- package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
- package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
- package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
- package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
- package/dist/fhe-airdrop/react/useFactoryFees.d.ts +11 -4
- package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
- package/dist/fhe-airdrop/react/useIsAirdrop.d.ts +44 -0
- package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
- package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
- package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +7 -19
- package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
- package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
- package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +67 -0
- package/dist/fhe-airdrop/react/useRefreshComplianceBalance.d.ts +36 -0
- package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
- package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
- package/dist/fhe-airdrop/react/useResolveGasFee.d.ts +30 -0
- package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +42 -0
- package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
- package/dist/fhe-airdrop/types.d.ts +27 -1
- package/dist/fhe-disperse/index.cjs +21 -21
- package/dist/fhe-disperse/index.js +2 -2
- package/dist/fhe-disperse/react/index.cjs +22 -22
- package/dist/fhe-disperse/react/index.js +3 -3
- package/dist/fhe-vesting/advanced/index.cjs +5 -5
- package/dist/fhe-vesting/advanced/index.js +3 -3
- package/dist/fhe-vesting/advanced/react/index.cjs +7 -7
- package/dist/fhe-vesting/advanced/react/index.js +4 -4
- package/dist/fhe-vesting/index.cjs +8 -8
- package/dist/fhe-vesting/index.js +2 -2
- package/dist/fhe-vesting/react/index.cjs +114 -114
- package/dist/fhe-vesting/react/index.js +3 -3
- package/dist/index.cjs +18 -18
- package/dist/index.js +1 -1
- package/dist/testnet-faucet/index.cjs +14 -14
- package/dist/testnet-faucet/index.js +2 -2
- package/dist/testnet-faucet/react/index.cjs +8 -8
- package/dist/testnet-faucet/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-NCVX3K2N.cjs +0 -161
- package/dist/chunk-VP2B4WM2.js +0 -154
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export { useEnsureOperator, useIsOperator } from '../../chunk-AXIPOR3C.js';
|
|
2
2
|
import '../../chunk-FT4LNBOS.js';
|
|
3
3
|
import '../../chunk-4TSDNZQ3.js';
|
|
4
|
-
import { useMemoFactoryClient, buildQueryKey, useMemoManagerClient } from '../../chunk-
|
|
4
|
+
import { useMemoFactoryClient, buildQueryKey, useMemoManagerClient } from '../../chunk-BPIVVCSQ.js';
|
|
5
5
|
export { ClaimLockedError, NoPendingTransferError, NotPendingRecipientError, NotVestingRecipientError, TransferAlreadyPendingError, TransferExpiredError, VestingExpiredError, VestingNotFoundError, VestingNotRevocableError, VestingRevokedError } from '../../chunk-TWT3STIX.js';
|
|
6
6
|
import '../../chunk-WMACINXO.js';
|
|
7
7
|
export { encryptUint64, encryptUint64Batch, resolveEncryptor, scaleRatio } from '../../chunk-6GNR22OV.js';
|
|
8
8
|
import '../../chunk-ZWXJTBZO.js';
|
|
9
9
|
import '../../chunk-7VELUOMI.js';
|
|
10
|
-
export { DisclosureType, FeeType } from '../../chunk-
|
|
10
|
+
export { DisclosureType, FeeType } from '../../chunk-WRWRA4TN.js';
|
|
11
11
|
import '../../chunk-NWFMBLSQ.js';
|
|
12
12
|
import '../../chunk-4RAAATVY.js';
|
|
13
|
-
import '../../chunk-
|
|
13
|
+
import '../../chunk-6HCT4QIX.js';
|
|
14
14
|
import '../../chunk-ZA673I3O.js';
|
|
15
15
|
import '../../chunk-KWFFIJYX.js';
|
|
16
16
|
import { MissingClientError } from '../../chunk-QBJ7O2B4.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkPG3WXT3K_cjs = require('./chunk-PG3WXT3K.cjs');
|
|
4
4
|
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
5
5
|
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
6
6
|
var chains = require('viem/chains');
|
|
@@ -15,71 +15,71 @@ function isSupportedChainId(chainId) {
|
|
|
15
15
|
|
|
16
16
|
Object.defineProperty(exports, "DEPLOYED_ADDRESSES", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkPG3WXT3K_cjs.DEPLOYED_ADDRESSES; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "chainsWithDeployment", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkPG3WXT3K_cjs.chainsWithDeployment; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "chainsWithKnownRegistryEntry", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkPG3WXT3K_cjs.chainsWithKnownRegistryEntry; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "getConfidentialTestTokenAddress", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkPG3WXT3K_cjs.getConfidentialTestTokenAddress; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "getDeployedAddress", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkPG3WXT3K_cjs.getDeployedAddress; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "getFheAirdropComplianceImplementationAddress", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkPG3WXT3K_cjs.getFheAirdropComplianceImplementationAddress; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "getFheAirdropEcdsaImplementationAddress", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkPG3WXT3K_cjs.getFheAirdropEcdsaImplementationAddress; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "getFheAirdropFactoryAddress", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkPG3WXT3K_cjs.getFheAirdropFactoryAddress; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "getFheAirdropMerkleImplementationAddress", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkPG3WXT3K_cjs.getFheAirdropMerkleImplementationAddress; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "getFheDisperseSingletonAddress", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkPG3WXT3K_cjs.getFheDisperseSingletonAddress; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "getFheVestingFactoryAddress", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkPG3WXT3K_cjs.getFheVestingFactoryAddress; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "getTestTokenAddress", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkPG3WXT3K_cjs.getTestTokenAddress; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "requireConfidentialTestTokenAddress", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkPG3WXT3K_cjs.requireConfidentialTestTokenAddress; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "requireFheAirdropFactoryAddress", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkPG3WXT3K_cjs.requireFheAirdropFactoryAddress; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "requireFheDisperseSingletonAddress", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkPG3WXT3K_cjs.requireFheDisperseSingletonAddress; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "requireFheVestingFactoryAddress", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkPG3WXT3K_cjs.requireFheVestingFactoryAddress; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "requireTestTokenAddress", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkPG3WXT3K_cjs.requireTestTokenAddress; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "asAirdropId", {
|
|
85
85
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { DEPLOYED_ADDRESSES, chainsWithDeployment, chainsWithKnownRegistryEntry, getConfidentialTestTokenAddress, getDeployedAddress, getFheAirdropComplianceImplementationAddress, getFheAirdropEcdsaImplementationAddress, getFheAirdropFactoryAddress, getFheAirdropMerkleImplementationAddress, getFheDisperseSingletonAddress, getFheVestingFactoryAddress, getTestTokenAddress, requireConfidentialTestTokenAddress, requireFheAirdropFactoryAddress, requireFheDisperseSingletonAddress, requireFheVestingFactoryAddress, requireTestTokenAddress } from './chunk-
|
|
1
|
+
export { DEPLOYED_ADDRESSES, chainsWithDeployment, chainsWithKnownRegistryEntry, getConfidentialTestTokenAddress, getDeployedAddress, getFheAirdropComplianceImplementationAddress, getFheAirdropEcdsaImplementationAddress, getFheAirdropFactoryAddress, getFheAirdropMerkleImplementationAddress, getFheDisperseSingletonAddress, getFheVestingFactoryAddress, getTestTokenAddress, requireConfidentialTestTokenAddress, requireFheAirdropFactoryAddress, requireFheDisperseSingletonAddress, requireFheVestingFactoryAddress, requireTestTokenAddress } from './chunk-6HCT4QIX.js';
|
|
2
2
|
export { asAirdropId, asDisperseId, asEncryptedHandle, asExternalInputProof, asRole, asSignature, asTxHash, asVestingId } from './chunk-KWFFIJYX.js';
|
|
3
3
|
export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, OPERATOR_NOT_APPROVED_REMEDIATION, OperatorNotApprovedError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsContractError, TokenOpsSdkError, TokenOpsValidationError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from './chunk-QBJ7O2B4.js';
|
|
4
4
|
import { sepolia, mainnet } from 'viem/chains';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkAHU2HMNE_cjs = require('../chunk-AHU2HMNE.cjs');
|
|
4
4
|
require('../chunk-UG5RKLU2.cjs');
|
|
5
5
|
require('../chunk-MVDQMV25.cjs');
|
|
6
|
-
var
|
|
6
|
+
var chunkPG3WXT3K_cjs = require('../chunk-PG3WXT3K.cjs');
|
|
7
7
|
require('../chunk-JK4XMMKM.cjs');
|
|
8
8
|
require('../chunk-66IHPTOK.cjs');
|
|
9
9
|
var chunk67OV5CX2_cjs = require('../chunk-67OV5CX2.cjs');
|
|
@@ -13,51 +13,51 @@ require('../chunk-VJKZWYYJ.cjs');
|
|
|
13
13
|
|
|
14
14
|
Object.defineProperty(exports, "FaucetSupplyExhaustedError", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkAHU2HMNE_cjs.FaucetSupplyExhaustedError; }
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "TESTNET_FAUCET_SUPPORTED_CHAIN_IDS", {
|
|
19
19
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkAHU2HMNE_cjs.TESTNET_FAUCET_SUPPORTED_CHAIN_IDS; }
|
|
21
21
|
});
|
|
22
22
|
Object.defineProperty(exports, "TestnetFaucetClient", {
|
|
23
23
|
enumerable: true,
|
|
24
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkAHU2HMNE_cjs.TestnetFaucetClient; }
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "assertTestnetFaucetChain", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkAHU2HMNE_cjs.assertTestnetFaucetChain; }
|
|
29
29
|
});
|
|
30
30
|
Object.defineProperty(exports, "confidentialTokenopsTestTokenAbi", {
|
|
31
31
|
enumerable: true,
|
|
32
|
-
get: function () { return
|
|
32
|
+
get: function () { return chunkAHU2HMNE_cjs.confidentialTokenopsTestTokenAbi; }
|
|
33
33
|
});
|
|
34
34
|
Object.defineProperty(exports, "createTestnetFaucetClient", {
|
|
35
35
|
enumerable: true,
|
|
36
|
-
get: function () { return
|
|
36
|
+
get: function () { return chunkAHU2HMNE_cjs.createTestnetFaucetClient; }
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "isTestnetFaucetChainId", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function () { return
|
|
40
|
+
get: function () { return chunkAHU2HMNE_cjs.isTestnetFaucetChainId; }
|
|
41
41
|
});
|
|
42
42
|
Object.defineProperty(exports, "tokenopsTestTokenAbi", {
|
|
43
43
|
enumerable: true,
|
|
44
|
-
get: function () { return
|
|
44
|
+
get: function () { return chunkAHU2HMNE_cjs.tokenopsTestTokenAbi; }
|
|
45
45
|
});
|
|
46
46
|
Object.defineProperty(exports, "getConfidentialTestTokenAddress", {
|
|
47
47
|
enumerable: true,
|
|
48
|
-
get: function () { return
|
|
48
|
+
get: function () { return chunkPG3WXT3K_cjs.getConfidentialTestTokenAddress; }
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "getTestTokenAddress", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function () { return
|
|
52
|
+
get: function () { return chunkPG3WXT3K_cjs.getTestTokenAddress; }
|
|
53
53
|
});
|
|
54
54
|
Object.defineProperty(exports, "requireConfidentialTestTokenAddress", {
|
|
55
55
|
enumerable: true,
|
|
56
|
-
get: function () { return
|
|
56
|
+
get: function () { return chunkPG3WXT3K_cjs.requireConfidentialTestTokenAddress; }
|
|
57
57
|
});
|
|
58
58
|
Object.defineProperty(exports, "requireTestTokenAddress", {
|
|
59
59
|
enumerable: true,
|
|
60
|
-
get: function () { return
|
|
60
|
+
get: function () { return chunkPG3WXT3K_cjs.requireTestTokenAddress; }
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "AccessDeniedError", {
|
|
63
63
|
enumerable: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { FaucetSupplyExhaustedError, TESTNET_FAUCET_SUPPORTED_CHAIN_IDS, TestnetFaucetClient, assertTestnetFaucetChain, confidentialTokenopsTestTokenAbi, createTestnetFaucetClient, isTestnetFaucetChainId, tokenopsTestTokenAbi } from '../chunk-
|
|
1
|
+
export { FaucetSupplyExhaustedError, TESTNET_FAUCET_SUPPORTED_CHAIN_IDS, TestnetFaucetClient, assertTestnetFaucetChain, confidentialTokenopsTestTokenAbi, createTestnetFaucetClient, isTestnetFaucetChainId, tokenopsTestTokenAbi } from '../chunk-4IB4IY5Y.js';
|
|
2
2
|
import '../chunk-NWFMBLSQ.js';
|
|
3
3
|
import '../chunk-4RAAATVY.js';
|
|
4
|
-
export { getConfidentialTestTokenAddress, getTestTokenAddress, requireConfidentialTestTokenAddress, requireTestTokenAddress } from '../chunk-
|
|
4
|
+
export { getConfidentialTestTokenAddress, getTestTokenAddress, requireConfidentialTestTokenAddress, requireTestTokenAddress } from '../chunk-6HCT4QIX.js';
|
|
5
5
|
import '../chunk-ZA673I3O.js';
|
|
6
6
|
import '../chunk-KWFFIJYX.js';
|
|
7
7
|
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, TokenOpsValidationError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../chunk-QBJ7O2B4.js';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkAHU2HMNE_cjs = require('../../chunk-AHU2HMNE.cjs');
|
|
4
4
|
var chunkZQUE2B3Q_cjs = require('../../chunk-ZQUE2B3Q.cjs');
|
|
5
5
|
require('../../chunk-UG5RKLU2.cjs');
|
|
6
6
|
require('../../chunk-MVDQMV25.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkPG3WXT3K_cjs = require('../../chunk-PG3WXT3K.cjs');
|
|
8
8
|
require('../../chunk-JK4XMMKM.cjs');
|
|
9
9
|
require('../../chunk-66IHPTOK.cjs');
|
|
10
10
|
var chunk67OV5CX2_cjs = require('../../chunk-67OV5CX2.cjs');
|
|
@@ -16,10 +16,10 @@ var wagmi = require('wagmi');
|
|
|
16
16
|
var TESTNET_FAUCET_KEY = "tokenops-sdk";
|
|
17
17
|
var TESTNET_FAUCET_NAMESPACE = "testnet-faucet";
|
|
18
18
|
function tryResolveSingletonAddress(override, chainId) {
|
|
19
|
-
if (chainId !== void 0 && !
|
|
19
|
+
if (chainId !== void 0 && !chunkAHU2HMNE_cjs.isTestnetFaucetChainId(chainId)) return void 0;
|
|
20
20
|
if (override) return override;
|
|
21
21
|
if (chainId === void 0) return void 0;
|
|
22
|
-
return
|
|
22
|
+
return chunkPG3WXT3K_cjs.getConfidentialTestTokenAddress(chainId);
|
|
23
23
|
}
|
|
24
24
|
function useMemoFaucetClient(opts = {}) {
|
|
25
25
|
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
@@ -30,7 +30,7 @@ function useMemoFaucetClient(opts = {}) {
|
|
|
30
30
|
const client = react.useMemo(() => {
|
|
31
31
|
if (!publicClient) return void 0;
|
|
32
32
|
if (!resolvedAddress) return void 0;
|
|
33
|
-
return
|
|
33
|
+
return chunkAHU2HMNE_cjs.createTestnetFaucetClient({
|
|
34
34
|
publicClient,
|
|
35
35
|
...walletClient ? { walletClient } : {},
|
|
36
36
|
...opts.address ? { address: resolvedAddress } : {},
|
|
@@ -47,7 +47,7 @@ function useMemoFaucetClient(opts = {}) {
|
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
49
|
function computeSingletonResolutionError(override, chainId) {
|
|
50
|
-
if (chainId !== void 0 && !
|
|
50
|
+
if (chainId !== void 0 && !chunkAHU2HMNE_cjs.isTestnetFaucetChainId(chainId)) {
|
|
51
51
|
return new chunk67OV5CX2_cjs.UnsupportedChainError(chainId);
|
|
52
52
|
}
|
|
53
53
|
if (override) return void 0;
|
|
@@ -59,7 +59,7 @@ function computeSingletonResolutionError(override, chainId) {
|
|
|
59
59
|
clientLabel: "TestnetFaucetClient"
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
-
const resolved =
|
|
62
|
+
const resolved = chunkPG3WXT3K_cjs.getConfidentialTestTokenAddress(chainId);
|
|
63
63
|
if (!resolved) {
|
|
64
64
|
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
65
65
|
reason: "registry-not-deployed",
|
|
@@ -220,7 +220,7 @@ function useMintUnderlying(options = {}) {
|
|
|
220
220
|
|
|
221
221
|
Object.defineProperty(exports, "FaucetSupplyExhaustedError", {
|
|
222
222
|
enumerable: true,
|
|
223
|
-
get: function () { return
|
|
223
|
+
get: function () { return chunkAHU2HMNE_cjs.FaucetSupplyExhaustedError; }
|
|
224
224
|
});
|
|
225
225
|
Object.defineProperty(exports, "AccessDeniedError", {
|
|
226
226
|
enumerable: true,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createTestnetFaucetClient, isTestnetFaucetChainId } from '../../chunk-
|
|
2
|
-
export { FaucetSupplyExhaustedError } from '../../chunk-
|
|
1
|
+
import { createTestnetFaucetClient, isTestnetFaucetChainId } from '../../chunk-4IB4IY5Y.js';
|
|
2
|
+
export { FaucetSupplyExhaustedError } from '../../chunk-4IB4IY5Y.js';
|
|
3
3
|
import { useWagmiAccount } from '../../chunk-FT4LNBOS.js';
|
|
4
4
|
import '../../chunk-NWFMBLSQ.js';
|
|
5
5
|
import '../../chunk-4RAAATVY.js';
|
|
6
|
-
import { getConfidentialTestTokenAddress } from '../../chunk-
|
|
6
|
+
import { getConfidentialTestTokenAddress } from '../../chunk-6HCT4QIX.js';
|
|
7
7
|
import '../../chunk-ZA673I3O.js';
|
|
8
8
|
import '../../chunk-KWFFIJYX.js';
|
|
9
9
|
import { MissingClientError, UnsupportedChainError, DeploymentAddressUnavailableError } from '../../chunk-QBJ7O2B4.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tokenops/sdk",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
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,
|
package/dist/chunk-NCVX3K2N.cjs
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var chunkPUX5VXDB_cjs = require('./chunk-PUX5VXDB.cjs');
|
|
4
|
-
var chunk5576FRT3_cjs = require('./chunk-5576FRT3.cjs');
|
|
5
|
-
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
6
|
-
var react = require('react');
|
|
7
|
-
var wagmi = require('wagmi');
|
|
8
|
-
|
|
9
|
-
var FHE_AIRDROP_KEY = "tokenops-sdk";
|
|
10
|
-
var FHE_AIRDROP_NAMESPACE = "fhe-airdrop";
|
|
11
|
-
function airdropQueryKey(params) {
|
|
12
|
-
return [
|
|
13
|
-
FHE_AIRDROP_KEY,
|
|
14
|
-
FHE_AIRDROP_NAMESPACE,
|
|
15
|
-
params.chainId ?? null,
|
|
16
|
-
params.address ? normalizeKeyArg(params.address) : null,
|
|
17
|
-
params.fn,
|
|
18
|
-
params.args.map(normalizeKeyArg)
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
function airdropQueryKeyPrefix(params) {
|
|
22
|
-
const prefix = [
|
|
23
|
-
FHE_AIRDROP_KEY,
|
|
24
|
-
FHE_AIRDROP_NAMESPACE,
|
|
25
|
-
params.chainId ?? null,
|
|
26
|
-
params.address ? normalizeKeyArg(params.address) : null
|
|
27
|
-
];
|
|
28
|
-
if (params.fn !== void 0) prefix.push(params.fn);
|
|
29
|
-
return prefix;
|
|
30
|
-
}
|
|
31
|
-
function normalizeKeyArg(value) {
|
|
32
|
-
if (typeof value === "bigint") return value.toString();
|
|
33
|
-
if (Array.isArray(value)) return value.map(normalizeKeyArg);
|
|
34
|
-
if (value && typeof value === "object") {
|
|
35
|
-
return Object.fromEntries(
|
|
36
|
-
Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
function tryResolveAirdropFactoryAddress(override, chainId) {
|
|
43
|
-
if (override) return override;
|
|
44
|
-
if (chainId === void 0) return void 0;
|
|
45
|
-
return chunk5576FRT3_cjs.getFheAirdropFactoryAddress(chainId);
|
|
46
|
-
}
|
|
47
|
-
function computeAirdropFactoryResolutionError(override, chainId) {
|
|
48
|
-
if (override) return void 0;
|
|
49
|
-
if (chainId === void 0) {
|
|
50
|
-
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
51
|
-
reason: "chain-id-missing",
|
|
52
|
-
product: "fheAirdrop",
|
|
53
|
-
contract: "airdropFactory",
|
|
54
|
-
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
const resolved = chunk5576FRT3_cjs.getFheAirdropFactoryAddress(chainId);
|
|
58
|
-
if (!resolved) {
|
|
59
|
-
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
60
|
-
reason: "registry-not-deployed",
|
|
61
|
-
product: "fheAirdrop",
|
|
62
|
-
contract: "airdropFactory",
|
|
63
|
-
chainId,
|
|
64
|
-
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
return void 0;
|
|
68
|
-
}
|
|
69
|
-
function useMemoAirdropFactoryClient(opts = {}) {
|
|
70
|
-
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
71
|
-
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
72
|
-
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
73
|
-
const resolvedAddress = tryResolveAirdropFactoryAddress(opts.address, chainId);
|
|
74
|
-
const resolutionError = computeAirdropFactoryResolutionError(opts.address, chainId);
|
|
75
|
-
const encryptorSourceRef = react.useRef(opts.encryptor);
|
|
76
|
-
encryptorSourceRef.current = opts.encryptor;
|
|
77
|
-
const telemetry = opts.telemetry;
|
|
78
|
-
const client = react.useMemo(() => {
|
|
79
|
-
if (!publicClient) return void 0;
|
|
80
|
-
if (!resolvedAddress) return void 0;
|
|
81
|
-
return chunkPUX5VXDB_cjs.createConfidentialAirdropFactoryClient({
|
|
82
|
-
publicClient,
|
|
83
|
-
...walletClient ? { walletClient } : {},
|
|
84
|
-
address: resolvedAddress,
|
|
85
|
-
...chainId !== void 0 ? { chainId } : {},
|
|
86
|
-
// Lazy — invoked per-encryption inside the headless client.
|
|
87
|
-
encryptor: () => chunkPUX5VXDB_cjs.resolveEncryptor(encryptorSourceRef.current),
|
|
88
|
-
...telemetry ? { telemetry } : {}
|
|
89
|
-
});
|
|
90
|
-
}, [publicClient, walletClient, resolvedAddress, chainId, telemetry]);
|
|
91
|
-
return {
|
|
92
|
-
client,
|
|
93
|
-
resolutionError,
|
|
94
|
-
publicClient,
|
|
95
|
-
walletClient: walletClient ?? void 0,
|
|
96
|
-
chainId,
|
|
97
|
-
resolvedAddress
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
function useMemoAirdropBaseClient(opts) {
|
|
101
|
-
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
102
|
-
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
103
|
-
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
104
|
-
const telemetry = opts.telemetry;
|
|
105
|
-
const client = react.useMemo(() => {
|
|
106
|
-
if (!publicClient) return void 0;
|
|
107
|
-
if (!opts.address) return void 0;
|
|
108
|
-
return chunkPUX5VXDB_cjs.createAirdropBaseClient({
|
|
109
|
-
publicClient,
|
|
110
|
-
...walletClient ? { walletClient } : {},
|
|
111
|
-
address: opts.address,
|
|
112
|
-
...chainId !== void 0 ? { chainId } : {},
|
|
113
|
-
...telemetry ? { telemetry } : {}
|
|
114
|
-
});
|
|
115
|
-
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
116
|
-
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
117
|
-
}
|
|
118
|
-
function useMemoMerkleAirdropClient(opts) {
|
|
119
|
-
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
120
|
-
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
121
|
-
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
122
|
-
const telemetry = opts.telemetry;
|
|
123
|
-
const client = react.useMemo(() => {
|
|
124
|
-
if (!publicClient) return void 0;
|
|
125
|
-
if (!opts.address) return void 0;
|
|
126
|
-
return chunkPUX5VXDB_cjs.createMerkleAirdropClient({
|
|
127
|
-
publicClient,
|
|
128
|
-
...walletClient ? { walletClient } : {},
|
|
129
|
-
address: opts.address,
|
|
130
|
-
...chainId !== void 0 ? { chainId } : {},
|
|
131
|
-
...telemetry ? { telemetry } : {}
|
|
132
|
-
});
|
|
133
|
-
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
134
|
-
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
135
|
-
}
|
|
136
|
-
function useMemoEcdsaAirdropClient(opts) {
|
|
137
|
-
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
138
|
-
const { data: walletClient } = wagmi.useWalletClient({ chainId: opts.chainId });
|
|
139
|
-
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
140
|
-
const telemetry = opts.telemetry;
|
|
141
|
-
const client = react.useMemo(() => {
|
|
142
|
-
if (!publicClient) return void 0;
|
|
143
|
-
if (!opts.address) return void 0;
|
|
144
|
-
return chunkPUX5VXDB_cjs.createEcdsaAirdropClient({
|
|
145
|
-
publicClient,
|
|
146
|
-
...walletClient ? { walletClient } : {},
|
|
147
|
-
address: opts.address,
|
|
148
|
-
dedupMode: opts.dedupMode,
|
|
149
|
-
...chainId !== void 0 ? { chainId } : {},
|
|
150
|
-
...telemetry ? { telemetry } : {}
|
|
151
|
-
});
|
|
152
|
-
}, [publicClient, walletClient, opts.address, opts.dedupMode, chainId, telemetry]);
|
|
153
|
-
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
exports.airdropQueryKey = airdropQueryKey;
|
|
157
|
-
exports.airdropQueryKeyPrefix = airdropQueryKeyPrefix;
|
|
158
|
-
exports.useMemoAirdropBaseClient = useMemoAirdropBaseClient;
|
|
159
|
-
exports.useMemoAirdropFactoryClient = useMemoAirdropFactoryClient;
|
|
160
|
-
exports.useMemoEcdsaAirdropClient = useMemoEcdsaAirdropClient;
|
|
161
|
-
exports.useMemoMerkleAirdropClient = useMemoMerkleAirdropClient;
|
package/dist/chunk-VP2B4WM2.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { createConfidentialAirdropFactoryClient, resolveEncryptor, createAirdropBaseClient, createMerkleAirdropClient, createEcdsaAirdropClient } from './chunk-GKKDAW44.js';
|
|
2
|
-
import { getFheAirdropFactoryAddress } from './chunk-DZHYSUGY.js';
|
|
3
|
-
import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
|
|
4
|
-
import { useRef, useMemo } from 'react';
|
|
5
|
-
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
6
|
-
|
|
7
|
-
var FHE_AIRDROP_KEY = "tokenops-sdk";
|
|
8
|
-
var FHE_AIRDROP_NAMESPACE = "fhe-airdrop";
|
|
9
|
-
function airdropQueryKey(params) {
|
|
10
|
-
return [
|
|
11
|
-
FHE_AIRDROP_KEY,
|
|
12
|
-
FHE_AIRDROP_NAMESPACE,
|
|
13
|
-
params.chainId ?? null,
|
|
14
|
-
params.address ? normalizeKeyArg(params.address) : null,
|
|
15
|
-
params.fn,
|
|
16
|
-
params.args.map(normalizeKeyArg)
|
|
17
|
-
];
|
|
18
|
-
}
|
|
19
|
-
function airdropQueryKeyPrefix(params) {
|
|
20
|
-
const prefix = [
|
|
21
|
-
FHE_AIRDROP_KEY,
|
|
22
|
-
FHE_AIRDROP_NAMESPACE,
|
|
23
|
-
params.chainId ?? null,
|
|
24
|
-
params.address ? normalizeKeyArg(params.address) : null
|
|
25
|
-
];
|
|
26
|
-
if (params.fn !== void 0) prefix.push(params.fn);
|
|
27
|
-
return prefix;
|
|
28
|
-
}
|
|
29
|
-
function normalizeKeyArg(value) {
|
|
30
|
-
if (typeof value === "bigint") return value.toString();
|
|
31
|
-
if (Array.isArray(value)) return value.map(normalizeKeyArg);
|
|
32
|
-
if (value && typeof value === "object") {
|
|
33
|
-
return Object.fromEntries(
|
|
34
|
-
Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
|
|
38
|
-
return value;
|
|
39
|
-
}
|
|
40
|
-
function tryResolveAirdropFactoryAddress(override, chainId) {
|
|
41
|
-
if (override) return override;
|
|
42
|
-
if (chainId === void 0) return void 0;
|
|
43
|
-
return getFheAirdropFactoryAddress(chainId);
|
|
44
|
-
}
|
|
45
|
-
function computeAirdropFactoryResolutionError(override, chainId) {
|
|
46
|
-
if (override) return void 0;
|
|
47
|
-
if (chainId === void 0) {
|
|
48
|
-
return new DeploymentAddressUnavailableError({
|
|
49
|
-
reason: "chain-id-missing",
|
|
50
|
-
product: "fheAirdrop",
|
|
51
|
-
contract: "airdropFactory",
|
|
52
|
-
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
const resolved = getFheAirdropFactoryAddress(chainId);
|
|
56
|
-
if (!resolved) {
|
|
57
|
-
return new DeploymentAddressUnavailableError({
|
|
58
|
-
reason: "registry-not-deployed",
|
|
59
|
-
product: "fheAirdrop",
|
|
60
|
-
contract: "airdropFactory",
|
|
61
|
-
chainId,
|
|
62
|
-
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
return void 0;
|
|
66
|
-
}
|
|
67
|
-
function useMemoAirdropFactoryClient(opts = {}) {
|
|
68
|
-
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
69
|
-
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
70
|
-
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
71
|
-
const resolvedAddress = tryResolveAirdropFactoryAddress(opts.address, chainId);
|
|
72
|
-
const resolutionError = computeAirdropFactoryResolutionError(opts.address, chainId);
|
|
73
|
-
const encryptorSourceRef = useRef(opts.encryptor);
|
|
74
|
-
encryptorSourceRef.current = opts.encryptor;
|
|
75
|
-
const telemetry = opts.telemetry;
|
|
76
|
-
const client = useMemo(() => {
|
|
77
|
-
if (!publicClient) return void 0;
|
|
78
|
-
if (!resolvedAddress) return void 0;
|
|
79
|
-
return createConfidentialAirdropFactoryClient({
|
|
80
|
-
publicClient,
|
|
81
|
-
...walletClient ? { walletClient } : {},
|
|
82
|
-
address: resolvedAddress,
|
|
83
|
-
...chainId !== void 0 ? { chainId } : {},
|
|
84
|
-
// Lazy — invoked per-encryption inside the headless client.
|
|
85
|
-
encryptor: () => resolveEncryptor(encryptorSourceRef.current),
|
|
86
|
-
...telemetry ? { telemetry } : {}
|
|
87
|
-
});
|
|
88
|
-
}, [publicClient, walletClient, resolvedAddress, chainId, telemetry]);
|
|
89
|
-
return {
|
|
90
|
-
client,
|
|
91
|
-
resolutionError,
|
|
92
|
-
publicClient,
|
|
93
|
-
walletClient: walletClient ?? void 0,
|
|
94
|
-
chainId,
|
|
95
|
-
resolvedAddress
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
function useMemoAirdropBaseClient(opts) {
|
|
99
|
-
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
100
|
-
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
101
|
-
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
102
|
-
const telemetry = opts.telemetry;
|
|
103
|
-
const client = useMemo(() => {
|
|
104
|
-
if (!publicClient) return void 0;
|
|
105
|
-
if (!opts.address) return void 0;
|
|
106
|
-
return createAirdropBaseClient({
|
|
107
|
-
publicClient,
|
|
108
|
-
...walletClient ? { walletClient } : {},
|
|
109
|
-
address: opts.address,
|
|
110
|
-
...chainId !== void 0 ? { chainId } : {},
|
|
111
|
-
...telemetry ? { telemetry } : {}
|
|
112
|
-
});
|
|
113
|
-
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
114
|
-
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
115
|
-
}
|
|
116
|
-
function useMemoMerkleAirdropClient(opts) {
|
|
117
|
-
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
118
|
-
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
119
|
-
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
120
|
-
const telemetry = opts.telemetry;
|
|
121
|
-
const client = useMemo(() => {
|
|
122
|
-
if (!publicClient) return void 0;
|
|
123
|
-
if (!opts.address) return void 0;
|
|
124
|
-
return createMerkleAirdropClient({
|
|
125
|
-
publicClient,
|
|
126
|
-
...walletClient ? { walletClient } : {},
|
|
127
|
-
address: opts.address,
|
|
128
|
-
...chainId !== void 0 ? { chainId } : {},
|
|
129
|
-
...telemetry ? { telemetry } : {}
|
|
130
|
-
});
|
|
131
|
-
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
132
|
-
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
133
|
-
}
|
|
134
|
-
function useMemoEcdsaAirdropClient(opts) {
|
|
135
|
-
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
136
|
-
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
137
|
-
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
138
|
-
const telemetry = opts.telemetry;
|
|
139
|
-
const client = useMemo(() => {
|
|
140
|
-
if (!publicClient) return void 0;
|
|
141
|
-
if (!opts.address) return void 0;
|
|
142
|
-
return createEcdsaAirdropClient({
|
|
143
|
-
publicClient,
|
|
144
|
-
...walletClient ? { walletClient } : {},
|
|
145
|
-
address: opts.address,
|
|
146
|
-
dedupMode: opts.dedupMode,
|
|
147
|
-
...chainId !== void 0 ? { chainId } : {},
|
|
148
|
-
...telemetry ? { telemetry } : {}
|
|
149
|
-
});
|
|
150
|
-
}, [publicClient, walletClient, opts.address, opts.dedupMode, chainId, telemetry]);
|
|
151
|
-
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export { airdropQueryKey, airdropQueryKeyPrefix, useMemoAirdropBaseClient, useMemoAirdropFactoryClient, useMemoEcdsaAirdropClient, useMemoMerkleAirdropClient };
|