@tokenops/sdk 1.6.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -8
- package/CONTRIBUTING.md +4 -2
- package/README.md +146 -90
- package/SUPPORT.md +47 -0
- package/dist/{chunk-HETNKZEE.js → chunk-335Z2W67.js} +1 -1
- package/dist/{chunk-BD4LZBVF.cjs → chunk-3QHNYEQD.cjs} +18 -17
- package/dist/chunk-456VDDA3.js +370 -0
- package/dist/{chunk-6WSNS3UV.js → chunk-4RAAATVY.js} +2 -4
- package/dist/{chunk-4KJ66YRH.js → chunk-4TSDNZQ3.js} +2 -2
- package/dist/{chunk-WUXUWTFW.cjs → chunk-5576FRT3.cjs} +31 -7
- package/dist/chunk-66IHPTOK.cjs +20 -0
- package/dist/{chunk-2RNW4MIJ.cjs → chunk-67OV5CX2.cjs} +0 -18
- package/dist/{chunk-PD7ME2BT.js → chunk-6GNR22OV.js} +2 -1
- package/dist/{chunk-VHSNYUYV.js → chunk-6NAVMWZQ.js} +5 -5
- package/dist/{chunk-EUKPOXWR.cjs → chunk-6PXXGACR.cjs} +17 -15
- package/dist/{chunk-WTK6JDSI.js → chunk-74QFZ5MK.js} +6 -4
- package/dist/{chunk-WOEETTH7.cjs → chunk-7AFPOE7N.cjs} +6 -6
- package/dist/{chunk-U57COLUE.js → chunk-AXIPOR3C.js} +2 -2
- package/dist/chunk-CTED3MTR.cjs +380 -0
- package/dist/{chunk-QKKBBH7I.js → chunk-DZHYSUGY.js} +28 -7
- package/dist/{chunk-V5D7BHW3.js → chunk-EAJ7SYHE.js} +6 -4
- package/dist/{chunk-SYHNZSZZ.cjs → chunk-FAXIIH5R.cjs} +3 -3
- package/dist/{chunk-7G7UOQV4.cjs → chunk-FGEB7RMY.cjs} +4 -4
- package/dist/chunk-GKKDAW44.js +8823 -0
- package/dist/{chunk-QET3Q4JP.js → chunk-H5POPGOZ.js} +8 -6
- package/dist/{chunk-VR3FREBX.cjs → chunk-JK4XMMKM.cjs} +3 -3
- package/dist/{chunk-CBRL2PJA.cjs → chunk-JQYC66TO.cjs} +12 -12
- package/dist/{chunk-YFIWCYHC.cjs → chunk-JZLGCTGK.cjs} +56 -54
- package/dist/{chunk-4ZCXK4VI.cjs → chunk-KFRDLKMA.cjs} +14 -14
- package/dist/chunk-KWFFIJYX.js +11 -0
- package/dist/chunk-M4IT6DNJ.cjs +608 -0
- package/dist/{chunk-43RFBQ73.cjs → chunk-MVDQMV25.cjs} +29 -32
- package/dist/chunk-NCVX3K2N.cjs +161 -0
- package/dist/chunk-NWFMBLSQ.js +4 -0
- package/dist/chunk-O5676ZWY.js +585 -0
- package/dist/chunk-PUX5VXDB.cjs +8845 -0
- package/dist/{chunk-DRSPMIZ7.js → chunk-QBJ7O2B4.js} +1 -11
- package/dist/{chunk-UJS4N2XM.cjs → chunk-TEBM66WA.cjs} +12 -12
- package/dist/{chunk-TN65XNTI.js → chunk-TWT3STIX.js} +8 -6
- package/dist/chunk-UG5RKLU2.cjs +6 -0
- package/dist/chunk-VP2B4WM2.js +154 -0
- package/dist/{chunk-BK7YIVLK.cjs → chunk-WJLECC22.cjs} +75 -73
- package/dist/{chunk-NFW7AUEX.js → chunk-WMACINXO.js} +1 -1
- package/dist/{chunk-AYGRYDBX.cjs → chunk-XAYGD4E4.cjs} +37 -35
- package/dist/{chunk-46T67CE2.js → chunk-ZA673I3O.js} +1 -1
- package/dist/{chunk-YPYCWLYP.js → chunk-ZWXJTBZO.js} +1 -1
- package/dist/core/addresses.d.ts +14 -2
- package/dist/core/brands.d.ts +8 -2
- package/dist/core/errors.d.ts +71 -10
- package/dist/core/preflight.d.ts +1 -0
- package/dist/fhe/erc7984-abi.d.ts +1 -0
- package/dist/fhe/index.cjs +64 -63
- package/dist/fhe/index.js +7 -6
- package/dist/fhe/operators.d.ts +22 -5
- package/dist/fhe/react/index.cjs +13 -12
- package/dist/fhe/react/index.js +6 -5
- package/dist/fhe/types.d.ts +6 -0
- package/dist/fhe-airdrop/abis/{cloneable.d.ts → airdrop-base.d.ts} +254 -396
- package/dist/fhe-airdrop/abis/compliance.d.ts +422 -0
- package/dist/fhe-airdrop/abis/ecdsa.d.ts +1316 -0
- package/dist/fhe-airdrop/abis/factory.d.ts +1319 -190
- package/dist/fhe-airdrop/abis/index.d.ts +5 -2
- package/dist/fhe-airdrop/abis/merkle.d.ts +1238 -0
- package/dist/fhe-airdrop/advanced/index.cjs +11 -12
- package/dist/fhe-airdrop/advanced/index.d.cts +34 -11
- package/dist/fhe-airdrop/advanced/index.d.ts +34 -11
- package/dist/fhe-airdrop/advanced/index.js +3 -8
- package/dist/fhe-airdrop/advanced/react/index.cjs +37 -50
- package/dist/fhe-airdrop/advanced/react/index.d.cts +9 -3
- package/dist/fhe-airdrop/advanced/react/index.d.ts +9 -3
- package/dist/fhe-airdrop/advanced/react/index.js +36 -50
- package/dist/fhe-airdrop/advanced/react/usePredictEcdsaAirdropAddress.d.ts +33 -0
- package/dist/fhe-airdrop/advanced/react/usePredictMerkleAirdropAddress.d.ts +27 -0
- package/dist/fhe-airdrop/airdrop-base.d.ts +600 -0
- package/dist/fhe-airdrop/campaign.d.ts +297 -0
- package/dist/fhe-airdrop/compliance.d.ts +302 -0
- package/dist/fhe-airdrop/constants.d.ts +33 -0
- package/dist/fhe-airdrop/ecdsa.d.ts +263 -0
- package/dist/fhe-airdrop/encryption.d.ts +92 -14
- package/dist/fhe-airdrop/errors.d.ts +245 -15
- package/dist/fhe-airdrop/factory.d.ts +533 -274
- package/dist/fhe-airdrop/guards.d.ts +273 -0
- package/dist/fhe-airdrop/index.cjs +1131 -74
- package/dist/fhe-airdrop/index.d.cts +46 -8
- package/dist/fhe-airdrop/index.d.ts +46 -8
- package/dist/fhe-airdrop/index.js +931 -8
- package/dist/fhe-airdrop/merkle-tree.d.ts +103 -0
- package/dist/fhe-airdrop/merkle.d.ts +180 -0
- package/dist/fhe-airdrop/react/_shared.d.ts +144 -71
- package/dist/fhe-airdrop/react/index.cjs +399 -459
- package/dist/fhe-airdrop/react/index.d.cts +53 -74
- package/dist/fhe-airdrop/react/index.d.ts +53 -74
- package/dist/fhe-airdrop/react/index.js +261 -374
- package/dist/fhe-airdrop/react/useAirdropGasFee.d.ts +10 -5
- package/dist/fhe-airdrop/react/useAirdropHasRole.d.ts +15 -6
- package/dist/fhe-airdrop/react/useAirdropPause.d.ts +30 -0
- package/dist/fhe-airdrop/react/useAirdropPaused.d.ts +17 -0
- package/dist/fhe-airdrop/react/useAirdropToken.d.ts +11 -4
- package/dist/fhe-airdrop/react/useAirdropWindow.d.ts +37 -0
- package/dist/fhe-airdrop/react/useClaimedAmount.d.ts +29 -0
- package/dist/fhe-airdrop/react/useComplianceManager.d.ts +16 -0
- package/dist/fhe-airdrop/react/useCreateEcdsaAirdrop.d.ts +28 -0
- package/dist/fhe-airdrop/react/useCreateMerkleAirdrop.d.ts +25 -0
- package/dist/fhe-airdrop/react/useEcdsaClaim.d.ts +23 -0
- package/dist/fhe-airdrop/react/useEffectiveUpgradeable.d.ts +20 -0
- package/dist/fhe-airdrop/react/useExtendClaimWindow.d.ts +17 -12
- package/dist/fhe-airdrop/react/useFactoryFees.d.ts +28 -0
- package/dist/fhe-airdrop/react/useFactoryRegistry.d.ts +35 -0
- package/dist/fhe-airdrop/react/useFundAirdrop.d.ts +35 -0
- package/dist/fhe-airdrop/react/useGrantInstanceRoles.d.ts +35 -0
- package/dist/fhe-airdrop/react/useMerkleClaim.d.ts +34 -0
- package/dist/fhe-airdrop/react/useMerkleRoot.d.ts +15 -0
- package/dist/fhe-airdrop/react/useSetMerkleRoot.d.ts +22 -0
- package/dist/fhe-airdrop/react/useWithdrawConfidential.d.ts +23 -0
- package/dist/fhe-airdrop/roles.d.ts +147 -0
- package/dist/fhe-airdrop/types.d.ts +67 -65
- package/dist/fhe-disperse/index.cjs +70 -68
- package/dist/fhe-disperse/index.js +10 -8
- package/dist/fhe-disperse/react/index.cjs +94 -92
- package/dist/fhe-disperse/react/index.js +13 -11
- package/dist/fhe-vesting/advanced/index.cjs +10 -8
- package/dist/fhe-vesting/advanced/index.js +8 -6
- package/dist/fhe-vesting/advanced/react/index.cjs +16 -14
- package/dist/fhe-vesting/advanced/react/index.js +13 -11
- package/dist/fhe-vesting/index.cjs +74 -72
- package/dist/fhe-vesting/index.js +11 -9
- package/dist/fhe-vesting/react/index.cjs +228 -226
- package/dist/fhe-vesting/react/index.js +15 -13
- package/dist/index.cjs +100 -87
- package/dist/index.js +3 -2
- package/dist/testnet-faucet/index.cjs +57 -55
- package/dist/testnet-faucet/index.js +7 -5
- package/dist/testnet-faucet/react/index.cjs +55 -53
- package/dist/testnet-faucet/react/index.js +9 -7
- package/package.json +6 -2
- package/dist/chunk-CNP4L3GF.js +0 -105
- package/dist/chunk-KSDSXJ34.js +0 -41
- package/dist/chunk-LBWRFZR3.cjs +0 -1681
- package/dist/chunk-OL6SHN3D.cjs +0 -44
- package/dist/chunk-S2XD75JM.js +0 -1637
- package/dist/chunk-SPGSO5SO.cjs +0 -1644
- package/dist/chunk-UE5XK2SY.js +0 -1673
- package/dist/chunk-WO72UBQD.cjs +0 -109
- package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +0 -53
- package/dist/fhe-airdrop/advanced/react/usePredictAirdropAddress.d.ts +0 -49
- package/dist/fhe-airdrop/airdrop.d.ts +0 -317
- package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +0 -37
- package/dist/fhe-airdrop/react/useAirdropCanExtendClaimWindow.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropClaimTypehash.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropClaimedSignatures.d.ts +0 -16
- package/dist/fhe-airdrop/react/useAirdropDeploymentBlockNumber.d.ts +0 -6
- package/dist/fhe-airdrop/react/useAirdropDomainSeparator.d.ts +0 -8
- package/dist/fhe-airdrop/react/useAirdropEndTime.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropFactoryCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactoryDefaultGasFee.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropFactoryDisableCustomFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropFactoryFeeCollector.d.ts +0 -11
- package/dist/fhe-airdrop/react/useAirdropFactoryInitCodeHash.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactorySetCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useAirdropFactorySetDefaultGasFee.d.ts +0 -16
- package/dist/fhe-airdrop/react/useAirdropFactorySetFeeCollector.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropGrantRole.d.ts +0 -16
- package/dist/fhe-airdrop/react/useAirdropHasClaimEnded.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropHasClaimStarted.d.ts +0 -7
- package/dist/fhe-airdrop/react/useAirdropIsClaimWindowActive.d.ts +0 -9
- package/dist/fhe-airdrop/react/useAirdropIsPaused.d.ts +0 -8
- package/dist/fhe-airdrop/react/useAirdropIsSignatureClaimed.d.ts +0 -22
- package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +0 -51
- package/dist/fhe-airdrop/react/useAirdropRevokeRole.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropStartTime.d.ts +0 -10
- package/dist/fhe-airdrop/react/useAirdropWithdrawGasFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useAirdropWithdrawOtherConfidentialToken.d.ts +0 -14
- package/dist/fhe-airdrop/react/useAirdropWithdrawOtherToken.d.ts +0 -14
- package/dist/fhe-airdrop/react/useClaim.d.ts +0 -39
- package/dist/fhe-airdrop/react/useConfidentialAirdropFactoryImplementation.d.ts +0 -11
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +0 -41
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +0 -48
- package/dist/fhe-airdrop/react/useCreateConfidentialAirdrop.d.ts +0 -29
- package/dist/fhe-airdrop/react/useCreateConfidentialAirdropAndGetAddress.d.ts +0 -31
- package/dist/fhe-airdrop/react/useDisableCustomFee.d.ts +0 -14
- package/dist/fhe-airdrop/react/useFactoryCustomFee.d.ts +0 -17
- package/dist/fhe-airdrop/react/useFactoryDefaultGasFee.d.ts +0 -10
- package/dist/fhe-airdrop/react/useFactoryFeeCollector.d.ts +0 -11
- package/dist/fhe-airdrop/react/useFactoryInitCodeHash.d.ts +0 -17
- package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +0 -33
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +0 -51
- package/dist/fhe-airdrop/react/useSetCustomFee.d.ts +0 -16
- package/dist/fhe-airdrop/react/useSetDefaultGasFee.d.ts +0 -15
- package/dist/fhe-airdrop/react/useSetFeeCollector.d.ts +0 -14
- package/dist/fhe-airdrop/react/useSetPaused.d.ts +0 -14
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +0 -31
- package/dist/fhe-airdrop/react/useWithdraw.d.ts +0 -12
- package/dist/fhe-airdrop/react/useWithdrawOtherConfidentialToken.d.ts +0 -13
- package/dist/fhe-airdrop/react/useWithdrawOtherToken.d.ts +0 -13
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
3
|
+
var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
|
|
4
|
+
var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
|
|
5
|
+
var chunk5576FRT3_cjs = require('./chunk-5576FRT3.cjs');
|
|
6
|
+
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
7
|
+
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
8
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
7
9
|
var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
|
|
8
10
|
var viem = require('viem');
|
|
9
11
|
|
|
@@ -443,10 +445,10 @@ var ConfidentialVestingFactoryClient = class {
|
|
|
443
445
|
this.publicClient = config.publicClient;
|
|
444
446
|
this.walletClient = config.walletClient;
|
|
445
447
|
const chainId = config.chainId ?? config.publicClient.chain?.id;
|
|
446
|
-
const addressOverride = config.address ?
|
|
447
|
-
const resolved = addressOverride ?? (chainId === void 0 ? void 0 :
|
|
448
|
+
const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
|
|
449
|
+
const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunk5576FRT3_cjs.getFheVestingFactoryAddress(chainId));
|
|
448
450
|
if (!resolved) {
|
|
449
|
-
throw new
|
|
451
|
+
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
450
452
|
reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
|
|
451
453
|
product: "fheVesting",
|
|
452
454
|
contract: "confidentialVestingFactory",
|
|
@@ -462,7 +464,7 @@ var ConfidentialVestingFactoryClient = class {
|
|
|
462
464
|
hasWallet: !!this.walletClient,
|
|
463
465
|
aclResolved: true,
|
|
464
466
|
// factory has no ACL dependency; constant for funnel-shape parity with manager.
|
|
465
|
-
sdkVersion:
|
|
467
|
+
sdkVersion: chunkUG5RKLU2_cjs.SDK_VERSION
|
|
466
468
|
});
|
|
467
469
|
}
|
|
468
470
|
// ----------------------- writes -----------------------
|
|
@@ -652,20 +654,20 @@ var ConfidentialVestingFactoryClient = class {
|
|
|
652
654
|
});
|
|
653
655
|
const ours = events.filter((ev) => ev.address.toLowerCase() === this.address.toLowerCase());
|
|
654
656
|
if (ours.length === 0) {
|
|
655
|
-
throw new
|
|
657
|
+
throw new chunk67OV5CX2_cjs.TokenOpsSdkError(
|
|
656
658
|
`${method}: no ManagerCreated event from factory ${this.address} in tx ${hash}`
|
|
657
659
|
);
|
|
658
660
|
}
|
|
659
661
|
if (ours.length > 1) {
|
|
660
|
-
throw new
|
|
662
|
+
throw new chunk67OV5CX2_cjs.TokenOpsSdkError(
|
|
661
663
|
`${method}: ${ours.length} ManagerCreated events from factory ${this.address} in tx ${hash}; ambiguous result`
|
|
662
664
|
);
|
|
663
665
|
}
|
|
664
|
-
return { hash:
|
|
666
|
+
return { hash: chunk66IHPTOK_cjs.asTxHash(hash), manager: ours[0].args.manager };
|
|
665
667
|
}
|
|
666
668
|
#requireWallet(method) {
|
|
667
669
|
if (!this.walletClient) {
|
|
668
|
-
throw new
|
|
670
|
+
throw new chunk67OV5CX2_cjs.MissingWalletClientError(method);
|
|
669
671
|
}
|
|
670
672
|
return this.walletClient;
|
|
671
673
|
}
|
|
@@ -673,7 +675,7 @@ var ConfidentialVestingFactoryClient = class {
|
|
|
673
675
|
const wallet = this.#requireWallet(functionName);
|
|
674
676
|
const acct = account ?? wallet.account;
|
|
675
677
|
if (!acct) {
|
|
676
|
-
throw new
|
|
678
|
+
throw new chunk67OV5CX2_cjs.MissingAccountError(String(functionName));
|
|
677
679
|
}
|
|
678
680
|
await this.#preflightWrite(String(functionName), functionName, args, acct);
|
|
679
681
|
try {
|
|
@@ -690,7 +692,7 @@ var ConfidentialVestingFactoryClient = class {
|
|
|
690
692
|
}
|
|
691
693
|
}
|
|
692
694
|
#mapRevert(method, err, account) {
|
|
693
|
-
return
|
|
695
|
+
return chunkMVDQMV25_cjs.mapContractRevert(err, {
|
|
694
696
|
method,
|
|
695
697
|
contractAddress: this.address,
|
|
696
698
|
abi: confidentialVestingFactoryAbi,
|
|
@@ -715,7 +717,7 @@ var ConfidentialVestingFactoryClient = class {
|
|
|
715
717
|
...value !== void 0 ? { value } : {}
|
|
716
718
|
});
|
|
717
719
|
} catch (err) {
|
|
718
|
-
if (
|
|
720
|
+
if (chunkMVDQMV25_cjs.isContractRevert(err)) {
|
|
719
721
|
throw this.#mapRevert(method, err, accountAddress(account));
|
|
720
722
|
}
|
|
721
723
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { SDK_VERSION
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
|
|
2
|
+
import { isContractRevert, mapContractRevert } from './chunk-4RAAATVY.js';
|
|
3
|
+
import { getConfidentialTestTokenAddress, getTestTokenAddress } from './chunk-DZHYSUGY.js';
|
|
4
|
+
import { normaliseAddress } from './chunk-ZA673I3O.js';
|
|
5
|
+
import { asEncryptedHandle, asTxHash } from './chunk-KWFFIJYX.js';
|
|
6
|
+
import { TokenOpsSdkError, UnsupportedChainError, DeploymentAddressUnavailableError, TokenOpsContractError, ReceiptEventNotFoundError, ReceiptEventAmbiguousError, MissingWalletClientError, MissingAccountError, InvalidArgumentError } from './chunk-QBJ7O2B4.js';
|
|
5
7
|
import { withTelemetry } from './chunk-Q2GP5UDC.js';
|
|
6
8
|
import { sepolia } from 'viem/chains';
|
|
7
9
|
import { parseEventLogs } from 'viem';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkZQUE2B3Q_cjs = require('./chunk-ZQUE2B3Q.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkKFRDLKMA_cjs = require('./chunk-KFRDLKMA.cjs');
|
|
5
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var wagmi = require('wagmi');
|
|
8
8
|
|
|
@@ -22,7 +22,7 @@ function useIsOperator(options = {}) {
|
|
|
22
22
|
holder ? holder.toLowerCase() : null,
|
|
23
23
|
spender ? spender.toLowerCase() : null
|
|
24
24
|
],
|
|
25
|
-
queryFn: () =>
|
|
25
|
+
queryFn: () => chunkKFRDLKMA_cjs.isOperator({
|
|
26
26
|
publicClient,
|
|
27
27
|
token,
|
|
28
28
|
holder,
|
|
@@ -39,9 +39,9 @@ function useEnsureOperator(options = {}) {
|
|
|
39
39
|
const telemetry = options.telemetry;
|
|
40
40
|
return reactQuery.useMutation({
|
|
41
41
|
mutationFn: async (vars) => {
|
|
42
|
-
if (!publicClient) throw new
|
|
43
|
-
if (!walletClient) throw new
|
|
44
|
-
return
|
|
42
|
+
if (!publicClient) throw new chunk67OV5CX2_cjs.MissingPublicClientError("useEnsureOperator");
|
|
43
|
+
if (!walletClient) throw new chunk67OV5CX2_cjs.MissingWalletClientError("useEnsureOperator");
|
|
44
|
+
return chunkKFRDLKMA_cjs.ensureOperator({
|
|
45
45
|
publicClient,
|
|
46
46
|
walletClient,
|
|
47
47
|
token: vars.token,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useWagmiAccount } from './chunk-FT4LNBOS.js';
|
|
2
|
-
import { isOperator, ensureOperator } from './chunk-
|
|
3
|
-
import { MissingPublicClientError, MissingWalletClientError } from './chunk-
|
|
2
|
+
import { isOperator, ensureOperator } from './chunk-4TSDNZQ3.js';
|
|
3
|
+
import { MissingPublicClientError, MissingWalletClientError } from './chunk-QBJ7O2B4.js';
|
|
4
4
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
5
5
|
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
6
6
|
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkPUX5VXDB_cjs = require('./chunk-PUX5VXDB.cjs');
|
|
4
|
+
var chunkM4IT6DNJ_cjs = require('./chunk-M4IT6DNJ.cjs');
|
|
5
|
+
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
6
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
7
|
+
var merkleTree = require('@openzeppelin/merkle-tree');
|
|
8
|
+
var viem = require('viem');
|
|
9
|
+
|
|
10
|
+
function leafOf(args) {
|
|
11
|
+
const inner = viem.keccak256(
|
|
12
|
+
viem.encodeAbiParameters(
|
|
13
|
+
[{ type: "address" }, { type: "address" }, { type: "bytes32" }],
|
|
14
|
+
[args.instance, args.recipient, args.handle]
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
return viem.keccak256(inner);
|
|
18
|
+
}
|
|
19
|
+
var HANDLE_PATTERN = /^0x[0-9a-fA-F]{64}$/;
|
|
20
|
+
function assertLeaves(instance, leaves, method) {
|
|
21
|
+
if (!viem.isAddress(instance, { strict: false })) {
|
|
22
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
23
|
+
method,
|
|
24
|
+
argument: "instance",
|
|
25
|
+
reason: "is not a 20-byte hex address",
|
|
26
|
+
value: instance
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
if (viem.isAddressEqual(instance, viem.zeroAddress)) {
|
|
30
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
31
|
+
method,
|
|
32
|
+
argument: "instance",
|
|
33
|
+
reason: "is the zero address; leaves must be scoped to the airdrop instance"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
if (leaves.length === 0) {
|
|
37
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
38
|
+
method,
|
|
39
|
+
argument: "leaves",
|
|
40
|
+
reason: "a tree needs at least one leaf"
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
const seen = /* @__PURE__ */ new Map();
|
|
44
|
+
leaves.forEach((leaf, index) => {
|
|
45
|
+
if (!viem.isAddress(leaf.recipient, { strict: false })) {
|
|
46
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
47
|
+
method,
|
|
48
|
+
argument: `leaves[${index}].recipient`,
|
|
49
|
+
reason: "is not a 20-byte hex address",
|
|
50
|
+
value: leaf.recipient
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (viem.isAddressEqual(leaf.recipient, viem.zeroAddress)) {
|
|
54
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
55
|
+
method,
|
|
56
|
+
argument: `leaves[${index}].recipient`,
|
|
57
|
+
reason: "is the zero address, whose leaf can never be claimed"
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (!HANDLE_PATTERN.test(leaf.handle)) {
|
|
61
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
62
|
+
method,
|
|
63
|
+
argument: `leaves[${index}].handle`,
|
|
64
|
+
reason: "is not a 32-byte hex handle; the tree would commit to a value no claim can reproduce",
|
|
65
|
+
value: leaf.handle
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const key = leaf.recipient.toLowerCase();
|
|
69
|
+
const first = seen.get(key);
|
|
70
|
+
if (first !== void 0) {
|
|
71
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
72
|
+
method,
|
|
73
|
+
argument: `leaves[${index}].recipient`,
|
|
74
|
+
reason: `appears twice (also at index ${first}); one root pays max, not sum, of a recipient's leaves \u2014 merge them into a single cumulative total`
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
seen.set(key, index);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
function buildMerkleTree(args) {
|
|
81
|
+
return buildMerkleTreeInternal(args, "buildMerkleTree");
|
|
82
|
+
}
|
|
83
|
+
function buildMerkleTreeInternal({ instance, leaves }, method) {
|
|
84
|
+
assertLeaves(instance, leaves, method);
|
|
85
|
+
const airdrop = chunkJK4XMMKM_cjs.normaliseAddress(instance);
|
|
86
|
+
const accounts = leaves.map((leaf) => chunkJK4XMMKM_cjs.normaliseAddress(leaf.recipient));
|
|
87
|
+
const rows = accounts.map((account, i) => [airdrop, account, leaves[i].handle]);
|
|
88
|
+
const tree = merkleTree.StandardMerkleTree.of(rows, ["address", "address", "bytes32"]);
|
|
89
|
+
return {
|
|
90
|
+
root: tree.root,
|
|
91
|
+
// `getProof(i)` indexes the INPUT array, not the tree: `StandardMerkleTree`
|
|
92
|
+
// sorts leaves internally but keeps `values` in insertion order, so entry
|
|
93
|
+
// `i` always belongs to `leaves[i]`.
|
|
94
|
+
entries: leaves.map((leaf, i) => ({
|
|
95
|
+
...leaf,
|
|
96
|
+
recipient: accounts[i],
|
|
97
|
+
merkleProof: tree.getProof(i)
|
|
98
|
+
}))
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
var MAX_UINT64 = (1n << 64n) - 1n;
|
|
102
|
+
function validateCampaignRecipients(recipients) {
|
|
103
|
+
validateCampaignRecipientsInternal(recipients, "validateCampaignRecipients");
|
|
104
|
+
}
|
|
105
|
+
function validateCampaignRecipientsInternal(recipients, method) {
|
|
106
|
+
if (recipients.length === 0) {
|
|
107
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
108
|
+
method,
|
|
109
|
+
argument: "recipients",
|
|
110
|
+
reason: "a campaign needs at least one recipient"
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const seen = /* @__PURE__ */ new Map();
|
|
114
|
+
recipients.forEach((entry, index) => {
|
|
115
|
+
if (!viem.isAddress(entry.recipient, { strict: false })) {
|
|
116
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
117
|
+
method,
|
|
118
|
+
argument: `recipients[${index}].recipient`,
|
|
119
|
+
reason: "is not a 20-byte hex address",
|
|
120
|
+
value: entry.recipient
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
if (viem.isAddressEqual(entry.recipient, viem.zeroAddress)) {
|
|
124
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
125
|
+
method,
|
|
126
|
+
argument: `recipients[${index}].recipient`,
|
|
127
|
+
reason: "is the zero address, whose leaf can never be claimed"
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (entry.cumulativeTotal < 0n || entry.cumulativeTotal > MAX_UINT64) {
|
|
131
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
132
|
+
method,
|
|
133
|
+
argument: `recipients[${index}].cumulativeTotal`,
|
|
134
|
+
// Deliberately no `value`: the total is confidential.
|
|
135
|
+
reason: "is outside uint64 range (0..2^64-1)"
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const key = entry.recipient.toLowerCase();
|
|
139
|
+
const first = seen.get(key);
|
|
140
|
+
if (first !== void 0) {
|
|
141
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
142
|
+
method,
|
|
143
|
+
argument: `recipients[${index}].recipient`,
|
|
144
|
+
reason: `appears twice (also at index ${first}); one root pays max, not sum, of a recipient's leaves \u2014 merge them into a single cumulative total`
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
seen.set(key, index);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
async function encryptRoster({ instance, recipients, encryptor }, method) {
|
|
151
|
+
validateCampaignRecipientsInternal(recipients, method);
|
|
152
|
+
if (!viem.isAddress(instance, { strict: false })) {
|
|
153
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
154
|
+
method,
|
|
155
|
+
argument: "instance",
|
|
156
|
+
reason: "is not a 20-byte hex address",
|
|
157
|
+
value: instance
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
if (viem.isAddressEqual(instance, viem.zeroAddress)) {
|
|
161
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
162
|
+
method,
|
|
163
|
+
argument: "instance",
|
|
164
|
+
reason: "is the zero address; inputs must be bound to the airdrop instance"
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const enc = chunkPUX5VXDB_cjs.resolveEncryptor(encryptor);
|
|
168
|
+
if (!enc) {
|
|
169
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError(method, {
|
|
170
|
+
hint: "Pass an encryptor instance, or a lazy factory that returns one."
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
const airdrop = chunkJK4XMMKM_cjs.normaliseAddress(instance);
|
|
174
|
+
const accounts = recipients.map((r) => chunkJK4XMMKM_cjs.normaliseAddress(r.recipient));
|
|
175
|
+
const encrypted = await Promise.all(
|
|
176
|
+
recipients.map(
|
|
177
|
+
(r, i) => chunkPUX5VXDB_cjs.encryptUint64({
|
|
178
|
+
encryptor: enc,
|
|
179
|
+
contractAddress: airdrop,
|
|
180
|
+
userAddress: accounts[i],
|
|
181
|
+
value: r.cumulativeTotal
|
|
182
|
+
})
|
|
183
|
+
)
|
|
184
|
+
);
|
|
185
|
+
return accounts.map((recipient, i) => ({
|
|
186
|
+
recipient,
|
|
187
|
+
handle: encrypted[i].handle,
|
|
188
|
+
inputProof: encrypted[i].inputProof
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
async function encryptCampaignAmounts(args) {
|
|
192
|
+
return encryptRoster(args, "encryptCampaignAmounts");
|
|
193
|
+
}
|
|
194
|
+
async function buildMerkleCampaign({
|
|
195
|
+
instance,
|
|
196
|
+
recipients,
|
|
197
|
+
encryptor
|
|
198
|
+
}) {
|
|
199
|
+
const leaves = await encryptRoster({ instance, recipients, encryptor }, "buildMerkleCampaign");
|
|
200
|
+
return buildMerkleTreeInternal({ instance, leaves }, "buildMerkleCampaign");
|
|
201
|
+
}
|
|
202
|
+
async function planMerkleCampaign({
|
|
203
|
+
factory,
|
|
204
|
+
params,
|
|
205
|
+
mode,
|
|
206
|
+
creator,
|
|
207
|
+
userSalt,
|
|
208
|
+
recipients,
|
|
209
|
+
encryptor
|
|
210
|
+
}) {
|
|
211
|
+
validateCampaignRecipientsInternal(recipients, "planMerkleCampaign");
|
|
212
|
+
const initCodeHashBefore = await factory.getMerkleInitCodeHash({ params, mode });
|
|
213
|
+
const predictedAddress = await factory.predictMerkleAirdropAddress({
|
|
214
|
+
params,
|
|
215
|
+
mode,
|
|
216
|
+
deployer: creator,
|
|
217
|
+
userSalt
|
|
218
|
+
});
|
|
219
|
+
const campaign = await buildMerkleCampaign({
|
|
220
|
+
instance: predictedAddress,
|
|
221
|
+
recipients,
|
|
222
|
+
encryptor
|
|
223
|
+
});
|
|
224
|
+
const initCodeHashAfter = await factory.getMerkleInitCodeHash({ params, mode });
|
|
225
|
+
chunkM4IT6DNJ_cjs.assertPredictionFresh({
|
|
226
|
+
variant: "merkle",
|
|
227
|
+
initCodeHashBefore,
|
|
228
|
+
initCodeHashAfter,
|
|
229
|
+
predictedAddress,
|
|
230
|
+
method: "planMerkleCampaign"
|
|
231
|
+
});
|
|
232
|
+
return { ...campaign, predictedAddress, initCodeHashBefore, initCodeHashAfter };
|
|
233
|
+
}
|
|
234
|
+
async function rotateMerkleRoot({
|
|
235
|
+
airdrop,
|
|
236
|
+
recipients,
|
|
237
|
+
encryptor,
|
|
238
|
+
account
|
|
239
|
+
}) {
|
|
240
|
+
const campaign = await buildMerkleCampaign({
|
|
241
|
+
instance: airdrop.address,
|
|
242
|
+
recipients,
|
|
243
|
+
encryptor
|
|
244
|
+
});
|
|
245
|
+
const hash = await airdrop.setMerkleRoot({ newRoot: campaign.root, account });
|
|
246
|
+
return { ...campaign, hash };
|
|
247
|
+
}
|
|
248
|
+
var ASSIGNABLE_ROLES = [
|
|
249
|
+
{ key: "pauser", role: "PAUSER_ROLE" },
|
|
250
|
+
{ key: "windowAdmin", role: "WINDOW_ADMIN_ROLE" },
|
|
251
|
+
{ key: "treasury", role: "TREASURY_ROLE" },
|
|
252
|
+
{ key: "rescuer", role: "RESCUER_ROLE" },
|
|
253
|
+
{ key: "disclosureAdmin", role: "DISCLOSURE_ADMIN_ROLE" },
|
|
254
|
+
{ key: "upgrader", role: "UPGRADER_ROLE" },
|
|
255
|
+
{ key: "merkleAdmin", role: "MERKLE_ADMIN_ROLE", variant: "merkle" },
|
|
256
|
+
{ key: "signer", role: "SIGNER_ROLE", variant: "ecdsa" }
|
|
257
|
+
];
|
|
258
|
+
function planInstanceRoleSplit(args) {
|
|
259
|
+
const { assignment, caller, airdropType } = args;
|
|
260
|
+
if (assignment.feeCollector !== void 0) {
|
|
261
|
+
throw new chunkM4IT6DNJ_cjs.FeeCollectorSelfAdministeredError({ requestedGrantee: assignment.feeCollector });
|
|
262
|
+
}
|
|
263
|
+
const steps = [];
|
|
264
|
+
for (const { key, role, variant } of ASSIGNABLE_ROLES) {
|
|
265
|
+
const account = assignment[key];
|
|
266
|
+
if (account === void 0) continue;
|
|
267
|
+
if (variant !== void 0 && variant !== airdropType) {
|
|
268
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
269
|
+
method: "planInstanceRoleSplit",
|
|
270
|
+
argument: `assignment.${key}`,
|
|
271
|
+
reason: `${role} only exists on ${variant} campaigns; this is a(n) ${airdropType} campaign`
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
steps.push({ kind: "grant", role, account });
|
|
275
|
+
}
|
|
276
|
+
if (assignment.admin !== void 0) {
|
|
277
|
+
if (viem.isAddressEqual(assignment.admin, viem.zeroAddress)) {
|
|
278
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
279
|
+
method: "planInstanceRoleSplit",
|
|
280
|
+
argument: "assignment.admin",
|
|
281
|
+
reason: "granting DEFAULT_ADMIN_ROLE to the zero address is never valid"
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
steps.push({ kind: "grant", role: "DEFAULT_ADMIN_ROLE", account: assignment.admin });
|
|
285
|
+
steps.push({ kind: "revoke", role: "DEFAULT_ADMIN_ROLE", account: caller });
|
|
286
|
+
}
|
|
287
|
+
return steps;
|
|
288
|
+
}
|
|
289
|
+
function roleGetterAbiEntry(name) {
|
|
290
|
+
return {
|
|
291
|
+
inputs: [],
|
|
292
|
+
name,
|
|
293
|
+
outputs: [{ internalType: "bytes32", name: "", type: "bytes32" }],
|
|
294
|
+
stateMutability: "view",
|
|
295
|
+
type: "function"
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
var ROLE_GETTER_ABI = [
|
|
299
|
+
roleGetterAbiEntry("PAUSER_ROLE"),
|
|
300
|
+
roleGetterAbiEntry("WINDOW_ADMIN_ROLE"),
|
|
301
|
+
roleGetterAbiEntry("TREASURY_ROLE"),
|
|
302
|
+
roleGetterAbiEntry("RESCUER_ROLE"),
|
|
303
|
+
roleGetterAbiEntry("DISCLOSURE_ADMIN_ROLE"),
|
|
304
|
+
roleGetterAbiEntry("UPGRADER_ROLE"),
|
|
305
|
+
roleGetterAbiEntry("MERKLE_ADMIN_ROLE"),
|
|
306
|
+
roleGetterAbiEntry("SIGNER_ROLE")
|
|
307
|
+
];
|
|
308
|
+
var DEFAULT_ADMIN_ROLE_CONSTANT = `0x${"0".repeat(64)}`;
|
|
309
|
+
async function resolveRoleConstant(airdrop, role) {
|
|
310
|
+
if (role === "DEFAULT_ADMIN_ROLE") return DEFAULT_ADMIN_ROLE_CONSTANT;
|
|
311
|
+
const result = await airdrop.publicClient.readContract({
|
|
312
|
+
address: airdrop.address,
|
|
313
|
+
abi: ROLE_GETTER_ABI,
|
|
314
|
+
functionName: role
|
|
315
|
+
});
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
function toOutcomeError(step, airdrop, error) {
|
|
319
|
+
if (chunk67OV5CX2_cjs.isTokenOpsSdkError(error)) return error;
|
|
320
|
+
return new chunk67OV5CX2_cjs.UnknownWriteFailureError({
|
|
321
|
+
method: `grantInstanceRoles.${step.kind}.${step.role}`,
|
|
322
|
+
contractAddress: airdrop.address,
|
|
323
|
+
cause: error
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
async function grantInstanceRoles(args) {
|
|
327
|
+
const { airdrop, assignment, revokeFromCreator = true } = args;
|
|
328
|
+
const wallet = airdrop.walletClient;
|
|
329
|
+
if (!wallet) {
|
|
330
|
+
throw new chunk67OV5CX2_cjs.MissingWalletClientError("grantInstanceRoles");
|
|
331
|
+
}
|
|
332
|
+
const callerAccount = wallet.account;
|
|
333
|
+
if (!callerAccount) {
|
|
334
|
+
throw new chunk67OV5CX2_cjs.MissingAccountError("grantInstanceRoles");
|
|
335
|
+
}
|
|
336
|
+
const caller = typeof callerAccount === "string" ? callerAccount : callerAccount.address;
|
|
337
|
+
const airdropType = await airdrop.airdropType() === 1 ? "merkle" : "ecdsa";
|
|
338
|
+
let steps = planInstanceRoleSplit({ assignment, caller, airdropType });
|
|
339
|
+
if (!revokeFromCreator) {
|
|
340
|
+
steps = steps.filter((step) => !(step.kind === "revoke" && step.role === "DEFAULT_ADMIN_ROLE"));
|
|
341
|
+
}
|
|
342
|
+
const outcomes = [];
|
|
343
|
+
for (const step of steps) {
|
|
344
|
+
try {
|
|
345
|
+
const role = await resolveRoleConstant(airdrop, step.role);
|
|
346
|
+
const hash = step.kind === "grant" ? await airdrop.grantRole({ role, holder: step.account, account: caller }) : await airdrop.revokeRole({ role, holder: step.account, account: caller });
|
|
347
|
+
const receipt = await airdrop.publicClient.waitForTransactionReceipt({ hash });
|
|
348
|
+
if (receipt.status !== "success") {
|
|
349
|
+
outcomes.push({
|
|
350
|
+
role: step.role,
|
|
351
|
+
account: step.account,
|
|
352
|
+
error: new chunk67OV5CX2_cjs.ContractRevertError({
|
|
353
|
+
method: `grantInstanceRoles.${step.kind}.${step.role}`,
|
|
354
|
+
contractAddress: airdrop.address,
|
|
355
|
+
message: `grantInstanceRoles.${step.kind}.${step.role}: transaction ${hash} was mined with a reverted status; the role change did not apply.`
|
|
356
|
+
})
|
|
357
|
+
});
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
outcomes.push({ role: step.role, account: step.account, hash });
|
|
361
|
+
} catch (error) {
|
|
362
|
+
outcomes.push({
|
|
363
|
+
role: step.role,
|
|
364
|
+
account: step.account,
|
|
365
|
+
error: toOutcomeError(step, airdrop, error)
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return outcomes;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
exports.buildMerkleCampaign = buildMerkleCampaign;
|
|
373
|
+
exports.buildMerkleTree = buildMerkleTree;
|
|
374
|
+
exports.encryptCampaignAmounts = encryptCampaignAmounts;
|
|
375
|
+
exports.grantInstanceRoles = grantInstanceRoles;
|
|
376
|
+
exports.leafOf = leafOf;
|
|
377
|
+
exports.planInstanceRoleSplit = planInstanceRoleSplit;
|
|
378
|
+
exports.planMerkleCampaign = planMerkleCampaign;
|
|
379
|
+
exports.rotateMerkleRoot = rotateMerkleRoot;
|
|
380
|
+
exports.validateCampaignRecipients = validateCampaignRecipients;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeploymentAddressUnavailableError } from './chunk-
|
|
1
|
+
import { DeploymentAddressUnavailableError } from './chunk-QBJ7O2B4.js';
|
|
2
2
|
import { sepolia, mainnet } from 'viem/chains';
|
|
3
3
|
|
|
4
4
|
var DEPLOYED_ADDRESSES = {
|
|
@@ -8,10 +8,22 @@ var DEPLOYED_ADDRESSES = {
|
|
|
8
8
|
// mainnet omitted — not deployed.
|
|
9
9
|
}
|
|
10
10
|
},
|
|
11
|
+
// Airdrop v2 (tokenops-fhe-airdrop-v2 @ 8e5b144). The four contracts deploy
|
|
12
|
+
// together in one scripted run, so a chain either has all of them or none —
|
|
13
|
+
// which is what `chainsWithDeployment` assumes.
|
|
11
14
|
fheAirdrop: {
|
|
12
|
-
|
|
13
|
-
[sepolia.id]: "
|
|
14
|
-
// mainnet omitted — not deployed.
|
|
15
|
+
airdropFactory: {
|
|
16
|
+
[sepolia.id]: "0x383083B6f13a0ee513596A6750B511c5E482d2d1"
|
|
17
|
+
// mainnet omitted — ZamaConfig-gated, not deployed.
|
|
18
|
+
},
|
|
19
|
+
ecdsaImplementation: {
|
|
20
|
+
[sepolia.id]: "0xefE40570C1837210f8E4Ae938635e11bd1ae788E"
|
|
21
|
+
},
|
|
22
|
+
merkleImplementation: {
|
|
23
|
+
[sepolia.id]: "0x9f3156546744F3ceE98Dc44bed817d98A8b8ae74"
|
|
24
|
+
},
|
|
25
|
+
complianceManagerImplementation: {
|
|
26
|
+
[sepolia.id]: "0x6adA841250C048364d1d3027958C662Dd4E62136"
|
|
15
27
|
}
|
|
16
28
|
},
|
|
17
29
|
fheDisperse: {
|
|
@@ -62,10 +74,19 @@ function requireFheVestingFactoryAddress(chainId) {
|
|
|
62
74
|
return requireDeployedAddress("fheVesting", "confidentialVestingFactory", chainId);
|
|
63
75
|
}
|
|
64
76
|
function getFheAirdropFactoryAddress(chainId) {
|
|
65
|
-
return getDeployedAddress("fheAirdrop", "
|
|
77
|
+
return getDeployedAddress("fheAirdrop", "airdropFactory", chainId);
|
|
66
78
|
}
|
|
67
79
|
function requireFheAirdropFactoryAddress(chainId) {
|
|
68
|
-
return requireDeployedAddress("fheAirdrop", "
|
|
80
|
+
return requireDeployedAddress("fheAirdrop", "airdropFactory", chainId);
|
|
81
|
+
}
|
|
82
|
+
function getFheAirdropEcdsaImplementationAddress(chainId) {
|
|
83
|
+
return getDeployedAddress("fheAirdrop", "ecdsaImplementation", chainId);
|
|
84
|
+
}
|
|
85
|
+
function getFheAirdropMerkleImplementationAddress(chainId) {
|
|
86
|
+
return getDeployedAddress("fheAirdrop", "merkleImplementation", chainId);
|
|
87
|
+
}
|
|
88
|
+
function getFheAirdropComplianceImplementationAddress(chainId) {
|
|
89
|
+
return getDeployedAddress("fheAirdrop", "complianceManagerImplementation", chainId);
|
|
69
90
|
}
|
|
70
91
|
function getFheDisperseSingletonAddress(chainId) {
|
|
71
92
|
return getDeployedAddress("fheDisperse", "disperseConfidentialSingleton", chainId);
|
|
@@ -108,4 +129,4 @@ function chainsWithDeployment(product) {
|
|
|
108
129
|
).sort((a, b) => a - b);
|
|
109
130
|
}
|
|
110
131
|
|
|
111
|
-
export { DEPLOYED_ADDRESSES, chainsWithDeployment, chainsWithKnownRegistryEntry, getConfidentialTestTokenAddress, getDeployedAddress, getFheAirdropFactoryAddress, getFheDisperseSingletonAddress, getFheVestingFactoryAddress, getTestTokenAddress, requireConfidentialTestTokenAddress, requireFheAirdropFactoryAddress, requireFheDisperseSingletonAddress, requireFheVestingFactoryAddress, requireTestTokenAddress };
|
|
132
|
+
export { DEPLOYED_ADDRESSES, chainsWithDeployment, chainsWithKnownRegistryEntry, getConfidentialTestTokenAddress, getDeployedAddress, getFheAirdropComplianceImplementationAddress, getFheAirdropEcdsaImplementationAddress, getFheAirdropFactoryAddress, getFheAirdropMerkleImplementationAddress, getFheDisperseSingletonAddress, getFheVestingFactoryAddress, getTestTokenAddress, requireConfidentialTestTokenAddress, requireFheAirdropFactoryAddress, requireFheDisperseSingletonAddress, requireFheVestingFactoryAddress, requireTestTokenAddress };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { SDK_VERSION
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
|
|
2
|
+
import { mapContractRevert, isContractRevert } from './chunk-4RAAATVY.js';
|
|
3
|
+
import { getFheVestingFactoryAddress } from './chunk-DZHYSUGY.js';
|
|
4
|
+
import { normaliseAddress } from './chunk-ZA673I3O.js';
|
|
5
|
+
import { asTxHash } from './chunk-KWFFIJYX.js';
|
|
6
|
+
import { DeploymentAddressUnavailableError, TokenOpsSdkError, MissingWalletClientError, MissingAccountError } from './chunk-QBJ7O2B4.js';
|
|
5
7
|
import { withTelemetry } from './chunk-Q2GP5UDC.js';
|
|
6
8
|
import { parseEventLogs } from 'viem';
|
|
7
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
4
4
|
var viem = require('viem');
|
|
5
5
|
|
|
6
6
|
var FHEVM_ACL_ADDRESS_BY_CHAIN = {
|
|
@@ -16,7 +16,7 @@ function getFhevmAclAddress(chainId) {
|
|
|
16
16
|
}
|
|
17
17
|
function requireFhevmAclAddress(chainId, clientLabel) {
|
|
18
18
|
if (chainId === void 0) {
|
|
19
|
-
throw new
|
|
19
|
+
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
20
20
|
reason: "chain-id-missing",
|
|
21
21
|
product: "fhevm",
|
|
22
22
|
contract: "acl",
|
|
@@ -26,7 +26,7 @@ function requireFhevmAclAddress(chainId, clientLabel) {
|
|
|
26
26
|
}
|
|
27
27
|
const addr = FHEVM_ACL_ADDRESS_BY_CHAIN[chainId];
|
|
28
28
|
if (addr) return addr;
|
|
29
|
-
throw new
|
|
29
|
+
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
30
30
|
reason: "registry-unknown-chain",
|
|
31
31
|
product: "fhevm",
|
|
32
32
|
contract: "acl",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk6PXXGACR_cjs = require('./chunk-6PXXGACR.cjs');
|
|
4
4
|
|
|
5
5
|
// src/fhe-vesting/advanced/factory-advanced.ts
|
|
6
|
-
var ConfidentialVestingFactoryAdvancedClient = class extends
|
|
6
|
+
var ConfidentialVestingFactoryAdvancedClient = class extends chunk6PXXGACR_cjs.ConfidentialVestingFactoryClient {
|
|
7
7
|
/**
|
|
8
8
|
* Compute the deterministic CREATE2 clone address as the factory would have
|
|
9
9
|
* computed it at `args.blockNumber`.
|
|
@@ -20,7 +20,7 @@ var ConfidentialVestingFactoryAdvancedClient = class extends chunkEUKPOXWR_cjs.C
|
|
|
20
20
|
if (hasOptions) {
|
|
21
21
|
return this.publicClient.readContract({
|
|
22
22
|
address: this.address,
|
|
23
|
-
abi:
|
|
23
|
+
abi: chunk6PXXGACR_cjs.confidentialVestingFactoryAbi,
|
|
24
24
|
functionName: "predictManagerAddressWithOptions",
|
|
25
25
|
args: [
|
|
26
26
|
args.token,
|
|
@@ -34,7 +34,7 @@ var ConfidentialVestingFactoryAdvancedClient = class extends chunkEUKPOXWR_cjs.C
|
|
|
34
34
|
}
|
|
35
35
|
return this.publicClient.readContract({
|
|
36
36
|
address: this.address,
|
|
37
|
-
abi:
|
|
37
|
+
abi: chunk6PXXGACR_cjs.confidentialVestingFactoryAbi,
|
|
38
38
|
functionName: "predictManagerAddress",
|
|
39
39
|
args: [args.token, args.userSalt, args.deployer],
|
|
40
40
|
blockNumber: args.blockNumber
|