@tokenops/sdk 1.6.0 → 2.0.0-alpha.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.
- package/CHANGELOG.md +48 -8
- package/CONTRIBUTING.md +4 -2
- package/README.md +146 -90
- package/SUPPORT.md +47 -0
- package/dist/{chunk-HETNKZEE.js → chunk-335Z2W67.js} +1 -1
- package/dist/{chunk-BD4LZBVF.cjs → chunk-3QHNYEQD.cjs} +18 -17
- package/dist/chunk-456VDDA3.js +370 -0
- package/dist/{chunk-6WSNS3UV.js → chunk-4RAAATVY.js} +2 -4
- package/dist/{chunk-4KJ66YRH.js → chunk-4TSDNZQ3.js} +2 -2
- package/dist/{chunk-WUXUWTFW.cjs → chunk-5576FRT3.cjs} +31 -7
- package/dist/chunk-66IHPTOK.cjs +20 -0
- package/dist/{chunk-2RNW4MIJ.cjs → chunk-67OV5CX2.cjs} +0 -18
- package/dist/{chunk-PD7ME2BT.js → chunk-6GNR22OV.js} +2 -1
- package/dist/{chunk-VHSNYUYV.js → chunk-6NAVMWZQ.js} +5 -5
- package/dist/{chunk-EUKPOXWR.cjs → chunk-6PXXGACR.cjs} +17 -15
- package/dist/{chunk-WTK6JDSI.js → chunk-74QFZ5MK.js} +6 -4
- package/dist/{chunk-WOEETTH7.cjs → chunk-7AFPOE7N.cjs} +6 -6
- package/dist/{chunk-U57COLUE.js → chunk-AXIPOR3C.js} +2 -2
- package/dist/chunk-CTED3MTR.cjs +380 -0
- package/dist/{chunk-QKKBBH7I.js → chunk-DZHYSUGY.js} +28 -7
- package/dist/{chunk-V5D7BHW3.js → chunk-EAJ7SYHE.js} +6 -4
- package/dist/{chunk-SYHNZSZZ.cjs → chunk-FAXIIH5R.cjs} +3 -3
- package/dist/{chunk-7G7UOQV4.cjs → chunk-FGEB7RMY.cjs} +4 -4
- package/dist/chunk-GKKDAW44.js +8823 -0
- package/dist/{chunk-QET3Q4JP.js → chunk-H5POPGOZ.js} +8 -6
- package/dist/{chunk-VR3FREBX.cjs → chunk-JK4XMMKM.cjs} +3 -3
- package/dist/{chunk-CBRL2PJA.cjs → chunk-JQYC66TO.cjs} +12 -12
- package/dist/{chunk-YFIWCYHC.cjs → chunk-JZLGCTGK.cjs} +56 -54
- package/dist/{chunk-4ZCXK4VI.cjs → chunk-KFRDLKMA.cjs} +14 -14
- package/dist/chunk-KWFFIJYX.js +11 -0
- package/dist/chunk-M4IT6DNJ.cjs +608 -0
- package/dist/{chunk-43RFBQ73.cjs → chunk-MVDQMV25.cjs} +29 -32
- package/dist/chunk-NCVX3K2N.cjs +161 -0
- package/dist/chunk-NWFMBLSQ.js +4 -0
- package/dist/chunk-O5676ZWY.js +585 -0
- package/dist/chunk-PUX5VXDB.cjs +8845 -0
- package/dist/{chunk-DRSPMIZ7.js → chunk-QBJ7O2B4.js} +1 -11
- package/dist/{chunk-UJS4N2XM.cjs → chunk-TEBM66WA.cjs} +12 -12
- package/dist/{chunk-TN65XNTI.js → chunk-TWT3STIX.js} +8 -6
- package/dist/chunk-UG5RKLU2.cjs +6 -0
- package/dist/chunk-VP2B4WM2.js +154 -0
- package/dist/{chunk-BK7YIVLK.cjs → chunk-WJLECC22.cjs} +75 -73
- package/dist/{chunk-NFW7AUEX.js → chunk-WMACINXO.js} +1 -1
- package/dist/{chunk-AYGRYDBX.cjs → chunk-XAYGD4E4.cjs} +37 -35
- package/dist/{chunk-46T67CE2.js → chunk-ZA673I3O.js} +1 -1
- package/dist/{chunk-YPYCWLYP.js → chunk-ZWXJTBZO.js} +1 -1
- package/dist/core/addresses.d.ts +14 -2
- package/dist/core/brands.d.ts +8 -2
- package/dist/core/errors.d.ts +71 -10
- package/dist/core/preflight.d.ts +1 -0
- package/dist/fhe/erc7984-abi.d.ts +1 -0
- package/dist/fhe/index.cjs +64 -63
- package/dist/fhe/index.js +7 -6
- package/dist/fhe/operators.d.ts +22 -5
- package/dist/fhe/react/index.cjs +13 -12
- package/dist/fhe/react/index.js +6 -5
- package/dist/fhe/types.d.ts +6 -0
- package/dist/fhe-airdrop/abis/{cloneable.d.ts → airdrop-base.d.ts} +254 -396
- package/dist/fhe-airdrop/abis/compliance.d.ts +422 -0
- package/dist/fhe-airdrop/abis/ecdsa.d.ts +1316 -0
- package/dist/fhe-airdrop/abis/factory.d.ts +1319 -190
- package/dist/fhe-airdrop/abis/index.d.ts +5 -2
- package/dist/fhe-airdrop/abis/merkle.d.ts +1238 -0
- package/dist/fhe-airdrop/advanced/index.cjs +11 -12
- package/dist/fhe-airdrop/advanced/index.d.cts +34 -11
- package/dist/fhe-airdrop/advanced/index.d.ts +34 -11
- package/dist/fhe-airdrop/advanced/index.js +3 -8
- package/dist/fhe-airdrop/advanced/react/index.cjs +37 -50
- package/dist/fhe-airdrop/advanced/react/index.d.cts +9 -3
- package/dist/fhe-airdrop/advanced/react/index.d.ts +9 -3
- package/dist/fhe-airdrop/advanced/react/index.js +36 -50
- package/dist/fhe-airdrop/advanced/react/usePredictEcdsaAirdropAddress.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/usePredictMerkleAirdropAddress.d.ts +27 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +600 -0
- package/dist/fhe-airdrop/campaign.d.ts +297 -0
- package/dist/fhe-airdrop/compliance.d.ts +302 -0
- package/dist/fhe-airdrop/constants.d.ts +33 -0
- package/dist/fhe-airdrop/ecdsa.d.ts +263 -0
- package/dist/fhe-airdrop/encryption.d.ts +92 -14
- package/dist/fhe-airdrop/errors.d.ts +245 -15
- package/dist/fhe-airdrop/factory.d.ts +533 -274
- package/dist/fhe-airdrop/guards.d.ts +273 -0
- package/dist/fhe-airdrop/index.cjs +1131 -74
- package/dist/fhe-airdrop/index.d.cts +46 -8
- package/dist/fhe-airdrop/index.d.ts +46 -8
- package/dist/fhe-airdrop/index.js +931 -8
- package/dist/fhe-airdrop/merkle-tree.d.ts +103 -0
- package/dist/fhe-airdrop/merkle.d.ts +180 -0
- package/dist/fhe-airdrop/react/_shared.d.ts +144 -71
- package/dist/fhe-airdrop/react/index.cjs +399 -459
- package/dist/fhe-airdrop/react/index.d.cts +53 -74
- package/dist/fhe-airdrop/react/index.d.ts +53 -74
- package/dist/fhe-airdrop/react/index.js +261 -374
- package/dist/fhe-airdrop/react/useAirdropGasFee.d.ts +10 -5
- package/dist/fhe-airdrop/react/useAirdropHasRole.d.ts +15 -6
- package/dist/fhe-airdrop/react/useAirdropPause.d.ts +30 -0
- package/dist/fhe-airdrop/react/useAirdropPaused.d.ts +17 -0
- package/dist/fhe-airdrop/react/useAirdropToken.d.ts +11 -4
- package/dist/fhe-airdrop/react/useAirdropWindow.d.ts +37 -0
- package/dist/fhe-airdrop/react/useClaimedAmount.d.ts +29 -0
- package/dist/fhe-airdrop/react/useComplianceManager.d.ts +16 -0
- package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +28 -0
- package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +25 -0
- package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +23 -0
- package/dist/fhe-airdrop/react/useEffectiveUpgradeable.d.ts +20 -0
- package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +17 -12
- package/dist/fhe-airdrop/react/useFactoryFees.d.ts +28 -0
- package/dist/fhe-airdrop/react/useFactoryRegistry.d.ts +35 -0
- package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +35 -0
- package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +35 -0
- package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +34 -0
- package/dist/fhe-airdrop/react/useMerkleRoot.d.ts +15 -0
- package/dist/fhe-airdrop/react/useSetMerkleRoot.d.ts +22 -0
- package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +23 -0
- package/dist/fhe-airdrop/roles.d.ts +147 -0
- package/dist/fhe-airdrop/types.d.ts +67 -65
- package/dist/fhe-disperse/index.cjs +70 -68
- package/dist/fhe-disperse/index.js +10 -8
- package/dist/fhe-disperse/react/index.cjs +94 -92
- package/dist/fhe-disperse/react/index.js +13 -11
- package/dist/fhe-vesting/advanced/index.cjs +10 -8
- package/dist/fhe-vesting/advanced/index.js +8 -6
- package/dist/fhe-vesting/advanced/react/index.cjs +16 -14
- package/dist/fhe-vesting/advanced/react/index.js +13 -11
- package/dist/fhe-vesting/index.cjs +74 -72
- package/dist/fhe-vesting/index.js +11 -9
- package/dist/fhe-vesting/react/index.cjs +228 -226
- package/dist/fhe-vesting/react/index.js +15 -13
- package/dist/index.cjs +100 -87
- package/dist/index.js +3 -2
- package/dist/testnet-faucet/index.cjs +57 -55
- package/dist/testnet-faucet/index.js +7 -5
- package/dist/testnet-faucet/react/index.cjs +55 -53
- package/dist/testnet-faucet/react/index.js +9 -7
- package/package.json +6 -2
- package/dist/chunk-CNP4L3GF.js +0 -105
- package/dist/chunk-KSDSXJ34.js +0 -41
- package/dist/chunk-LBWRFZR3.cjs +0 -1681
- package/dist/chunk-OL6SHN3D.cjs +0 -44
- package/dist/chunk-S2XD75JM.js +0 -1637
- package/dist/chunk-SPGSO5SO.cjs +0 -1644
- package/dist/chunk-UE5XK2SY.js +0 -1673
- package/dist/chunk-WO72UBQD.cjs +0 -109
- package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +0 -53
- package/dist/fhe-airdrop/advanced/react/usePredictAirdropAddress.d.ts +0 -49
- package/dist/fhe-airdrop/airdrop.d.ts +0 -317
- package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +0 -37
- package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropClaimTypehash.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropClaimedSignatures.d.ts +0 -16
- package/dist/fhe-airdrop/react/useAirdropDeploymentBlockNumber.d.ts +0 -6
- package/dist/fhe-airdrop/react/useAirdropDomainSeparator.d.ts +0 -8
- package/dist/fhe-airdrop/react/useAirdropEndTime.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropFactoryCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactoryDefaultGasFee.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropFactoryDisableCustomFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropFactoryFeeCollector.d.ts +0 -11
- package/dist/fhe-airdrop/react/useAirdropFactoryInitCodeHash.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactorySetCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactorySetDefaultGasFee.d.ts +0 -16
- package/dist/fhe-airdrop/react/useAirdropFactorySetFeeCollector.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +0 -16
- package/dist/fhe-airdrop/react/useAirdropHasClaimEnded.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropHasClaimStarted.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropIsClaimWindowActive.d.ts +0 -9
- package/dist/fhe-airdrop/react/useAirdropIsPaused.d.ts +0 -8
- package/dist/fhe-airdrop/react/useAirdropIsSignatureClaimed.d.ts +0 -22
- package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +0 -51
- package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropStartTime.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropWithdrawGasFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropWithdrawOtherConfidentialToken.d.ts +0 -14
- package/dist/fhe-airdrop/react/useAirdropWithdrawOtherToken.d.ts +0 -14
- package/dist/fhe-airdrop/react/useClaim.d.ts +0 -39
- package/dist/fhe-airdrop/react/useConfidentialAirdropFactoryImplementation.d.ts +0 -11
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +0 -41
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +0 -48
- package/dist/fhe-airdrop/react/useCreateConfidentialAirdrop.d.ts +0 -29
- package/dist/fhe-airdrop/react/useCreateConfidentialAirdropAndGetAddress.d.ts +0 -31
- package/dist/fhe-airdrop/react/useDisableCustomFee.d.ts +0 -14
- package/dist/fhe-airdrop/react/useFactoryCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useFactoryDefaultGasFee.d.ts +0 -10
- package/dist/fhe-airdrop/react/useFactoryFeeCollector.d.ts +0 -11
- package/dist/fhe-airdrop/react/useFactoryInitCodeHash.d.ts +0 -17
- package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +0 -33
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +0 -51
- package/dist/fhe-airdrop/react/useSetCustomFee.d.ts +0 -16
- package/dist/fhe-airdrop/react/useSetDefaultGasFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useSetFeeCollector.d.ts +0 -14
- package/dist/fhe-airdrop/react/useSetPaused.d.ts +0 -14
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +0 -31
- package/dist/fhe-airdrop/react/useWithdraw.d.ts +0 -12
- package/dist/fhe-airdrop/react/useWithdrawOtherConfidentialToken.d.ts +0 -13
- package/dist/fhe-airdrop/react/useWithdrawOtherToken.d.ts +0 -13
|
@@ -1,457 +1,344 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
10
|
-
import '../../chunk-
|
|
11
|
-
import '../../chunk-
|
|
12
|
-
import '../../chunk-
|
|
13
|
-
import { MissingClientError
|
|
14
|
-
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, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-
|
|
1
|
+
import { grantInstanceRoles } from '../../chunk-456VDDA3.js';
|
|
2
|
+
export { buildMerkleCampaign, buildMerkleTree, encryptCampaignAmounts, grantInstanceRoles, leafOf, planInstanceRoleSplit, planMerkleCampaign, rotateMerkleRoot, validateCampaignRecipients } from '../../chunk-456VDDA3.js';
|
|
3
|
+
import { useMemoAirdropBaseClient, airdropQueryKey, useMemoMerkleAirdropClient, useMemoAirdropFactoryClient, airdropQueryKeyPrefix, useMemoEcdsaAirdropClient } from '../../chunk-VP2B4WM2.js';
|
|
4
|
+
export { airdropQueryKey, airdropQueryKeyPrefix } from '../../chunk-VP2B4WM2.js';
|
|
5
|
+
export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-GKKDAW44.js';
|
|
6
|
+
export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, DedupIdConsumedError, FeeCollectorSelfAdministeredError, MerkleUupsUnsupportedError, NonStockWrapperError, PredictionDriftError, SaltCollisionError, SignatureExpiredError, UpgradeabilityNotAllowedError, preflightClaim, preflightCreate } from '../../chunk-O5676ZWY.js';
|
|
7
|
+
import '../../chunk-ZWXJTBZO.js';
|
|
8
|
+
import '../../chunk-NWFMBLSQ.js';
|
|
9
|
+
import '../../chunk-4RAAATVY.js';
|
|
10
|
+
import '../../chunk-DZHYSUGY.js';
|
|
11
|
+
import '../../chunk-ZA673I3O.js';
|
|
12
|
+
import '../../chunk-KWFFIJYX.js';
|
|
13
|
+
import { MissingClientError } from '../../chunk-QBJ7O2B4.js';
|
|
14
|
+
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, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-QBJ7O2B4.js';
|
|
15
15
|
import '../../chunk-Q2GP5UDC.js';
|
|
16
|
-
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
17
|
-
import { useWalletClient } from 'wagmi';
|
|
16
|
+
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
18
17
|
|
|
19
|
-
function
|
|
20
|
-
const { client, chainId
|
|
18
|
+
function useAirdropToken(args) {
|
|
19
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
21
20
|
return useQuery({
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
...args.query,
|
|
22
|
+
queryKey: airdropQueryKey({ chainId, address: args.address, fn: "token", args: [] }),
|
|
23
|
+
queryFn: () => client.token(),
|
|
24
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
26
25
|
});
|
|
27
26
|
}
|
|
28
|
-
function
|
|
29
|
-
const { client, chainId
|
|
27
|
+
function useAirdropWindow(args) {
|
|
28
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
29
|
+
return useQuery({
|
|
30
|
+
...args.query,
|
|
31
|
+
queryKey: airdropQueryKey({ chainId, address: args.address, fn: "window", args: [] }),
|
|
32
|
+
queryFn: async () => {
|
|
33
|
+
const [startTime, endTime, hasStarted, hasEnded, isActive] = await Promise.all([
|
|
34
|
+
client.startTime(),
|
|
35
|
+
client.endTime(),
|
|
36
|
+
client.hasClaimStarted(),
|
|
37
|
+
client.hasClaimEnded(),
|
|
38
|
+
client.isClaimWindowActive()
|
|
39
|
+
]);
|
|
40
|
+
return { startTime, endTime, hasStarted, hasEnded, isActive };
|
|
41
|
+
},
|
|
42
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function useAirdropPaused(args) {
|
|
46
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
30
47
|
return useQuery({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
...args.query,
|
|
49
|
+
queryKey: airdropQueryKey({ chainId, address: args.address, fn: "paused", args: [] }),
|
|
50
|
+
queryFn: () => client.paused(),
|
|
51
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
35
52
|
});
|
|
36
53
|
}
|
|
37
|
-
function
|
|
38
|
-
const { client, chainId
|
|
54
|
+
function useAirdropGasFee(args) {
|
|
55
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
39
56
|
return useQuery({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
57
|
+
...args.query,
|
|
58
|
+
queryKey: airdropQueryKey({ chainId, address: args.address, fn: "gasFee", args: [] }),
|
|
59
|
+
queryFn: () => client.gasFee(),
|
|
60
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
44
61
|
});
|
|
45
62
|
}
|
|
46
|
-
function
|
|
47
|
-
const {
|
|
48
|
-
const { client, chainId
|
|
63
|
+
function useAirdropHasRole(args) {
|
|
64
|
+
const { role, holder, ...base } = args;
|
|
65
|
+
const { client, chainId } = useMemoAirdropBaseClient(base);
|
|
49
66
|
return useQuery({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
67
|
+
...args.query,
|
|
68
|
+
queryKey: airdropQueryKey({
|
|
69
|
+
chainId,
|
|
70
|
+
address: args.address,
|
|
71
|
+
fn: "hasRole",
|
|
72
|
+
args: [role, holder]
|
|
73
|
+
}),
|
|
74
|
+
queryFn: () => client.hasRole({ role, holder }),
|
|
75
|
+
enabled: Boolean(client && role && holder && (args.query?.enabled ?? true))
|
|
54
76
|
});
|
|
55
77
|
}
|
|
56
|
-
function
|
|
57
|
-
const {
|
|
58
|
-
const { client, chainId, resolvedAddress } = useMemoFactoryClient(base);
|
|
78
|
+
function useMerkleRoot(args) {
|
|
79
|
+
const { client, chainId } = useMemoMerkleAirdropClient(args);
|
|
59
80
|
return useQuery({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
...args.query,
|
|
82
|
+
queryKey: airdropQueryKey({ chainId, address: args.address, fn: "merkleRoot", args: [] }),
|
|
83
|
+
queryFn: () => client.merkleRoot(),
|
|
84
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
64
85
|
});
|
|
65
86
|
}
|
|
66
|
-
function
|
|
67
|
-
const {
|
|
68
|
-
const { client, chainId
|
|
87
|
+
function useClaimedAmount(args) {
|
|
88
|
+
const { account, ...base } = args;
|
|
89
|
+
const { client, chainId } = useMemoMerkleAirdropClient(base);
|
|
69
90
|
return useQuery({
|
|
70
|
-
|
|
71
|
-
|
|
91
|
+
...args.query,
|
|
92
|
+
queryKey: airdropQueryKey({
|
|
72
93
|
chainId,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
userSalt,
|
|
77
|
-
funding
|
|
78
|
-
),
|
|
79
|
-
queryFn: () => client.preflightCreateAirdrop({
|
|
80
|
-
params,
|
|
81
|
-
creator,
|
|
82
|
-
...userSalt !== void 0 ? { userSalt } : {},
|
|
83
|
-
...funding !== void 0 ? { funding } : {}
|
|
94
|
+
address: args.address,
|
|
95
|
+
fn: "getClaimedAmount",
|
|
96
|
+
args: [account]
|
|
84
97
|
}),
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
queryFn: () => client.getClaimedAmount(account),
|
|
99
|
+
enabled: Boolean(client && account && (args.query?.enabled ?? true))
|
|
87
100
|
});
|
|
88
101
|
}
|
|
89
|
-
function
|
|
90
|
-
const { client,
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
function useComplianceManager(args) {
|
|
103
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
104
|
+
return useQuery({
|
|
105
|
+
...args.query,
|
|
106
|
+
queryKey: airdropQueryKey({
|
|
107
|
+
chainId,
|
|
108
|
+
address: args.address,
|
|
109
|
+
fn: "complianceManager",
|
|
110
|
+
args: []
|
|
111
|
+
}),
|
|
112
|
+
queryFn: () => client.complianceManager(),
|
|
113
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function useFactoryFees(args = {}) {
|
|
117
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
|
|
118
|
+
return useQuery({
|
|
119
|
+
...args.query,
|
|
120
|
+
queryKey: airdropQueryKey({ chainId, address: resolvedAddress, fn: "fees", args: [] }),
|
|
121
|
+
queryFn: async () => {
|
|
122
|
+
const [feeCollector, defaultGasFee] = await Promise.all([
|
|
123
|
+
client.feeCollector(),
|
|
124
|
+
client.defaultGasFee()
|
|
125
|
+
]);
|
|
126
|
+
return { feeCollector, defaultGasFee };
|
|
127
|
+
},
|
|
128
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function useFactoryRegistry(args = {}) {
|
|
132
|
+
const { offset = 0n, limit = 50n, ...base } = args;
|
|
133
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
134
|
+
return useQuery({
|
|
135
|
+
...args.query,
|
|
136
|
+
queryKey: airdropQueryKey({
|
|
137
|
+
chainId,
|
|
138
|
+
address: resolvedAddress,
|
|
139
|
+
fn: "registry",
|
|
140
|
+
args: [offset, limit]
|
|
141
|
+
}),
|
|
142
|
+
queryFn: async () => {
|
|
143
|
+
const [count, items] = await Promise.all([
|
|
144
|
+
client.airdropCount(),
|
|
145
|
+
client.airdrops(offset, limit)
|
|
146
|
+
]);
|
|
147
|
+
return { count, items };
|
|
148
|
+
},
|
|
149
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function useEffectiveUpgradeable(args = {}) {
|
|
153
|
+
const { creator, ...base } = args;
|
|
154
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
155
|
+
return useQuery({
|
|
156
|
+
...args.query,
|
|
157
|
+
queryKey: airdropQueryKey({
|
|
158
|
+
chainId,
|
|
159
|
+
address: resolvedAddress,
|
|
160
|
+
fn: "effectiveUpgradeable",
|
|
161
|
+
args: [creator]
|
|
162
|
+
}),
|
|
163
|
+
queryFn: () => client.effectiveUpgradeable(creator),
|
|
164
|
+
enabled: Boolean(client && creator && (args.query?.enabled ?? true))
|
|
98
165
|
});
|
|
99
166
|
}
|
|
100
|
-
function
|
|
101
|
-
const { client, resolutionError } =
|
|
167
|
+
function useCreateEcdsaAirdrop(options = {}) {
|
|
168
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
169
|
+
const queryClient = useQueryClient();
|
|
102
170
|
return useMutation({
|
|
103
171
|
mutationFn: async (args) => {
|
|
104
172
|
if (!client) {
|
|
105
|
-
throw resolutionError ?? new MissingClientError("
|
|
173
|
+
throw resolutionError ?? new MissingClientError("useCreateEcdsaAirdrop", "factory");
|
|
106
174
|
}
|
|
107
|
-
return client.
|
|
175
|
+
return client.createEcdsaAirdrop(args);
|
|
176
|
+
},
|
|
177
|
+
onSuccess: () => {
|
|
178
|
+
void queryClient.invalidateQueries({
|
|
179
|
+
queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
|
|
180
|
+
});
|
|
108
181
|
}
|
|
109
182
|
});
|
|
110
183
|
}
|
|
111
|
-
function
|
|
112
|
-
const { client, resolutionError } =
|
|
184
|
+
function useCreateMerkleAirdrop(options = {}) {
|
|
185
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
186
|
+
const queryClient = useQueryClient();
|
|
113
187
|
return useMutation({
|
|
114
188
|
mutationFn: async (args) => {
|
|
115
189
|
if (!client) {
|
|
116
|
-
throw resolutionError ?? new MissingClientError("
|
|
190
|
+
throw resolutionError ?? new MissingClientError("useCreateMerkleAirdrop", "factory");
|
|
117
191
|
}
|
|
118
|
-
return client.
|
|
192
|
+
return client.createMerkleAirdrop(args);
|
|
193
|
+
},
|
|
194
|
+
onSuccess: () => {
|
|
195
|
+
void queryClient.invalidateQueries({
|
|
196
|
+
queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
|
|
197
|
+
});
|
|
119
198
|
}
|
|
120
199
|
});
|
|
121
200
|
}
|
|
122
|
-
function
|
|
123
|
-
const { client, resolutionError } =
|
|
201
|
+
function useFundAirdrop(options = {}) {
|
|
202
|
+
const { client, resolutionError } = useMemoAirdropFactoryClient(options);
|
|
124
203
|
return useMutation({
|
|
125
204
|
mutationFn: async (args) => {
|
|
126
205
|
if (!client) {
|
|
127
|
-
throw resolutionError ?? new MissingClientError("
|
|
206
|
+
throw resolutionError ?? new MissingClientError("useFundAirdrop", "factory");
|
|
128
207
|
}
|
|
129
|
-
return client.
|
|
208
|
+
return client.fundAirdrop(args);
|
|
130
209
|
}
|
|
131
210
|
});
|
|
132
211
|
}
|
|
133
|
-
function
|
|
134
|
-
const { client
|
|
212
|
+
function useEcdsaClaim(options) {
|
|
213
|
+
const { client } = useMemoEcdsaAirdropClient(options);
|
|
135
214
|
return useMutation({
|
|
136
215
|
mutationFn: async (args) => {
|
|
137
216
|
if (!client) {
|
|
138
|
-
throw
|
|
217
|
+
throw new MissingClientError("useEcdsaClaim", "ecdsa-airdrop");
|
|
139
218
|
}
|
|
140
|
-
return client.
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function useSetFeeCollector(options = {}) {
|
|
145
|
-
const { client, resolutionError } = useMemoFactoryClient(options);
|
|
146
|
-
return useMutation({
|
|
147
|
-
mutationFn: async ({ newFeeCollector, account }) => {
|
|
148
|
-
if (!client) throw resolutionError ?? new MissingClientError("useSetFeeCollector", "factory");
|
|
149
|
-
return client.setFeeCollector(newFeeCollector, account);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function useSetDefaultGasFee(options = {}) {
|
|
154
|
-
const { client, resolutionError } = useMemoFactoryClient(options);
|
|
155
|
-
return useMutation({
|
|
156
|
-
mutationFn: async ({ newGasFee, account }) => {
|
|
157
|
-
if (!client)
|
|
158
|
-
throw resolutionError ?? new MissingClientError("useSetDefaultGasFee", "factory");
|
|
159
|
-
return client.setDefaultGasFee(newGasFee, account);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
function useSetCustomFee(options = {}) {
|
|
164
|
-
const { client, resolutionError } = useMemoFactoryClient(options);
|
|
165
|
-
return useMutation({
|
|
166
|
-
mutationFn: async ({ campaignCreator, gasFee, account }) => {
|
|
167
|
-
if (!client) throw resolutionError ?? new MissingClientError("useSetCustomFee", "factory");
|
|
168
|
-
return client.setCustomFee(campaignCreator, gasFee, account);
|
|
219
|
+
return client.claim(args);
|
|
169
220
|
}
|
|
170
221
|
});
|
|
171
222
|
}
|
|
172
|
-
function
|
|
173
|
-
const { client,
|
|
174
|
-
|
|
175
|
-
mutationFn: async ({ campaignCreator, account }) => {
|
|
176
|
-
if (!client)
|
|
177
|
-
throw resolutionError ?? new MissingClientError("useDisableCustomFee", "factory");
|
|
178
|
-
return client.disableCustomFee(campaignCreator, account);
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
function useAirdropToken(options) {
|
|
183
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
184
|
-
return useQuery({
|
|
185
|
-
queryKey: buildQueryKey("airdrop:TOKEN", chainId, options.address),
|
|
186
|
-
queryFn: () => client.token(),
|
|
187
|
-
enabled: !!client,
|
|
188
|
-
staleTime: 0
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
function useAirdropGasFee(options) {
|
|
192
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
193
|
-
return useQuery({
|
|
194
|
-
queryKey: buildQueryKey("airdrop:GAS_FEE", chainId, options.address),
|
|
195
|
-
queryFn: () => client.gasFee(),
|
|
196
|
-
enabled: !!client,
|
|
197
|
-
staleTime: 0
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
function useAirdropStartTime(options) {
|
|
201
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
202
|
-
return useQuery({
|
|
203
|
-
queryKey: buildQueryKey("airdrop:START_TIME", chainId, options.address),
|
|
204
|
-
queryFn: () => client.startTime(),
|
|
205
|
-
enabled: !!client,
|
|
206
|
-
staleTime: 0
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
|
-
function useAirdropCanExtendClaimWindow(options) {
|
|
210
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
211
|
-
return useQuery({
|
|
212
|
-
queryKey: buildQueryKey("airdrop:CAN_EXTEND_CLAIM_WINDOW", chainId, options.address),
|
|
213
|
-
queryFn: () => client.canExtendClaimWindow(),
|
|
214
|
-
enabled: !!client,
|
|
215
|
-
staleTime: 0
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
function useAirdropEndTime(options) {
|
|
219
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
220
|
-
return useQuery({
|
|
221
|
-
queryKey: buildQueryKey("airdrop:endTime", chainId, options.address),
|
|
222
|
-
queryFn: () => client.endTime(),
|
|
223
|
-
enabled: !!client,
|
|
224
|
-
staleTime: 0
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
function useAirdropIsPaused(options) {
|
|
228
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
229
|
-
return useQuery({
|
|
230
|
-
queryKey: buildQueryKey("airdrop:isPaused", chainId, options.address),
|
|
231
|
-
queryFn: () => client.isPaused(),
|
|
232
|
-
enabled: !!client,
|
|
233
|
-
staleTime: 0
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
function useAirdropDeploymentBlockNumber(options) {
|
|
237
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
238
|
-
return useQuery({
|
|
239
|
-
queryKey: buildQueryKey("airdrop:deploymentBlockNumber", chainId, options.address),
|
|
240
|
-
queryFn: () => client.deploymentBlockNumber(),
|
|
241
|
-
enabled: !!client,
|
|
242
|
-
staleTime: 0
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
function useAirdropDomainSeparator(options) {
|
|
246
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
247
|
-
return useQuery({
|
|
248
|
-
queryKey: buildQueryKey("airdrop:DOMAIN_SEPARATOR", chainId, options.address),
|
|
249
|
-
queryFn: () => client.domainSeparator(),
|
|
250
|
-
enabled: !!client,
|
|
251
|
-
staleTime: 0
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
function useAirdropClaimTypehash(options) {
|
|
255
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
256
|
-
return useQuery({
|
|
257
|
-
queryKey: buildQueryKey("airdrop:CLAIM_TYPEHASH", chainId, options.address),
|
|
258
|
-
queryFn: () => client.claimTypehash(),
|
|
259
|
-
enabled: !!client,
|
|
260
|
-
staleTime: 0
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
function useAirdropIsClaimWindowActive(options) {
|
|
264
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
265
|
-
return useQuery({
|
|
266
|
-
queryKey: buildQueryKey("airdrop:isClaimWindowActive", chainId, options.address),
|
|
267
|
-
queryFn: () => client.isClaimWindowActive(),
|
|
268
|
-
enabled: !!client,
|
|
269
|
-
staleTime: 0
|
|
270
|
-
});
|
|
271
|
-
}
|
|
272
|
-
function useAirdropHasClaimStarted(options) {
|
|
273
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
274
|
-
return useQuery({
|
|
275
|
-
queryKey: buildQueryKey("airdrop:hasClaimStarted", chainId, options.address),
|
|
276
|
-
queryFn: () => client.hasClaimStarted(),
|
|
277
|
-
enabled: !!client,
|
|
278
|
-
staleTime: 0
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
function useAirdropHasClaimEnded(options) {
|
|
282
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
283
|
-
return useQuery({
|
|
284
|
-
queryKey: buildQueryKey("airdrop:hasClaimEnded", chainId, options.address),
|
|
285
|
-
queryFn: () => client.hasClaimEnded(),
|
|
286
|
-
enabled: !!client,
|
|
287
|
-
staleTime: 0
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
function useAirdropClaimedSignatures(args) {
|
|
291
|
-
const { signatureHash, ...base } = args;
|
|
292
|
-
const { client, chainId } = useMemoAirdropClient(base);
|
|
293
|
-
return useQuery({
|
|
294
|
-
queryKey: buildQueryKey("airdrop:claimedSignatures", chainId, base.address, signatureHash),
|
|
295
|
-
queryFn: () => client.claimedSignatures(signatureHash),
|
|
296
|
-
enabled: !!client && !!signatureHash,
|
|
297
|
-
staleTime: 0
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
function useAirdropIsSignatureClaimed(args) {
|
|
301
|
-
const { user, encryptedAmountHandle, ...base } = args;
|
|
302
|
-
const { client, chainId } = useMemoAirdropClient(base);
|
|
303
|
-
return useQuery({
|
|
304
|
-
queryKey: buildQueryKey(
|
|
305
|
-
"airdrop:isSignatureClaimed",
|
|
306
|
-
chainId,
|
|
307
|
-
base.address,
|
|
308
|
-
user,
|
|
309
|
-
encryptedAmountHandle
|
|
310
|
-
),
|
|
311
|
-
queryFn: () => client.isSignatureClaimed(user, encryptedAmountHandle),
|
|
312
|
-
enabled: !!client && !!user && !!encryptedAmountHandle,
|
|
313
|
-
staleTime: 0
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
function useAirdropIsSignatureValid(args) {
|
|
317
|
-
const { encryptedAmountHandle, signature, caller, ...base } = args;
|
|
318
|
-
const { client, chainId } = useMemoAirdropClient(base);
|
|
319
|
-
const { address: connectedAddress } = useWagmiAccount();
|
|
320
|
-
const resolvedCaller = caller ?? connectedAddress;
|
|
321
|
-
return useQuery({
|
|
322
|
-
queryKey: buildQueryKey(
|
|
323
|
-
"airdrop:isSignatureValid",
|
|
324
|
-
chainId,
|
|
325
|
-
base.address,
|
|
326
|
-
encryptedAmountHandle,
|
|
327
|
-
signature,
|
|
328
|
-
resolvedCaller
|
|
329
|
-
),
|
|
330
|
-
queryFn: () => client.isSignatureValid({
|
|
331
|
-
encryptedAmountHandle,
|
|
332
|
-
signature,
|
|
333
|
-
caller: resolvedCaller
|
|
334
|
-
}),
|
|
335
|
-
enabled: !!client && !!encryptedAmountHandle && !!signature && !!resolvedCaller,
|
|
336
|
-
staleTime: 0
|
|
337
|
-
});
|
|
338
|
-
}
|
|
339
|
-
function useAirdropHasRole(args) {
|
|
340
|
-
const { role, account, ...base } = args;
|
|
341
|
-
const { client, chainId } = useMemoAirdropClient(base);
|
|
342
|
-
return useQuery({
|
|
343
|
-
queryKey: buildQueryKey("airdrop:hasRole", chainId, base.address, role, account),
|
|
344
|
-
queryFn: () => client.hasRole(role, account),
|
|
345
|
-
enabled: !!client && !!role && !!account,
|
|
346
|
-
staleTime: 0
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
function useClaim(options) {
|
|
350
|
-
const { client } = useMemoAirdropClient(options);
|
|
223
|
+
function useMerkleClaim(options) {
|
|
224
|
+
const { client, chainId, walletClient } = useMemoMerkleAirdropClient(options);
|
|
225
|
+
const queryClient = useQueryClient();
|
|
351
226
|
return useMutation({
|
|
352
227
|
mutationFn: async (args) => {
|
|
353
|
-
if (!client)
|
|
228
|
+
if (!client) {
|
|
229
|
+
throw new MissingClientError("useMerkleClaim", "merkle-airdrop");
|
|
230
|
+
}
|
|
354
231
|
return client.claim(args);
|
|
232
|
+
},
|
|
233
|
+
onMutate: (variables) => {
|
|
234
|
+
const account = variables.account ?? walletClient?.account;
|
|
235
|
+
return {
|
|
236
|
+
claimant: account ? typeof account === "string" ? account : account.address : void 0
|
|
237
|
+
};
|
|
238
|
+
},
|
|
239
|
+
onSuccess: (_hash, _variables, context) => {
|
|
240
|
+
if (!context?.claimant) return;
|
|
241
|
+
void queryClient.invalidateQueries({
|
|
242
|
+
queryKey: airdropQueryKey({
|
|
243
|
+
chainId,
|
|
244
|
+
address: options.address,
|
|
245
|
+
fn: "getClaimedAmount",
|
|
246
|
+
args: [context.claimant]
|
|
247
|
+
})
|
|
248
|
+
});
|
|
355
249
|
}
|
|
356
250
|
});
|
|
357
251
|
}
|
|
358
|
-
function
|
|
359
|
-
const { client } =
|
|
252
|
+
function useSetMerkleRoot(options) {
|
|
253
|
+
const { client, chainId } = useMemoMerkleAirdropClient(options);
|
|
254
|
+
const queryClient = useQueryClient();
|
|
360
255
|
return useMutation({
|
|
361
256
|
mutationFn: async (args) => {
|
|
362
|
-
if (!client)
|
|
363
|
-
|
|
257
|
+
if (!client) {
|
|
258
|
+
throw new MissingClientError("useSetMerkleRoot", "merkle-airdrop");
|
|
259
|
+
}
|
|
260
|
+
return client.setMerkleRoot(args);
|
|
261
|
+
},
|
|
262
|
+
onSuccess: () => {
|
|
263
|
+
void queryClient.invalidateQueries({
|
|
264
|
+
queryKey: airdropQueryKey({
|
|
265
|
+
chainId,
|
|
266
|
+
address: options.address,
|
|
267
|
+
fn: "merkleRoot",
|
|
268
|
+
args: []
|
|
269
|
+
})
|
|
270
|
+
});
|
|
364
271
|
}
|
|
365
272
|
});
|
|
366
273
|
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
const
|
|
274
|
+
function useGrantInstanceRoles(options) {
|
|
275
|
+
const { client, chainId } = useMemoAirdropBaseClient(options);
|
|
276
|
+
const queryClient = useQueryClient();
|
|
370
277
|
return useMutation({
|
|
371
|
-
mutationFn: async (
|
|
372
|
-
if (!client)
|
|
373
|
-
|
|
278
|
+
mutationFn: async (args) => {
|
|
279
|
+
if (!client) {
|
|
280
|
+
throw new MissingClientError("useGrantInstanceRoles", "airdrop-base");
|
|
281
|
+
}
|
|
282
|
+
return grantInstanceRoles({
|
|
283
|
+
airdrop: client,
|
|
284
|
+
assignment: args.assignment,
|
|
285
|
+
...args.revokeFromCreator !== void 0 ? { revokeFromCreator: args.revokeFromCreator } : {}
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
onSuccess: () => {
|
|
289
|
+
void queryClient.invalidateQueries({
|
|
290
|
+
queryKey: airdropQueryKeyPrefix({ chainId, address: options.address, fn: "hasRole" })
|
|
291
|
+
});
|
|
374
292
|
}
|
|
375
293
|
});
|
|
376
294
|
}
|
|
377
|
-
function
|
|
378
|
-
const { client } =
|
|
295
|
+
function useAirdropPause(options) {
|
|
296
|
+
const { client, chainId } = useMemoAirdropBaseClient(options);
|
|
297
|
+
const queryClient = useQueryClient();
|
|
379
298
|
return useMutation({
|
|
380
|
-
mutationFn: async ({ paused,
|
|
381
|
-
if (!client)
|
|
382
|
-
|
|
299
|
+
mutationFn: async ({ paused, ...rest }) => {
|
|
300
|
+
if (!client) {
|
|
301
|
+
throw new MissingClientError("useAirdropPause", "airdrop-base");
|
|
302
|
+
}
|
|
303
|
+
return paused ? client.pause(rest) : client.unpause(rest);
|
|
304
|
+
},
|
|
305
|
+
onSuccess: () => {
|
|
306
|
+
void queryClient.invalidateQueries({
|
|
307
|
+
queryKey: airdropQueryKey({ chainId, address: options.address, fn: "paused", args: [] })
|
|
308
|
+
});
|
|
309
|
+
void queryClient.invalidateQueries({
|
|
310
|
+
queryKey: airdropQueryKey({ chainId, address: options.address, fn: "window", args: [] })
|
|
311
|
+
});
|
|
383
312
|
}
|
|
384
313
|
});
|
|
385
314
|
}
|
|
386
315
|
function useExtendClaimWindow(options) {
|
|
387
|
-
const { client } =
|
|
316
|
+
const { client, chainId } = useMemoAirdropBaseClient(options);
|
|
317
|
+
const queryClient = useQueryClient();
|
|
388
318
|
return useMutation({
|
|
389
|
-
mutationFn: async (
|
|
390
|
-
if (!client)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
if (!client) throw new MissingClientError("useWithdrawOtherToken", "airdrop");
|
|
400
|
-
return client.withdrawOtherToken(tokenAddress, recipient, account);
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
function useWithdrawOtherConfidentialToken(options) {
|
|
405
|
-
const { client } = useMemoAirdropClient(options);
|
|
406
|
-
return useMutation({
|
|
407
|
-
mutationFn: async ({ tokenAddress, recipient, account }) => {
|
|
408
|
-
if (!client) throw new MissingClientError("useWithdrawOtherConfidentialToken", "airdrop");
|
|
409
|
-
return client.withdrawOtherConfidentialToken(tokenAddress, recipient, account);
|
|
410
|
-
}
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
function useAirdropWithdrawGasFee(options) {
|
|
414
|
-
const { client } = useMemoAirdropClient(options);
|
|
415
|
-
return useMutation({
|
|
416
|
-
mutationFn: async ({ recipient, amount, account }) => {
|
|
417
|
-
if (!client) throw new MissingClientError("useAirdropWithdrawGasFee", "airdrop");
|
|
418
|
-
return client.withdrawGasFee(recipient, amount, account);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
function useAirdropGrantRole(options) {
|
|
423
|
-
const { client } = useMemoAirdropClient(options);
|
|
424
|
-
return useMutation({
|
|
425
|
-
mutationFn: async ({ role, accountTarget, account }) => {
|
|
426
|
-
if (!client) throw new MissingClientError("useAirdropGrantRole", "airdrop");
|
|
427
|
-
return client.grantRole(role, accountTarget, account);
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
}
|
|
431
|
-
function useAirdropRevokeRole(options) {
|
|
432
|
-
const { client } = useMemoAirdropClient(options);
|
|
433
|
-
return useMutation({
|
|
434
|
-
mutationFn: async ({ role, accountTarget, account }) => {
|
|
435
|
-
if (!client) throw new MissingClientError("useAirdropRevokeRole", "airdrop");
|
|
436
|
-
return client.revokeRole(role, accountTarget, account);
|
|
319
|
+
mutationFn: async (args) => {
|
|
320
|
+
if (!client) {
|
|
321
|
+
throw new MissingClientError("useExtendClaimWindow", "airdrop-base");
|
|
322
|
+
}
|
|
323
|
+
return client.extendClaimWindow(args);
|
|
324
|
+
},
|
|
325
|
+
onSuccess: () => {
|
|
326
|
+
void queryClient.invalidateQueries({
|
|
327
|
+
queryKey: airdropQueryKey({ chainId, address: options.address, fn: "window", args: [] })
|
|
328
|
+
});
|
|
437
329
|
}
|
|
438
330
|
});
|
|
439
331
|
}
|
|
440
|
-
function
|
|
441
|
-
const {
|
|
332
|
+
function useWithdrawConfidential(options) {
|
|
333
|
+
const { client } = useMemoAirdropBaseClient(options);
|
|
442
334
|
return useMutation({
|
|
443
335
|
mutationFn: async (args) => {
|
|
444
|
-
if (!
|
|
445
|
-
throw new
|
|
336
|
+
if (!client) {
|
|
337
|
+
throw new MissingClientError("useWithdrawConfidential", "airdrop-base");
|
|
446
338
|
}
|
|
447
|
-
return
|
|
448
|
-
walletClient,
|
|
449
|
-
airdropAddress: args.airdropAddress,
|
|
450
|
-
recipient: args.recipient,
|
|
451
|
-
encryptedAmountHandle: args.encryptedAmountHandle
|
|
452
|
-
});
|
|
339
|
+
return client.withdrawConfidential(args);
|
|
453
340
|
}
|
|
454
341
|
});
|
|
455
342
|
}
|
|
456
343
|
|
|
457
|
-
export {
|
|
344
|
+
export { useAirdropGasFee, useAirdropHasRole, useAirdropPause, useAirdropPaused, useAirdropToken, useAirdropWindow, useClaimedAmount, useComplianceManager, useCreateEcdsaAirdrop, useCreateMerkleAirdrop, useEcdsaClaim, useEffectiveUpgradeable, useExtendClaimWindow, useFactoryFees, useFactoryRegistry, useFundAirdrop, useGrantInstanceRoles, useMerkleClaim, useMerkleRoot, useSetMerkleRoot, useWithdrawConfidential };
|