@tokenops/sdk 1.5.1 → 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 +198 -2
- package/CONTRIBUTING.md +4 -2
- package/README.md +146 -90
- package/SECURITY.md +7 -1
- package/SUPPORT.md +47 -0
- package/dist/{chunk-YQIBBEFJ.js → chunk-335Z2W67.js} +1 -1
- package/dist/{chunk-2NCLOQ56.cjs → chunk-3QHNYEQD.cjs} +77 -0
- package/dist/chunk-456VDDA3.js +370 -0
- package/dist/{chunk-SG65XWH7.js → chunk-4RAAATVY.js} +1 -3
- package/dist/{chunk-6BMP4ICG.js → chunk-4TSDNZQ3.js} +60 -2
- package/dist/{chunk-PUPKNW3R.cjs → chunk-5576FRT3.cjs} +30 -6
- package/dist/{chunk-AOP6HMPW.js → chunk-6GNR22OV.js} +75 -1
- package/dist/{chunk-NTZY6IB7.js → chunk-6NAVMWZQ.js} +4 -3
- package/dist/{chunk-C7BRZXJA.cjs → chunk-6PXXGACR.cjs} +8 -7
- package/dist/{chunk-IJFQ5L4I.js → chunk-74QFZ5MK.js} +4 -3
- package/dist/chunk-7AFPOE7N.cjs +59 -0
- package/dist/chunk-AXIPOR3C.js +56 -0
- package/dist/chunk-CTED3MTR.cjs +380 -0
- package/dist/{chunk-XGGTQQFH.js → chunk-DZHYSUGY.js} +28 -7
- package/dist/{chunk-OXTLPTO3.js → chunk-EAJ7SYHE.js} +4 -3
- package/dist/{chunk-V2PXZVBF.cjs → chunk-FGEB7RMY.cjs} +4 -4
- package/dist/chunk-GKKDAW44.js +8823 -0
- package/dist/{chunk-2PWNH3UE.js → chunk-H5POPGOZ.js} +63 -5
- package/dist/{chunk-W7IGCOVL.cjs → chunk-JQYC66TO.cjs} +9 -8
- package/dist/{chunk-PFXURMBZ.cjs → chunk-JZLGCTGK.cjs} +68 -8
- package/dist/{chunk-JYOTGRSO.cjs → chunk-KFRDLKMA.cjs} +61 -1
- package/dist/chunk-M4IT6DNJ.cjs +608 -0
- package/dist/{chunk-KLKI352M.cjs → chunk-MVDQMV25.cjs} +0 -3
- 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-IXLO7GO5.js → chunk-TWT3STIX.js} +46 -80
- package/dist/chunk-UG5RKLU2.cjs +6 -0
- package/dist/chunk-VP2B4WM2.js +154 -0
- package/dist/{chunk-5X5WL5CU.cjs → chunk-WJLECC22.cjs} +51 -88
- package/dist/{chunk-WENHUPZC.cjs → chunk-XAYGD4E4.cjs} +9 -8
- package/dist/core/addresses.d.ts +15 -3
- 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 +34 -13
- package/dist/fhe/index.d.cts +1 -0
- package/dist/fhe/index.d.ts +1 -0
- package/dist/fhe/index.js +19 -6
- package/dist/fhe/mock-erc7984.d.ts +4 -4
- package/dist/fhe/operators.d.ts +160 -3
- package/dist/fhe/react/index.cjs +14 -0
- package/dist/fhe/react/index.d.cts +2 -0
- package/dist/fhe/react/index.d.ts +2 -0
- package/dist/fhe/react/index.js +6 -0
- 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/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 +10 -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 +2 -8
- package/dist/fhe-airdrop/advanced/react/index.cjs +34 -48
- 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 +33 -48
- 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 +1089 -33
- package/dist/fhe-airdrop/index.d.cts +46 -8
- package/dist/fhe-airdrop/index.d.ts +46 -8
- package/dist/fhe-airdrop/index.js +929 -7
- 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 +364 -413
- package/dist/fhe-airdrop/react/index.d.cts +53 -72
- package/dist/fhe-airdrop/react/index.d.ts +53 -72
- package/dist/fhe-airdrop/react/index.js +258 -369
- 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 +68 -55
- package/dist/fhe-disperse/errors.d.ts +55 -0
- package/dist/fhe-disperse/index.cjs +34 -25
- package/dist/fhe-disperse/index.d.cts +1 -1
- package/dist/fhe-disperse/index.d.ts +1 -1
- package/dist/fhe-disperse/index.js +6 -5
- package/dist/fhe-disperse/react/index.cjs +42 -23
- 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 +9 -6
- package/dist/fhe-vesting/advanced/index.cjs +8 -7
- package/dist/fhe-vesting/advanced/index.js +6 -5
- package/dist/fhe-vesting/advanced/react/index.cjs +12 -11
- package/dist/fhe-vesting/advanced/react/index.js +9 -8
- package/dist/fhe-vesting/index.cjs +35 -34
- package/dist/fhe-vesting/index.js +7 -6
- package/dist/fhe-vesting/manager.d.ts +19 -0
- package/dist/fhe-vesting/react/index.cjs +160 -140
- 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 +24 -16
- 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 +27 -15
- package/dist/index.js +1 -1
- package/dist/testnet-faucet/index.cjs +17 -16
- package/dist/testnet-faucet/index.js +5 -4
- package/dist/testnet-faucet/react/index.cjs +11 -10
- package/dist/testnet-faucet/react/index.js +6 -5
- package/package.json +18 -9
- package/dist/chunk-4WPGQSNT.cjs +0 -44
- package/dist/chunk-6R4KNAPK.js +0 -1630
- package/dist/chunk-DUZIIRPF.js +0 -1655
- package/dist/chunk-MCRBVJGZ.cjs +0 -1637
- package/dist/chunk-ODLTEGHB.js +0 -41
- package/dist/chunk-ORFTDNFZ.js +0 -105
- package/dist/chunk-T46YXSBP.cjs +0 -109
- package/dist/chunk-TIUKIY5V.cjs +0 -1663
- 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 -310
- package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +0 -31
- package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +0 -27
- 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 -31
- 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/useGetClaimAmount.d.ts +0 -30
- 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
- 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,455 +1,344 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
|
|
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';
|
|
6
7
|
import '../../chunk-ZWXJTBZO.js';
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
8
|
+
import '../../chunk-NWFMBLSQ.js';
|
|
9
|
+
import '../../chunk-4RAAATVY.js';
|
|
10
|
+
import '../../chunk-DZHYSUGY.js';
|
|
10
11
|
import '../../chunk-ZA673I3O.js';
|
|
11
|
-
import '../../chunk-Q2GP5UDC.js';
|
|
12
12
|
import '../../chunk-KWFFIJYX.js';
|
|
13
|
-
import { MissingClientError
|
|
13
|
+
import { MissingClientError } from '../../chunk-QBJ7O2B4.js';
|
|
14
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
|
-
import
|
|
16
|
-
import {
|
|
15
|
+
import '../../chunk-Q2GP5UDC.js';
|
|
16
|
+
import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
|
|
17
17
|
|
|
18
|
-
function
|
|
19
|
-
const { client, chainId
|
|
18
|
+
function useAirdropToken(args) {
|
|
19
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
20
20
|
return useQuery({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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))
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const { client, chainId
|
|
27
|
+
function useAirdropWindow(args) {
|
|
28
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
29
29
|
return useQuery({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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);
|
|
47
|
+
return useQuery({
|
|
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))
|
|
34
52
|
});
|
|
35
53
|
}
|
|
36
|
-
function
|
|
37
|
-
const { client, chainId
|
|
54
|
+
function useAirdropGasFee(args) {
|
|
55
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
38
56
|
return useQuery({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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))
|
|
43
61
|
});
|
|
44
62
|
}
|
|
45
|
-
function
|
|
46
|
-
const {
|
|
47
|
-
const { client, chainId
|
|
63
|
+
function useAirdropHasRole(args) {
|
|
64
|
+
const { role, holder, ...base } = args;
|
|
65
|
+
const { client, chainId } = useMemoAirdropBaseClient(base);
|
|
48
66
|
return useQuery({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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))
|
|
53
76
|
});
|
|
54
77
|
}
|
|
55
|
-
function
|
|
56
|
-
const {
|
|
57
|
-
const { client, chainId, resolvedAddress } = useMemoFactoryClient(base);
|
|
78
|
+
function useMerkleRoot(args) {
|
|
79
|
+
const { client, chainId } = useMemoMerkleAirdropClient(args);
|
|
58
80
|
return useQuery({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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))
|
|
63
85
|
});
|
|
64
86
|
}
|
|
65
|
-
function
|
|
66
|
-
const {
|
|
67
|
-
const { client, chainId
|
|
87
|
+
function useClaimedAmount(args) {
|
|
88
|
+
const { account, ...base } = args;
|
|
89
|
+
const { client, chainId } = useMemoMerkleAirdropClient(base);
|
|
68
90
|
return useQuery({
|
|
69
|
-
|
|
70
|
-
|
|
91
|
+
...args.query,
|
|
92
|
+
queryKey: airdropQueryKey({
|
|
71
93
|
chainId,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
userSalt,
|
|
76
|
-
funding
|
|
77
|
-
),
|
|
78
|
-
queryFn: () => client.preflightCreateAirdrop({
|
|
79
|
-
params,
|
|
80
|
-
creator,
|
|
81
|
-
...userSalt !== void 0 ? { userSalt } : {},
|
|
82
|
-
...funding !== void 0 ? { funding } : {}
|
|
94
|
+
address: args.address,
|
|
95
|
+
fn: "getClaimedAmount",
|
|
96
|
+
args: [account]
|
|
83
97
|
}),
|
|
84
|
-
|
|
85
|
-
|
|
98
|
+
queryFn: () => client.getClaimedAmount(account),
|
|
99
|
+
enabled: Boolean(client && account && (args.query?.enabled ?? true))
|
|
86
100
|
});
|
|
87
101
|
}
|
|
88
|
-
function
|
|
89
|
-
const { client,
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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))
|
|
97
165
|
});
|
|
98
166
|
}
|
|
99
|
-
function
|
|
100
|
-
const { client, resolutionError } =
|
|
167
|
+
function useCreateEcdsaAirdrop(options = {}) {
|
|
168
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
169
|
+
const queryClient = useQueryClient();
|
|
101
170
|
return useMutation({
|
|
102
171
|
mutationFn: async (args) => {
|
|
103
172
|
if (!client) {
|
|
104
|
-
throw resolutionError ?? new MissingClientError("
|
|
173
|
+
throw resolutionError ?? new MissingClientError("useCreateEcdsaAirdrop", "factory");
|
|
105
174
|
}
|
|
106
|
-
return client.
|
|
175
|
+
return client.createEcdsaAirdrop(args);
|
|
176
|
+
},
|
|
177
|
+
onSuccess: () => {
|
|
178
|
+
void queryClient.invalidateQueries({
|
|
179
|
+
queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
|
|
180
|
+
});
|
|
107
181
|
}
|
|
108
182
|
});
|
|
109
183
|
}
|
|
110
|
-
function
|
|
111
|
-
const { client, resolutionError } =
|
|
184
|
+
function useCreateMerkleAirdrop(options = {}) {
|
|
185
|
+
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
186
|
+
const queryClient = useQueryClient();
|
|
112
187
|
return useMutation({
|
|
113
188
|
mutationFn: async (args) => {
|
|
114
189
|
if (!client) {
|
|
115
|
-
throw resolutionError ?? new MissingClientError("
|
|
190
|
+
throw resolutionError ?? new MissingClientError("useCreateMerkleAirdrop", "factory");
|
|
116
191
|
}
|
|
117
|
-
return client.
|
|
192
|
+
return client.createMerkleAirdrop(args);
|
|
193
|
+
},
|
|
194
|
+
onSuccess: () => {
|
|
195
|
+
void queryClient.invalidateQueries({
|
|
196
|
+
queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
|
|
197
|
+
});
|
|
118
198
|
}
|
|
119
199
|
});
|
|
120
200
|
}
|
|
121
|
-
function
|
|
122
|
-
const { client, resolutionError } =
|
|
201
|
+
function useFundAirdrop(options = {}) {
|
|
202
|
+
const { client, resolutionError } = useMemoAirdropFactoryClient(options);
|
|
123
203
|
return useMutation({
|
|
124
204
|
mutationFn: async (args) => {
|
|
125
205
|
if (!client) {
|
|
126
|
-
throw resolutionError ?? new MissingClientError("
|
|
206
|
+
throw resolutionError ?? new MissingClientError("useFundAirdrop", "factory");
|
|
127
207
|
}
|
|
128
|
-
return client.
|
|
208
|
+
return client.fundAirdrop(args);
|
|
129
209
|
}
|
|
130
210
|
});
|
|
131
211
|
}
|
|
132
|
-
function
|
|
133
|
-
const { client
|
|
212
|
+
function useEcdsaClaim(options) {
|
|
213
|
+
const { client } = useMemoEcdsaAirdropClient(options);
|
|
134
214
|
return useMutation({
|
|
135
215
|
mutationFn: async (args) => {
|
|
136
216
|
if (!client) {
|
|
137
|
-
throw
|
|
217
|
+
throw new MissingClientError("useEcdsaClaim", "ecdsa-airdrop");
|
|
138
218
|
}
|
|
139
|
-
return client.
|
|
140
|
-
}
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
function useSetFeeCollector(options = {}) {
|
|
144
|
-
const { client, resolutionError } = useMemoFactoryClient(options);
|
|
145
|
-
return useMutation({
|
|
146
|
-
mutationFn: async ({ newFeeCollector, account }) => {
|
|
147
|
-
if (!client) throw resolutionError ?? new MissingClientError("useSetFeeCollector", "factory");
|
|
148
|
-
return client.setFeeCollector(newFeeCollector, account);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
function useSetDefaultGasFee(options = {}) {
|
|
153
|
-
const { client, resolutionError } = useMemoFactoryClient(options);
|
|
154
|
-
return useMutation({
|
|
155
|
-
mutationFn: async ({ newGasFee, account }) => {
|
|
156
|
-
if (!client)
|
|
157
|
-
throw resolutionError ?? new MissingClientError("useSetDefaultGasFee", "factory");
|
|
158
|
-
return client.setDefaultGasFee(newGasFee, account);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
function useSetCustomFee(options = {}) {
|
|
163
|
-
const { client, resolutionError } = useMemoFactoryClient(options);
|
|
164
|
-
return useMutation({
|
|
165
|
-
mutationFn: async ({ campaignCreator, gasFee, account }) => {
|
|
166
|
-
if (!client) throw resolutionError ?? new MissingClientError("useSetCustomFee", "factory");
|
|
167
|
-
return client.setCustomFee(campaignCreator, gasFee, account);
|
|
219
|
+
return client.claim(args);
|
|
168
220
|
}
|
|
169
221
|
});
|
|
170
222
|
}
|
|
171
|
-
function
|
|
172
|
-
const { client,
|
|
173
|
-
|
|
174
|
-
mutationFn: async ({ campaignCreator, account }) => {
|
|
175
|
-
if (!client)
|
|
176
|
-
throw resolutionError ?? new MissingClientError("useDisableCustomFee", "factory");
|
|
177
|
-
return client.disableCustomFee(campaignCreator, account);
|
|
178
|
-
}
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
function useAirdropToken(options) {
|
|
182
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
183
|
-
return useQuery({
|
|
184
|
-
queryKey: buildQueryKey("airdrop:TOKEN", chainId, options.address),
|
|
185
|
-
queryFn: () => client.token(),
|
|
186
|
-
enabled: !!client,
|
|
187
|
-
staleTime: 0
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
function useAirdropGasFee(options) {
|
|
191
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
192
|
-
return useQuery({
|
|
193
|
-
queryKey: buildQueryKey("airdrop:GAS_FEE", chainId, options.address),
|
|
194
|
-
queryFn: () => client.gasFee(),
|
|
195
|
-
enabled: !!client,
|
|
196
|
-
staleTime: 0
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
function useAirdropStartTime(options) {
|
|
200
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
201
|
-
return useQuery({
|
|
202
|
-
queryKey: buildQueryKey("airdrop:START_TIME", chainId, options.address),
|
|
203
|
-
queryFn: () => client.startTime(),
|
|
204
|
-
enabled: !!client,
|
|
205
|
-
staleTime: 0
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
function useAirdropCanExtendClaimWindow(options) {
|
|
209
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
210
|
-
return useQuery({
|
|
211
|
-
queryKey: buildQueryKey("airdrop:CAN_EXTEND_CLAIM_WINDOW", chainId, options.address),
|
|
212
|
-
queryFn: () => client.canExtendClaimWindow(),
|
|
213
|
-
enabled: !!client,
|
|
214
|
-
staleTime: 0
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
function useAirdropEndTime(options) {
|
|
218
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
219
|
-
return useQuery({
|
|
220
|
-
queryKey: buildQueryKey("airdrop:endTime", chainId, options.address),
|
|
221
|
-
queryFn: () => client.endTime(),
|
|
222
|
-
enabled: !!client,
|
|
223
|
-
staleTime: 0
|
|
224
|
-
});
|
|
225
|
-
}
|
|
226
|
-
function useAirdropIsPaused(options) {
|
|
227
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
228
|
-
return useQuery({
|
|
229
|
-
queryKey: buildQueryKey("airdrop:isPaused", chainId, options.address),
|
|
230
|
-
queryFn: () => client.isPaused(),
|
|
231
|
-
enabled: !!client,
|
|
232
|
-
staleTime: 0
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
function useAirdropDeploymentBlockNumber(options) {
|
|
236
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
237
|
-
return useQuery({
|
|
238
|
-
queryKey: buildQueryKey("airdrop:deploymentBlockNumber", chainId, options.address),
|
|
239
|
-
queryFn: () => client.deploymentBlockNumber(),
|
|
240
|
-
enabled: !!client,
|
|
241
|
-
staleTime: 0
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
function useAirdropDomainSeparator(options) {
|
|
245
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
246
|
-
return useQuery({
|
|
247
|
-
queryKey: buildQueryKey("airdrop:DOMAIN_SEPARATOR", chainId, options.address),
|
|
248
|
-
queryFn: () => client.domainSeparator(),
|
|
249
|
-
enabled: !!client,
|
|
250
|
-
staleTime: 0
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
function useAirdropClaimTypehash(options) {
|
|
254
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
255
|
-
return useQuery({
|
|
256
|
-
queryKey: buildQueryKey("airdrop:CLAIM_TYPEHASH", chainId, options.address),
|
|
257
|
-
queryFn: () => client.claimTypehash(),
|
|
258
|
-
enabled: !!client,
|
|
259
|
-
staleTime: 0
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
function useAirdropIsClaimWindowActive(options) {
|
|
263
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
264
|
-
return useQuery({
|
|
265
|
-
queryKey: buildQueryKey("airdrop:isClaimWindowActive", chainId, options.address),
|
|
266
|
-
queryFn: () => client.isClaimWindowActive(),
|
|
267
|
-
enabled: !!client,
|
|
268
|
-
staleTime: 0
|
|
269
|
-
});
|
|
270
|
-
}
|
|
271
|
-
function useAirdropHasClaimStarted(options) {
|
|
272
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
273
|
-
return useQuery({
|
|
274
|
-
queryKey: buildQueryKey("airdrop:hasClaimStarted", chainId, options.address),
|
|
275
|
-
queryFn: () => client.hasClaimStarted(),
|
|
276
|
-
enabled: !!client,
|
|
277
|
-
staleTime: 0
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
function useAirdropHasClaimEnded(options) {
|
|
281
|
-
const { client, chainId } = useMemoAirdropClient(options);
|
|
282
|
-
return useQuery({
|
|
283
|
-
queryKey: buildQueryKey("airdrop:hasClaimEnded", chainId, options.address),
|
|
284
|
-
queryFn: () => client.hasClaimEnded(),
|
|
285
|
-
enabled: !!client,
|
|
286
|
-
staleTime: 0
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
function useAirdropClaimedSignatures(args) {
|
|
290
|
-
const { signatureHash, ...base } = args;
|
|
291
|
-
const { client, chainId } = useMemoAirdropClient(base);
|
|
292
|
-
return useQuery({
|
|
293
|
-
queryKey: buildQueryKey("airdrop:claimedSignatures", chainId, base.address, signatureHash),
|
|
294
|
-
queryFn: () => client.claimedSignatures(signatureHash),
|
|
295
|
-
enabled: !!client && !!signatureHash,
|
|
296
|
-
staleTime: 0
|
|
297
|
-
});
|
|
298
|
-
}
|
|
299
|
-
function useAirdropIsSignatureClaimed(args) {
|
|
300
|
-
const { user, encryptedAmountHandle, ...base } = args;
|
|
301
|
-
const { client, chainId } = useMemoAirdropClient(base);
|
|
302
|
-
return useQuery({
|
|
303
|
-
queryKey: buildQueryKey(
|
|
304
|
-
"airdrop:isSignatureClaimed",
|
|
305
|
-
chainId,
|
|
306
|
-
base.address,
|
|
307
|
-
user,
|
|
308
|
-
encryptedAmountHandle
|
|
309
|
-
),
|
|
310
|
-
queryFn: () => client.isSignatureClaimed(user, encryptedAmountHandle),
|
|
311
|
-
enabled: !!client && !!user && !!encryptedAmountHandle,
|
|
312
|
-
staleTime: 0
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
function useAirdropIsSignatureValid(args) {
|
|
316
|
-
const { encryptedAmountHandle, signature, caller, ...base } = args;
|
|
317
|
-
const { client, chainId } = useMemoAirdropClient(base);
|
|
318
|
-
const { address: connectedAddress } = useWagmiAccount();
|
|
319
|
-
const resolvedCaller = caller ?? connectedAddress;
|
|
320
|
-
return useQuery({
|
|
321
|
-
queryKey: buildQueryKey(
|
|
322
|
-
"airdrop:isSignatureValid",
|
|
323
|
-
chainId,
|
|
324
|
-
base.address,
|
|
325
|
-
encryptedAmountHandle,
|
|
326
|
-
signature,
|
|
327
|
-
resolvedCaller
|
|
328
|
-
),
|
|
329
|
-
queryFn: () => client.isSignatureValid({
|
|
330
|
-
encryptedAmountHandle,
|
|
331
|
-
signature,
|
|
332
|
-
caller: resolvedCaller
|
|
333
|
-
}),
|
|
334
|
-
enabled: !!client && !!encryptedAmountHandle && !!signature && !!resolvedCaller,
|
|
335
|
-
staleTime: 0
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
function useAirdropHasRole(args) {
|
|
339
|
-
const { role, account, ...base } = args;
|
|
340
|
-
const { client, chainId } = useMemoAirdropClient(base);
|
|
341
|
-
return useQuery({
|
|
342
|
-
queryKey: buildQueryKey("airdrop:hasRole", chainId, base.address, role, account),
|
|
343
|
-
queryFn: () => client.hasRole(role, account),
|
|
344
|
-
enabled: !!client && !!role && !!account,
|
|
345
|
-
staleTime: 0
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
function useClaim(options) {
|
|
349
|
-
const { client } = useMemoAirdropClient(options);
|
|
223
|
+
function useMerkleClaim(options) {
|
|
224
|
+
const { client, chainId, walletClient } = useMemoMerkleAirdropClient(options);
|
|
225
|
+
const queryClient = useQueryClient();
|
|
350
226
|
return useMutation({
|
|
351
227
|
mutationFn: async (args) => {
|
|
352
|
-
if (!client)
|
|
228
|
+
if (!client) {
|
|
229
|
+
throw new MissingClientError("useMerkleClaim", "merkle-airdrop");
|
|
230
|
+
}
|
|
353
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
|
+
});
|
|
354
249
|
}
|
|
355
250
|
});
|
|
356
251
|
}
|
|
357
|
-
function
|
|
358
|
-
const { client } =
|
|
252
|
+
function useSetMerkleRoot(options) {
|
|
253
|
+
const { client, chainId } = useMemoMerkleAirdropClient(options);
|
|
254
|
+
const queryClient = useQueryClient();
|
|
359
255
|
return useMutation({
|
|
360
256
|
mutationFn: async (args) => {
|
|
361
|
-
if (!client)
|
|
362
|
-
|
|
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
|
+
});
|
|
363
271
|
}
|
|
364
272
|
});
|
|
365
273
|
}
|
|
366
|
-
function
|
|
367
|
-
const { client } =
|
|
274
|
+
function useGrantInstanceRoles(options) {
|
|
275
|
+
const { client, chainId } = useMemoAirdropBaseClient(options);
|
|
276
|
+
const queryClient = useQueryClient();
|
|
368
277
|
return useMutation({
|
|
369
|
-
mutationFn: async (
|
|
370
|
-
if (!client)
|
|
371
|
-
|
|
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
|
+
});
|
|
372
292
|
}
|
|
373
293
|
});
|
|
374
294
|
}
|
|
375
|
-
function
|
|
376
|
-
const { client } =
|
|
295
|
+
function useAirdropPause(options) {
|
|
296
|
+
const { client, chainId } = useMemoAirdropBaseClient(options);
|
|
297
|
+
const queryClient = useQueryClient();
|
|
377
298
|
return useMutation({
|
|
378
|
-
mutationFn: async ({ paused,
|
|
379
|
-
if (!client)
|
|
380
|
-
|
|
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
|
+
});
|
|
381
312
|
}
|
|
382
313
|
});
|
|
383
314
|
}
|
|
384
315
|
function useExtendClaimWindow(options) {
|
|
385
|
-
const { client } =
|
|
316
|
+
const { client, chainId } = useMemoAirdropBaseClient(options);
|
|
317
|
+
const queryClient = useQueryClient();
|
|
386
318
|
return useMutation({
|
|
387
|
-
mutationFn: async (
|
|
388
|
-
if (!client)
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
if (!client) throw new MissingClientError("useWithdrawOtherToken", "airdrop");
|
|
398
|
-
return client.withdrawOtherToken(tokenAddress, recipient, account);
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
function useWithdrawOtherConfidentialToken(options) {
|
|
403
|
-
const { client } = useMemoAirdropClient(options);
|
|
404
|
-
return useMutation({
|
|
405
|
-
mutationFn: async ({ tokenAddress, recipient, account }) => {
|
|
406
|
-
if (!client) throw new MissingClientError("useWithdrawOtherConfidentialToken", "airdrop");
|
|
407
|
-
return client.withdrawOtherConfidentialToken(tokenAddress, recipient, account);
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
function useAirdropWithdrawGasFee(options) {
|
|
412
|
-
const { client } = useMemoAirdropClient(options);
|
|
413
|
-
return useMutation({
|
|
414
|
-
mutationFn: async ({ recipient, amount, account }) => {
|
|
415
|
-
if (!client) throw new MissingClientError("useAirdropWithdrawGasFee", "airdrop");
|
|
416
|
-
return client.withdrawGasFee(recipient, amount, account);
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
}
|
|
420
|
-
function useAirdropGrantRole(options) {
|
|
421
|
-
const { client } = useMemoAirdropClient(options);
|
|
422
|
-
return useMutation({
|
|
423
|
-
mutationFn: async ({ role, accountTarget, account }) => {
|
|
424
|
-
if (!client) throw new MissingClientError("useAirdropGrantRole", "airdrop");
|
|
425
|
-
return client.grantRole(role, accountTarget, account);
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
function useAirdropRevokeRole(options) {
|
|
430
|
-
const { client } = useMemoAirdropClient(options);
|
|
431
|
-
return useMutation({
|
|
432
|
-
mutationFn: async ({ role, accountTarget, account }) => {
|
|
433
|
-
if (!client) throw new MissingClientError("useAirdropRevokeRole", "airdrop");
|
|
434
|
-
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
|
+
});
|
|
435
329
|
}
|
|
436
330
|
});
|
|
437
331
|
}
|
|
438
|
-
function
|
|
439
|
-
const {
|
|
332
|
+
function useWithdrawConfidential(options) {
|
|
333
|
+
const { client } = useMemoAirdropBaseClient(options);
|
|
440
334
|
return useMutation({
|
|
441
335
|
mutationFn: async (args) => {
|
|
442
|
-
if (!
|
|
443
|
-
throw new
|
|
336
|
+
if (!client) {
|
|
337
|
+
throw new MissingClientError("useWithdrawConfidential", "airdrop-base");
|
|
444
338
|
}
|
|
445
|
-
return
|
|
446
|
-
walletClient,
|
|
447
|
-
airdropAddress: args.airdropAddress,
|
|
448
|
-
recipient: args.recipient,
|
|
449
|
-
encryptedAmountHandle: args.encryptedAmountHandle
|
|
450
|
-
});
|
|
339
|
+
return client.withdrawConfidential(args);
|
|
451
340
|
}
|
|
452
341
|
});
|
|
453
342
|
}
|
|
454
343
|
|
|
455
|
-
export {
|
|
344
|
+
export { useAirdropGasFee, useAirdropHasRole, useAirdropPause, useAirdropPaused, useAirdropToken, useAirdropWindow, useClaimedAmount, useComplianceManager, useCreateEcdsaAirdrop, useCreateMerkleAirdrop, useEcdsaClaim, useEffectiveUpgradeable, useExtendClaimWindow, useFactoryFees, useFactoryRegistry, useFundAirdrop, useGrantInstanceRoles, useMerkleClaim, useMerkleRoot, useSetMerkleRoot, useWithdrawConfidential };
|