@tokenops/sdk 2.0.0-alpha.2 → 2.0.0-alpha.3
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 +39 -3
- package/README.md +11 -5
- package/dist/{chunk-PZZK3O3S.cjs → chunk-4AWQJQXY.cjs} +391 -43
- package/dist/{chunk-SPLNGUFF.js → chunk-4IB4IY5Y.js} +1 -1
- package/dist/{chunk-A4DCEE33.js → chunk-6HCT4QIX.js} +11 -10
- package/dist/{chunk-MM5BV5CS.cjs → chunk-6XOAYDC6.cjs} +4 -4
- package/dist/{chunk-FEDX7B6T.cjs → chunk-AHU2HMNE.cjs} +3 -3
- package/dist/{chunk-IGO5XSPS.js → chunk-BPIVVCSQ.js} +2 -2
- package/dist/{chunk-X7WBPCEU.js → chunk-BXX5TETM.js} +375 -27
- package/dist/{chunk-GADGBQJO.js → chunk-GCJFAY4X.js} +2 -2
- package/dist/{chunk-IUKKNJ2R.cjs → chunk-GKYZQJGP.cjs} +7 -7
- package/dist/{chunk-3YHBO2DL.cjs → chunk-IEKTGJ4J.cjs} +2 -2
- package/dist/{chunk-UHHMVBLU.cjs → chunk-JVNJSDQ4.cjs} +2 -2
- package/dist/{chunk-VW356KR3.js → chunk-LEYYG4RF.js} +126 -3
- package/dist/{chunk-PYYSB5ZN.js → chunk-NGU4JYIR.js} +1 -1
- package/dist/{chunk-FT5H2Q7Y.cjs → chunk-PG3WXT3K.cjs} +11 -10
- package/dist/{chunk-44YJPMQC.js → chunk-PK6Q6J5F.js} +1 -1
- package/dist/{chunk-EBLBPUPI.cjs → chunk-TND5NDV7.cjs} +18 -10
- package/dist/{chunk-EYDA6Q6C.js → chunk-U3TBQRT7.js} +10 -2
- package/dist/{chunk-WJMEBBU7.js → chunk-WRWRA4TN.js} +1 -1
- package/dist/{chunk-FHWSBGWE.cjs → chunk-YABHXJNH.cjs} +5 -5
- package/dist/{chunk-AREQJHKA.cjs → chunk-YTIYTV4K.cjs} +129 -2
- package/dist/core/addresses.d.ts +4 -4
- package/dist/core/errors.d.ts +1 -1
- package/dist/fhe-airdrop/abis/airdrop-base.d.ts +19 -0
- package/dist/fhe-airdrop/abis/ecdsa.d.ts +19 -0
- package/dist/fhe-airdrop/abis/factory.d.ts +113 -0
- package/dist/fhe-airdrop/abis/merkle.d.ts +19 -0
- 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 +110 -80
- package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -0
- package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -0
- package/dist/fhe-airdrop/advanced/react/index.js +34 -5
- package/dist/fhe-airdrop/advanced/react/useDisableCustomFee.d.ts +2 -1
- package/dist/fhe-airdrop/advanced/react/useFactoryRenounceRole.d.ts +4 -3
- package/dist/fhe-airdrop/advanced/react/useFactoryRevokeRole.d.ts +9 -7
- package/dist/fhe-airdrop/advanced/react/useFactoryRoleMembers.d.ts +6 -5
- package/dist/fhe-airdrop/advanced/react/useSetCustomFee.d.ts +2 -1
- package/dist/fhe-airdrop/advanced/react/useSetDefaultGasFee.d.ts +5 -3
- package/dist/fhe-airdrop/advanced/react/useSetMaxGasFee.d.ts +33 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +47 -8
- package/dist/fhe-airdrop/constants.d.ts +9 -1
- package/dist/fhe-airdrop/ecdsa.d.ts +13 -0
- package/dist/fhe-airdrop/errors.d.ts +59 -0
- package/dist/fhe-airdrop/factory.d.ts +62 -22
- package/dist/fhe-airdrop/guards.d.ts +87 -2
- package/dist/fhe-airdrop/index.cjs +67 -55
- package/dist/fhe-airdrop/index.d.cts +3 -3
- package/dist/fhe-airdrop/index.d.ts +3 -3
- package/dist/fhe-airdrop/index.js +4 -4
- package/dist/fhe-airdrop/react/index.cjs +237 -177
- package/dist/fhe-airdrop/react/index.d.cts +4 -1
- package/dist/fhe-airdrop/react/index.d.ts +4 -1
- package/dist/fhe-airdrop/react/index.js +72 -15
- package/dist/fhe-airdrop/react/keys.d.ts +8 -0
- package/dist/fhe-airdrop/react/useFactoryFees.d.ts +11 -4
- package/dist/fhe-airdrop/react/useIsAirdrop.d.ts +44 -0
- package/dist/fhe-airdrop/react/useRefreshComplianceBalance.d.ts +36 -0
- package/dist/fhe-airdrop/react/useResolveGasFee.d.ts +30 -0
- package/dist/fhe-airdrop/types.d.ts +13 -0
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk4AWQJQXY_cjs = require('./chunk-4AWQJQXY.cjs');
|
|
4
|
+
var chunkYTIYTV4K_cjs = require('./chunk-YTIYTV4K.cjs');
|
|
5
5
|
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
6
6
|
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
7
7
|
var merkleTree = require('@openzeppelin/merkle-tree');
|
|
@@ -165,7 +165,7 @@ async function encryptRoster({ instance, recipients, encryptor, submitter }, met
|
|
|
165
165
|
reason: "is the zero address; inputs must be bound to the airdrop instance"
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
|
-
const enc =
|
|
168
|
+
const enc = chunk4AWQJQXY_cjs.resolveEncryptor(encryptor);
|
|
169
169
|
if (!enc) {
|
|
170
170
|
throw new chunk67OV5CX2_cjs.MissingEncryptorError(method, {
|
|
171
171
|
hint: "Pass an encryptor instance, or a lazy factory that returns one."
|
|
@@ -198,7 +198,7 @@ async function encryptRoster({ instance, recipients, encryptor, submitter }, met
|
|
|
198
198
|
}
|
|
199
199
|
const encryptedChunks = await Promise.all(
|
|
200
200
|
chunks.map(
|
|
201
|
-
(chunk) =>
|
|
201
|
+
(chunk) => chunk4AWQJQXY_cjs.encryptUint64Batch({
|
|
202
202
|
encryptor: enc,
|
|
203
203
|
contractAddress: airdrop,
|
|
204
204
|
userAddress: boundTo,
|
|
@@ -218,7 +218,7 @@ async function encryptRoster({ instance, recipients, encryptor, submitter }, met
|
|
|
218
218
|
}
|
|
219
219
|
const encrypted = await Promise.all(
|
|
220
220
|
recipients.map(
|
|
221
|
-
(r, i) =>
|
|
221
|
+
(r, i) => chunk4AWQJQXY_cjs.encryptUint64({
|
|
222
222
|
encryptor: enc,
|
|
223
223
|
contractAddress: airdrop,
|
|
224
224
|
userAddress: accounts[i],
|
|
@@ -273,7 +273,7 @@ async function planMerkleCampaign({
|
|
|
273
273
|
submitter
|
|
274
274
|
});
|
|
275
275
|
const initCodeHashAfter = await factory.getMerkleInitCodeHash({ params, mode });
|
|
276
|
-
|
|
276
|
+
chunkYTIYTV4K_cjs.assertPredictionFresh({
|
|
277
277
|
variant: "merkle",
|
|
278
278
|
initCodeHashBefore,
|
|
279
279
|
initCodeHashAfter,
|
|
@@ -311,7 +311,7 @@ var ASSIGNABLE_ROLES = [
|
|
|
311
311
|
function planInstanceRoleSplit(args) {
|
|
312
312
|
const { assignment, caller, airdropType } = args;
|
|
313
313
|
if (assignment.feeCollector !== void 0) {
|
|
314
|
-
throw new
|
|
314
|
+
throw new chunkYTIYTV4K_cjs.FeeCollectorSelfAdministeredError({ requestedGrantee: assignment.feeCollector });
|
|
315
315
|
}
|
|
316
316
|
const steps = [];
|
|
317
317
|
for (const { key, role, variant } of ASSIGNABLE_ROLES) {
|
|
@@ -4,7 +4,7 @@ var chunkTEBM66WA_cjs = require('./chunk-TEBM66WA.cjs');
|
|
|
4
4
|
var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
|
|
5
5
|
var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
|
|
6
6
|
var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
|
|
7
|
-
var
|
|
7
|
+
var chunkPG3WXT3K_cjs = require('./chunk-PG3WXT3K.cjs');
|
|
8
8
|
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
9
9
|
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
10
10
|
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
@@ -2052,7 +2052,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2052
2052
|
this.#telemetry = config.telemetry;
|
|
2053
2053
|
const chainId = config.chainId ?? config.publicClient.chain?.id;
|
|
2054
2054
|
const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
|
|
2055
|
-
const resolved = addressOverride ?? (chainId === void 0 ? void 0 :
|
|
2055
|
+
const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkPG3WXT3K_cjs.getFheDisperseSingletonAddress(chainId));
|
|
2056
2056
|
if (!resolved) {
|
|
2057
2057
|
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
2058
2058
|
reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
|
|
@@ -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 chunkPG3WXT3K_cjs = require('./chunk-PG3WXT3K.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');
|
|
@@ -446,7 +446,7 @@ var ConfidentialVestingFactoryClient = class {
|
|
|
446
446
|
this.walletClient = config.walletClient;
|
|
447
447
|
const chainId = config.chainId ?? config.publicClient.chain?.id;
|
|
448
448
|
const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
|
|
449
|
-
const resolved = addressOverride ?? (chainId === void 0 ? void 0 :
|
|
449
|
+
const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunkPG3WXT3K_cjs.getFheVestingFactoryAddress(chainId));
|
|
450
450
|
if (!resolved) {
|
|
451
451
|
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
452
452
|
reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
|
|
@@ -3,9 +3,10 @@ import { TokenOpsSdkError, InvalidArgumentError, FeatureDisabledError, Unsupport
|
|
|
3
3
|
import { isAddressEqual, zeroAddress, isAddress, BaseError, ContractFunctionZeroDataError } from 'viem';
|
|
4
4
|
|
|
5
5
|
// src/fhe-airdrop/constants.ts
|
|
6
|
-
var AIRDROP_CONTRACTS_COMMIT = "
|
|
6
|
+
var AIRDROP_CONTRACTS_COMMIT = "c5c12c2087f61bcd5bd1daa802563ed3cd68f002";
|
|
7
7
|
var DEPLOYMENT_MODE = { clone: 0, uups: 1 };
|
|
8
8
|
var DEDUP_MODE = { perAddress: 0, perDedupId: 1, both: 2, none: 3 };
|
|
9
|
+
var UINT96_MAX = (1n << 96n) - 1n;
|
|
9
10
|
|
|
10
11
|
// src/fhe-airdrop/errors.ts
|
|
11
12
|
var MerkleUupsUnsupportedError = class extends TokenOpsSdkError {
|
|
@@ -203,6 +204,42 @@ var ClaimWindowClosedError = class extends TokenOpsSdkError {
|
|
|
203
204
|
});
|
|
204
205
|
}
|
|
205
206
|
};
|
|
207
|
+
var GasFeeNotAcceptedError = class extends TokenOpsSdkError {
|
|
208
|
+
name = "GasFeeNotAcceptedError";
|
|
209
|
+
constructor(args) {
|
|
210
|
+
const detail = args.resolvedFee !== void 0 && args.maxAcceptedGasFee !== void 0 ? ` The factory resolved ${args.resolvedFee} wei; \`maxAcceptedGasFee\` is ${args.maxAcceptedGasFee} wei.` : "";
|
|
211
|
+
super(
|
|
212
|
+
`${args.method}: the resolved per-claim gas fee exceeds \`common.maxAcceptedGasFee\`.${detail} The fee is frozen into the instance at create and cannot be changed after. Every claimant pays it on every claim, so raise the bound only if that is a fee you accept charging them.`,
|
|
213
|
+
{
|
|
214
|
+
code: "TOKENOPS_GAS_FEE_NOT_ACCEPTED",
|
|
215
|
+
cause: args.cause,
|
|
216
|
+
context: {
|
|
217
|
+
method: args.method,
|
|
218
|
+
contractAddress: args.contractAddress,
|
|
219
|
+
resolvedFee: args.resolvedFee,
|
|
220
|
+
maxAcceptedGasFee: args.maxAcceptedGasFee
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
var UnrecognisedAirdropError = class extends TokenOpsSdkError {
|
|
227
|
+
name = "UnrecognisedAirdropError";
|
|
228
|
+
constructor(args) {
|
|
229
|
+
super(
|
|
230
|
+
`${args.method}: ${args.contractAddress} was not created by the factory at ${args.factory}, so it is not a TokenOps airdrop. Treat its ABI, its events and its pool as unverified.`,
|
|
231
|
+
{
|
|
232
|
+
code: "TOKENOPS_UNRECOGNISED_AIRDROP",
|
|
233
|
+
cause: args.cause,
|
|
234
|
+
context: {
|
|
235
|
+
method: args.method,
|
|
236
|
+
contractAddress: args.contractAddress,
|
|
237
|
+
factory: args.factory
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
206
243
|
var airdropProductMapper = (name, errArgs, ctx) => {
|
|
207
244
|
switch (name) {
|
|
208
245
|
// ---- guarded conditions, caught on-chain instead of pre-flight -------
|
|
@@ -287,6 +324,28 @@ var airdropProductMapper = (name, errArgs, ctx) => {
|
|
|
287
324
|
}
|
|
288
325
|
// ---- argument-validation bucket: reverts not already covered by the
|
|
289
326
|
// cross-product default mapper's `Zero*`/`Invalid*` list ---------------
|
|
327
|
+
case "GasFeeNotAccepted": {
|
|
328
|
+
const resolvedFee = errArgs?.[0];
|
|
329
|
+
const maxAcceptedGasFee = errArgs?.[1];
|
|
330
|
+
return new GasFeeNotAcceptedError({ ...ctx, resolvedFee, maxAcceptedGasFee });
|
|
331
|
+
}
|
|
332
|
+
case "GasFeeExceedsMaximum": {
|
|
333
|
+
const gasFee = errArgs?.[0];
|
|
334
|
+
const maxGasFee = errArgs?.[1];
|
|
335
|
+
return new InvalidArgumentError({
|
|
336
|
+
method: ctx.method,
|
|
337
|
+
argument: "gasFee",
|
|
338
|
+
reason: `exceeds the factory's own maximum${gasFee !== void 0 && maxGasFee !== void 0 ? ` (${gasFee} wei > ${maxGasFee} wei)` : ""}; \`setMaxGasFee\` is DEFAULT_ADMIN_ROLE-gated and bounds what FEE_MANAGER_ROLE may configure`,
|
|
339
|
+
value: gasFee
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
case "ZeroUnwrapRequestId":
|
|
343
|
+
return invalidArg(
|
|
344
|
+
ctx,
|
|
345
|
+
"token",
|
|
346
|
+
name,
|
|
347
|
+
"the wrapper returned the zero request id, which names no handle to read the delivered amount from; the campaign token is not a conforming ERC7984ERC20Wrapper"
|
|
348
|
+
);
|
|
290
349
|
case "ZeroToken":
|
|
291
350
|
return invalidArg(ctx, "token", name);
|
|
292
351
|
case "ZeroFeeCollector":
|
|
@@ -319,7 +378,7 @@ var airdropProductMapper = (name, errArgs, ctx) => {
|
|
|
319
378
|
ctx,
|
|
320
379
|
"admin",
|
|
321
380
|
name,
|
|
322
|
-
"revoking or renouncing the sole DEFAULT_ADMIN_ROLE member would leave the
|
|
381
|
+
"revoking or renouncing the sole DEFAULT_ADMIN_ROLE member would leave the contract permanently ungovernable. Declared once and enforced by BOTH the instances and the factory, each on its own admin set (audit-14) - grant a second admin first, then renounce"
|
|
323
382
|
);
|
|
324
383
|
case "LastFeeCollector":
|
|
325
384
|
return invalidArg(
|
|
@@ -478,6 +537,27 @@ async function assertSaltAvailable(args) {
|
|
|
478
537
|
predictedAddress: args.predictedAddress
|
|
479
538
|
});
|
|
480
539
|
}
|
|
540
|
+
function assertMaxAcceptedGasFeeRange(value, method) {
|
|
541
|
+
if (value < 0n || value > UINT96_MAX) {
|
|
542
|
+
throw new InvalidArgumentError({
|
|
543
|
+
method,
|
|
544
|
+
argument: "common.maxAcceptedGasFee",
|
|
545
|
+
reason: `is outside uint96 (0 to ${UINT96_MAX}); the params tuple cannot be ABI-encoded at all`,
|
|
546
|
+
value
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
async function assertGasFeeAccepted(args) {
|
|
551
|
+
assertMaxAcceptedGasFeeRange(args.maxAcceptedGasFee, args.method);
|
|
552
|
+
const resolvedFee = await args.factory.resolveGasFee(args.creator);
|
|
553
|
+
if (resolvedFee <= args.maxAcceptedGasFee) return;
|
|
554
|
+
throw new GasFeeNotAcceptedError({
|
|
555
|
+
method: args.method,
|
|
556
|
+
contractAddress: args.factory.address,
|
|
557
|
+
resolvedFee,
|
|
558
|
+
maxAcceptedGasFee: args.maxAcceptedGasFee
|
|
559
|
+
});
|
|
560
|
+
}
|
|
481
561
|
function assertPredictionFresh(args) {
|
|
482
562
|
if (args.initCodeHashBefore.toLowerCase() === args.initCodeHashAfter.toLowerCase()) return;
|
|
483
563
|
throw new PredictionDriftError({
|
|
@@ -495,6 +575,20 @@ async function preflightCreate(args) {
|
|
|
495
575
|
if (args.variant === "merkle") {
|
|
496
576
|
collect(blockers, () => assertMerkleModeSupported(args.mode));
|
|
497
577
|
}
|
|
578
|
+
const encodable = collect(
|
|
579
|
+
blockers,
|
|
580
|
+
() => assertMaxAcceptedGasFeeRange(args.params.common.maxAcceptedGasFee, method)
|
|
581
|
+
);
|
|
582
|
+
if (!encodable) return { ready: false, blockers };
|
|
583
|
+
await collectAsync(
|
|
584
|
+
blockers,
|
|
585
|
+
() => assertGasFeeAccepted({
|
|
586
|
+
factory: args.factory,
|
|
587
|
+
creator: args.creator,
|
|
588
|
+
maxAcceptedGasFee: args.params.common.maxAcceptedGasFee,
|
|
589
|
+
method
|
|
590
|
+
})
|
|
591
|
+
);
|
|
498
592
|
const predictArgs = {
|
|
499
593
|
mode: args.mode,
|
|
500
594
|
deployer: args.creator,
|
|
@@ -548,6 +642,22 @@ async function preflightCreate(args) {
|
|
|
548
642
|
}
|
|
549
643
|
return { ready: blockers.length === 0, blockers };
|
|
550
644
|
}
|
|
645
|
+
async function assertKnownAirdrop(args) {
|
|
646
|
+
if (args.factory.chainId !== args.chainId) {
|
|
647
|
+
throw new InvalidArgumentError({
|
|
648
|
+
method: args.method,
|
|
649
|
+
argument: "factory",
|
|
650
|
+
reason: `is bound to chain ${args.factory.chainId} but the airdrop is on chain ${args.chainId}; a registry answer from another chain proves nothing about this instance`,
|
|
651
|
+
value: args.factory.address
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
if (await args.factory.isAirdrop(args.airdrop)) return;
|
|
655
|
+
throw new UnrecognisedAirdropError({
|
|
656
|
+
method: args.method,
|
|
657
|
+
contractAddress: args.airdrop,
|
|
658
|
+
factory: args.factory.address
|
|
659
|
+
});
|
|
660
|
+
}
|
|
551
661
|
function assertMerkleClaimIdentity(args) {
|
|
552
662
|
const { method, account, submitter, boundTo, to, entrypoint = "claim" } = args;
|
|
553
663
|
for (const [argument, value] of [
|
|
@@ -599,6 +709,17 @@ async function preflightClaim(args) {
|
|
|
599
709
|
const method = "preflightClaim";
|
|
600
710
|
const blockers = [];
|
|
601
711
|
collect(blockers, () => assertSupportedChain(airdrop.chainId));
|
|
712
|
+
if (args.factory) {
|
|
713
|
+
await collectAsync(
|
|
714
|
+
blockers,
|
|
715
|
+
() => assertKnownAirdrop({
|
|
716
|
+
factory: args.factory,
|
|
717
|
+
airdrop: airdrop.address,
|
|
718
|
+
chainId: airdrop.chainId,
|
|
719
|
+
method
|
|
720
|
+
})
|
|
721
|
+
);
|
|
722
|
+
}
|
|
602
723
|
if (args.account !== void 0 || args.entrypoint !== void 0) {
|
|
603
724
|
collect(
|
|
604
725
|
blockers,
|
|
@@ -671,9 +792,11 @@ async function preflightClaim(args) {
|
|
|
671
792
|
function collect(blockers, run) {
|
|
672
793
|
try {
|
|
673
794
|
run();
|
|
795
|
+
return true;
|
|
674
796
|
} catch (err) {
|
|
675
797
|
if (!isTokenOpsSdkError(err)) throw err;
|
|
676
798
|
blockers.push(err);
|
|
799
|
+
return false;
|
|
677
800
|
}
|
|
678
801
|
}
|
|
679
802
|
async function collectAsync(blockers, run) {
|
|
@@ -685,4 +808,4 @@ async function collectAsync(blockers, run) {
|
|
|
685
808
|
}
|
|
686
809
|
}
|
|
687
810
|
|
|
688
|
-
export { AIRDROP_CONTRACTS_COMMIT, AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, DEDUP_MODE, DEPLOYMENT_MODE, DedupIdConsumedError, FeeCollectorSelfAdministeredError, MerkleUupsUnsupportedError, NonStockWrapperError, PredictionDriftError, SaltCollisionError, SignatureExpiredError, UnauthorizedRedirectError, UpgradeabilityNotAllowedError, airdropProductMapper, assertMerkleClaimIdentity, assertMerkleModeSupported, assertPredictionFresh, assertSaltAvailable, assertStockWrapper, assertSupportedChain, preflightClaim, preflightCreate };
|
|
811
|
+
export { AIRDROP_CONTRACTS_COMMIT, AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError, DEDUP_MODE, DEPLOYMENT_MODE, DedupIdConsumedError, FeeCollectorSelfAdministeredError, GasFeeNotAcceptedError, MerkleUupsUnsupportedError, NonStockWrapperError, PredictionDriftError, SaltCollisionError, SignatureExpiredError, UINT96_MAX, UnauthorizedRedirectError, UnrecognisedAirdropError, UpgradeabilityNotAllowedError, airdropProductMapper, assertGasFeeAccepted, assertMerkleClaimIdentity, assertMerkleModeSupported, assertPredictionFresh, assertSaltAvailable, assertStockWrapper, assertSupportedChain, preflightClaim, preflightCreate };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConfidentialVestingFactoryClient, confidentialVestingFactoryAbi } from './chunk-
|
|
1
|
+
import { ConfidentialVestingFactoryClient, confidentialVestingFactoryAbi } from './chunk-WRWRA4TN.js';
|
|
2
2
|
|
|
3
3
|
// src/fhe-vesting/advanced/factory-advanced.ts
|
|
4
4
|
var ConfidentialVestingFactoryAdvancedClient = class extends ConfidentialVestingFactoryClient {
|
|
@@ -10,28 +10,29 @@ 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 @ c5c12c2). 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
16
|
//
|
|
17
|
-
// Every address moved at
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
17
|
+
// Every address moved again at c5c12c2. The internal-audit round changed the
|
|
18
|
+
// factory and all three implementations, and CREATE3 returns a consumed salt's
|
|
19
|
+
// EXISTING address without comparing codehashes - so the run bumps the canonical
|
|
20
|
+
// salt version (2.0.0 → 2.0.2) rather than redeploying over itself. A campaign
|
|
21
|
+
// planned against the previous factory therefore predicts an address the new
|
|
22
|
+
// factory will never produce; `PredictionDriftError` is what catches that.
|
|
22
23
|
fheAirdrop: {
|
|
23
24
|
airdropFactory: {
|
|
24
|
-
[chains.sepolia.id]: "
|
|
25
|
+
[chains.sepolia.id]: "0xA10ff713cfeE5348313Cda0B2CA1b190A1194cab"
|
|
25
26
|
// mainnet omitted — ZamaConfig-gated, not deployed.
|
|
26
27
|
},
|
|
27
28
|
ecdsaImplementation: {
|
|
28
|
-
[chains.sepolia.id]: "
|
|
29
|
+
[chains.sepolia.id]: "0x8d4E8F379f73D5488a76B6C3CC8a2fD489936BDe"
|
|
29
30
|
},
|
|
30
31
|
merkleImplementation: {
|
|
31
|
-
[chains.sepolia.id]: "
|
|
32
|
+
[chains.sepolia.id]: "0x4B4F43Ed9aB3F9D10468b59C03d14f55A9d4E82F"
|
|
32
33
|
},
|
|
33
34
|
complianceManagerImplementation: {
|
|
34
|
-
[chains.sepolia.id]: "
|
|
35
|
+
[chains.sepolia.id]: "0x14bdE71e6b32b50dF1a5Dca1bccD150a319168e2"
|
|
35
36
|
}
|
|
36
37
|
},
|
|
37
38
|
fheDisperse: {
|
|
@@ -2,7 +2,7 @@ import { mapZamaError } from './chunk-WMACINXO.js';
|
|
|
2
2
|
import { getFhevmAclAddress, requireFhevmAclAddress, ACL_ALLOWED_EVENT } from './chunk-ZWXJTBZO.js';
|
|
3
3
|
import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
|
|
4
4
|
import { isContractRevert, mapContractRevert } from './chunk-4RAAATVY.js';
|
|
5
|
-
import { getFheDisperseSingletonAddress } from './chunk-
|
|
5
|
+
import { getFheDisperseSingletonAddress } from './chunk-6HCT4QIX.js';
|
|
6
6
|
import { normaliseAddress } from './chunk-ZA673I3O.js';
|
|
7
7
|
import { asExternalInputProof, asEncryptedHandle } from './chunk-KWFFIJYX.js';
|
|
8
8
|
import { InvalidArgumentError, TokenOpsSdkError, DeploymentAddressUnavailableError, PausedError, InsufficientFeeError, MissingEncryptorError, ReceiptEventAmbiguousError, MissingWalletClientError, MissingAccountError, BatchTooLargeError } from './chunk-QBJ7O2B4.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunk4AWQJQXY_cjs = require('./chunk-4AWQJQXY.cjs');
|
|
4
|
+
var chunkPG3WXT3K_cjs = require('./chunk-PG3WXT3K.cjs');
|
|
5
5
|
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var wagmi = require('wagmi');
|
|
@@ -42,7 +42,7 @@ function normalizeKeyArg(value) {
|
|
|
42
42
|
function tryResolveAirdropFactoryAddress(override, chainId) {
|
|
43
43
|
if (override) return override;
|
|
44
44
|
if (chainId === void 0) return void 0;
|
|
45
|
-
return
|
|
45
|
+
return chunkPG3WXT3K_cjs.getFheAirdropFactoryAddress(chainId);
|
|
46
46
|
}
|
|
47
47
|
function computeAirdropFactoryResolutionError(override, chainId) {
|
|
48
48
|
if (override) return void 0;
|
|
@@ -54,7 +54,7 @@ function computeAirdropFactoryResolutionError(override, chainId) {
|
|
|
54
54
|
clientLabel: "ConfidentialAirdropFactoryClient"
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
const resolved =
|
|
57
|
+
const resolved = chunkPG3WXT3K_cjs.getFheAirdropFactoryAddress(chainId);
|
|
58
58
|
if (!resolved) {
|
|
59
59
|
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
60
60
|
reason: "registry-not-deployed",
|
|
@@ -78,13 +78,13 @@ function useMemoAirdropFactoryClient(opts = {}) {
|
|
|
78
78
|
const client = react.useMemo(() => {
|
|
79
79
|
if (!publicClient) return void 0;
|
|
80
80
|
if (!resolvedAddress) return void 0;
|
|
81
|
-
return
|
|
81
|
+
return chunk4AWQJQXY_cjs.createConfidentialAirdropFactoryClient({
|
|
82
82
|
publicClient,
|
|
83
83
|
...walletClient ? { walletClient } : {},
|
|
84
84
|
address: resolvedAddress,
|
|
85
85
|
...chainId !== void 0 ? { chainId } : {},
|
|
86
86
|
// Lazy — invoked per-encryption inside the headless client.
|
|
87
|
-
encryptor: () =>
|
|
87
|
+
encryptor: () => chunk4AWQJQXY_cjs.resolveEncryptor(encryptorSourceRef.current),
|
|
88
88
|
...telemetry ? { telemetry } : {}
|
|
89
89
|
});
|
|
90
90
|
}, [publicClient, walletClient, resolvedAddress, chainId, telemetry]);
|
|
@@ -105,7 +105,7 @@ function useMemoAirdropBaseClient(opts) {
|
|
|
105
105
|
const client = react.useMemo(() => {
|
|
106
106
|
if (!publicClient) return void 0;
|
|
107
107
|
if (!opts.address) return void 0;
|
|
108
|
-
return
|
|
108
|
+
return chunk4AWQJQXY_cjs.createAirdropBaseClient({
|
|
109
109
|
publicClient,
|
|
110
110
|
...walletClient ? { walletClient } : {},
|
|
111
111
|
address: opts.address,
|
|
@@ -123,7 +123,7 @@ function useMemoMerkleAirdropClient(opts) {
|
|
|
123
123
|
const client = react.useMemo(() => {
|
|
124
124
|
if (!publicClient) return void 0;
|
|
125
125
|
if (!opts.address) return void 0;
|
|
126
|
-
return
|
|
126
|
+
return chunk4AWQJQXY_cjs.createMerkleAirdropClient({
|
|
127
127
|
publicClient,
|
|
128
128
|
...walletClient ? { walletClient } : {},
|
|
129
129
|
address: opts.address,
|
|
@@ -141,7 +141,7 @@ function useMemoComplianceManagerClient(opts) {
|
|
|
141
141
|
const client = react.useMemo(() => {
|
|
142
142
|
if (!publicClient) return void 0;
|
|
143
143
|
if (!opts.address) return void 0;
|
|
144
|
-
return
|
|
144
|
+
return chunk4AWQJQXY_cjs.createComplianceManagerClient({
|
|
145
145
|
publicClient,
|
|
146
146
|
...walletClient ? { walletClient } : {},
|
|
147
147
|
address: opts.address,
|
|
@@ -159,7 +159,7 @@ function useMemoEcdsaAirdropClient(opts) {
|
|
|
159
159
|
const client = react.useMemo(() => {
|
|
160
160
|
if (!publicClient) return void 0;
|
|
161
161
|
if (!opts.address) return void 0;
|
|
162
|
-
return
|
|
162
|
+
return chunk4AWQJQXY_cjs.createEcdsaAirdropClient({
|
|
163
163
|
publicClient,
|
|
164
164
|
...walletClient ? { walletClient } : {},
|
|
165
165
|
address: opts.address,
|
|
@@ -188,6 +188,8 @@ var AIRDROP_FN = {
|
|
|
188
188
|
// factory reads
|
|
189
189
|
fees: "fees",
|
|
190
190
|
registry: "registry",
|
|
191
|
+
isAirdrop: "isAirdrop",
|
|
192
|
+
resolvedGasFee: "resolvedGasFee",
|
|
191
193
|
customFee: "customFee",
|
|
192
194
|
implementations: "implementations",
|
|
193
195
|
compliancePolicy: "compliancePolicy",
|
|
@@ -222,8 +224,14 @@ var airdropKeys = {
|
|
|
222
224
|
fees: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.fees, args: [] }),
|
|
223
225
|
customFee: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.customFee, args: [creator] }),
|
|
224
226
|
customFeeAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.customFee }),
|
|
227
|
+
resolvedGasFee: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.resolvedGasFee, args: [creator] }),
|
|
228
|
+
/** Every creator's resolved fee; the default and any override both move it. */
|
|
229
|
+
resolvedGasFeeAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.resolvedGasFee }),
|
|
225
230
|
/** Every registry page, whatever offset/limit was queried. */
|
|
226
231
|
registryAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.registry }),
|
|
232
|
+
isAirdrop: (s, candidate) => airdropQueryKey({ ...s, fn: AIRDROP_FN.isAirdrop, args: [candidate] }),
|
|
233
|
+
/** Every genuineness answer from this factory; a create adds one address. */
|
|
234
|
+
isAirdropAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.isAirdrop }),
|
|
227
235
|
implementations: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.implementations, args: [] }),
|
|
228
236
|
compliancePolicy: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.compliancePolicy, args: [creator] }),
|
|
229
237
|
compliancePolicyAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.compliancePolicy }),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createConfidentialAirdropFactoryClient, resolveEncryptor, createAirdropBaseClient, createMerkleAirdropClient, createComplianceManagerClient, createEcdsaAirdropClient } from './chunk-
|
|
2
|
-
import { getFheAirdropFactoryAddress } from './chunk-
|
|
1
|
+
import { createConfidentialAirdropFactoryClient, resolveEncryptor, createAirdropBaseClient, createMerkleAirdropClient, createComplianceManagerClient, createEcdsaAirdropClient } from './chunk-BXX5TETM.js';
|
|
2
|
+
import { getFheAirdropFactoryAddress } from './chunk-6HCT4QIX.js';
|
|
3
3
|
import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
|
|
4
4
|
import { useRef, useMemo } from 'react';
|
|
5
5
|
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
@@ -186,6 +186,8 @@ var AIRDROP_FN = {
|
|
|
186
186
|
// factory reads
|
|
187
187
|
fees: "fees",
|
|
188
188
|
registry: "registry",
|
|
189
|
+
isAirdrop: "isAirdrop",
|
|
190
|
+
resolvedGasFee: "resolvedGasFee",
|
|
189
191
|
customFee: "customFee",
|
|
190
192
|
implementations: "implementations",
|
|
191
193
|
compliancePolicy: "compliancePolicy",
|
|
@@ -220,8 +222,14 @@ var airdropKeys = {
|
|
|
220
222
|
fees: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.fees, args: [] }),
|
|
221
223
|
customFee: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.customFee, args: [creator] }),
|
|
222
224
|
customFeeAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.customFee }),
|
|
225
|
+
resolvedGasFee: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.resolvedGasFee, args: [creator] }),
|
|
226
|
+
/** Every creator's resolved fee; the default and any override both move it. */
|
|
227
|
+
resolvedGasFeeAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.resolvedGasFee }),
|
|
223
228
|
/** Every registry page, whatever offset/limit was queried. */
|
|
224
229
|
registryAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.registry }),
|
|
230
|
+
isAirdrop: (s, candidate) => airdropQueryKey({ ...s, fn: AIRDROP_FN.isAirdrop, args: [candidate] }),
|
|
231
|
+
/** Every genuineness answer from this factory; a create adds one address. */
|
|
232
|
+
isAirdropAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.isAirdrop }),
|
|
225
233
|
implementations: (s) => airdropQueryKey({ ...s, fn: AIRDROP_FN.implementations, args: [] }),
|
|
226
234
|
compliancePolicy: (s, creator) => airdropQueryKey({ ...s, fn: AIRDROP_FN.compliancePolicy, args: [creator] }),
|
|
227
235
|
compliancePolicyAll: (s) => airdropQueryKeyPrefix({ ...s, fn: AIRDROP_FN.compliancePolicy }),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
|
|
2
2
|
import { mapContractRevert, isContractRevert } from './chunk-4RAAATVY.js';
|
|
3
|
-
import { getFheVestingFactoryAddress } from './chunk-
|
|
3
|
+
import { getFheVestingFactoryAddress } from './chunk-6HCT4QIX.js';
|
|
4
4
|
import { normaliseAddress } from './chunk-ZA673I3O.js';
|
|
5
5
|
import { asTxHash } from './chunk-KWFFIJYX.js';
|
|
6
6
|
import { DeploymentAddressUnavailableError, TokenOpsSdkError, MissingWalletClientError, MissingAccountError } from './chunk-QBJ7O2B4.js';
|
|
@@ -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 chunkJVNJSDQ4_cjs = require('./chunk-JVNJSDQ4.cjs');
|
|
6
|
+
var chunkPG3WXT3K_cjs = require('./chunk-PG3WXT3K.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 chunkPG3WXT3K_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 chunkJVNJSDQ4_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 = chunkPG3WXT3K_cjs.getFheVestingFactoryAddress(chainId);
|
|
70
70
|
if (!resolved) {
|
|
71
71
|
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
72
72
|
reason: "registry-not-deployed",
|