@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
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { createConfidentialAirdropFactoryClient, resolveEncryptor, createAirdropBaseClient, createMerkleAirdropClient, createComplianceManagerClient, createEcdsaAirdropClient } from './chunk-X7WBPCEU.js';
|
|
2
|
+
import { getFheAirdropFactoryAddress } from './chunk-A4DCEE33.js';
|
|
3
|
+
import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
|
|
4
|
+
import { useRef, useMemo } from 'react';
|
|
5
|
+
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
6
|
+
|
|
7
|
+
var FHE_AIRDROP_KEY = "tokenops-sdk";
|
|
8
|
+
var FHE_AIRDROP_NAMESPACE = "fhe-airdrop";
|
|
9
|
+
function airdropQueryKey(params) {
|
|
10
|
+
return [
|
|
11
|
+
FHE_AIRDROP_KEY,
|
|
12
|
+
FHE_AIRDROP_NAMESPACE,
|
|
13
|
+
params.chainId ?? null,
|
|
14
|
+
params.address ? normalizeKeyArg(params.address) : null,
|
|
15
|
+
params.fn,
|
|
16
|
+
params.args.map(normalizeKeyArg)
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
function airdropQueryKeyPrefix(params) {
|
|
20
|
+
const prefix = [
|
|
21
|
+
FHE_AIRDROP_KEY,
|
|
22
|
+
FHE_AIRDROP_NAMESPACE,
|
|
23
|
+
params.chainId ?? null,
|
|
24
|
+
params.address ? normalizeKeyArg(params.address) : null
|
|
25
|
+
];
|
|
26
|
+
if (params.fn !== void 0) prefix.push(params.fn);
|
|
27
|
+
return prefix;
|
|
28
|
+
}
|
|
29
|
+
function normalizeKeyArg(value) {
|
|
30
|
+
if (typeof value === "bigint") return value.toString();
|
|
31
|
+
if (Array.isArray(value)) return value.map(normalizeKeyArg);
|
|
32
|
+
if (value && typeof value === "object") {
|
|
33
|
+
return Object.fromEntries(
|
|
34
|
+
Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
function tryResolveAirdropFactoryAddress(override, chainId) {
|
|
41
|
+
if (override) return override;
|
|
42
|
+
if (chainId === void 0) return void 0;
|
|
43
|
+
return getFheAirdropFactoryAddress(chainId);
|
|
44
|
+
}
|
|
45
|
+
function computeAirdropFactoryResolutionError(override, chainId) {
|
|
46
|
+
if (override) return void 0;
|
|
47
|
+
if (chainId === void 0) {
|
|
48
|
+
return new DeploymentAddressUnavailableError({
|
|
49
|
+
reason: "chain-id-missing",
|
|
50
|
+
product: "fheAirdrop",
|
|
51
|
+
contract: "airdropFactory",
|
|
52
|
+
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
const resolved = getFheAirdropFactoryAddress(chainId);
|
|
56
|
+
if (!resolved) {
|
|
57
|
+
return new DeploymentAddressUnavailableError({
|
|
58
|
+
reason: "registry-not-deployed",
|
|
59
|
+
product: "fheAirdrop",
|
|
60
|
+
contract: "airdropFactory",
|
|
61
|
+
chainId,
|
|
62
|
+
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return void 0;
|
|
66
|
+
}
|
|
67
|
+
function useMemoAirdropFactoryClient(opts = {}) {
|
|
68
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
69
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
70
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
71
|
+
const resolvedAddress = tryResolveAirdropFactoryAddress(opts.address, chainId);
|
|
72
|
+
const resolutionError = computeAirdropFactoryResolutionError(opts.address, chainId);
|
|
73
|
+
const encryptorSourceRef = useRef(opts.encryptor);
|
|
74
|
+
encryptorSourceRef.current = opts.encryptor;
|
|
75
|
+
const telemetry = opts.telemetry;
|
|
76
|
+
const client = useMemo(() => {
|
|
77
|
+
if (!publicClient) return void 0;
|
|
78
|
+
if (!resolvedAddress) return void 0;
|
|
79
|
+
return createConfidentialAirdropFactoryClient({
|
|
80
|
+
publicClient,
|
|
81
|
+
...walletClient ? { walletClient } : {},
|
|
82
|
+
address: resolvedAddress,
|
|
83
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
84
|
+
// Lazy — invoked per-encryption inside the headless client.
|
|
85
|
+
encryptor: () => resolveEncryptor(encryptorSourceRef.current),
|
|
86
|
+
...telemetry ? { telemetry } : {}
|
|
87
|
+
});
|
|
88
|
+
}, [publicClient, walletClient, resolvedAddress, chainId, telemetry]);
|
|
89
|
+
return {
|
|
90
|
+
client,
|
|
91
|
+
resolutionError,
|
|
92
|
+
publicClient,
|
|
93
|
+
walletClient: walletClient ?? void 0,
|
|
94
|
+
chainId,
|
|
95
|
+
resolvedAddress
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
function useMemoAirdropBaseClient(opts) {
|
|
99
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
100
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
101
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
102
|
+
const telemetry = opts.telemetry;
|
|
103
|
+
const client = useMemo(() => {
|
|
104
|
+
if (!publicClient) return void 0;
|
|
105
|
+
if (!opts.address) return void 0;
|
|
106
|
+
return createAirdropBaseClient({
|
|
107
|
+
publicClient,
|
|
108
|
+
...walletClient ? { walletClient } : {},
|
|
109
|
+
address: opts.address,
|
|
110
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
111
|
+
...telemetry ? { telemetry } : {}
|
|
112
|
+
});
|
|
113
|
+
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
114
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
115
|
+
}
|
|
116
|
+
function useMemoMerkleAirdropClient(opts) {
|
|
117
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
118
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
119
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
120
|
+
const telemetry = opts.telemetry;
|
|
121
|
+
const client = useMemo(() => {
|
|
122
|
+
if (!publicClient) return void 0;
|
|
123
|
+
if (!opts.address) return void 0;
|
|
124
|
+
return createMerkleAirdropClient({
|
|
125
|
+
publicClient,
|
|
126
|
+
...walletClient ? { walletClient } : {},
|
|
127
|
+
address: opts.address,
|
|
128
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
129
|
+
...telemetry ? { telemetry } : {}
|
|
130
|
+
});
|
|
131
|
+
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
132
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
133
|
+
}
|
|
134
|
+
function useMemoComplianceManagerClient(opts) {
|
|
135
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
136
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
137
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
138
|
+
const telemetry = opts.telemetry;
|
|
139
|
+
const client = useMemo(() => {
|
|
140
|
+
if (!publicClient) return void 0;
|
|
141
|
+
if (!opts.address) return void 0;
|
|
142
|
+
return createComplianceManagerClient({
|
|
143
|
+
publicClient,
|
|
144
|
+
...walletClient ? { walletClient } : {},
|
|
145
|
+
address: opts.address,
|
|
146
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
147
|
+
...telemetry ? { telemetry } : {}
|
|
148
|
+
});
|
|
149
|
+
}, [publicClient, walletClient, opts.address, chainId, telemetry]);
|
|
150
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
151
|
+
}
|
|
152
|
+
function useMemoEcdsaAirdropClient(opts) {
|
|
153
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
154
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
155
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
156
|
+
const telemetry = opts.telemetry;
|
|
157
|
+
const client = useMemo(() => {
|
|
158
|
+
if (!publicClient) return void 0;
|
|
159
|
+
if (!opts.address) return void 0;
|
|
160
|
+
return createEcdsaAirdropClient({
|
|
161
|
+
publicClient,
|
|
162
|
+
...walletClient ? { walletClient } : {},
|
|
163
|
+
address: opts.address,
|
|
164
|
+
dedupMode: opts.dedupMode,
|
|
165
|
+
...chainId !== void 0 ? { chainId } : {},
|
|
166
|
+
...telemetry ? { telemetry } : {}
|
|
167
|
+
});
|
|
168
|
+
}, [publicClient, walletClient, opts.address, opts.dedupMode, chainId, telemetry]);
|
|
169
|
+
return { client, publicClient, walletClient: walletClient ?? void 0, chainId };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// src/fhe-airdrop/react/keys.ts
|
|
173
|
+
var AIRDROP_FN = {
|
|
174
|
+
// instance reads
|
|
175
|
+
claimedAmount: "getClaimedAmount",
|
|
176
|
+
paused: "paused",
|
|
177
|
+
window: "window",
|
|
178
|
+
config: "config",
|
|
179
|
+
merkleRoot: "merkleRoot",
|
|
180
|
+
merkleRootMutable: "isMerkleRootMutable",
|
|
181
|
+
hasRole: "hasRole",
|
|
182
|
+
roleMembers: "roleMembers",
|
|
183
|
+
gasFee: "gasFee",
|
|
184
|
+
preflightCreate: "preflightCreate",
|
|
185
|
+
isSignatureValid: "isSignatureValid",
|
|
186
|
+
// factory reads
|
|
187
|
+
fees: "fees",
|
|
188
|
+
registry: "registry",
|
|
189
|
+
customFee: "customFee",
|
|
190
|
+
implementations: "implementations",
|
|
191
|
+
compliancePolicy: "compliancePolicy",
|
|
192
|
+
upgradeabilityPolicy: "upgradeabilityPolicy",
|
|
193
|
+
factoryHasRole: "factoryHasRole",
|
|
194
|
+
factoryRoleMembers: "factoryRoleMembers",
|
|
195
|
+
// compliance-manager reads
|
|
196
|
+
complianceInfo: "complianceInfo",
|
|
197
|
+
activeDelegate: "isActiveDelegate",
|
|
198
|
+
clientDelegates: "clientDelegates",
|
|
199
|
+
complianceHasRole: "complianceHasRole",
|
|
200
|
+
complianceRoleMembers: "complianceRoleMembers"
|
|
201
|
+
};
|
|
202
|
+
var airdropKeys = {
|
|
203
|
+
/** One account's cumulative delivered total. Keyed on the CLAIM IDENTITY, never the sender. */
|
|
204
|
+
claimedAmount: (s, account) => airdropQueryKey({ ...s, fn: AIRDROP_FN.claimedAmount, args: [account] }),
|
|
205
|
+
paused: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.paused, args: [] }),
|
|
206
|
+
window: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.window, args: [] }),
|
|
207
|
+
config: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.config, args: [] }),
|
|
208
|
+
gasFee: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.gasFee, args: [] }),
|
|
209
|
+
merkleRoot: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.merkleRoot, args: [] }),
|
|
210
|
+
merkleRootMutable: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.merkleRootMutable, args: [] }),
|
|
211
|
+
hasRole: (s, role, holder) => airdropQueryKey({ ...s, fn: AIRDROP_FN.hasRole, args: [role, holder] }),
|
|
212
|
+
/** Every cached `hasRole` for this instance, whatever role/holder pair was queried. */
|
|
213
|
+
hasRoleAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.hasRole }),
|
|
214
|
+
roleMembers: (s, role) => airdropQueryKey({ ...s, fn: AIRDROP_FN.roleMembers, args: [role] }),
|
|
215
|
+
roleMembersAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.roleMembers }),
|
|
216
|
+
/** Every cached create-preflight, whatever params/mode/salt combination was queried. */
|
|
217
|
+
preflightCreateAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.preflightCreate }),
|
|
218
|
+
/** Every cached signature check on this instance; a claim consumes a digest and flips it. */
|
|
219
|
+
isSignatureValidAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.isSignatureValid }),
|
|
220
|
+
fees: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.fees, args: [] }),
|
|
221
|
+
customFee: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.customFee, args: [creator] }),
|
|
222
|
+
customFeeAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.customFee }),
|
|
223
|
+
/** Every registry page, whatever offset/limit was queried. */
|
|
224
|
+
registryAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.registry }),
|
|
225
|
+
implementations: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.implementations, args: [] }),
|
|
226
|
+
compliancePolicy: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.compliancePolicy, args: [creator] }),
|
|
227
|
+
compliancePolicyAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.compliancePolicy }),
|
|
228
|
+
upgradeabilityPolicy: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.upgradeabilityPolicy, args: [creator] }),
|
|
229
|
+
upgradeabilityPolicyAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.upgradeabilityPolicy }),
|
|
230
|
+
factoryHasRole: (s, role, holder) => airdropQueryKey({ ...s, fn: AIRDROP_FN.factoryHasRole, args: [role, holder] }),
|
|
231
|
+
factoryHasRoleAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.factoryHasRole }),
|
|
232
|
+
factoryRoleMembers: (s, role) => airdropQueryKey({ ...s, fn: AIRDROP_FN.factoryRoleMembers, args: [role] }),
|
|
233
|
+
factoryRoleMembersAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.factoryRoleMembers }),
|
|
234
|
+
complianceInfo: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.complianceInfo, args: [] }),
|
|
235
|
+
activeDelegate: (s, delegate) => airdropQueryKey({ ...s, fn: AIRDROP_FN.activeDelegate, args: [delegate] }),
|
|
236
|
+
activeDelegateAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.activeDelegate }),
|
|
237
|
+
clientDelegates: (s, index) => airdropQueryKey({ ...s, fn: AIRDROP_FN.clientDelegates, args: [index] }),
|
|
238
|
+
clientDelegatesAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.clientDelegates }),
|
|
239
|
+
complianceHasRole: (s, role, holder) => airdropQueryKey({ ...s, fn: AIRDROP_FN.complianceHasRole, args: [role, holder] }),
|
|
240
|
+
complianceHasRoleAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.complianceHasRole }),
|
|
241
|
+
complianceRoleMembers: (s, role) => airdropQueryKey({ ...s, fn: AIRDROP_FN.complianceRoleMembers, args: [role] }),
|
|
242
|
+
complianceRoleMembersAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.complianceRoleMembers })
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
export { AIRDROP_FN, airdropKeys, airdropQueryKey, airdropQueryKeyPrefix, useMemoAirdropBaseClient, useMemoAirdropFactoryClient, useMemoComplianceManagerClient, useMemoEcdsaAirdropClient, useMemoMerkleAirdropClient };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
|
|
4
4
|
var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkFT5H2Q7Y_cjs = require('./chunk-FT5H2Q7Y.cjs');
|
|
6
6
|
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
7
7
|
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
8
8
|
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
@@ -1826,7 +1826,7 @@ var TestnetFaucetClient = class {
|
|
|
1826
1826
|
this.#chainId = chainId;
|
|
1827
1827
|
assertTestnetFaucetChain(chainId);
|
|
1828
1828
|
const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
|
|
1829
|
-
const resolved = addressOverride ?? (chainId === void 0 ? void 0 :
|
|
1829
|
+
const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkFT5H2Q7Y_cjs.getConfidentialTestTokenAddress(chainId));
|
|
1830
1830
|
if (!resolved) {
|
|
1831
1831
|
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
1832
1832
|
reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
|
|
@@ -1864,7 +1864,7 @@ var TestnetFaucetClient = class {
|
|
|
1864
1864
|
*/
|
|
1865
1865
|
async underlyingToken() {
|
|
1866
1866
|
if (this.#cachedUnderlying) return this.#cachedUnderlying;
|
|
1867
|
-
const fromRegistry = this.#cttAddressIsOverride || this.#chainId === void 0 ? void 0 :
|
|
1867
|
+
const fromRegistry = this.#cttAddressIsOverride || this.#chainId === void 0 ? void 0 : chunkFT5H2Q7Y_cjs.getTestTokenAddress(this.#chainId);
|
|
1868
1868
|
const resolved = fromRegistry ?? await this.#readCtt("underlying");
|
|
1869
1869
|
this.#cachedUnderlying = chunkJK4XMMKM_cjs.normaliseAddress(resolved);
|
|
1870
1870
|
return this.#cachedUnderlying;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkWJLECC22_cjs = require('./chunk-WJLECC22.cjs');
|
|
4
4
|
var chunk3QHNYEQD_cjs = require('./chunk-3QHNYEQD.cjs');
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var chunkUHHMVBLU_cjs = require('./chunk-UHHMVBLU.cjs');
|
|
6
|
+
var chunkFT5H2Q7Y_cjs = require('./chunk-FT5H2Q7Y.cjs');
|
|
7
7
|
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var wagmi = require('wagmi');
|
|
@@ -26,7 +26,7 @@ function useHookFiredEvent(hookName, telemetry, hasWallet, chainId) {
|
|
|
26
26
|
function tryResolveFactoryAddress(override, chainId) {
|
|
27
27
|
if (override) return override;
|
|
28
28
|
if (chainId === void 0) return void 0;
|
|
29
|
-
return
|
|
29
|
+
return chunkFT5H2Q7Y_cjs.getFheVestingFactoryAddress(chainId);
|
|
30
30
|
}
|
|
31
31
|
function useMemoFactoryClient(opts = {}) {
|
|
32
32
|
const publicClient = wagmi.usePublicClient({ chainId: opts.chainId });
|
|
@@ -39,7 +39,7 @@ function useMemoFactoryClient(opts = {}) {
|
|
|
39
39
|
const client = react.useMemo(() => {
|
|
40
40
|
if (!publicClient) return void 0;
|
|
41
41
|
if (!resolvedAddress) return void 0;
|
|
42
|
-
return
|
|
42
|
+
return chunkUHHMVBLU_cjs.createConfidentialVestingFactoryClient({
|
|
43
43
|
publicClient,
|
|
44
44
|
...walletClient ? { walletClient } : {},
|
|
45
45
|
address: resolvedAddress,
|
|
@@ -66,7 +66,7 @@ function computeFactoryResolutionError(override, chainId) {
|
|
|
66
66
|
clientLabel: "ConfidentialVestingFactoryClient"
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
const resolved =
|
|
69
|
+
const resolved = chunkFT5H2Q7Y_cjs.getFheVestingFactoryAddress(chainId);
|
|
70
70
|
if (!resolved) {
|
|
71
71
|
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
72
72
|
reason: "registry-not-deployed",
|
|
@@ -10,22 +10,28 @@ var DEPLOYED_ADDRESSES = {
|
|
|
10
10
|
// mainnet omitted — not deployed.
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
|
-
// Airdrop v2 (tokenops-fhe-airdrop-v2 @
|
|
13
|
+
// Airdrop v2 (tokenops-fhe-airdrop-v2 @ 7175ac8). The four contracts deploy
|
|
14
14
|
// together in one scripted run, so a chain either has all of them or none —
|
|
15
15
|
// which is what `chainsWithDeployment` assumes.
|
|
16
|
+
//
|
|
17
|
+
// Every address moved at 7175ac8: `claim`'s breaking signature change forced a
|
|
18
|
+
// fresh Merkle implementation, and the run redeploys the whole system rather
|
|
19
|
+
// than repointing one implementation slot. A campaign planned against the old
|
|
20
|
+
// factory therefore predicts an address the new factory will never produce —
|
|
21
|
+
// `PredictionDriftError` is what catches that.
|
|
16
22
|
fheAirdrop: {
|
|
17
23
|
airdropFactory: {
|
|
18
|
-
[chains.sepolia.id]: "
|
|
24
|
+
[chains.sepolia.id]: "0x174A7CB40F64aBC4C95CecB4172A066Cf531e4E9"
|
|
19
25
|
// mainnet omitted — ZamaConfig-gated, not deployed.
|
|
20
26
|
},
|
|
21
27
|
ecdsaImplementation: {
|
|
22
|
-
[chains.sepolia.id]: "
|
|
28
|
+
[chains.sepolia.id]: "0xDeD7AB391f87B8F891F89AaEC64C7c9C800C6645"
|
|
23
29
|
},
|
|
24
30
|
merkleImplementation: {
|
|
25
|
-
[chains.sepolia.id]: "
|
|
31
|
+
[chains.sepolia.id]: "0x815E65Cdd707F07F09332537b47C530d0E87aAf5"
|
|
26
32
|
},
|
|
27
33
|
complianceManagerImplementation: {
|
|
28
|
-
[chains.sepolia.id]: "
|
|
34
|
+
[chains.sepolia.id]: "0x885474FA494748C85410482244a406C6Ad570CCe"
|
|
29
35
|
}
|
|
30
36
|
},
|
|
31
37
|
fheDisperse: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveEncryptor, encryptUint64 } from './chunk-
|
|
2
|
-
import { assertPredictionFresh, FeeCollectorSelfAdministeredError } from './chunk-
|
|
1
|
+
import { resolveEncryptor, encryptUint64Batch, encryptUint64 } from './chunk-X7WBPCEU.js';
|
|
2
|
+
import { assertPredictionFresh, FeeCollectorSelfAdministeredError } from './chunk-VW356KR3.js';
|
|
3
3
|
import { normaliseAddress } from './chunk-ZA673I3O.js';
|
|
4
4
|
import { InvalidArgumentError, MissingWalletClientError, MissingAccountError, ContractRevertError, MissingEncryptorError, isTokenOpsSdkError, UnknownWriteFailureError } from './chunk-QBJ7O2B4.js';
|
|
5
5
|
import { StandardMerkleTree } from '@openzeppelin/merkle-tree';
|
|
@@ -9,7 +9,7 @@ function leafOf(args) {
|
|
|
9
9
|
const inner = keccak256(
|
|
10
10
|
encodeAbiParameters(
|
|
11
11
|
[{ type: "address" }, { type: "address" }, { type: "bytes32" }],
|
|
12
|
-
[args.instance, args.
|
|
12
|
+
[args.instance, args.account, args.handle]
|
|
13
13
|
)
|
|
14
14
|
);
|
|
15
15
|
return keccak256(inner);
|
|
@@ -40,19 +40,19 @@ function assertLeaves(instance, leaves, method) {
|
|
|
40
40
|
}
|
|
41
41
|
const seen = /* @__PURE__ */ new Map();
|
|
42
42
|
leaves.forEach((leaf, index) => {
|
|
43
|
-
if (!isAddress(leaf.
|
|
43
|
+
if (!isAddress(leaf.account, { strict: false })) {
|
|
44
44
|
throw new InvalidArgumentError({
|
|
45
45
|
method,
|
|
46
|
-
argument: `leaves[${index}].
|
|
46
|
+
argument: `leaves[${index}].account`,
|
|
47
47
|
reason: "is not a 20-byte hex address",
|
|
48
|
-
value: leaf.
|
|
48
|
+
value: leaf.account
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
if (isAddressEqual(leaf.
|
|
51
|
+
if (isAddressEqual(leaf.account, zeroAddress)) {
|
|
52
52
|
throw new InvalidArgumentError({
|
|
53
53
|
method,
|
|
54
|
-
argument: `leaves[${index}].
|
|
55
|
-
reason: "is the zero address
|
|
54
|
+
argument: `leaves[${index}].account`,
|
|
55
|
+
reason: "is the zero address; the contract rejects it with ZeroAccount"
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
if (!HANDLE_PATTERN.test(leaf.handle)) {
|
|
@@ -63,13 +63,13 @@ function assertLeaves(instance, leaves, method) {
|
|
|
63
63
|
value: leaf.handle
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
-
const key = leaf.
|
|
66
|
+
const key = leaf.account.toLowerCase();
|
|
67
67
|
const first = seen.get(key);
|
|
68
68
|
if (first !== void 0) {
|
|
69
69
|
throw new InvalidArgumentError({
|
|
70
70
|
method,
|
|
71
|
-
argument: `leaves[${index}].
|
|
72
|
-
reason: `appears twice (also at index ${first}); one root pays max, not sum, of
|
|
71
|
+
argument: `leaves[${index}].account`,
|
|
72
|
+
reason: `appears twice (also at index ${first}); one root pays max, not sum, of an account's leaves \u2014 merge them into a single cumulative total`
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
seen.set(key, index);
|
|
@@ -81,22 +81,23 @@ function buildMerkleTree(args) {
|
|
|
81
81
|
function buildMerkleTreeInternal({ instance, leaves }, method) {
|
|
82
82
|
assertLeaves(instance, leaves, method);
|
|
83
83
|
const airdrop = normaliseAddress(instance);
|
|
84
|
-
const accounts = leaves.map((leaf) => normaliseAddress(leaf.
|
|
84
|
+
const accounts = leaves.map((leaf) => normaliseAddress(leaf.account));
|
|
85
85
|
const rows = accounts.map((account, i) => [airdrop, account, leaves[i].handle]);
|
|
86
86
|
const tree = StandardMerkleTree.of(rows, ["address", "address", "bytes32"]);
|
|
87
87
|
return {
|
|
88
88
|
root: tree.root,
|
|
89
|
-
// `getProof(i)` indexes the INPUT array, not the tree: `StandardMerkleTree`
|
|
90
|
-
//
|
|
91
|
-
//
|
|
89
|
+
// `getProof(i)` indexes the INPUT array, not the tree: `StandardMerkleTree` sorts
|
|
90
|
+
// leaves internally but keeps `values` in insertion order, so entry `i` always belongs
|
|
91
|
+
// to `leaves[i]`.
|
|
92
92
|
entries: leaves.map((leaf, i) => ({
|
|
93
93
|
...leaf,
|
|
94
|
-
|
|
94
|
+
account: accounts[i],
|
|
95
95
|
merkleProof: tree.getProof(i)
|
|
96
96
|
}))
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
var MAX_UINT64 = (1n << 64n) - 1n;
|
|
100
|
+
var MERKLE_BATCH_LIMIT = 2048 / 64;
|
|
100
101
|
function validateCampaignRecipients(recipients) {
|
|
101
102
|
validateCampaignRecipientsInternal(recipients, "validateCampaignRecipients");
|
|
102
103
|
}
|
|
@@ -145,7 +146,7 @@ function validateCampaignRecipientsInternal(recipients, method) {
|
|
|
145
146
|
seen.set(key, index);
|
|
146
147
|
});
|
|
147
148
|
}
|
|
148
|
-
async function encryptRoster({ instance, recipients, encryptor }, method) {
|
|
149
|
+
async function encryptRoster({ instance, recipients, encryptor, submitter }, method) {
|
|
149
150
|
validateCampaignRecipientsInternal(recipients, method);
|
|
150
151
|
if (!isAddress(instance, { strict: false })) {
|
|
151
152
|
throw new InvalidArgumentError({
|
|
@@ -168,8 +169,51 @@ async function encryptRoster({ instance, recipients, encryptor }, method) {
|
|
|
168
169
|
hint: "Pass an encryptor instance, or a lazy factory that returns one."
|
|
169
170
|
});
|
|
170
171
|
}
|
|
172
|
+
if (submitter !== void 0) {
|
|
173
|
+
if (!isAddress(submitter, { strict: false })) {
|
|
174
|
+
throw new InvalidArgumentError({
|
|
175
|
+
method,
|
|
176
|
+
argument: "submitter",
|
|
177
|
+
reason: "is not a 20-byte hex address",
|
|
178
|
+
value: submitter
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
if (isAddressEqual(submitter, zeroAddress)) {
|
|
182
|
+
throw new InvalidArgumentError({
|
|
183
|
+
method,
|
|
184
|
+
argument: "submitter",
|
|
185
|
+
reason: "is the zero address; no proof can be bound to it, so no leaf would be claimable"
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
171
189
|
const airdrop = normaliseAddress(instance);
|
|
172
190
|
const accounts = recipients.map((r) => normaliseAddress(r.recipient));
|
|
191
|
+
if (submitter !== void 0) {
|
|
192
|
+
const boundTo = normaliseAddress(submitter);
|
|
193
|
+
const chunks = [];
|
|
194
|
+
for (let i = 0; i < recipients.length; i += MERKLE_BATCH_LIMIT) {
|
|
195
|
+
chunks.push(recipients.slice(i, i + MERKLE_BATCH_LIMIT));
|
|
196
|
+
}
|
|
197
|
+
const encryptedChunks = await Promise.all(
|
|
198
|
+
chunks.map(
|
|
199
|
+
(chunk) => encryptUint64Batch({
|
|
200
|
+
encryptor: enc,
|
|
201
|
+
contractAddress: airdrop,
|
|
202
|
+
userAddress: boundTo,
|
|
203
|
+
values: chunk.map((r) => r.cumulativeTotal)
|
|
204
|
+
})
|
|
205
|
+
)
|
|
206
|
+
);
|
|
207
|
+
return accounts.map((account, i) => {
|
|
208
|
+
const chunk = encryptedChunks[Math.floor(i / MERKLE_BATCH_LIMIT)];
|
|
209
|
+
return {
|
|
210
|
+
account,
|
|
211
|
+
boundTo,
|
|
212
|
+
handle: chunk.handles[i % MERKLE_BATCH_LIMIT],
|
|
213
|
+
inputProof: chunk.inputProof
|
|
214
|
+
};
|
|
215
|
+
});
|
|
216
|
+
}
|
|
173
217
|
const encrypted = await Promise.all(
|
|
174
218
|
recipients.map(
|
|
175
219
|
(r, i) => encryptUint64({
|
|
@@ -180,8 +224,9 @@ async function encryptRoster({ instance, recipients, encryptor }, method) {
|
|
|
180
224
|
})
|
|
181
225
|
)
|
|
182
226
|
);
|
|
183
|
-
return accounts.map((
|
|
184
|
-
|
|
227
|
+
return accounts.map((account, i) => ({
|
|
228
|
+
account,
|
|
229
|
+
boundTo: account,
|
|
185
230
|
handle: encrypted[i].handle,
|
|
186
231
|
inputProof: encrypted[i].inputProof
|
|
187
232
|
}));
|
|
@@ -192,9 +237,13 @@ async function encryptCampaignAmounts(args) {
|
|
|
192
237
|
async function buildMerkleCampaign({
|
|
193
238
|
instance,
|
|
194
239
|
recipients,
|
|
195
|
-
encryptor
|
|
240
|
+
encryptor,
|
|
241
|
+
submitter
|
|
196
242
|
}) {
|
|
197
|
-
const leaves = await encryptRoster(
|
|
243
|
+
const leaves = await encryptRoster(
|
|
244
|
+
{ instance, recipients, encryptor, submitter },
|
|
245
|
+
"buildMerkleCampaign"
|
|
246
|
+
);
|
|
198
247
|
return buildMerkleTreeInternal({ instance, leaves }, "buildMerkleCampaign");
|
|
199
248
|
}
|
|
200
249
|
async function planMerkleCampaign({
|
|
@@ -204,7 +253,8 @@ async function planMerkleCampaign({
|
|
|
204
253
|
creator,
|
|
205
254
|
userSalt,
|
|
206
255
|
recipients,
|
|
207
|
-
encryptor
|
|
256
|
+
encryptor,
|
|
257
|
+
submitter
|
|
208
258
|
}) {
|
|
209
259
|
validateCampaignRecipientsInternal(recipients, "planMerkleCampaign");
|
|
210
260
|
const initCodeHashBefore = await factory.getMerkleInitCodeHash({ params, mode });
|
|
@@ -217,7 +267,8 @@ async function planMerkleCampaign({
|
|
|
217
267
|
const campaign = await buildMerkleCampaign({
|
|
218
268
|
instance: predictedAddress,
|
|
219
269
|
recipients,
|
|
220
|
-
encryptor
|
|
270
|
+
encryptor,
|
|
271
|
+
submitter
|
|
221
272
|
});
|
|
222
273
|
const initCodeHashAfter = await factory.getMerkleInitCodeHash({ params, mode });
|
|
223
274
|
assertPredictionFresh({
|
|
@@ -233,12 +284,14 @@ async function rotateMerkleRoot({
|
|
|
233
284
|
airdrop,
|
|
234
285
|
recipients,
|
|
235
286
|
encryptor,
|
|
287
|
+
submitter,
|
|
236
288
|
account
|
|
237
289
|
}) {
|
|
238
290
|
const campaign = await buildMerkleCampaign({
|
|
239
291
|
instance: airdrop.address,
|
|
240
292
|
recipients,
|
|
241
|
-
encryptor
|
|
293
|
+
encryptor,
|
|
294
|
+
submitter
|
|
242
295
|
});
|
|
243
296
|
const hash = await airdrop.setMerkleRoot({ newRoot: campaign.root, account });
|
|
244
297
|
return { ...campaign, hash };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createConfidentialVestingManagerClient } from './chunk-TWT3STIX.js';
|
|
2
2
|
import { resolveEncryptor } from './chunk-6GNR22OV.js';
|
|
3
|
-
import { createConfidentialVestingFactoryClient } from './chunk-
|
|
4
|
-
import { getFheVestingFactoryAddress } from './chunk-
|
|
3
|
+
import { createConfidentialVestingFactoryClient } from './chunk-WJMEBBU7.js';
|
|
4
|
+
import { getFheVestingFactoryAddress } from './chunk-A4DCEE33.js';
|
|
5
5
|
import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
|
|
6
6
|
import { useMemo, useRef, useEffect } from 'react';
|
|
7
7
|
import { usePublicClient, useWalletClient } from 'wagmi';
|