@tokenops/sdk 2.0.0-alpha.1 → 2.0.0-alpha.2
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 +29 -0
- package/README.md +5 -5
- package/dist/{chunk-JZLGCTGK.cjs → chunk-3YHBO2DL.cjs} +2 -2
- package/dist/{chunk-H5POPGOZ.js → chunk-44YJPMQC.js} +1 -1
- package/dist/{chunk-DZHYSUGY.js → chunk-A4DCEE33.js} +11 -5
- package/dist/{chunk-M4IT6DNJ.cjs → chunk-AREQJHKA.cjs} +108 -3
- package/dist/chunk-EBLBPUPI.cjs +255 -0
- package/dist/chunk-EYDA6Q6C.js +245 -0
- package/dist/{chunk-XAYGD4E4.cjs → chunk-FEDX7B6T.cjs} +3 -3
- package/dist/{chunk-JQYC66TO.cjs → chunk-FHWSBGWE.cjs} +5 -5
- package/dist/{chunk-5576FRT3.cjs → chunk-FT5H2Q7Y.cjs} +11 -5
- package/dist/{chunk-456VDDA3.js → chunk-GADGBQJO.js} +78 -25
- package/dist/{chunk-6NAVMWZQ.js → chunk-IGO5XSPS.js} +2 -2
- package/dist/{chunk-CTED3MTR.cjs → chunk-IUKKNJ2R.cjs} +82 -29
- package/dist/{chunk-FGEB7RMY.cjs → chunk-MM5BV5CS.cjs} +4 -4
- package/dist/{chunk-335Z2W67.js → chunk-PYYSB5ZN.js} +1 -1
- package/dist/{chunk-PUX5VXDB.cjs → chunk-PZZK3O3S.cjs} +1040 -42
- package/dist/{chunk-74QFZ5MK.js → chunk-SPLNGUFF.js} +1 -1
- package/dist/{chunk-6PXXGACR.cjs → chunk-UHHMVBLU.cjs} +2 -2
- package/dist/{chunk-O5676ZWY.js → chunk-VW356KR3.js} +108 -5
- package/dist/{chunk-EAJ7SYHE.js → chunk-WJMEBBU7.js} +1 -1
- package/dist/{chunk-GKKDAW44.js → chunk-X7WBPCEU.js} +1026 -32
- package/dist/core/addresses.d.ts +4 -4
- package/dist/core/errors.d.ts +1 -1
- package/dist/fhe/types.d.ts +2 -2
- package/dist/fhe-airdrop/abis/merkle.d.ts +24 -12
- package/dist/fhe-airdrop/advanced/index.cjs +4 -4
- package/dist/fhe-airdrop/advanced/index.js +1 -1
- package/dist/fhe-airdrop/advanced/react/index.cjs +590 -9
- package/dist/fhe-airdrop/advanced/react/index.d.cts +34 -0
- package/dist/fhe-airdrop/advanced/react/index.d.ts +34 -0
- package/dist/fhe-airdrop/advanced/react/index.js +561 -7
- package/dist/fhe-airdrop/advanced/react/useClearCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useClearUpgradeabilityPolicy.d.ts +26 -0
- package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +25 -0
- package/dist/fhe-airdrop/advanced/react/useEcdsaInitCodeHash.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryComplianceDelegate.d.ts +25 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCompliancePolicy.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryCustomFee.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryHasRole.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryImplementations.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +36 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +35 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleConstants.d.ts +46 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +47 -0
- package/dist/fhe-airdrop/advanced/react/useFactoryUpgradeabilityPolicy.d.ts +39 -0
- package/dist/fhe-airdrop/advanced/react/useMerkleInitCodeHash.d.ts +24 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceDelegate.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/useSetComplianceManagerImpl.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetCompliancePolicy.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultDelegateToCompliance.d.ts +31 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +28 -0
- package/dist/fhe-airdrop/advanced/react/useSetDefaultUpgradeable.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetEcdsaImplementation.d.ts +34 -0
- package/dist/fhe-airdrop/advanced/react/useSetFeeCollector.d.ts +27 -0
- package/dist/fhe-airdrop/advanced/react/useSetMerkleImplementation.d.ts +30 -0
- package/dist/fhe-airdrop/advanced/react/useSetUpgradeabilityPolicy.d.ts +31 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +8 -0
- package/dist/fhe-airdrop/campaign.d.ts +61 -20
- package/dist/fhe-airdrop/constants.d.ts +1 -1
- package/dist/fhe-airdrop/errors.d.ts +28 -0
- package/dist/fhe-airdrop/guards.d.ts +46 -2
- package/dist/fhe-airdrop/index.cjs +74 -971
- package/dist/fhe-airdrop/index.d.cts +2 -2
- package/dist/fhe-airdrop/index.d.ts +2 -2
- package/dist/fhe-airdrop/index.js +8 -927
- package/dist/fhe-airdrop/merkle-tree.d.ts +32 -38
- package/dist/fhe-airdrop/merkle.d.ts +52 -31
- package/dist/fhe-airdrop/react/_shared.d.ts +13 -0
- package/dist/fhe-airdrop/react/index.cjs +934 -84
- package/dist/fhe-airdrop/react/index.d.cts +49 -3
- package/dist/fhe-airdrop/react/index.d.ts +49 -3
- package/dist/fhe-airdrop/react/index.js +825 -22
- package/dist/fhe-airdrop/react/keys.d.ts +90 -0
- package/dist/fhe-airdrop/react/useAccessEcdsaClaimAmount.d.ts +26 -0
- package/dist/fhe-airdrop/react/useAccessMerkleClaimAmount.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAddComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useAdminBatchDiscloseBalanceToParties.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAdminDiscloseBalanceToParty.d.ts +31 -0
- package/dist/fhe-airdrop/react/useAdminGetCurrentBalance.d.ts +27 -0
- package/dist/fhe-airdrop/react/useAirdropConfig.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropDeploymentMode.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +35 -0
- package/dist/fhe-airdrop/react/useAirdropRenounceRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +33 -0
- package/dist/fhe-airdrop/react/useAirdropRoleAdmin.d.ts +28 -0
- package/dist/fhe-airdrop/react/useAirdropRoleConstants.d.ts +67 -0
- package/dist/fhe-airdrop/react/useAirdropRoleMembers.d.ts +49 -0
- package/dist/fhe-airdrop/react/useAirdropUpgradeToAndCall.d.ts +45 -0
- package/dist/fhe-airdrop/react/useBatchDiscloseHandlesToParty.d.ts +32 -0
- package/dist/fhe-airdrop/react/useBuildMerkleCampaign.d.ts +68 -0
- package/dist/fhe-airdrop/react/useComplianceGrantRole.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceHasRole.d.ts +37 -0
- package/dist/fhe-airdrop/react/useComplianceInfo.d.ts +50 -0
- package/dist/fhe-airdrop/react/useComplianceManagerOf.d.ts +32 -0
- package/dist/fhe-airdrop/react/useComplianceRenounceRole.d.ts +38 -0
- package/dist/fhe-airdrop/react/useComplianceRevokeRole.d.ts +36 -0
- package/dist/fhe-airdrop/react/useComplianceRoleConstants.d.ts +41 -0
- package/dist/fhe-airdrop/react/useComplianceRoleMembers.d.ts +45 -0
- package/dist/fhe-airdrop/react/useCreateAndFundEcdsaAirdrop.d.ts +55 -0
- package/dist/fhe-airdrop/react/useCreateAndFundMerkleAirdrop.d.ts +52 -0
- package/dist/fhe-airdrop/react/useDiscloseHandleToParty.d.ts +35 -0
- package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +4 -3
- package/dist/fhe-airdrop/react/useEcdsaClaimAndUnwrap.d.ts +27 -0
- package/dist/fhe-airdrop/react/useEcdsaDomain.d.ts +41 -0
- package/dist/fhe-airdrop/react/useEffectiveDelegateToCompliance.d.ts +26 -0
- package/dist/fhe-airdrop/react/useEncryptCampaignAmounts.d.ts +59 -0
- package/dist/fhe-airdrop/react/useIsActiveDelegate.d.ts +29 -0
- package/dist/fhe-airdrop/react/useIsMerkleRootMutable.d.ts +21 -0
- package/dist/fhe-airdrop/react/useIsSignatureValid.d.ts +46 -0
- package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +7 -19
- package/dist/fhe-airdrop/react/useMerkleClaimAndUnwrap.d.ts +29 -0
- package/dist/fhe-airdrop/react/usePlanMerkleCampaign.d.ts +53 -0
- package/dist/fhe-airdrop/react/usePreflightClaim.d.ts +46 -0
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +67 -0
- package/dist/fhe-airdrop/react/useRescueERC20.d.ts +30 -0
- package/dist/fhe-airdrop/react/useRescueOtherConfidentialToken.d.ts +34 -0
- package/dist/fhe-airdrop/react/useRevokeComplianceDelegate.d.ts +37 -0
- package/dist/fhe-airdrop/react/useRotateMerkleRoot.d.ts +52 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +42 -0
- package/dist/fhe-airdrop/react/useWithdrawGasFee.d.ts +37 -0
- package/dist/fhe-airdrop/types.d.ts +14 -1
- package/dist/fhe-disperse/index.cjs +21 -21
- package/dist/fhe-disperse/index.js +2 -2
- package/dist/fhe-disperse/react/index.cjs +22 -22
- package/dist/fhe-disperse/react/index.js +3 -3
- package/dist/fhe-vesting/advanced/index.cjs +5 -5
- package/dist/fhe-vesting/advanced/index.js +3 -3
- package/dist/fhe-vesting/advanced/react/index.cjs +7 -7
- package/dist/fhe-vesting/advanced/react/index.js +4 -4
- package/dist/fhe-vesting/index.cjs +8 -8
- package/dist/fhe-vesting/index.js +2 -2
- package/dist/fhe-vesting/react/index.cjs +114 -114
- package/dist/fhe-vesting/react/index.js +3 -3
- package/dist/index.cjs +18 -18
- package/dist/index.js +1 -1
- package/dist/testnet-faucet/index.cjs +14 -14
- package/dist/testnet-faucet/index.js +2 -2
- package/dist/testnet-faucet/react/index.cjs +8 -8
- package/dist/testnet-faucet/react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-NCVX3K2N.cjs +0 -161
- package/dist/chunk-VP2B4WM2.js +0 -154
|
@@ -7,32 +7,32 @@ import type { Address, Hex } from "viem";
|
|
|
7
7
|
export interface LeafOfArgs {
|
|
8
8
|
/** The `MerkleConfidentialAirdrop` instance the leaf is scoped to — `address(this)` on-chain. */
|
|
9
9
|
instance: Address;
|
|
10
|
-
/** The
|
|
11
|
-
|
|
12
|
-
/** The encrypted handle committing the
|
|
10
|
+
/** The claim identity, independent of both the transaction submitter and the payout destination. */
|
|
11
|
+
account: Address;
|
|
12
|
+
/** The encrypted handle committing the account's cumulative total allocation. */
|
|
13
13
|
handle: Hex;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Compute a Merkle leaf byte-for-byte identical to the contract's
|
|
17
|
-
*
|
|
18
|
-
* verified derivation. Mirrors what the campaign builder (`buildMerkleCampaign`,
|
|
19
|
-
* `campaign.ts`) needs to construct the same tree `StandardMerkleTree` would,
|
|
20
|
-
* and is useful to any caller who wants to recompute a leaf independently of
|
|
21
|
-
* the campaign orchestrator.
|
|
16
|
+
* Compute a Merkle leaf byte-for-byte identical to the contract's `_leafOf` — see the
|
|
17
|
+
* module comment for the verified derivation.
|
|
22
18
|
*
|
|
23
19
|
* @alpha
|
|
24
20
|
*/
|
|
25
21
|
export declare function leafOf(args: LeafOfArgs): Hex;
|
|
26
22
|
/**
|
|
27
|
-
* The minimum a leaf must carry. `buildMerkleTree` is generic over anything
|
|
28
|
-
*
|
|
23
|
+
* The minimum a leaf must carry. `buildMerkleTree` is generic over anything wider, so a
|
|
24
|
+
* caller's own fields ride along onto the entry.
|
|
25
|
+
*
|
|
26
|
+
* Deliberately does NOT include `boundTo`: the tree does not commit the submitter, so it
|
|
27
|
+
* is not needed to build one. Pass it anyway (alongside `inputProof`) and it rides through
|
|
28
|
+
* to the entry, which is what makes the result assignable to {@link CampaignEntry}.
|
|
29
29
|
*
|
|
30
30
|
* @alpha
|
|
31
31
|
*/
|
|
32
32
|
export interface MerkleLeafInput {
|
|
33
|
-
/** The
|
|
34
|
-
|
|
35
|
-
/** The encrypted handle committing this
|
|
33
|
+
/** The claim identity this leaf commits — whose payout and cumulative accounting it keys. */
|
|
34
|
+
account: Address;
|
|
35
|
+
/** The encrypted handle committing this account's cumulative total. */
|
|
36
36
|
handle: Hex;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -57,34 +57,30 @@ export interface BuiltMerkleTree<L extends MerkleLeafInput> {
|
|
|
57
57
|
})[];
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
* Build the Merkle tree a `MerkleConfidentialAirdrop` verifies against, from
|
|
61
|
-
*
|
|
60
|
+
* Build the Merkle tree a `MerkleConfidentialAirdrop` verifies against, from handles
|
|
61
|
+
* produced anywhere.
|
|
62
62
|
*
|
|
63
|
-
* **Pure.** No relayer, no chain access, no encryptor
|
|
64
|
-
* it returns the same root, so it can run offline, in a test, or on a machine
|
|
65
|
-
* that has never seen a private key.
|
|
63
|
+
* **Pure.** No relayer, no chain access, no encryptor — same leaves in, same root out.
|
|
66
64
|
*
|
|
67
|
-
* **The tree commits to the handle, not the amount.** `_leafOf`
|
|
68
|
-
* `(
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
65
|
+
* **The tree commits to the handle, not the amount, and not the submitter.** `_leafOf`
|
|
66
|
+
* hashes `(instance, account, handle)`, so whoever encrypted must have bound each input
|
|
67
|
+
* to `(instance, the intended submitter)`. This function cannot check that: it will
|
|
68
|
+
* happily build a tree over wrongly-bound handles, and the failure surfaces at claim time
|
|
69
|
+
* inside the coprocessor.
|
|
72
70
|
*
|
|
73
|
-
* **Extra fields ride along.** Whatever
|
|
74
|
-
* `
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* assignable to `CampaignEntry`, which is what `MerkleAirdropClient.claim`
|
|
78
|
-
* consumes.
|
|
71
|
+
* **Extra fields ride along.** Whatever a leaf carries beyond `account` and `handle` —
|
|
72
|
+
* `boundTo`, an `inputProof`, your own row id — comes back on the entry, still aligned
|
|
73
|
+
* with its proof. Passing `{ account, boundTo, handle, inputProof }` therefore yields a
|
|
74
|
+
* value structurally assignable to {@link CampaignEntry}.
|
|
79
75
|
*
|
|
80
76
|
* @param args The instance the leaves are scoped to, and the leaves.
|
|
81
77
|
* @returns The root to publish, and one proof-bearing entry per input leaf, in input order.
|
|
82
|
-
* @throws {@link InvalidArgumentError} on a zero or malformed instance, an empty leaf set, a malformed or zero
|
|
78
|
+
* @throws {@link InvalidArgumentError} on a zero or malformed instance, an empty leaf set, a malformed or zero account, a duplicate account, or a handle that is not 32 bytes.
|
|
83
79
|
*
|
|
84
80
|
* @example
|
|
85
81
|
* const { root, entries } = buildMerkleTree({
|
|
86
82
|
* instance: airdrop,
|
|
87
|
-
* leaves: [{
|
|
83
|
+
* leaves: [{ account: alice, boundTo: alice, handle, inputProof }],
|
|
88
84
|
* });
|
|
89
85
|
* await merkle.setMerkleRoot({ newRoot: root });
|
|
90
86
|
*
|
|
@@ -92,12 +88,10 @@ export interface BuiltMerkleTree<L extends MerkleLeafInput> {
|
|
|
92
88
|
*/
|
|
93
89
|
export declare function buildMerkleTree<L extends MerkleLeafInput>(args: BuildMerkleTreeArgs<L>): BuiltMerkleTree<L>;
|
|
94
90
|
/**
|
|
95
|
-
* Real implementation behind {@link buildMerkleTree}, parameterised on the
|
|
96
|
-
*
|
|
91
|
+
* Real implementation behind {@link buildMerkleTree}, parameterised on the function name
|
|
92
|
+
* a thrown {@link InvalidArgumentError} blames.
|
|
97
93
|
*
|
|
98
|
-
* Not part of the public surface — exported
|
|
99
|
-
*
|
|
100
|
-
* name, attributing a malformed-handle failure to itself rather than to
|
|
101
|
-
* `buildMerkleTree`. Neither barrel (`index.ts`) re-exports it.
|
|
94
|
+
* Not part of the public surface — exported only so `buildMerkleCampaign` can call it
|
|
95
|
+
* with its own name. Neither barrel re-exports it.
|
|
102
96
|
*/
|
|
103
97
|
export declare function buildMerkleTreeInternal<L extends MerkleLeafInput>({ instance, leaves }: BuildMerkleTreeArgs<L>, method: string): BuiltMerkleTree<L>;
|
|
@@ -10,23 +10,22 @@ import type { CampaignEntry } from "./types.js";
|
|
|
10
10
|
*/
|
|
11
11
|
export interface MerkleClaimArgs extends WriteAccountOverride {
|
|
12
12
|
/**
|
|
13
|
-
* Payout destination. Omit (or pass the zero address) to default to
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
13
|
+
* Payout destination. Omit (or pass the zero address) to default to
|
|
14
|
+
* `entry.account` — note that is the CLAIM IDENTITY, not the sender, so on a
|
|
15
|
+
* relayed claim omitting `to` still pays the recipient.
|
|
16
|
+
*
|
|
17
|
+
* Only the account itself may redirect elsewhere; a third-party submitter passing
|
|
18
|
+
* a different `to` is refused before the write with
|
|
19
|
+
* {@link UnauthorizedRedirectError}.
|
|
19
20
|
*/
|
|
20
21
|
to?: Address;
|
|
21
22
|
/**
|
|
22
|
-
* The
|
|
23
|
-
*
|
|
24
|
-
* account
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* leaf and reverts `InvalidMerkleProof` even though the proof bytes
|
|
29
|
-
* themselves are untouched.
|
|
23
|
+
* The proof-bearing claim entry, built by a campaign builder (`campaign.ts`).
|
|
24
|
+
*
|
|
25
|
+
* `entry.account` is submitted as the claim identity and selects the leaf.
|
|
26
|
+
* `entry.boundTo` must be the sending account, because the coprocessor verifies
|
|
27
|
+
* the input proof against the literal caller — the SDK checks this before the
|
|
28
|
+
* write rather than letting the transaction revert.
|
|
30
29
|
*/
|
|
31
30
|
entry: CampaignEntry;
|
|
32
31
|
}
|
|
@@ -37,18 +36,22 @@ export interface MerkleClaimArgs extends WriteAccountOverride {
|
|
|
37
36
|
*/
|
|
38
37
|
export interface GetClaimAmountArgs extends WriteAccountOverride {
|
|
39
38
|
/**
|
|
40
|
-
* Same binding rule as {@link MerkleClaimArgs.entry}: `entry.
|
|
41
|
-
*
|
|
42
|
-
*
|
|
39
|
+
* Same binding rule as {@link MerkleClaimArgs.entry}: `entry.boundTo` must be the
|
|
40
|
+
* calling account. The preview's result is ACL'd to `entry.account`, so a relayer
|
|
41
|
+
* can confirm a leaf verifies without being able to read the amount.
|
|
43
42
|
*/
|
|
44
43
|
entry: CampaignEntry;
|
|
45
44
|
}
|
|
46
45
|
/**
|
|
47
46
|
* Client for one `MerkleConfidentialAirdrop` instance — the variant whose
|
|
48
47
|
* claims are authorised by inclusion in a published Merkle tree rather than
|
|
49
|
-
* an off-chain signature. Each leaf commits `(instance,
|
|
50
|
-
*
|
|
51
|
-
*
|
|
48
|
+
* an off-chain signature. Each leaf commits `(instance, account, handle)`, where
|
|
49
|
+
* `handle` is that account's CUMULATIVE total allocation, not a per-drop tranche —
|
|
50
|
+
* see the `@remarks` on {@link getClaimedAmount}.
|
|
51
|
+
*
|
|
52
|
+
* `claim` names its claim identity explicitly, so a relayer can settle a leaf on a
|
|
53
|
+
* recipient's behalf. `claimAndUnwrap` deliberately cannot: it is always submitted
|
|
54
|
+
* for the caller.
|
|
52
55
|
*
|
|
53
56
|
* Adds the claim surface on top of {@link AirdropBaseClient}'s shared
|
|
54
57
|
* lifecycle/treasury/rescue/role/disclosure methods: `claim` /
|
|
@@ -71,8 +74,8 @@ export interface GetClaimAmountArgs extends WriteAccountOverride {
|
|
|
71
74
|
export declare class MerkleAirdropClient extends AirdropBaseClient {
|
|
72
75
|
constructor(config: AirdropBaseClientConfig);
|
|
73
76
|
/**
|
|
74
|
-
* Claim the outstanding amount for a proof-bearing entry, delivering the
|
|
75
|
-
*
|
|
77
|
+
* Claim the outstanding amount for a proof-bearing entry, delivering the tokens to
|
|
78
|
+
* `to` — which defaults to `entry.account`, the CLAIM IDENTITY, not the sender.
|
|
76
79
|
*
|
|
77
80
|
* Requires `msg.value == gasFee()` exactly — handled for you; see the
|
|
78
81
|
* class TSDoc.
|
|
@@ -89,8 +92,9 @@ export declare class MerkleAirdropClient extends AirdropBaseClient {
|
|
|
89
92
|
*
|
|
90
93
|
* @throws {@link ClaimNotStartedError} before `startTime`.
|
|
91
94
|
* @throws {@link ClaimWindowClosedError} after `endTime`.
|
|
92
|
-
* @throws {@link InvalidArgumentError} (`argument: "
|
|
93
|
-
*
|
|
95
|
+
* @throws {@link InvalidArgumentError} (`argument: "entry.boundTo"`) when the entry's proof is bound to
|
|
96
|
+
* another address, or (`argument: "merkleProof"`) when the proof does not verify against the current root.
|
|
97
|
+
* @throws {@link UnauthorizedRedirectError} when a third-party submitter passes a `to` other than `entry.account`.
|
|
94
98
|
* @returns The transaction hash.
|
|
95
99
|
*/
|
|
96
100
|
claim(args: MerkleClaimArgs): Promise<Hex>;
|
|
@@ -103,6 +107,14 @@ export declare class MerkleAirdropClient extends AirdropBaseClient {
|
|
|
103
107
|
* Same replay/accounting semantics and `msg.value == gasFee()` requirement
|
|
104
108
|
* as {@link claim} — see its `@remarks`.
|
|
105
109
|
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* **Self-only by design.** This entrypoint takes no claim identity: releasing an
|
|
112
|
+
* allocation as a public ERC-20 transfer publishes the amount irreversibly, which is
|
|
113
|
+
* the recipient's own choice to make. A relayed unwrap is therefore unrepresentable
|
|
114
|
+
* rather than merely rejected, and an entry whose `account` is not the sender is
|
|
115
|
+
* refused before the write. A third party can still submit a confidential
|
|
116
|
+
* {@link claim}.
|
|
117
|
+
*
|
|
106
118
|
* @returns The transaction hash. The underlying ERC-20 is released later by
|
|
107
119
|
* a separate, permissionless `finalizeUnwrap` — this hash is only the
|
|
108
120
|
* unwrap request.
|
|
@@ -113,11 +125,15 @@ export declare class MerkleAirdropClient extends AirdropBaseClient {
|
|
|
113
125
|
* caller can decrypt. Consumes no accounting and no per-leaf state — the
|
|
114
126
|
* same entry still pays the same amount after a preview. No fee.
|
|
115
127
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
128
|
+
* **Submits a transaction.** The contract calls `FHE.allow(outstanding, account)`, so
|
|
129
|
+
* the result is recovered from the receipt's ACL `Allowed` event, never from a
|
|
130
|
+
* simulation. See {@link AirdropBaseClient}'s class TSDoc.
|
|
131
|
+
*
|
|
132
|
+
* **`entry.account` is the decryptable party, not the caller.** A relayer previewing on
|
|
133
|
+
* someone's behalf gets a valid handle it cannot read — that is the contract's intent,
|
|
134
|
+
* and it is what makes a blind relayed submission possible.
|
|
119
135
|
*
|
|
120
|
-
* @returns `{ handle, hash }` — pass `handle` to the Zama relayer's `userDecrypt`.
|
|
136
|
+
* @returns `{ handle, hash }` — pass `handle` to the Zama relayer's `userDecrypt`, as `entry.account`.
|
|
121
137
|
*/
|
|
122
138
|
getClaimAmount(args: GetClaimAmountArgs): Promise<EncryptedViewResult>;
|
|
123
139
|
/**
|
|
@@ -139,10 +155,15 @@ export declare class MerkleAirdropClient extends AirdropBaseClient {
|
|
|
139
155
|
* leaves for the same recipient, claiming both pays the higher of the
|
|
140
156
|
* two totals net of this running value — `max`, not `sum`.
|
|
141
157
|
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
158
|
+
* **An account that has never claimed returns the ZERO handle, which cannot be
|
|
159
|
+
* decrypted.** It is an uninitialized ciphertext, so nobody holds an ACL on it and
|
|
160
|
+
* the relayer rejects it with "not authorized to user decrypt handle 0x0…0" rather
|
|
161
|
+
* than answering zero. Treat `handle === zeroHash` as "nothing delivered yet" and
|
|
162
|
+
* skip the decrypt; only call `userDecrypt` on a non-zero handle. (A mock FHEVM
|
|
163
|
+
* instance does answer zero here, so this only bites against a live relayer.)
|
|
144
164
|
*
|
|
145
|
-
* @returns The account's cumulative delivered total
|
|
165
|
+
* @returns The account's cumulative delivered total as an encrypted handle, or the
|
|
166
|
+
* zero handle if it has never claimed.
|
|
146
167
|
*/
|
|
147
168
|
getClaimedAmount(account: Address): Promise<EncryptedHandle>;
|
|
148
169
|
/** The currently published root. Proofs must verify against this exact value. */
|
|
@@ -8,6 +8,7 @@ import { type EcdsaAirdropClient } from "../ecdsa.js";
|
|
|
8
8
|
import { type EncryptorSource } from "../encryption.js";
|
|
9
9
|
import { type ConfidentialAirdropFactoryClient } from "../factory.js";
|
|
10
10
|
import { type MerkleAirdropClient } from "../merkle.js";
|
|
11
|
+
import { type ComplianceManagerClient } from "../compliance.js";
|
|
11
12
|
/**
|
|
12
13
|
* Stable query-key prefix for every hook in this subpath — matches the
|
|
13
14
|
* sibling subpaths' convention (`FHE_VESTING_KEY`/`FHE_DISPERSE_KEY`/
|
|
@@ -154,6 +155,18 @@ export declare function useMemoMerkleAirdropClient(opts: AirdropInstanceClientOp
|
|
|
154
155
|
walletClient: WalletClient | undefined;
|
|
155
156
|
chainId: number | undefined;
|
|
156
157
|
};
|
|
158
|
+
/**
|
|
159
|
+
* Memoize a {@link ComplianceManagerClient} for `opts.address`.
|
|
160
|
+
*
|
|
161
|
+
* `address` is the manager CLONE, not the airdrop instance and not the factory — read it
|
|
162
|
+
* from `factory.complianceManagerOf(airdrop)` or off `CreateAirdropResult.complianceManager`.
|
|
163
|
+
*/
|
|
164
|
+
export declare function useMemoComplianceManagerClient(opts: AirdropInstanceClientOptions): {
|
|
165
|
+
client: ComplianceManagerClient | undefined;
|
|
166
|
+
publicClient: PublicClient | undefined;
|
|
167
|
+
walletClient: WalletClient | undefined;
|
|
168
|
+
chainId: number | undefined;
|
|
169
|
+
};
|
|
157
170
|
/**
|
|
158
171
|
* Per-hook overrides for {@link useMemoEcdsaAirdropClient} — `dedupMode` has no on-chain getter, so it must be supplied.
|
|
159
172
|
*
|