@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,11 +1,16 @@
|
|
|
1
1
|
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
-
import { type
|
|
2
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
3
|
+
/** @alpha */
|
|
4
|
+
export type UseAirdropGasFeeArgs = AirdropInstanceHookOptions<bigint>;
|
|
3
5
|
/**
|
|
4
|
-
* Read the
|
|
5
|
-
*
|
|
6
|
-
* `value`
|
|
6
|
+
* Read the per-claim ETH fee (wei) an instance charges; `0n` on a fee-free
|
|
7
|
+
* campaign. Every claim entrypoint (`useEcdsaClaim` / `useMerkleClaim`)
|
|
8
|
+
* reads this itself and attaches it as `value` — this hook is for a UI that
|
|
9
|
+
* wants to display the fee before the claimant submits.
|
|
7
10
|
*
|
|
8
11
|
* @example
|
|
9
12
|
* const { data: gasFee } = useAirdropGasFee({ address: airdropAddress });
|
|
13
|
+
*
|
|
14
|
+
* @alpha
|
|
10
15
|
*/
|
|
11
|
-
export declare function useAirdropGasFee(
|
|
16
|
+
export declare function useAirdropGasFee(args: UseAirdropGasFeeArgs): UseQueryResult<bigint, Error>;
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
|
-
import { type
|
|
4
|
-
|
|
3
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface UseAirdropHasRoleArgs extends AirdropInstanceHookOptions<boolean> {
|
|
6
|
+
/** A `bytes32` role identifier — read it from the headless client's role getters (`PAUSER_ROLE()`, etc.), not hand-hashed. */
|
|
5
7
|
role?: Hex;
|
|
6
|
-
account
|
|
8
|
+
/** The account to check. */
|
|
9
|
+
holder?: Address;
|
|
7
10
|
}
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
12
|
+
* Whether `holder` holds `role` on an airdrop instance.
|
|
10
13
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
14
|
+
* Stays disabled (no request fired) until both `role` and `holder` are
|
|
15
|
+
* defined — a UI can call this unconditionally while a form is still being
|
|
16
|
+
* filled in, with no manual `enabled` guard.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const { data: isPauser } = useAirdropHasRole({ address, role: pauserRole, holder: account });
|
|
20
|
+
*
|
|
21
|
+
* @alpha
|
|
13
22
|
*/
|
|
14
23
|
export declare function useAirdropHasRole(args: UseAirdropHasRoleArgs): UseQueryResult<boolean, Error>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/** @alpha */
|
|
6
|
+
export interface AirdropPauseArgs extends WriteAccountOverride {
|
|
7
|
+
/** `true` calls `pause()`, `false` calls `unpause()`. Both require `PAUSER_ROLE`. */
|
|
8
|
+
paused: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Set an airdrop instance's pause flag. One hook covers both directions —
|
|
12
|
+
* `paused: true` submits `pause()`, `paused: false` submits `unpause()` —
|
|
13
|
+
* rather than shipping two near-identical hooks for what is one UI toggle.
|
|
14
|
+
*
|
|
15
|
+
* Pausing does not stop the clock: `endTime` still passes while paused. Pair
|
|
16
|
+
* with `useExtendClaimWindow` when the campaign is meant to survive the
|
|
17
|
+
* pause.
|
|
18
|
+
*
|
|
19
|
+
* **Invalidates:** this instance's `useAirdropPaused` entry, and its
|
|
20
|
+
* `useAirdropWindow` entry — `isClaimWindowActive` ANDs the pause flag into
|
|
21
|
+
* `window.isActive`, so a mounted `useAirdropWindow` consumer would otherwise
|
|
22
|
+
* keep showing a stale `isActive` after a pause/unpause.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const setPause = useAirdropPause({ address: airdropAddress });
|
|
26
|
+
* await setPause.mutateAsync({ paused: true });
|
|
27
|
+
*
|
|
28
|
+
* @alpha
|
|
29
|
+
*/
|
|
30
|
+
export declare function useAirdropPause(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, AirdropPauseArgs>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
3
|
+
/** @alpha */
|
|
4
|
+
export type UseAirdropPausedArgs = AirdropInstanceHookOptions<boolean>;
|
|
5
|
+
/**
|
|
6
|
+
* Whether claiming is currently halted (`PausableUpgradeable.paused()`).
|
|
7
|
+
*
|
|
8
|
+
* Distinct from {@link useAirdropWindow}'s `isActive`: this is the pause flag
|
|
9
|
+
* alone, independent of the claim-window timestamps. Use `isActive` for "can
|
|
10
|
+
* a claim succeed right now" and this hook for "did an admin explicitly pause".
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const { data: paused } = useAirdropPaused({ address: airdropAddress });
|
|
14
|
+
*
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export declare function useAirdropPaused(args: UseAirdropPausedArgs): UseQueryResult<boolean, Error>;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
|
-
import { type
|
|
3
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export type UseAirdropTokenArgs = AirdropInstanceHookOptions<Address>;
|
|
4
6
|
/**
|
|
5
|
-
* Read the
|
|
6
|
-
*
|
|
7
|
+
* Read the ERC-7984 token an airdrop instance distributes.
|
|
8
|
+
*
|
|
9
|
+
* Works against either variant — `token` is declared on the shared
|
|
10
|
+
* `ConfidentialAirdropBase` surface, so this hook needs no ECDSA/Merkle
|
|
11
|
+
* distinction.
|
|
7
12
|
*
|
|
8
13
|
* @example
|
|
9
14
|
* const { data: token } = useAirdropToken({ address: airdropAddress });
|
|
15
|
+
*
|
|
16
|
+
* @alpha
|
|
10
17
|
*/
|
|
11
|
-
export declare function useAirdropToken(
|
|
18
|
+
export declare function useAirdropToken(args: UseAirdropTokenArgs): UseQueryResult<Address, Error>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* Plaintext claim-window snapshot — combines five `AirdropBaseClient` reads into one.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export interface AirdropWindow {
|
|
9
|
+
/** Claim-window open, Unix seconds. */
|
|
10
|
+
startTime: number;
|
|
11
|
+
/** Claim-window close, Unix seconds. Movable forward via `useExtendClaimWindow`. */
|
|
12
|
+
endTime: number;
|
|
13
|
+
/** Whether `startTime` has passed. Says nothing about the pause flag. */
|
|
14
|
+
hasStarted: boolean;
|
|
15
|
+
/** Whether `endTime` has passed. Says nothing about the pause flag. */
|
|
16
|
+
hasEnded: boolean;
|
|
17
|
+
/** In window AND not paused — the actual "would a claim be accepted right now" answer. */
|
|
18
|
+
isActive: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** @alpha */
|
|
21
|
+
export type UseAirdropWindowArgs = AirdropInstanceHookOptions<AirdropWindow>;
|
|
22
|
+
/**
|
|
23
|
+
* Read an airdrop instance's claim-window snapshot in one round trip.
|
|
24
|
+
*
|
|
25
|
+
* Bundles `startTime` / `endTime` / `hasClaimStarted` / `hasClaimEnded` /
|
|
26
|
+
* `isClaimWindowActive` — five independent contract reads a UI almost always
|
|
27
|
+
* wants together (e.g. "claim opens at X, closes at Y, currently active: Z")
|
|
28
|
+
* — rather than shipping five near-identical one-line hooks nobody would call
|
|
29
|
+
* separately (the v1 mistake this cutover is deliberately not repeating).
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const { data: window } = useAirdropWindow({ address: airdropAddress });
|
|
33
|
+
* if (window?.isActive) { ... }
|
|
34
|
+
*
|
|
35
|
+
* @alpha
|
|
36
|
+
*/
|
|
37
|
+
export declare function useAirdropWindow(args: UseAirdropWindowArgs): UseQueryResult<AirdropWindow, Error>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import type { EncryptedHandle } from "../../core/brands.js";
|
|
4
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
5
|
+
/** @alpha */
|
|
6
|
+
export interface UseClaimedAmountArgs extends AirdropInstanceHookOptions<EncryptedHandle> {
|
|
7
|
+
/** The account whose cumulative delivered total to read. */
|
|
8
|
+
account?: Address;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Read `account`'s cumulative delivered total on a `MerkleConfidentialAirdrop`
|
|
12
|
+
* instance, as an encrypted handle — pass it to the Zama relayer's
|
|
13
|
+
* `userDecrypt` to see the plaintext.
|
|
14
|
+
*
|
|
15
|
+
* **Caller-specific — `account` is part of the cache key.** Switching the
|
|
16
|
+
* connected account (or checking a different address) never serves a value
|
|
17
|
+
* cached for the previous account; see {@link airdropQueryKey}.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* This is the recipient's CUMULATIVE total delivered so far, not a per-claim
|
|
21
|
+
* amount — see {@link MerkleAirdropClient.getClaimedAmount}'s TSDoc for the
|
|
22
|
+
* root-rotation and one-leaf-per-recipient consequences of that.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* const { data: claimedHandle } = useClaimedAmount({ address, account });
|
|
26
|
+
*
|
|
27
|
+
* @alpha
|
|
28
|
+
*/
|
|
29
|
+
export declare function useClaimedAmount(args: UseClaimedAmountArgs): UseQueryResult<EncryptedHandle, Error>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export type UseComplianceManagerArgs = AirdropInstanceHookOptions<Address>;
|
|
6
|
+
/**
|
|
7
|
+
* Read an airdrop instance's own compliance-manager clone — the only
|
|
8
|
+
* contract, besides the caller, ever granted ACL on that instance's
|
|
9
|
+
* confidential handles.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const { data: complianceManager } = useComplianceManager({ address: airdropAddress });
|
|
13
|
+
*
|
|
14
|
+
* @alpha
|
|
15
|
+
*/
|
|
16
|
+
export declare function useComplianceManager(args: UseComplianceManagerArgs): UseQueryResult<Address, Error>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { CreateAirdropArgs, CreateAirdropResult, EcdsaAirdropParams } from "../types.js";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Deploy an ECDSA-authorised airdrop instance via the factory.
|
|
7
|
+
*
|
|
8
|
+
* Returns the headless client's `CreateAirdropResult` unchanged — `{ hash,
|
|
9
|
+
* airdrop, complianceManager }` — never flattened to just a hash: a caller
|
|
10
|
+
* needs the deployed instance address to do anything with the campaign
|
|
11
|
+
* afterwards.
|
|
12
|
+
*
|
|
13
|
+
* **Invalidates:** the factory's registry reads (`useFactoryRegistry`) for
|
|
14
|
+
* this factory address, since a new instance changes `airdropCount()` /
|
|
15
|
+
* `airdrops()`. Nothing else — the new instance has no cached reads yet, and
|
|
16
|
+
* no other factory or instance state changed.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* const create = useCreateEcdsaAirdrop();
|
|
20
|
+
* const { airdrop, complianceManager } = await create.mutateAsync({
|
|
21
|
+
* params: { common, signer, dedupMode: "perAddress" },
|
|
22
|
+
* mode: "clone",
|
|
23
|
+
* userSalt,
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export declare function useCreateEcdsaAirdrop(options?: AirdropClientOptions): UseMutationResult<CreateAirdropResult, Error, CreateAirdropArgs<EcdsaAirdropParams> & WriteAccountOverride>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
3
|
+
import type { CreateAirdropArgs, CreateAirdropResult, MerkleAirdropParams } from "../types.js";
|
|
4
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Deploy a Merkle-proof airdrop instance via the factory.
|
|
7
|
+
*
|
|
8
|
+
* Returns the headless client's `CreateAirdropResult` unchanged — `{ hash,
|
|
9
|
+
* airdrop, complianceManager }`.
|
|
10
|
+
*
|
|
11
|
+
* **Invalidates:** the factory's registry reads (`useFactoryRegistry`) for
|
|
12
|
+
* this factory address — a new instance changes `airdropCount()` /
|
|
13
|
+
* `airdrops()`. Nothing else.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const create = useCreateMerkleAirdrop();
|
|
17
|
+
* const { airdrop } = await create.mutateAsync({
|
|
18
|
+
* params: { common, merkleRoot, isMerkleRootMutable: true },
|
|
19
|
+
* mode: "clone",
|
|
20
|
+
* userSalt,
|
|
21
|
+
* });
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
25
|
+
export declare function useCreateMerkleAirdrop(options?: AirdropClientOptions): UseMutationResult<CreateAirdropResult, Error, CreateAirdropArgs<MerkleAirdropParams> & WriteAccountOverride>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { EcdsaClaimArgs } from "../ecdsa.js";
|
|
4
|
+
import { type EcdsaAirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Claim a signed encrypted allocation on an `ECDSAConfidentialAirdrop`
|
|
7
|
+
* instance.
|
|
8
|
+
*
|
|
9
|
+
* `dedupMode` must be supplied — the contract has no on-chain getter for it
|
|
10
|
+
* (see {@link EcdsaAirdropClientConfig.dedupMode}); pass the same value used
|
|
11
|
+
* at `createEcdsaAirdrop` time.
|
|
12
|
+
*
|
|
13
|
+
* **Invalidates:** nothing. No exposed read in this subpath tracks per-claim
|
|
14
|
+
* ECDSA state (replay consumption isn't queryable), so there is no cached
|
|
15
|
+
* entry a successful claim could leave stale.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const claim = useEcdsaClaim({ address: airdropAddress, dedupMode: "perAddress" });
|
|
19
|
+
* await claim.mutateAsync({ encryptedInput, dedupId, deadline, signer, signature });
|
|
20
|
+
*
|
|
21
|
+
* @alpha
|
|
22
|
+
*/
|
|
23
|
+
export declare function useEcdsaClaim(options: EcdsaAirdropInstanceClientOptions): UseMutationResult<Hex, Error, EcdsaClaimArgs>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface UseEffectiveUpgradeableArgs extends AirdropHookOptions<boolean> {
|
|
6
|
+
/** The creator whose effective upgradeability policy to read. */
|
|
7
|
+
creator?: Address;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Whether `creator`'s NEXT `create*` may deploy `mode: "uups"` — the factory
|
|
11
|
+
* default, overridden per-creator via `setUpgradeabilityPolicy`. Read this
|
|
12
|
+
* before offering a UUPS deploy option in a UI; the factory refuses the
|
|
13
|
+
* create outright when this is `false` (`UpgradeabilityNotAllowedError`).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const { data: canUseUups } = useEffectiveUpgradeable({ creator: deployerAddress });
|
|
17
|
+
*
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export declare function useEffectiveUpgradeable(args?: UseEffectiveUpgradeableArgs): UseQueryResult<boolean, Error>;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
newEndTime: number;
|
|
6
|
-
account?: Account | Address;
|
|
7
|
-
}
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
8
5
|
/**
|
|
9
|
-
*
|
|
10
|
-
* `
|
|
11
|
-
*
|
|
6
|
+
* Move an airdrop instance's claim-window end time forward. Requires
|
|
7
|
+
* `WINDOW_ADMIN_ROLE`, and only succeeds on an instance created with
|
|
8
|
+
* `canExtendClaimWindow: true`.
|
|
9
|
+
*
|
|
10
|
+
* **Invalidates:** only this instance's `useAirdropWindow` entry — `endTime`
|
|
11
|
+
* is one of the five fields that hook bundles.
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* @example
|
|
14
|
+
* const extend = useExtendClaimWindow({ address: airdropAddress });
|
|
15
|
+
* await extend.mutateAsync({ newEndTime: Math.floor(Date.now() / 1000) + 86_400 });
|
|
16
|
+
*
|
|
17
|
+
* @alpha
|
|
15
18
|
*/
|
|
16
|
-
export declare function useExtendClaimWindow(options:
|
|
19
|
+
export declare function useExtendClaimWindow(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, {
|
|
20
|
+
newEndTime: number;
|
|
21
|
+
} & WriteAccountOverride>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropHookOptions } from "./_shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* The factory's chain-wide fee configuration.
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export interface FactoryFees {
|
|
10
|
+
/** Where withdrawn gas fees go. */
|
|
11
|
+
feeCollector: Address;
|
|
12
|
+
/** Wei charged per claim on a fee-charging campaign, absent a per-creator custom fee. */
|
|
13
|
+
defaultGasFee: bigint;
|
|
14
|
+
}
|
|
15
|
+
/** @alpha */
|
|
16
|
+
export type UseFactoryFeesArgs = AirdropHookOptions<FactoryFees>;
|
|
17
|
+
/**
|
|
18
|
+
* Read the airdrop factory's default fee configuration — `feeCollector` and
|
|
19
|
+
* `defaultGasFee` in one round trip. For a specific creator's override, read
|
|
20
|
+
* `factory.getCustomFee(creator)` from the headless client directly (not
|
|
21
|
+
* wrapped here — see the module's scope-discipline note).
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* const { data: fees } = useFactoryFees();
|
|
25
|
+
*
|
|
26
|
+
* @alpha
|
|
27
|
+
*/
|
|
28
|
+
export declare function useFactoryFees(args?: UseFactoryFeesArgs): UseQueryResult<FactoryFees, Error>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type AirdropHookOptions } from "./_shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* One page of the factory's deployment registry.
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
export interface FactoryRegistryPage {
|
|
10
|
+
/** Total instances the factory has deployed — the upper bound for paging. */
|
|
11
|
+
count: bigint;
|
|
12
|
+
/** Instance addresses in `[offset, offset + limit)` deployment order. */
|
|
13
|
+
items: readonly Address[];
|
|
14
|
+
}
|
|
15
|
+
/** @alpha */
|
|
16
|
+
export interface UseFactoryRegistryArgs extends AirdropHookOptions<FactoryRegistryPage> {
|
|
17
|
+
/** Zero-based index to start the page at. Defaults to `0n`. */
|
|
18
|
+
offset?: bigint;
|
|
19
|
+
/** Page size. Defaults to `50n`. */
|
|
20
|
+
limit?: bigint;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Page through every instance the factory has deployed, plus the total
|
|
24
|
+
* count — the two reads a "list my campaigns" admin view needs together.
|
|
25
|
+
*
|
|
26
|
+
* The contract clamps to the tail rather than reverting on an out-of-range
|
|
27
|
+
* `offset`, so `items` may come back shorter than `limit` — page until it
|
|
28
|
+
* does, not until a read throws.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const { data } = useFactoryRegistry({ offset: 0n, limit: 20n });
|
|
32
|
+
*
|
|
33
|
+
* @alpha
|
|
34
|
+
*/
|
|
35
|
+
export declare function useFactoryRegistry(args?: UseFactoryRegistryArgs): UseQueryResult<FactoryRegistryPage, Error>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import type { FundInput } from "../factory.js";
|
|
5
|
+
import { type AirdropClientOptions } from "./_shared.js";
|
|
6
|
+
/**
|
|
7
|
+
* Top up an already-deployed instance's pool through the factory.
|
|
8
|
+
*
|
|
9
|
+
* Takes exactly one of `amount` (plaintext — the SDK encrypts it against the
|
|
10
|
+
* hook-level `encryptor`, or a per-call `encryptor` override) or
|
|
11
|
+
* `encryptedInput` (already built ciphertext) — see {@link FundInput}. The
|
|
12
|
+
* lazy `encryptor` on the hook config (CLAUDE.md Pitfall #3) is threaded
|
|
13
|
+
* through to the underlying `ConfidentialAirdropFactoryClient`, which itself
|
|
14
|
+
* falls back from a per-call override to this hook-level default and throws
|
|
15
|
+
* `MissingEncryptorError` only if neither resolves — no encryptor
|
|
16
|
+
* indirection needs duplicating here.
|
|
17
|
+
*
|
|
18
|
+
* **Invalidates:** nothing. No read hook in this subpath's list exposes the
|
|
19
|
+
* confidential pool balance (`adminGetCurrentBalance` is disclosure-gated
|
|
20
|
+
* and intentionally not wrapped here), so there is no cached query this
|
|
21
|
+
* write could leave stale.
|
|
22
|
+
*
|
|
23
|
+
* **Never log `amount`.** It is the one plaintext confidential value this
|
|
24
|
+
* hook ever sees — do not pass it to telemetry, `onError` context, or a
|
|
25
|
+
* console statement.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* const fund = useFundAirdrop({ encryptor: () => sdk.relayer });
|
|
29
|
+
* await fund.mutateAsync({ airdrop: airdropAddress, amount: 1_000_000n });
|
|
30
|
+
*
|
|
31
|
+
* @alpha
|
|
32
|
+
*/
|
|
33
|
+
export declare function useFundAirdrop(options?: AirdropClientOptions): UseMutationResult<Hex, Error, {
|
|
34
|
+
airdrop: Address;
|
|
35
|
+
} & FundInput & WriteAccountOverride>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import { type InstanceRoleAssignment, type RoleGrantOutcome } from "../roles.js";
|
|
3
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export interface GrantInstanceRolesArgs {
|
|
6
|
+
assignment: InstanceRoleAssignment;
|
|
7
|
+
/** Defaults to `true` — the creator's own `DEFAULT_ADMIN_ROLE` is revoked once the new admin is granted. */
|
|
8
|
+
revokeFromCreator?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Split an airdrop instance's roles after create — one `grantRole` /
|
|
12
|
+
* `revokeRole` transaction per requested assignment, submitted in the order
|
|
13
|
+
* `planInstanceRoleSplit` computes.
|
|
14
|
+
*
|
|
15
|
+
* **Returns `RoleGrantOutcome[]` unchanged — do not collapse it.** Each step
|
|
16
|
+
* is its own transaction and can independently fail; flattening the array
|
|
17
|
+
* into a single success/failure bit destroys exactly the partial-failure
|
|
18
|
+
* legibility `grantInstanceRoles` was designed to preserve (see `roles.ts`).
|
|
19
|
+
* Inspect `outcomes.filter(o => o.error)` for what didn't land.
|
|
20
|
+
*
|
|
21
|
+
* **Invalidates:** every `useAirdropHasRole` entry for this instance
|
|
22
|
+
* (regardless of which role/holder pair), since a role split can touch
|
|
23
|
+
* several roles across several accounts in one call and the SDK does not
|
|
24
|
+
* duplicate the on-chain role-constant lookup client-side to invalidate more
|
|
25
|
+
* narrowly. Scoped to this instance only — other campaigns' role caches are
|
|
26
|
+
* untouched.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const grant = useGrantInstanceRoles({ address: airdropAddress });
|
|
30
|
+
* const outcomes = await grant.mutateAsync({ assignment: { pauser, treasury } });
|
|
31
|
+
* const failed = outcomes.filter((o) => o.error);
|
|
32
|
+
*
|
|
33
|
+
* @alpha
|
|
34
|
+
*/
|
|
35
|
+
export declare function useGrantInstanceRoles(options: AirdropInstanceClientOptions): UseMutationResult<RoleGrantOutcome[], Error, GrantInstanceRolesArgs>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { MerkleClaimArgs } from "../merkle.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Claim the outstanding amount for a proof-bearing entry on a
|
|
7
|
+
* `MerkleConfidentialAirdrop` instance.
|
|
8
|
+
*
|
|
9
|
+
* **Invalidates:** the claiming account's `useClaimedAmount` entry for this
|
|
10
|
+
* instance — the read whose cumulative-delivered value a successful claim
|
|
11
|
+
* changes. The claiming account is `args.account` if given, else the
|
|
12
|
+
* connected wallet's own account; other accounts' cached reads, and every
|
|
13
|
+
* other instance's cache, are left untouched (a `useMerkleClaim` on one
|
|
14
|
+
* campaign must not invalidate another campaign's `useClaimedAmount`).
|
|
15
|
+
*
|
|
16
|
+
* The claimant is resolved once in `onMutate` — synchronously, before the
|
|
17
|
+
* (async) write runs — and threaded into `onSuccess` via TanStack's mutation
|
|
18
|
+
* `context`, rather than re-read from `useWalletClient()` after the write
|
|
19
|
+
* settles. A mutation can outlive several re-renders of its own component
|
|
20
|
+
* (its `isPending` transition alone triggers one), and `useWalletClient()`'s
|
|
21
|
+
* data can read back transiently empty across those re-renders even though
|
|
22
|
+
* the write itself already resolved and used a real account — re-reading it
|
|
23
|
+
* in `onSuccess` risks silently skipping the invalidation this TSDoc
|
|
24
|
+
* promises. `onMutate` runs in the same tick `mutate()`/`mutateAsync()` was
|
|
25
|
+
* called, so it observes the exact same `walletClient` value the write is
|
|
26
|
+
* about to use.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const claim = useMerkleClaim({ address: airdropAddress });
|
|
30
|
+
* await claim.mutateAsync({ entry });
|
|
31
|
+
*
|
|
32
|
+
* @alpha
|
|
33
|
+
*/
|
|
34
|
+
export declare function useMerkleClaim(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, MerkleClaimArgs>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import { type AirdropInstanceHookOptions } from "./_shared.js";
|
|
4
|
+
/** @alpha */
|
|
5
|
+
export type UseMerkleRootArgs = AirdropInstanceHookOptions<Hex>;
|
|
6
|
+
/**
|
|
7
|
+
* Read a `MerkleConfidentialAirdrop` instance's currently published root.
|
|
8
|
+
* Proofs presented to `useMerkleClaim` must verify against this exact value.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const { data: root } = useMerkleRoot({ address: merkleAirdropAddress });
|
|
12
|
+
*
|
|
13
|
+
* @alpha
|
|
14
|
+
*/
|
|
15
|
+
export declare function useMerkleRoot(args: UseMerkleRootArgs): UseQueryResult<Hex, Error>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Rotate the published root on a `MerkleConfidentialAirdrop` instance.
|
|
7
|
+
* Requires `MERKLE_ADMIN_ROLE`.
|
|
8
|
+
*
|
|
9
|
+
* **Invalidates:** only this instance's `useMerkleRoot` entry — a rotation
|
|
10
|
+
* on one campaign must never blow away another campaign's cached root
|
|
11
|
+
* (CLAUDE.md-adjacent requirement for this subpath: precise, not
|
|
12
|
+
* namespace-wide, invalidation).
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const setRoot = useSetMerkleRoot({ address: airdropAddress });
|
|
16
|
+
* await setRoot.mutateAsync({ newRoot });
|
|
17
|
+
*
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
export declare function useSetMerkleRoot(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, {
|
|
21
|
+
newRoot: Hex;
|
|
22
|
+
} & WriteAccountOverride>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { WriteAccountOverride } from "../airdrop-base.js";
|
|
4
|
+
import { type AirdropInstanceClientOptions } from "./_shared.js";
|
|
5
|
+
/**
|
|
6
|
+
* Sweep an airdrop instance's entire remaining confidential balance to
|
|
7
|
+
* `recipient`. Requires `TREASURY_ROLE`. The amount is not a parameter and
|
|
8
|
+
* never appears in plaintext anywhere — the contract reads its own encrypted
|
|
9
|
+
* balance and moves all of it.
|
|
10
|
+
*
|
|
11
|
+
* **Invalidates:** nothing. No read hook in this subpath's list exposes the
|
|
12
|
+
* confidential pool balance (see {@link useFundAirdrop}'s TSDoc for the same
|
|
13
|
+
* reasoning), so there is no cached query left stale by a withdrawal.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const withdraw = useWithdrawConfidential({ address: airdropAddress });
|
|
17
|
+
* await withdraw.mutateAsync({ recipient: treasuryAddress });
|
|
18
|
+
*
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export declare function useWithdrawConfidential(options: AirdropInstanceClientOptions): UseMutationResult<Hex, Error, {
|
|
22
|
+
recipient: Address;
|
|
23
|
+
} & WriteAccountOverride>;
|