@tokenops/sdk 2.0.0-alpha.2 → 2.0.0-alpha.4
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 +92 -3
- package/README.md +76 -34
- package/SUPPORT.md +1 -1
- package/dist/{chunk-PYYSB5ZN.js → chunk-2ND7US2I.js} +1 -1
- package/dist/{chunk-EYDA6Q6C.js → chunk-3ZSPRHR3.js} +63 -12
- package/dist/{chunk-X7WBPCEU.js → chunk-67Q6KSVV.js} +4578 -3383
- package/dist/{chunk-UHHMVBLU.cjs → chunk-6AYJRUGP.cjs} +7 -50
- package/dist/{chunk-FEDX7B6T.cjs → chunk-6FUHF73F.cjs} +5 -5
- package/dist/{chunk-NWFMBLSQ.js → chunk-7KY4K4PH.js} +1 -1
- package/dist/{chunk-FHWSBGWE.cjs → chunk-ARZ5C3FS.cjs} +7 -7
- package/dist/{chunk-SPLNGUFF.js → chunk-AX6MQAWU.js} +2 -2
- package/dist/{chunk-IGO5XSPS.js → chunk-BSXEX2SH.js} +3 -3
- package/dist/{chunk-44YJPMQC.js → chunk-CHGY6B7L.js} +34 -81
- package/dist/{chunk-IUKKNJ2R.cjs → chunk-DFK5GCJP.cjs} +55 -72
- package/dist/{chunk-PZZK3O3S.cjs → chunk-E4IV4M4E.cjs} +4598 -3403
- package/dist/{chunk-A4DCEE33.js → chunk-GHGF65LN.js} +16 -12
- package/dist/{chunk-TWT3STIX.js → chunk-K3R27WX4.js} +8 -46
- package/dist/{chunk-GADGBQJO.js → chunk-KJUNBOJQ.js} +52 -71
- package/dist/{chunk-MM5BV5CS.cjs → chunk-PO3A2AQX.cjs} +4 -4
- package/dist/{chunk-EBLBPUPI.cjs → chunk-QHDMPT7I.cjs} +72 -19
- package/dist/{chunk-3YHBO2DL.cjs → chunk-S47IBDTA.cjs} +36 -83
- package/dist/{chunk-UG5RKLU2.cjs → chunk-SUYBAF27.cjs} +1 -1
- package/dist/{chunk-WJMEBBU7.js → chunk-TWU7L5H7.js} +5 -48
- package/dist/{chunk-WJLECC22.cjs → chunk-UUSSWOPR.cjs} +9 -47
- package/dist/{chunk-AREQJHKA.cjs → chunk-VHKMWWBA.cjs} +428 -22
- package/dist/{chunk-FT5H2Q7Y.cjs → chunk-YAL6JSAZ.cjs} +16 -12
- package/dist/{chunk-VW356KR3.js → chunk-YMWMIWBP.js} +421 -25
- package/dist/core/addresses.d.ts +4 -4
- package/dist/core/errors.d.ts +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/pending.d.ts +57 -0
- package/dist/core/version.d.ts +1 -1
- package/dist/fhe/operators.d.ts +6 -5
- package/dist/fhe/types.d.ts +1 -1
- package/dist/fhe-airdrop/abis/airdrop-base.d.ts +97 -1
- package/dist/fhe-airdrop/abis/ecdsa.d.ts +117 -1
- package/dist/fhe-airdrop/abis/factory.d.ts +332 -1
- package/dist/fhe-airdrop/abis/merkle.d.ts +116 -1
- package/dist/fhe-airdrop/advanced/index.cjs +8 -4
- package/dist/fhe-airdrop/advanced/index.d.cts +1 -0
- package/dist/fhe-airdrop/advanced/index.d.ts +1 -0
- package/dist/fhe-airdrop/advanced/index.js +1 -1
- package/dist/fhe-airdrop/advanced/react/index.cjs +145 -137
- package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -0
- package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -0
- package/dist/fhe-airdrop/advanced/react/index.js +85 -78
- package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +3 -1
- package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +4 -1
- package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +2 -4
- package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +4 -3
- package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +9 -7
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +6 -5
- package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +7 -7
- package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +3 -1
- package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +2 -1
- package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +4 -1
- package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +5 -4
- package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +7 -3
- package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +37 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +142 -18
- package/dist/fhe-airdrop/campaign.d.ts +37 -73
- package/dist/fhe-airdrop/compliance-clone.d.ts +21 -0
- package/dist/fhe-airdrop/constants.d.ts +11 -1
- package/dist/fhe-airdrop/ecdsa.d.ts +79 -26
- package/dist/fhe-airdrop/encryption.d.ts +19 -6
- package/dist/fhe-airdrop/errors.d.ts +136 -2
- package/dist/fhe-airdrop/factory-params.d.ts +2361 -0
- package/dist/fhe-airdrop/factory.d.ts +189 -75
- package/dist/fhe-airdrop/guards.d.ts +183 -19
- package/dist/fhe-airdrop/index.cjs +88 -56
- package/dist/fhe-airdrop/index.d.cts +12 -10
- package/dist/fhe-airdrop/index.d.ts +12 -10
- package/dist/fhe-airdrop/index.js +5 -5
- package/dist/fhe-airdrop/merkle-tree.d.ts +9 -9
- package/dist/fhe-airdrop/merkle.d.ts +32 -11
- package/dist/fhe-airdrop/react/_shared.d.ts +12 -6
- package/dist/fhe-airdrop/react/index.cjs +336 -240
- package/dist/fhe-airdrop/react/index.d.cts +19 -9
- package/dist/fhe-airdrop/react/index.d.ts +19 -9
- package/dist/fhe-airdrop/react/index.js +158 -97
- package/dist/fhe-airdrop/react/keys.d.ts +54 -7
- package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +6 -3
- package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +2 -2
- package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +8 -3
- package/dist/fhe-airdrop/react/useAirdropPause.d.ts +5 -0
- package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +4 -6
- package/dist/fhe-airdrop/react/useComplianceManager.d.ts +2 -2
- package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +1 -2
- package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +16 -11
- package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +23 -7
- package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +13 -8
- package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +27 -7
- package/dist/fhe-airdrop/react/useDedupMode.d.ts +16 -0
- package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +4 -3
- package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +6 -4
- package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +15 -8
- package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +1 -1
- package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +5 -7
- package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +4 -1
- package/dist/fhe-airdrop/react/useFactoryFees.d.ts +11 -4
- package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +3 -4
- package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +2 -1
- package/dist/fhe-airdrop/react/useIsAirdrop.d.ts +44 -0
- package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +5 -4
- package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +4 -1
- package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +14 -3
- package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +18 -3
- package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +1 -1
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +34 -13
- package/dist/fhe-airdrop/react/useRefreshComplianceBalance.d.ts +36 -0
- package/dist/fhe-airdrop/react/useRescueERC20.d.ts +3 -3
- package/dist/fhe-airdrop/react/useRescueNativeToken.d.ts +23 -0
- package/dist/fhe-airdrop/react/useResolveGasFee.d.ts +30 -0
- package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +5 -2
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +4 -0
- package/dist/fhe-airdrop/react/useTokenOf.d.ts +29 -0
- package/dist/fhe-airdrop/react/useUnwrapRequest.d.ts +25 -0
- package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +4 -0
- package/dist/fhe-airdrop/roles.d.ts +82 -7
- package/dist/fhe-airdrop/types.d.ts +122 -14
- package/dist/fhe-disperse/errors.d.ts +3 -3
- package/dist/fhe-disperse/index.cjs +22 -22
- package/dist/fhe-disperse/index.d.cts +2 -1
- package/dist/fhe-disperse/index.d.ts +2 -1
- package/dist/fhe-disperse/index.js +3 -3
- package/dist/fhe-disperse/react/index.cjs +27 -25
- package/dist/fhe-disperse/react/index.d.cts +2 -1
- package/dist/fhe-disperse/react/index.d.ts +2 -1
- package/dist/fhe-disperse/react/index.js +8 -6
- package/dist/fhe-disperse/react/useDisperse.d.ts +6 -2
- package/dist/fhe-disperse/react/useRegister.d.ts +9 -3
- package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +7 -2
- package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +7 -2
- package/dist/fhe-disperse/singleton.d.ts +33 -19
- package/dist/fhe-disperse/types.d.ts +48 -8
- package/dist/fhe-vesting/advanced/index.cjs +6 -6
- package/dist/fhe-vesting/advanced/index.js +4 -4
- package/dist/fhe-vesting/advanced/react/index.cjs +9 -9
- package/dist/fhe-vesting/advanced/react/index.js +6 -6
- package/dist/fhe-vesting/factory.d.ts +31 -8
- package/dist/fhe-vesting/index.cjs +23 -23
- package/dist/fhe-vesting/index.d.cts +3 -2
- package/dist/fhe-vesting/index.d.ts +3 -2
- package/dist/fhe-vesting/index.js +4 -4
- package/dist/fhe-vesting/manager.d.ts +27 -2
- package/dist/fhe-vesting/react/index.cjs +126 -126
- package/dist/fhe-vesting/react/index.d.cts +3 -2
- package/dist/fhe-vesting/react/index.d.ts +3 -2
- package/dist/fhe-vesting/react/index.js +5 -5
- package/dist/fhe-vesting/react/useCreateManager.d.ts +16 -9
- package/dist/fhe-vesting/react/useCreateManagerAndGetAddress.d.ts +9 -5
- package/dist/fhe-vesting/react/useSplitVesting.d.ts +9 -3
- package/dist/index.cjs +18 -18
- package/dist/index.js +1 -1
- package/dist/testnet-faucet/faucet.d.ts +3 -0
- package/dist/testnet-faucet/index.cjs +15 -15
- package/dist/testnet-faucet/index.js +3 -3
- package/dist/testnet-faucet/react/index.cjs +9 -9
- package/dist/testnet-faucet/react/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { grantInstanceRoles, buildMerkleCampaign, encryptCampaignAmounts, planMerkleCampaign, rotateMerkleRoot } from '../../chunk-
|
|
2
|
-
export { buildMerkleCampaign, buildMerkleTree, encryptCampaignAmounts, grantInstanceRoles, leafOf, planInstanceRoleSplit, planMerkleCampaign, rotateMerkleRoot, validateCampaignRecipients } from '../../chunk-
|
|
3
|
-
import { useMemoAirdropBaseClient, airdropQueryKey, useMemoMerkleAirdropClient, useMemoAirdropFactoryClient,
|
|
4
|
-
export { airdropQueryKey, airdropQueryKeyPrefix } from '../../chunk-
|
|
5
|
-
import { resolveEncryptor, signClaimAuthorization } from '../../chunk-
|
|
6
|
-
export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-
|
|
7
|
-
import { preflightClaim, preflightCreate } from '../../chunk-
|
|
8
|
-
export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, DedupIdConsumedError, FeeCollectorSelfAdministeredError, MerkleUupsUnsupportedError, NonStockWrapperError, PredictionDriftError, SaltCollisionError, SignatureExpiredError, UnauthorizedRedirectError, UpgradeabilityNotAllowedError, preflightClaim, preflightCreate } from '../../chunk-
|
|
1
|
+
import { grantInstanceRoles, buildMerkleCampaign, encryptCampaignAmounts, planMerkleCampaign, rotateMerkleRoot } from '../../chunk-KJUNBOJQ.js';
|
|
2
|
+
export { MERKLE_BATCH_LIMIT, buildMerkleCampaign, buildMerkleTree, encryptCampaignAmounts, grantInstanceRoles, leafOf, planInstanceRoleSplit, planMerkleCampaign, rotateMerkleRoot, validateCampaignRecipients } from '../../chunk-KJUNBOJQ.js';
|
|
3
|
+
import { useMemoAirdropBaseClient, airdropQueryKey, airdropKeys, useMemoMerkleAirdropClient, useMemoAirdropFactoryClient, AIRDROP_FN, useMemoEcdsaAirdropClient, useMemoComplianceManagerClient, staleUntilNonZeroAddress, invalidateAfterCreate } from '../../chunk-3ZSPRHR3.js';
|
|
4
|
+
export { airdropQueryKey, airdropQueryKeyPrefix } from '../../chunk-3ZSPRHR3.js';
|
|
5
|
+
import { resolveEncryptor, signClaimAuthorization } from '../../chunk-67Q6KSVV.js';
|
|
6
|
+
export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-67Q6KSVV.js';
|
|
7
|
+
import { preflightClaim, preflightCreate } from '../../chunk-YMWMIWBP.js';
|
|
8
|
+
export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, ClawbackRequiresPauseError, CreateCommitmentMismatchError, DedupIdConsumedError, FeeCollectorSelfAdministeredError, GasFeeNotAcceptedError, MerkleUupsUnsupportedError, NativeRescueRequiresZeroFeeError, NonStockWrapperError, PredictionDriftError, SaltCollisionError, SignatureExpiredError, UINT96_MAX, UnauthorizedRedirectError, UnrecognisedAirdropError, UpgradeabilityNotAllowedError, preflightClaim, preflightCreate } from '../../chunk-YMWMIWBP.js';
|
|
9
9
|
import '../../chunk-ZWXJTBZO.js';
|
|
10
|
-
import '../../chunk-
|
|
10
|
+
import '../../chunk-7KY4K4PH.js';
|
|
11
11
|
import '../../chunk-4RAAATVY.js';
|
|
12
|
-
import '../../chunk-
|
|
12
|
+
import '../../chunk-GHGF65LN.js';
|
|
13
13
|
import '../../chunk-ZA673I3O.js';
|
|
14
14
|
import '../../chunk-KWFFIJYX.js';
|
|
15
15
|
import { MissingClientError, MissingWalletClientError } from '../../chunk-QBJ7O2B4.js';
|
|
@@ -31,7 +31,7 @@ function useAirdropWindow(args) {
|
|
|
31
31
|
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
32
32
|
return useQuery({
|
|
33
33
|
...args.query,
|
|
34
|
-
queryKey:
|
|
34
|
+
queryKey: airdropKeys.window({ chainId, address: args.address }),
|
|
35
35
|
queryFn: async () => {
|
|
36
36
|
const [startTime, endTime, hasStarted, hasEnded, isActive] = await Promise.all([
|
|
37
37
|
client.startTime(),
|
|
@@ -49,7 +49,7 @@ function useAirdropPaused(args) {
|
|
|
49
49
|
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
50
50
|
return useQuery({
|
|
51
51
|
...args.query,
|
|
52
|
-
queryKey:
|
|
52
|
+
queryKey: airdropKeys.paused({ chainId, address: args.address }),
|
|
53
53
|
queryFn: () => client.paused(),
|
|
54
54
|
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
55
55
|
});
|
|
@@ -58,7 +58,7 @@ function useAirdropGasFee(args) {
|
|
|
58
58
|
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
59
59
|
return useQuery({
|
|
60
60
|
...args.query,
|
|
61
|
-
queryKey:
|
|
61
|
+
queryKey: airdropKeys.gasFee({ chainId, address: args.address }),
|
|
62
62
|
queryFn: () => client.gasFee(),
|
|
63
63
|
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
64
64
|
});
|
|
@@ -68,12 +68,7 @@ function useAirdropHasRole(args) {
|
|
|
68
68
|
const { client, chainId } = useMemoAirdropBaseClient(base);
|
|
69
69
|
return useQuery({
|
|
70
70
|
...args.query,
|
|
71
|
-
queryKey:
|
|
72
|
-
chainId,
|
|
73
|
-
address: args.address,
|
|
74
|
-
fn: "hasRole",
|
|
75
|
-
args: [role, holder]
|
|
76
|
-
}),
|
|
71
|
+
queryKey: airdropKeys.hasRole({ chainId, address: args.address }, role, holder),
|
|
77
72
|
queryFn: () => client.hasRole({ role, holder }),
|
|
78
73
|
enabled: Boolean(client && role && holder && (args.query?.enabled ?? true))
|
|
79
74
|
});
|
|
@@ -82,7 +77,7 @@ function useMerkleRoot(args) {
|
|
|
82
77
|
const { client, chainId } = useMemoMerkleAirdropClient(args);
|
|
83
78
|
return useQuery({
|
|
84
79
|
...args.query,
|
|
85
|
-
queryKey:
|
|
80
|
+
queryKey: airdropKeys.merkleRoot({ chainId, address: args.address }),
|
|
86
81
|
queryFn: () => client.merkleRoot(),
|
|
87
82
|
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
88
83
|
});
|
|
@@ -92,12 +87,7 @@ function useClaimedAmount(args) {
|
|
|
92
87
|
const { client, chainId } = useMemoMerkleAirdropClient(base);
|
|
93
88
|
return useQuery({
|
|
94
89
|
...args.query,
|
|
95
|
-
queryKey:
|
|
96
|
-
chainId,
|
|
97
|
-
address: args.address,
|
|
98
|
-
fn: "getClaimedAmount",
|
|
99
|
-
args: [account]
|
|
100
|
-
}),
|
|
90
|
+
queryKey: airdropKeys.claimedAmount({ chainId, address: args.address }, account),
|
|
101
91
|
queryFn: () => client.getClaimedAmount(account),
|
|
102
92
|
enabled: Boolean(client && account && (args.query?.enabled ?? true))
|
|
103
93
|
});
|
|
@@ -120,28 +110,39 @@ function useFactoryFees(args = {}) {
|
|
|
120
110
|
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(args);
|
|
121
111
|
return useQuery({
|
|
122
112
|
...args.query,
|
|
123
|
-
queryKey:
|
|
113
|
+
queryKey: airdropKeys.fees({ chainId, address: resolvedAddress }),
|
|
124
114
|
queryFn: async () => {
|
|
125
|
-
const [feeCollector, defaultGasFee] = await Promise.all([
|
|
115
|
+
const [feeCollector, defaultGasFee, maxGasFee] = await Promise.all([
|
|
126
116
|
client.feeCollector(),
|
|
127
|
-
client.defaultGasFee()
|
|
117
|
+
client.defaultGasFee(),
|
|
118
|
+
client.maxGasFee()
|
|
128
119
|
]);
|
|
129
|
-
return { feeCollector, defaultGasFee };
|
|
120
|
+
return { feeCollector, defaultGasFee, maxGasFee };
|
|
130
121
|
},
|
|
131
122
|
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
132
123
|
});
|
|
133
124
|
}
|
|
134
|
-
function
|
|
135
|
-
const {
|
|
125
|
+
function useResolveGasFee(args = {}) {
|
|
126
|
+
const { creator, ...base } = args;
|
|
136
127
|
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
137
128
|
return useQuery({
|
|
138
129
|
...args.query,
|
|
139
130
|
queryKey: airdropQueryKey({
|
|
140
131
|
chainId,
|
|
141
132
|
address: resolvedAddress,
|
|
142
|
-
fn:
|
|
143
|
-
args: [
|
|
133
|
+
fn: AIRDROP_FN.resolvedGasFee,
|
|
134
|
+
args: [creator]
|
|
144
135
|
}),
|
|
136
|
+
queryFn: () => client.resolveGasFee(creator),
|
|
137
|
+
enabled: Boolean(client && creator && (args.query?.enabled ?? true))
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function useFactoryRegistry(args = {}) {
|
|
141
|
+
const { offset = 0n, limit = 50n, ...base } = args;
|
|
142
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
143
|
+
return useQuery({
|
|
144
|
+
...args.query,
|
|
145
|
+
queryKey: airdropKeys.registry({ chainId, address: resolvedAddress }, offset, limit),
|
|
145
146
|
queryFn: async () => {
|
|
146
147
|
const [count, items] = await Promise.all([
|
|
147
148
|
client.airdropCount(),
|
|
@@ -152,17 +153,30 @@ function useFactoryRegistry(args = {}) {
|
|
|
152
153
|
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
153
154
|
});
|
|
154
155
|
}
|
|
155
|
-
function
|
|
156
|
-
const {
|
|
156
|
+
function useIsAirdrop(args = {}) {
|
|
157
|
+
const { candidate, ...base } = args;
|
|
157
158
|
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
158
159
|
return useQuery({
|
|
160
|
+
// Per-result, not blanket: `true` is immutable (append-only registry),
|
|
161
|
+
// `false` is not. See the TSDoc above.
|
|
162
|
+
staleTime: (query) => query.state.data === true ? Infinity : 0,
|
|
159
163
|
...args.query,
|
|
160
164
|
queryKey: airdropQueryKey({
|
|
161
165
|
chainId,
|
|
162
166
|
address: resolvedAddress,
|
|
163
|
-
fn:
|
|
164
|
-
args: [
|
|
167
|
+
fn: AIRDROP_FN.isAirdrop,
|
|
168
|
+
args: [candidate]
|
|
165
169
|
}),
|
|
170
|
+
queryFn: () => client.isAirdrop(candidate),
|
|
171
|
+
enabled: Boolean(client && candidate && (args.query?.enabled ?? true))
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function useEffectiveUpgradeable(args = {}) {
|
|
175
|
+
const { creator, ...base } = args;
|
|
176
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
177
|
+
return useQuery({
|
|
178
|
+
...args.query,
|
|
179
|
+
queryKey: airdropKeys.effectiveUpgradeable({ chainId, address: resolvedAddress }, creator),
|
|
166
180
|
queryFn: () => client.effectiveUpgradeable(creator),
|
|
167
181
|
enabled: Boolean(client && creator && (args.query?.enabled ?? true))
|
|
168
182
|
});
|
|
@@ -174,12 +188,22 @@ function useAirdropConfig(args) {
|
|
|
174
188
|
...args.query,
|
|
175
189
|
queryKey: airdropKeys.config({ chainId, address: args.address }),
|
|
176
190
|
queryFn: async () => {
|
|
177
|
-
const [
|
|
191
|
+
const [
|
|
192
|
+
token,
|
|
193
|
+
airdropType,
|
|
194
|
+
unwrappable,
|
|
195
|
+
complianceManager,
|
|
196
|
+
gasFee,
|
|
197
|
+
canExtendClaimWindow,
|
|
198
|
+
deploymentBlockNumber
|
|
199
|
+
] = await Promise.all([
|
|
178
200
|
client.token(),
|
|
179
201
|
client.airdropType(),
|
|
180
202
|
client.unwrappable(),
|
|
181
203
|
client.complianceManager(),
|
|
182
|
-
client.gasFee()
|
|
204
|
+
client.gasFee(),
|
|
205
|
+
client.canExtendClaimWindow(),
|
|
206
|
+
client.deploymentBlockNumber()
|
|
183
207
|
]);
|
|
184
208
|
return {
|
|
185
209
|
token,
|
|
@@ -187,7 +211,9 @@ function useAirdropConfig(args) {
|
|
|
187
211
|
variant: airdropType === 1 ? "merkle" : "ecdsa",
|
|
188
212
|
unwrappable,
|
|
189
213
|
complianceManager,
|
|
190
|
-
gasFee
|
|
214
|
+
gasFee,
|
|
215
|
+
canExtendClaimWindow,
|
|
216
|
+
deploymentBlockNumber
|
|
191
217
|
};
|
|
192
218
|
},
|
|
193
219
|
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
@@ -329,14 +355,9 @@ function useComplianceManagerOf(args = {}) {
|
|
|
329
355
|
const { airdrop, ...base } = args;
|
|
330
356
|
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
331
357
|
return useQuery({
|
|
332
|
-
staleTime:
|
|
358
|
+
staleTime: staleUntilNonZeroAddress,
|
|
333
359
|
...args.query,
|
|
334
|
-
queryKey:
|
|
335
|
-
chainId,
|
|
336
|
-
address: resolvedAddress,
|
|
337
|
-
fn: "complianceManagerOf",
|
|
338
|
-
args: [airdrop]
|
|
339
|
-
}),
|
|
360
|
+
queryKey: airdropKeys.complianceManagerOf({ chainId, address: resolvedAddress }, airdrop),
|
|
340
361
|
queryFn: () => client.complianceManagerOf(airdrop),
|
|
341
362
|
enabled: Boolean(client && airdrop && (args.query?.enabled ?? true))
|
|
342
363
|
});
|
|
@@ -379,6 +400,16 @@ function useComplianceRoleMembers(args) {
|
|
|
379
400
|
enabled: Boolean(client && role && (args.query?.enabled ?? true))
|
|
380
401
|
});
|
|
381
402
|
}
|
|
403
|
+
function useDedupMode(args) {
|
|
404
|
+
const { client, chainId } = useMemoEcdsaAirdropClient(args);
|
|
405
|
+
return useQuery({
|
|
406
|
+
staleTime: Infinity,
|
|
407
|
+
...args.query,
|
|
408
|
+
queryKey: airdropKeys.dedupMode({ chainId, address: args.address }),
|
|
409
|
+
queryFn: () => client.readDedupMode(),
|
|
410
|
+
enabled: Boolean(client && (args.query?.enabled ?? true))
|
|
411
|
+
});
|
|
412
|
+
}
|
|
382
413
|
function useEcdsaDomain(args) {
|
|
383
414
|
const { client, chainId } = useMemoEcdsaAirdropClient(args);
|
|
384
415
|
return useQuery({
|
|
@@ -403,12 +434,10 @@ function useEffectiveDelegateToCompliance(args = {}) {
|
|
|
403
434
|
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
404
435
|
return useQuery({
|
|
405
436
|
...args.query,
|
|
406
|
-
queryKey:
|
|
407
|
-
chainId,
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
args: [creator]
|
|
411
|
-
}),
|
|
437
|
+
queryKey: airdropKeys.effectiveDelegateToCompliance(
|
|
438
|
+
{ chainId, address: resolvedAddress },
|
|
439
|
+
creator
|
|
440
|
+
),
|
|
412
441
|
queryFn: () => client.effectiveDelegateToCompliance(creator),
|
|
413
442
|
enabled: Boolean(client && creator && (args.query?.enabled ?? true))
|
|
414
443
|
});
|
|
@@ -499,6 +528,13 @@ function usePreflightCreateAirdrop(args = {}) {
|
|
|
499
528
|
args.creator,
|
|
500
529
|
args.userSalt,
|
|
501
530
|
args.expectedInitCodeHash,
|
|
531
|
+
// Pinned commitments change the reported quote.
|
|
532
|
+
args.expected,
|
|
533
|
+
// A plan pins three scalars; `entries` never changes the verdict, and
|
|
534
|
+
// keying on it would hash every ciphertext on each render.
|
|
535
|
+
args.variant === "merkle" ? args.plan?.predictedAddress : void 0,
|
|
536
|
+
args.variant === "merkle" ? args.plan?.root : void 0,
|
|
537
|
+
args.variant === "merkle" ? args.plan?.initCodeHashAfter : void 0,
|
|
502
538
|
// `params` IS key-affecting here, unlike in the predict hooks: the
|
|
503
539
|
// stock-wrapper probe reads `common.token` / `common.unwrappable`.
|
|
504
540
|
args.params
|
|
@@ -510,15 +546,27 @@ function usePreflightCreateAirdrop(args = {}) {
|
|
|
510
546
|
mode: args.mode,
|
|
511
547
|
creator: args.creator,
|
|
512
548
|
userSalt: args.userSalt,
|
|
513
|
-
expectedInitCodeHash: args.expectedInitCodeHash
|
|
549
|
+
expectedInitCodeHash: args.expectedInitCodeHash,
|
|
550
|
+
expected: args.expected
|
|
514
551
|
};
|
|
515
|
-
return args.variant === "merkle" ? preflightCreate({ ...common, variant: "merkle", params: args.params }) : preflightCreate({ ...common, variant: "ecdsa", params: args.params });
|
|
552
|
+
return args.variant === "merkle" ? preflightCreate({ ...common, variant: "merkle", params: args.params, plan: args.plan }) : preflightCreate({ ...common, variant: "ecdsa", params: args.params });
|
|
516
553
|
},
|
|
517
554
|
enabled: Boolean(
|
|
518
555
|
client && args.variant && args.params && args.mode && args.creator && args.userSalt && (args.query?.enabled ?? true)
|
|
519
556
|
)
|
|
520
557
|
});
|
|
521
558
|
}
|
|
559
|
+
function useTokenOf(args = {}) {
|
|
560
|
+
const { airdrop, ...base } = args;
|
|
561
|
+
const { client, chainId, resolvedAddress } = useMemoAirdropFactoryClient(base);
|
|
562
|
+
return useQuery({
|
|
563
|
+
staleTime: staleUntilNonZeroAddress,
|
|
564
|
+
...args.query,
|
|
565
|
+
queryKey: airdropKeys.tokenOf({ chainId, address: resolvedAddress }, airdrop),
|
|
566
|
+
queryFn: () => client.tokenOf(airdrop),
|
|
567
|
+
enabled: Boolean(client && airdrop && (args.query?.enabled ?? true))
|
|
568
|
+
});
|
|
569
|
+
}
|
|
522
570
|
function useCreateEcdsaAirdrop(options = {}) {
|
|
523
571
|
const { client, resolutionError, chainId, resolvedAddress } = useMemoAirdropFactoryClient(options);
|
|
524
572
|
const queryClient = useQueryClient();
|
|
@@ -529,10 +577,8 @@ function useCreateEcdsaAirdrop(options = {}) {
|
|
|
529
577
|
}
|
|
530
578
|
return client.createEcdsaAirdrop(args);
|
|
531
579
|
},
|
|
532
|
-
onSuccess: () => {
|
|
533
|
-
|
|
534
|
-
queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
|
|
535
|
-
});
|
|
580
|
+
onSuccess: (result) => {
|
|
581
|
+
invalidateAfterCreate(queryClient, { chainId, address: resolvedAddress }, result.airdrop);
|
|
536
582
|
}
|
|
537
583
|
});
|
|
538
584
|
}
|
|
@@ -546,10 +592,8 @@ function useCreateMerkleAirdrop(options = {}) {
|
|
|
546
592
|
}
|
|
547
593
|
return client.createMerkleAirdrop(args);
|
|
548
594
|
},
|
|
549
|
-
onSuccess: () => {
|
|
550
|
-
|
|
551
|
-
queryKey: airdropQueryKeyPrefix({ chainId, address: resolvedAddress, fn: "registry" })
|
|
552
|
-
});
|
|
595
|
+
onSuccess: (result) => {
|
|
596
|
+
invalidateAfterCreate(queryClient, { chainId, address: resolvedAddress }, result.airdrop);
|
|
553
597
|
}
|
|
554
598
|
});
|
|
555
599
|
}
|
|
@@ -595,12 +639,7 @@ function useMerkleClaim(options) {
|
|
|
595
639
|
onSuccess: (_hash, _variables, context) => {
|
|
596
640
|
if (!context?.account) return;
|
|
597
641
|
void queryClient.invalidateQueries({
|
|
598
|
-
queryKey:
|
|
599
|
-
chainId,
|
|
600
|
-
address: options.address,
|
|
601
|
-
fn: "getClaimedAmount",
|
|
602
|
-
args: [context.account]
|
|
603
|
-
})
|
|
642
|
+
queryKey: airdropKeys.claimedAmount({ chainId, address: options.address }, context.account)
|
|
604
643
|
});
|
|
605
644
|
}
|
|
606
645
|
});
|
|
@@ -617,12 +656,7 @@ function useSetMerkleRoot(options) {
|
|
|
617
656
|
},
|
|
618
657
|
onSuccess: () => {
|
|
619
658
|
void queryClient.invalidateQueries({
|
|
620
|
-
queryKey:
|
|
621
|
-
chainId,
|
|
622
|
-
address: options.address,
|
|
623
|
-
fn: "merkleRoot",
|
|
624
|
-
args: []
|
|
625
|
-
})
|
|
659
|
+
queryKey: airdropKeys.merkleRoot({ chainId, address: options.address })
|
|
626
660
|
});
|
|
627
661
|
}
|
|
628
662
|
});
|
|
@@ -659,12 +693,9 @@ function useAirdropPause(options) {
|
|
|
659
693
|
return paused ? client.pause(rest) : client.unpause(rest);
|
|
660
694
|
},
|
|
661
695
|
onSuccess: () => {
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
});
|
|
665
|
-
void queryClient.invalidateQueries({
|
|
666
|
-
queryKey: airdropQueryKey({ chainId, address: options.address, fn: "window", args: [] })
|
|
667
|
-
});
|
|
696
|
+
const scope = { chainId, address: options.address };
|
|
697
|
+
void queryClient.invalidateQueries({ queryKey: airdropKeys.paused(scope) });
|
|
698
|
+
void queryClient.invalidateQueries({ queryKey: airdropKeys.window(scope) });
|
|
668
699
|
}
|
|
669
700
|
});
|
|
670
701
|
}
|
|
@@ -680,7 +711,7 @@ function useExtendClaimWindow(options) {
|
|
|
680
711
|
},
|
|
681
712
|
onSuccess: () => {
|
|
682
713
|
void queryClient.invalidateQueries({
|
|
683
|
-
queryKey:
|
|
714
|
+
queryKey: airdropKeys.window({ chainId, address: options.address })
|
|
684
715
|
});
|
|
685
716
|
}
|
|
686
717
|
});
|
|
@@ -696,6 +727,17 @@ function useWithdrawConfidential(options) {
|
|
|
696
727
|
}
|
|
697
728
|
});
|
|
698
729
|
}
|
|
730
|
+
function useRescueNativeToken(options) {
|
|
731
|
+
const { client } = useMemoAirdropBaseClient(options);
|
|
732
|
+
return useMutation({
|
|
733
|
+
mutationFn: async (args) => {
|
|
734
|
+
if (!client) {
|
|
735
|
+
throw new MissingClientError("useRescueNativeToken", "airdrop-base");
|
|
736
|
+
}
|
|
737
|
+
return client.rescueNativeToken(args);
|
|
738
|
+
}
|
|
739
|
+
});
|
|
740
|
+
}
|
|
699
741
|
function useAddComplianceDelegate(options) {
|
|
700
742
|
const { client, chainId } = useMemoComplianceManagerClient(options);
|
|
701
743
|
const queryClient = useQueryClient();
|
|
@@ -805,8 +847,7 @@ function useBuildMerkleCampaign(options = {}) {
|
|
|
805
847
|
mutationFn: async (args) => buildMerkleCampaign({
|
|
806
848
|
instance: args.instance,
|
|
807
849
|
recipients: args.recipients,
|
|
808
|
-
encryptor: () => resolveEncryptor(encryptorSourceRef.current)
|
|
809
|
-
...args.submitter !== void 0 ? { submitter: args.submitter } : {}
|
|
850
|
+
encryptor: () => resolveEncryptor(encryptorSourceRef.current)
|
|
810
851
|
})
|
|
811
852
|
});
|
|
812
853
|
}
|
|
@@ -881,10 +922,8 @@ function useCreateAndFundEcdsaAirdrop(options = {}) {
|
|
|
881
922
|
}
|
|
882
923
|
return client.createAndFundEcdsaAirdrop(args);
|
|
883
924
|
},
|
|
884
|
-
onSuccess: () => {
|
|
885
|
-
|
|
886
|
-
queryKey: airdropKeys.registryAll({ chainId, address: resolvedAddress })
|
|
887
|
-
});
|
|
925
|
+
onSuccess: (result) => {
|
|
926
|
+
invalidateAfterCreate(queryClient, { chainId, address: resolvedAddress }, result.airdrop);
|
|
888
927
|
}
|
|
889
928
|
});
|
|
890
929
|
}
|
|
@@ -898,10 +937,8 @@ function useCreateAndFundMerkleAirdrop(options = {}) {
|
|
|
898
937
|
}
|
|
899
938
|
return client.createAndFundMerkleAirdrop(args);
|
|
900
939
|
},
|
|
901
|
-
onSuccess: () => {
|
|
902
|
-
|
|
903
|
-
queryKey: airdropKeys.registryAll({ chainId, address: resolvedAddress })
|
|
904
|
-
});
|
|
940
|
+
onSuccess: (result) => {
|
|
941
|
+
invalidateAfterCreate(queryClient, { chainId, address: resolvedAddress }, result.airdrop);
|
|
905
942
|
}
|
|
906
943
|
});
|
|
907
944
|
}
|
|
@@ -940,8 +977,7 @@ function useEncryptCampaignAmounts(options = {}) {
|
|
|
940
977
|
mutationFn: async (args) => encryptCampaignAmounts({
|
|
941
978
|
instance: args.instance,
|
|
942
979
|
recipients: args.recipients,
|
|
943
|
-
encryptor: () => resolveEncryptor(encryptorSourceRef.current)
|
|
944
|
-
...args.submitter !== void 0 ? { submitter: args.submitter } : {}
|
|
980
|
+
encryptor: () => resolveEncryptor(encryptorSourceRef.current)
|
|
945
981
|
})
|
|
946
982
|
});
|
|
947
983
|
}
|
|
@@ -971,6 +1007,21 @@ function useMerkleClaimAndUnwrap(options) {
|
|
|
971
1007
|
}
|
|
972
1008
|
});
|
|
973
1009
|
}
|
|
1010
|
+
function useUnwrapRequest(args) {
|
|
1011
|
+
const { client, chainId } = useMemoAirdropBaseClient(args);
|
|
1012
|
+
return useQuery({
|
|
1013
|
+
staleTime: Infinity,
|
|
1014
|
+
...args.query,
|
|
1015
|
+
queryKey: airdropQueryKey({
|
|
1016
|
+
chainId,
|
|
1017
|
+
address: args.address,
|
|
1018
|
+
fn: "unwrapRequest",
|
|
1019
|
+
args: [args.hash]
|
|
1020
|
+
}),
|
|
1021
|
+
queryFn: () => client.readUnwrapRequest(args.hash),
|
|
1022
|
+
enabled: Boolean(client && args.hash && (args.query?.enabled ?? true))
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
974
1025
|
function usePlanMerkleCampaign(options = {}) {
|
|
975
1026
|
const { client, resolutionError } = useMemoAirdropFactoryClient(options);
|
|
976
1027
|
const encryptorSourceRef = useRef(options.encryptor);
|
|
@@ -1043,7 +1094,6 @@ function useRotateMerkleRoot(options) {
|
|
|
1043
1094
|
airdrop: client,
|
|
1044
1095
|
recipients: args.recipients,
|
|
1045
1096
|
encryptor: () => resolveEncryptor(encryptorSourceRef.current),
|
|
1046
|
-
...args.submitter !== void 0 ? { submitter: args.submitter } : {},
|
|
1047
1097
|
...args.account !== void 0 ? { account: args.account } : {}
|
|
1048
1098
|
});
|
|
1049
1099
|
},
|
|
@@ -1121,6 +1171,17 @@ function useAdminGetCurrentBalance(options) {
|
|
|
1121
1171
|
}
|
|
1122
1172
|
});
|
|
1123
1173
|
}
|
|
1174
|
+
function useRefreshComplianceBalance(options) {
|
|
1175
|
+
const { client } = useMemoAirdropBaseClient(options);
|
|
1176
|
+
return useMutation({
|
|
1177
|
+
mutationFn: async (args) => {
|
|
1178
|
+
if (!client) {
|
|
1179
|
+
throw new MissingClientError("useRefreshComplianceBalance", "airdrop-base");
|
|
1180
|
+
}
|
|
1181
|
+
return client.refreshComplianceBalance(args ?? {});
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1124
1185
|
function useAccessEcdsaClaimAmount(options) {
|
|
1125
1186
|
const { client } = useMemoEcdsaAirdropClient(options);
|
|
1126
1187
|
return useMutation({
|
|
@@ -1144,4 +1205,4 @@ function useAccessMerkleClaimAmount(options) {
|
|
|
1144
1205
|
});
|
|
1145
1206
|
}
|
|
1146
1207
|
|
|
1147
|
-
export { useAccessEcdsaClaimAmount, useAccessMerkleClaimAmount, useAddComplianceDelegate, useAdminBatchDiscloseBalanceToParties, useAdminDiscloseBalanceToParty, useAdminGetCurrentBalance, useAirdropConfig, useAirdropDeploymentMode, useAirdropGasFee, useAirdropGrantRole, useAirdropHasRole, useAirdropPause, useAirdropPaused, useAirdropRenounceRole, useAirdropRevokeRole, useAirdropRoleAdmin, useAirdropRoleConstants, useAirdropRoleMembers, useAirdropToken, useAirdropUpgradeToAndCall, useAirdropWindow, useBatchDiscloseHandlesToParty, useBuildMerkleCampaign, useClaimedAmount, useComplianceGrantRole, useComplianceHasRole, useComplianceInfo, useComplianceManager, useComplianceManagerOf, useComplianceRenounceRole, useComplianceRevokeRole, useComplianceRoleConstants, useComplianceRoleMembers, useCreateAndFundEcdsaAirdrop, useCreateAndFundMerkleAirdrop, useCreateEcdsaAirdrop, useCreateMerkleAirdrop, useDiscloseHandleToParty, useEcdsaClaim, useEcdsaClaimAndUnwrap, useEcdsaDomain, useEffectiveDelegateToCompliance, useEffectiveUpgradeable, useEncryptCampaignAmounts, useExtendClaimWindow, useFactoryFees, useFactoryRegistry, useFundAirdrop, useGrantInstanceRoles, useIsActiveDelegate, useIsMerkleRootMutable, useIsSignatureValid, useMerkleClaim, useMerkleClaimAndUnwrap, useMerkleRoot, usePlanMerkleCampaign, usePreflightClaim, usePreflightCreateAirdrop, useRescueERC20, useRescueOtherConfidentialToken, useRevokeComplianceDelegate, useRotateMerkleRoot, useSetMerkleRoot, useSignClaimAuthorization, useWithdrawConfidential, useWithdrawGasFee };
|
|
1208
|
+
export { useAccessEcdsaClaimAmount, useAccessMerkleClaimAmount, useAddComplianceDelegate, useAdminBatchDiscloseBalanceToParties, useAdminDiscloseBalanceToParty, useAdminGetCurrentBalance, useAirdropConfig, useAirdropDeploymentMode, useAirdropGasFee, useAirdropGrantRole, useAirdropHasRole, useAirdropPause, useAirdropPaused, useAirdropRenounceRole, useAirdropRevokeRole, useAirdropRoleAdmin, useAirdropRoleConstants, useAirdropRoleMembers, useAirdropToken, useAirdropUpgradeToAndCall, useAirdropWindow, useBatchDiscloseHandlesToParty, useBuildMerkleCampaign, useClaimedAmount, useComplianceGrantRole, useComplianceHasRole, useComplianceInfo, useComplianceManager, useComplianceManagerOf, useComplianceRenounceRole, useComplianceRevokeRole, useComplianceRoleConstants, useComplianceRoleMembers, useCreateAndFundEcdsaAirdrop, useCreateAndFundMerkleAirdrop, useCreateEcdsaAirdrop, useCreateMerkleAirdrop, useDedupMode, useDiscloseHandleToParty, useEcdsaClaim, useEcdsaClaimAndUnwrap, useEcdsaDomain, useEffectiveDelegateToCompliance, useEffectiveUpgradeable, useEncryptCampaignAmounts, useExtendClaimWindow, useFactoryFees, useFactoryRegistry, useFundAirdrop, useGrantInstanceRoles, useIsActiveDelegate, useIsAirdrop, useIsMerkleRootMutable, useIsSignatureValid, useMerkleClaim, useMerkleClaimAndUnwrap, useMerkleRoot, usePlanMerkleCampaign, usePreflightClaim, usePreflightCreateAirdrop, useRefreshComplianceBalance, useRescueERC20, useRescueNativeToken, useRescueOtherConfidentialToken, useResolveGasFee, useRevokeComplianceDelegate, useRotateMerkleRoot, useSetMerkleRoot, useSignClaimAuthorization, useTokenOf, useUnwrapRequest, useWithdrawConfidential, useWithdrawGasFee };
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
*
|
|
13
13
|
* A `fn` label used by exactly one hook stays inline in that hook.
|
|
14
14
|
*/
|
|
15
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
15
16
|
import type { Address, Hex } from "viem";
|
|
17
|
+
import type { DeploymentMode } from "../constants.js";
|
|
16
18
|
/** Chain + contract scope every key below is built against. */
|
|
17
19
|
interface Scope {
|
|
18
20
|
chainId: number | undefined;
|
|
@@ -22,6 +24,7 @@ interface Scope {
|
|
|
22
24
|
export declare const AIRDROP_FN: {
|
|
23
25
|
readonly claimedAmount: "getClaimedAmount";
|
|
24
26
|
readonly paused: "paused";
|
|
27
|
+
readonly dedupMode: "dedupMode";
|
|
25
28
|
readonly window: "window";
|
|
26
29
|
readonly config: "config";
|
|
27
30
|
readonly merkleRoot: "merkleRoot";
|
|
@@ -33,21 +36,32 @@ export declare const AIRDROP_FN: {
|
|
|
33
36
|
readonly isSignatureValid: "isSignatureValid";
|
|
34
37
|
readonly fees: "fees";
|
|
35
38
|
readonly registry: "registry";
|
|
39
|
+
readonly isAirdrop: "isAirdrop";
|
|
40
|
+
readonly resolvedGasFee: "resolvedGasFee";
|
|
36
41
|
readonly customFee: "customFee";
|
|
37
42
|
readonly implementations: "implementations";
|
|
43
|
+
readonly tokenOf: "tokenOf";
|
|
44
|
+
readonly complianceManagerOf: "complianceManagerOf";
|
|
38
45
|
readonly compliancePolicy: "compliancePolicy";
|
|
39
46
|
readonly upgradeabilityPolicy: "upgradeabilityPolicy";
|
|
40
47
|
readonly factoryHasRole: "factoryHasRole";
|
|
41
48
|
readonly factoryRoleMembers: "factoryRoleMembers";
|
|
49
|
+
readonly effectiveDelegateToCompliance: "effectiveDelegateToCompliance";
|
|
50
|
+
readonly effectiveUpgradeable: "effectiveUpgradeable";
|
|
51
|
+
readonly complianceDelegate: "complianceDelegate";
|
|
52
|
+
readonly ecdsaInitCodeHash: "getEcdsaInitCodeHash";
|
|
53
|
+
readonly predictEcdsaAddress: "predictEcdsaAirdropAddress";
|
|
54
|
+
readonly merkleInitCodeHash: "getMerkleInitCodeHash";
|
|
55
|
+
readonly predictMerkleAddress: "predictMerkleAirdropAddress";
|
|
42
56
|
readonly complianceInfo: "complianceInfo";
|
|
43
57
|
readonly activeDelegate: "isActiveDelegate";
|
|
44
|
-
readonly clientDelegates: "clientDelegates";
|
|
45
58
|
readonly complianceHasRole: "complianceHasRole";
|
|
46
59
|
readonly complianceRoleMembers: "complianceRoleMembers";
|
|
47
60
|
};
|
|
48
61
|
export declare const airdropKeys: {
|
|
49
62
|
/** One account's cumulative delivered total. Keyed on the CLAIM IDENTITY, never the sender. */
|
|
50
63
|
readonly claimedAmount: (s: Scope, account: Address | undefined) => unknown[];
|
|
64
|
+
readonly dedupMode: (s: Scope) => unknown[];
|
|
51
65
|
readonly paused: (s: Scope) => unknown[];
|
|
52
66
|
readonly window: (s: Scope) => unknown[];
|
|
53
67
|
readonly config: (s: Scope) => unknown[];
|
|
@@ -65,9 +79,17 @@ export declare const airdropKeys: {
|
|
|
65
79
|
readonly isSignatureValidAll: (s: Scope) => unknown[];
|
|
66
80
|
readonly fees: (s: Scope) => unknown[];
|
|
67
81
|
readonly customFee: (s: Scope, creator: Address | undefined) => unknown[];
|
|
68
|
-
readonly
|
|
82
|
+
readonly resolvedGasFee: (s: Scope, creator: Address | undefined) => unknown[];
|
|
83
|
+
/** Every creator's resolved fee; the default and any override both move it. */
|
|
84
|
+
readonly resolvedGasFeeAll: (s: Scope) => unknown[];
|
|
85
|
+
readonly registry: (s: Scope, offset: bigint | undefined, limit: bigint | undefined) => unknown[];
|
|
69
86
|
/** Every registry page, whatever offset/limit was queried. */
|
|
70
87
|
readonly registryAll: (s: Scope) => unknown[];
|
|
88
|
+
readonly isAirdrop: (s: Scope, candidate: Address | undefined) => unknown[];
|
|
89
|
+
/** Every genuineness answer from this factory; a create adds one address. */
|
|
90
|
+
readonly isAirdropAll: (s: Scope) => unknown[];
|
|
91
|
+
readonly tokenOf: (s: Scope, airdrop: Address | undefined) => unknown[];
|
|
92
|
+
readonly complianceManagerOf: (s: Scope, airdrop: Address | undefined) => unknown[];
|
|
71
93
|
readonly implementations: (s: Scope) => unknown[];
|
|
72
94
|
readonly compliancePolicy: (s: Scope, creator: Address | undefined) => unknown[];
|
|
73
95
|
readonly compliancePolicyAll: (s: Scope) => unknown[];
|
|
@@ -76,15 +98,40 @@ export declare const airdropKeys: {
|
|
|
76
98
|
readonly factoryHasRole: (s: Scope, role: Hex | undefined, holder: Address | undefined) => unknown[];
|
|
77
99
|
readonly factoryHasRoleAll: (s: Scope) => unknown[];
|
|
78
100
|
readonly factoryRoleMembers: (s: Scope, role: Hex | undefined) => unknown[];
|
|
79
|
-
readonly
|
|
101
|
+
readonly effectiveDelegateToCompliance: (s: Scope, creator: Address | undefined) => unknown[];
|
|
102
|
+
/** Every creator's effective compliance default; the factory-wide default moves them all. */
|
|
103
|
+
readonly effectiveDelegateToComplianceAll: (s: Scope) => unknown[];
|
|
104
|
+
readonly effectiveUpgradeable: (s: Scope, creator: Address | undefined) => unknown[];
|
|
105
|
+
/** Every creator's effective upgradeability; the factory-wide default moves them all. */
|
|
106
|
+
readonly effectiveUpgradeableAll: (s: Scope) => unknown[];
|
|
107
|
+
readonly complianceDelegate: (s: Scope) => unknown[];
|
|
108
|
+
/** Keyed on `mode` only: `params` does not affect the hash (see `useEcdsaInitCodeHash`). */
|
|
109
|
+
readonly ecdsaInitCodeHash: (s: Scope, mode: DeploymentMode) => unknown[];
|
|
110
|
+
readonly ecdsaInitCodeHashAll: (s: Scope) => unknown[];
|
|
111
|
+
readonly predictEcdsaAddress: (s: Scope, mode: DeploymentMode, deployer: Address, userSalt: Hex) => unknown[];
|
|
112
|
+
readonly predictEcdsaAddressAll: (s: Scope) => unknown[];
|
|
113
|
+
readonly merkleInitCodeHash: (s: Scope, mode: DeploymentMode) => unknown[];
|
|
114
|
+
readonly merkleInitCodeHashAll: (s: Scope) => unknown[];
|
|
115
|
+
readonly predictMerkleAddress: (s: Scope, mode: DeploymentMode, deployer: Address, userSalt: Hex) => unknown[];
|
|
116
|
+
readonly predictMerkleAddressAll: (s: Scope) => unknown[];
|
|
80
117
|
readonly complianceInfo: (s: Scope) => unknown[];
|
|
81
118
|
readonly activeDelegate: (s: Scope, delegate: Address | undefined) => unknown[];
|
|
82
|
-
readonly activeDelegateAll: (s: Scope) => unknown[];
|
|
83
|
-
readonly clientDelegates: (s: Scope, index: bigint | undefined) => unknown[];
|
|
84
|
-
readonly clientDelegatesAll: (s: Scope) => unknown[];
|
|
85
119
|
readonly complianceHasRole: (s: Scope, role: Hex | undefined, holder: Address | undefined) => unknown[];
|
|
86
120
|
readonly complianceHasRoleAll: (s: Scope) => unknown[];
|
|
87
121
|
readonly complianceRoleMembers: (s: Scope, role: Hex | undefined) => unknown[];
|
|
88
|
-
readonly complianceRoleMembersAll: (s: Scope) => unknown[];
|
|
89
122
|
};
|
|
123
|
+
/**
|
|
124
|
+
* Invalidate everything a create makes stale, for the four factory create hooks.
|
|
125
|
+
*
|
|
126
|
+
* - `registryAll`: the registry gained an instance.
|
|
127
|
+
* - `isAirdropAll`: `isAirdrop(airdrop)` flipped from false to true.
|
|
128
|
+
* - `preflightCreateAll`: the create consumed its `(mode, deployer, userSalt)`, so a cached
|
|
129
|
+
* `ready: true` for it is now a guaranteed `SaltCollisionError`.
|
|
130
|
+
* - `tokenOf` / `complianceManagerOf` for `airdrop`: a read of the predicted address taken
|
|
131
|
+
* before the create cached a zero.
|
|
132
|
+
*
|
|
133
|
+
* A receipt-free create runs this too, before the transaction executes. That is harmless:
|
|
134
|
+
* the refetch reads the pre-create state and the entries are marked stale again later.
|
|
135
|
+
*/
|
|
136
|
+
export declare function invalidateAfterCreate(queryClient: QueryClient, scope: Scope, airdrop: Address): void;
|
|
90
137
|
export {};
|
|
@@ -10,15 +10,18 @@ import { type EcdsaAirdropInstanceClientOptions } from "./_shared.js";
|
|
|
10
10
|
* with `FHE.allow(amount, msg.sender)`, unlike {@link useAccessMerkleClaimAmount}, whose
|
|
11
11
|
* grantee is the entry's claim identity rather than the caller.
|
|
12
12
|
*
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
13
|
+
* An empty `inputProof` is accepted only for a zero handle or one the sender and the
|
|
14
|
+
* instance already hold ACL on; see `EcdsaClaimArgs.encryptedInput`.
|
|
15
|
+
*
|
|
16
|
+
* `dedupMode` is deprecated - no call branches on it. Read the
|
|
17
|
+
* instance's actual policy with `useDedupMode`.
|
|
15
18
|
*
|
|
16
19
|
* **Invalidates:** nothing. The preview consumes neither replay guard nor the EIP-712
|
|
17
20
|
* digest, so the same input is still claimable for real afterwards and no cached read
|
|
18
21
|
* changes value.
|
|
19
22
|
*
|
|
20
23
|
* @example
|
|
21
|
-
* const preview = useAccessEcdsaClaimAmount({ address: airdropAddress
|
|
24
|
+
* const preview = useAccessEcdsaClaimAmount({ address: airdropAddress });
|
|
22
25
|
* const { handle } = await preview.mutateAsync({ encryptedInput, dedupId, deadline, signer, signature });
|
|
23
26
|
*
|
|
24
27
|
* @alpha
|
|
@@ -6,8 +6,8 @@ import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
|
6
6
|
* **Submits a transaction.** Previews the outstanding amount for a proof-bearing Merkle
|
|
7
7
|
* entry as an encrypted handle. Pass `data.handle` to the Zama relayer's `userDecrypt`.
|
|
8
8
|
*
|
|
9
|
-
* `entry.
|
|
10
|
-
*
|
|
9
|
+
* `entry.account` selects the leaf. A leaf someone else already settled previews as an
|
|
10
|
+
* encrypted zero; see {@link MerkleClaimArgs.entry}.
|
|
11
11
|
*
|
|
12
12
|
* **`entry.account` is the only party that can decrypt the result, not the submitter.**
|
|
13
13
|
* The contract grants the outstanding handle with `_outstandingOf(account, account, …)`,
|