@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
|
-
import { mapZamaError } from './chunk-
|
|
2
|
-
import { getFhevmAclAddress, requireFhevmAclAddress, ACL_ALLOWED_EVENT } from './chunk-
|
|
3
|
-
import { SDK_VERSION
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { mapZamaError } from './chunk-WMACINXO.js';
|
|
2
|
+
import { getFhevmAclAddress, requireFhevmAclAddress, ACL_ALLOWED_EVENT } from './chunk-ZWXJTBZO.js';
|
|
3
|
+
import { SDK_VERSION } from './chunk-NWFMBLSQ.js';
|
|
4
|
+
import { isContractRevert, mapContractRevert } from './chunk-4RAAATVY.js';
|
|
5
|
+
import { getFheDisperseSingletonAddress } from './chunk-DZHYSUGY.js';
|
|
6
|
+
import { normaliseAddress } from './chunk-ZA673I3O.js';
|
|
7
|
+
import { asExternalInputProof, asEncryptedHandle } from './chunk-KWFFIJYX.js';
|
|
8
|
+
import { InvalidArgumentError, TokenOpsSdkError, DeploymentAddressUnavailableError, PausedError, InsufficientFeeError, MissingEncryptorError, ReceiptEventAmbiguousError, MissingWalletClientError, MissingAccountError, BatchTooLargeError } from './chunk-QBJ7O2B4.js';
|
|
7
9
|
import { withTelemetry } from './chunk-Q2GP5UDC.js';
|
|
8
10
|
import { bytesToHex, keccak256, encodePacked, parseEventLogs, isAddress, getCreate2Address } from 'viem';
|
|
9
11
|
|
|
@@ -1,17 +1,17 @@
|
|
|
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
|
function normaliseAddress(input) {
|
|
7
7
|
if (typeof input !== "string") {
|
|
8
|
-
throw new
|
|
8
|
+
throw new chunk67OV5CX2_cjs.TokenOpsValidationError("normaliseAddress: input is not a string", {
|
|
9
9
|
method: "normaliseAddress",
|
|
10
10
|
args: { input: typeof input }
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
if (!viem.isAddress(input, { strict: false })) {
|
|
14
|
-
throw new
|
|
14
|
+
throw new chunk67OV5CX2_cjs.TokenOpsValidationError(
|
|
15
15
|
`normaliseAddress: '${input}' is not a valid 0x-prefixed 20-byte hex address`,
|
|
16
16
|
{
|
|
17
17
|
method: "normaliseAddress",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var chunkWJLECC22_cjs = require('./chunk-WJLECC22.cjs');
|
|
4
|
+
var chunk3QHNYEQD_cjs = require('./chunk-3QHNYEQD.cjs');
|
|
5
|
+
var chunk6PXXGACR_cjs = require('./chunk-6PXXGACR.cjs');
|
|
6
|
+
var chunk5576FRT3_cjs = require('./chunk-5576FRT3.cjs');
|
|
7
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
8
8
|
var react = require('react');
|
|
9
9
|
var wagmi = require('wagmi');
|
|
10
10
|
|
|
@@ -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 chunk5576FRT3_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 chunk6PXXGACR_cjs.createConfidentialVestingFactoryClient({
|
|
43
43
|
publicClient,
|
|
44
44
|
...walletClient ? { walletClient } : {},
|
|
45
45
|
address: resolvedAddress,
|
|
@@ -59,16 +59,16 @@ function useMemoFactoryClient(opts = {}) {
|
|
|
59
59
|
function computeFactoryResolutionError(override, chainId) {
|
|
60
60
|
if (override) return void 0;
|
|
61
61
|
if (chainId === void 0) {
|
|
62
|
-
return new
|
|
62
|
+
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
63
63
|
reason: "chain-id-missing",
|
|
64
64
|
product: "fheVesting",
|
|
65
65
|
contract: "confidentialVestingFactory",
|
|
66
66
|
clientLabel: "ConfidentialVestingFactoryClient"
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
|
-
const resolved =
|
|
69
|
+
const resolved = chunk5576FRT3_cjs.getFheVestingFactoryAddress(chainId);
|
|
70
70
|
if (!resolved) {
|
|
71
|
-
return new
|
|
71
|
+
return new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
72
72
|
reason: "registry-not-deployed",
|
|
73
73
|
product: "fheVesting",
|
|
74
74
|
contract: "confidentialVestingFactory",
|
|
@@ -89,13 +89,13 @@ function useMemoManagerClient(opts) {
|
|
|
89
89
|
const client = react.useMemo(() => {
|
|
90
90
|
if (!publicClient) return void 0;
|
|
91
91
|
if (!opts.address) return void 0;
|
|
92
|
-
return
|
|
92
|
+
return chunkWJLECC22_cjs.createConfidentialVestingManagerClient({
|
|
93
93
|
publicClient,
|
|
94
94
|
...walletClient ? { walletClient } : {},
|
|
95
95
|
address: opts.address,
|
|
96
96
|
// Lazy — invoked per-encryption inside the headless client. Picks up
|
|
97
97
|
// whichever EncryptorSource the consumer last passed in.
|
|
98
|
-
encryptor: () =>
|
|
98
|
+
encryptor: () => chunk3QHNYEQD_cjs.resolveEncryptor(encryptorSourceRef.current),
|
|
99
99
|
...opts.aclAddress ? { aclAddress: opts.aclAddress } : {},
|
|
100
100
|
...telemetry ? { telemetry } : {}
|
|
101
101
|
});
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
var
|
|
3
|
+
var chunkTEBM66WA_cjs = require('./chunk-TEBM66WA.cjs');
|
|
4
|
+
var chunkFAXIIH5R_cjs = require('./chunk-FAXIIH5R.cjs');
|
|
5
|
+
var chunkUG5RKLU2_cjs = require('./chunk-UG5RKLU2.cjs');
|
|
6
|
+
var chunkMVDQMV25_cjs = require('./chunk-MVDQMV25.cjs');
|
|
7
|
+
var chunk5576FRT3_cjs = require('./chunk-5576FRT3.cjs');
|
|
8
|
+
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
9
|
+
var chunk66IHPTOK_cjs = require('./chunk-66IHPTOK.cjs');
|
|
10
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
9
11
|
var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
|
|
10
12
|
var viem = require('viem');
|
|
11
13
|
|
|
@@ -1688,7 +1690,7 @@ function resolveEncryptor(source) {
|
|
|
1688
1690
|
var MAX_UINT64 = (1n << 64n) - 1n;
|
|
1689
1691
|
function assertUint64(value, label) {
|
|
1690
1692
|
if (value < 0n || value > MAX_UINT64) {
|
|
1691
|
-
throw new
|
|
1693
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1692
1694
|
method: "encryptUint64",
|
|
1693
1695
|
argument: label,
|
|
1694
1696
|
reason: "exceeds uint64 range (0..2^64-1)",
|
|
@@ -1709,7 +1711,7 @@ async function encryptUint64({
|
|
|
1709
1711
|
userAddress
|
|
1710
1712
|
});
|
|
1711
1713
|
if (handles.length !== 1) {
|
|
1712
|
-
throw new
|
|
1714
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1713
1715
|
method: "encryptUint64",
|
|
1714
1716
|
argument: "handles",
|
|
1715
1717
|
reason: `expected 1 handle, got ${handles.length}`,
|
|
@@ -1717,8 +1719,8 @@ async function encryptUint64({
|
|
|
1717
1719
|
});
|
|
1718
1720
|
}
|
|
1719
1721
|
return {
|
|
1720
|
-
handle:
|
|
1721
|
-
inputProof:
|
|
1722
|
+
handle: chunk66IHPTOK_cjs.asEncryptedHandle(viem.bytesToHex(handles[0])),
|
|
1723
|
+
inputProof: chunk66IHPTOK_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
|
|
1722
1724
|
};
|
|
1723
1725
|
}
|
|
1724
1726
|
async function encryptUint64Batch({
|
|
@@ -1728,7 +1730,7 @@ async function encryptUint64Batch({
|
|
|
1728
1730
|
values
|
|
1729
1731
|
}) {
|
|
1730
1732
|
if (values.length === 0) {
|
|
1731
|
-
throw new
|
|
1733
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1732
1734
|
method: "encryptUint64Batch",
|
|
1733
1735
|
argument: "values",
|
|
1734
1736
|
reason: "must be non-empty"
|
|
@@ -1741,7 +1743,7 @@ async function encryptUint64Batch({
|
|
|
1741
1743
|
userAddress
|
|
1742
1744
|
});
|
|
1743
1745
|
if (handles.length !== values.length) {
|
|
1744
|
-
throw new
|
|
1746
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1745
1747
|
method: "encryptUint64Batch",
|
|
1746
1748
|
argument: "handles",
|
|
1747
1749
|
reason: `expected ${values.length} handles, got ${handles.length}`,
|
|
@@ -1749,13 +1751,13 @@ async function encryptUint64Batch({
|
|
|
1749
1751
|
});
|
|
1750
1752
|
}
|
|
1751
1753
|
return {
|
|
1752
|
-
handles: handles.map((h) =>
|
|
1753
|
-
inputProof:
|
|
1754
|
+
handles: handles.map((h) => chunk66IHPTOK_cjs.asEncryptedHandle(viem.bytesToHex(h))),
|
|
1755
|
+
inputProof: chunk66IHPTOK_cjs.asExternalInputProof(viem.bytesToHex(inputProof))
|
|
1754
1756
|
};
|
|
1755
1757
|
}
|
|
1756
1758
|
|
|
1757
1759
|
// src/fhe-disperse/errors.ts
|
|
1758
|
-
var NotRegisteredError = class extends
|
|
1760
|
+
var NotRegisteredError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1759
1761
|
name = "NotRegisteredError";
|
|
1760
1762
|
constructor(args) {
|
|
1761
1763
|
super(
|
|
@@ -1772,7 +1774,7 @@ var NotRegisteredError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkError {
|
|
|
1772
1774
|
);
|
|
1773
1775
|
}
|
|
1774
1776
|
};
|
|
1775
|
-
var SubwalletsNotApprovedError = class extends
|
|
1777
|
+
var SubwalletsNotApprovedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1776
1778
|
name = "SubwalletsNotApprovedError";
|
|
1777
1779
|
constructor(args) {
|
|
1778
1780
|
super(
|
|
@@ -1792,7 +1794,7 @@ var SubwalletsNotApprovedError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkErro
|
|
|
1792
1794
|
);
|
|
1793
1795
|
}
|
|
1794
1796
|
};
|
|
1795
|
-
var SingletonNotApprovedError = class extends
|
|
1797
|
+
var SingletonNotApprovedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1796
1798
|
name = "SingletonNotApprovedError";
|
|
1797
1799
|
constructor(args) {
|
|
1798
1800
|
super(
|
|
@@ -1810,7 +1812,7 @@ var SingletonNotApprovedError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdkError
|
|
|
1810
1812
|
);
|
|
1811
1813
|
}
|
|
1812
1814
|
};
|
|
1813
|
-
var AlreadyRegisteredError = class extends
|
|
1815
|
+
var AlreadyRegisteredError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1814
1816
|
name = "AlreadyRegisteredError";
|
|
1815
1817
|
constructor(args) {
|
|
1816
1818
|
super(
|
|
@@ -1847,7 +1849,7 @@ function validateDisperseInputs(args) {
|
|
|
1847
1849
|
const errors = [];
|
|
1848
1850
|
if (recipients.length === 0) {
|
|
1849
1851
|
errors.push(
|
|
1850
|
-
new
|
|
1852
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1851
1853
|
method,
|
|
1852
1854
|
argument: "recipients",
|
|
1853
1855
|
reason: "must be non-empty"
|
|
@@ -1856,7 +1858,7 @@ function validateDisperseInputs(args) {
|
|
|
1856
1858
|
}
|
|
1857
1859
|
if (amounts.length !== recipients.length) {
|
|
1858
1860
|
errors.push(
|
|
1859
|
-
new
|
|
1861
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1860
1862
|
method,
|
|
1861
1863
|
argument: "amounts",
|
|
1862
1864
|
reason: `length mismatch: recipients.length (${recipients.length}) !== amounts.length (${amounts.length})`
|
|
@@ -1866,7 +1868,7 @@ function validateDisperseInputs(args) {
|
|
|
1866
1868
|
recipients.forEach((r, i) => {
|
|
1867
1869
|
if (!viem.isAddress(r, { strict: true })) {
|
|
1868
1870
|
errors.push(
|
|
1869
|
-
new
|
|
1871
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1870
1872
|
method,
|
|
1871
1873
|
argument: `recipients[${i}]`,
|
|
1872
1874
|
reason: "must be a valid EIP-55 checksummed address",
|
|
@@ -1877,7 +1879,7 @@ function validateDisperseInputs(args) {
|
|
|
1877
1879
|
}
|
|
1878
1880
|
if (r === ZERO_ADDRESS) {
|
|
1879
1881
|
errors.push(
|
|
1880
|
-
new
|
|
1882
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1881
1883
|
method,
|
|
1882
1884
|
argument: `recipients[${i}]`,
|
|
1883
1885
|
reason: "zero address",
|
|
@@ -1889,7 +1891,7 @@ function validateDisperseInputs(args) {
|
|
|
1889
1891
|
amounts.forEach((v, i) => {
|
|
1890
1892
|
if (v < 0n || v > MAX_UINT642) {
|
|
1891
1893
|
errors.push(
|
|
1892
|
-
new
|
|
1894
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1893
1895
|
method,
|
|
1894
1896
|
argument: `amounts[${i}]`,
|
|
1895
1897
|
reason: "exceeds uint64 range (0..2^64-1)"
|
|
@@ -1903,7 +1905,7 @@ function validateDisperseInputs(args) {
|
|
|
1903
1905
|
const { group0, group1 } = computeSubtotals([...amounts]);
|
|
1904
1906
|
if (group0 > MAX_UINT642) {
|
|
1905
1907
|
errors.push(
|
|
1906
|
-
new
|
|
1908
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1907
1909
|
method,
|
|
1908
1910
|
argument: "amounts",
|
|
1909
1911
|
reason: "wallet-mode subtotal exceeds uint64 range"
|
|
@@ -1912,7 +1914,7 @@ function validateDisperseInputs(args) {
|
|
|
1912
1914
|
}
|
|
1913
1915
|
if (group1 > MAX_UINT642) {
|
|
1914
1916
|
errors.push(
|
|
1915
|
-
new
|
|
1917
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1916
1918
|
method,
|
|
1917
1919
|
argument: "amounts",
|
|
1918
1920
|
reason: "wallet-mode subtotal exceeds uint64 range"
|
|
@@ -1921,7 +1923,7 @@ function validateDisperseInputs(args) {
|
|
|
1921
1923
|
}
|
|
1922
1924
|
if (group0 <= MAX_UINT642 && group1 <= MAX_UINT642 && group0 + group1 > MAX_UINT642) {
|
|
1923
1925
|
errors.push(
|
|
1924
|
-
new
|
|
1926
|
+
new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1925
1927
|
method,
|
|
1926
1928
|
argument: "amounts",
|
|
1927
1929
|
reason: "wallet-mode subtotals sum exceeds uint64 range (would silently zero on-chain)"
|
|
@@ -1931,7 +1933,7 @@ function validateDisperseInputs(args) {
|
|
|
1931
1933
|
}
|
|
1932
1934
|
if (batchLimit > 0n && BigInt(recipients.length) > batchLimit) {
|
|
1933
1935
|
errors.push(
|
|
1934
|
-
new
|
|
1936
|
+
new chunk67OV5CX2_cjs.BatchTooLargeError({
|
|
1935
1937
|
method,
|
|
1936
1938
|
contractAddress,
|
|
1937
1939
|
requested: recipients.length,
|
|
@@ -1944,7 +1946,7 @@ function validateDisperseInputs(args) {
|
|
|
1944
1946
|
function assertChecksumAddress(value, argument, method) {
|
|
1945
1947
|
if (value === void 0) return;
|
|
1946
1948
|
if (!viem.isAddress(value, { strict: true })) {
|
|
1947
|
-
throw new
|
|
1949
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1948
1950
|
method,
|
|
1949
1951
|
argument,
|
|
1950
1952
|
reason: "must be a valid EIP-55 checksummed address \u2014 use viem's getAddress(addr) to fix the checksum",
|
|
@@ -1956,7 +1958,7 @@ function assertNonZeroChecksumAddress(value, argument, method) {
|
|
|
1956
1958
|
if (value === void 0) return;
|
|
1957
1959
|
assertChecksumAddress(value, argument, method);
|
|
1958
1960
|
if (value === ZERO_ADDRESS) {
|
|
1959
|
-
throw new
|
|
1961
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
1960
1962
|
method,
|
|
1961
1963
|
argument,
|
|
1962
1964
|
reason: "must not be the zero address",
|
|
@@ -1971,7 +1973,7 @@ function batchLimitForMode(mode, limits) {
|
|
|
1971
1973
|
}
|
|
1972
1974
|
|
|
1973
1975
|
// src/fhe-disperse/types.ts
|
|
1974
|
-
var DisperseSubwalletNotFoundError = class extends
|
|
1976
|
+
var DisperseSubwalletNotFoundError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1975
1977
|
name = "DisperseSubwalletNotFoundError";
|
|
1976
1978
|
constructor(txHash, singletonAddress) {
|
|
1977
1979
|
super(
|
|
@@ -1983,7 +1985,7 @@ var DisperseSubwalletNotFoundError = class extends chunk2RNW4MIJ_cjs.TokenOpsSdk
|
|
|
1983
1985
|
);
|
|
1984
1986
|
}
|
|
1985
1987
|
};
|
|
1986
|
-
var DisperseEncryptedReserveNotGrantedError = class extends
|
|
1988
|
+
var DisperseEncryptedReserveNotGrantedError = class extends chunk67OV5CX2_cjs.TokenOpsSdkError {
|
|
1987
1989
|
name = "DisperseEncryptedReserveNotGrantedError";
|
|
1988
1990
|
constructor(txHash, callerAddress) {
|
|
1989
1991
|
super(
|
|
@@ -2005,7 +2007,7 @@ var disperseProductMapper = (name, _args, ctx) => {
|
|
|
2005
2007
|
case "UserNotRegistered":
|
|
2006
2008
|
return new NotRegisteredError({ ...ctx, user });
|
|
2007
2009
|
case "ContractNotAllowed":
|
|
2008
|
-
return new
|
|
2010
|
+
return new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2009
2011
|
method: ctx.method,
|
|
2010
2012
|
argument: "handle",
|
|
2011
2013
|
reason: "the handle's origin contract did not grant this singleton persistent ACL on the handle. ERC-7984 `transferred` handles are scoped to the token contract \u2014 disclose them through the token, not through `DisperseConfidential`."
|
|
@@ -2049,10 +2051,10 @@ var ConfidentialDisperseClient = class {
|
|
|
2049
2051
|
this.encryptor = config.encryptor;
|
|
2050
2052
|
this.#telemetry = config.telemetry;
|
|
2051
2053
|
const chainId = config.chainId ?? config.publicClient.chain?.id;
|
|
2052
|
-
const addressOverride = config.address ?
|
|
2053
|
-
const resolved = addressOverride ?? (chainId === void 0 ? void 0 :
|
|
2054
|
+
const addressOverride = config.address ? chunkJK4XMMKM_cjs.normaliseAddress(config.address) : void 0;
|
|
2055
|
+
const resolved = addressOverride ?? (chainId === void 0 ? void 0 : chunk5576FRT3_cjs.getFheDisperseSingletonAddress(chainId));
|
|
2054
2056
|
if (!resolved) {
|
|
2055
|
-
throw new
|
|
2057
|
+
throw new chunk67OV5CX2_cjs.DeploymentAddressUnavailableError({
|
|
2056
2058
|
reason: chainId === void 0 ? "chain-id-missing" : "registry-not-deployed",
|
|
2057
2059
|
product: "fheDisperse",
|
|
2058
2060
|
contract: "disperseConfidentialSingleton",
|
|
@@ -2066,8 +2068,8 @@ var ConfidentialDisperseClient = class {
|
|
|
2066
2068
|
surface: "singleton",
|
|
2067
2069
|
chainId: chainId ?? null,
|
|
2068
2070
|
hasWallet: !!this.walletClient,
|
|
2069
|
-
aclResolved: !!config.aclAddress || chainId !== void 0 && !!
|
|
2070
|
-
sdkVersion:
|
|
2071
|
+
aclResolved: !!config.aclAddress || chainId !== void 0 && !!chunkFAXIIH5R_cjs.getFhevmAclAddress(chainId),
|
|
2072
|
+
sdkVersion: chunkUG5RKLU2_cjs.SDK_VERSION
|
|
2071
2073
|
});
|
|
2072
2074
|
}
|
|
2073
2075
|
/**
|
|
@@ -2078,7 +2080,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2078
2080
|
*/
|
|
2079
2081
|
get aclAddress() {
|
|
2080
2082
|
if (this.#cachedAclAddress) return this.#cachedAclAddress;
|
|
2081
|
-
this.#cachedAclAddress = this.#aclAddressOverride ??
|
|
2083
|
+
this.#cachedAclAddress = this.#aclAddressOverride ?? chunkFAXIIH5R_cjs.requireFhevmAclAddress(this.publicClient.chain?.id, "ConfidentialDisperseClient");
|
|
2082
2084
|
return this.#cachedAclAddress;
|
|
2083
2085
|
}
|
|
2084
2086
|
// ============================================================
|
|
@@ -2218,7 +2220,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2218
2220
|
const fees = await this.getFees(args.user);
|
|
2219
2221
|
if (args.mode === "wallet-token-fee") {
|
|
2220
2222
|
if (args.totalTokens === void 0) {
|
|
2221
|
-
throw new
|
|
2223
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
2222
2224
|
method: "calculateFee",
|
|
2223
2225
|
argument: "totalTokens",
|
|
2224
2226
|
reason: "is required for wallet-token-fee mode"
|
|
@@ -2404,12 +2406,12 @@ var ConfidentialDisperseClient = class {
|
|
|
2404
2406
|
if (isPaused) {
|
|
2405
2407
|
blockers.push("Singleton is paused");
|
|
2406
2408
|
blockerErrors.push(
|
|
2407
|
-
new
|
|
2409
|
+
new chunk67OV5CX2_cjs.PausedError({ method: "preflightDisperse", contractAddress: this.address })
|
|
2408
2410
|
);
|
|
2409
2411
|
}
|
|
2410
2412
|
if (callerBalance < fee.ethValue) {
|
|
2411
2413
|
blockerErrors.push(
|
|
2412
|
-
new
|
|
2414
|
+
new chunk67OV5CX2_cjs.InsufficientFeeError({
|
|
2413
2415
|
method: "preflightDisperse",
|
|
2414
2416
|
contractAddress: this.address,
|
|
2415
2417
|
feeKind: "gas",
|
|
@@ -2566,7 +2568,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2566
2568
|
const account = this.#resolveAccount(wallet, args.account, "disperse");
|
|
2567
2569
|
const enc = resolveEncryptor(this.encryptor);
|
|
2568
2570
|
if (!enc) {
|
|
2569
|
-
throw new
|
|
2571
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError("disperse", {
|
|
2570
2572
|
hint: "Pass `encryptor` to the call or the client config."
|
|
2571
2573
|
});
|
|
2572
2574
|
}
|
|
@@ -2661,7 +2663,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2661
2663
|
const aclLogs = receipt.logs.filter(
|
|
2662
2664
|
(log) => log.address.toLowerCase() === this.aclAddress.toLowerCase()
|
|
2663
2665
|
);
|
|
2664
|
-
const events = viem.parseEventLogs({ abi: [
|
|
2666
|
+
const events = viem.parseEventLogs({ abi: [chunkFAXIIH5R_cjs.ACL_ALLOWED_EVENT], logs: aclLogs });
|
|
2665
2667
|
const granted = events.filter(
|
|
2666
2668
|
(ev) => ev.args.account.toLowerCase() === callerAddress && ev.args.caller.toLowerCase() === this.address.toLowerCase()
|
|
2667
2669
|
);
|
|
@@ -2669,7 +2671,7 @@ var ConfidentialDisperseClient = class {
|
|
|
2669
2671
|
throw new DisperseEncryptedReserveNotGrantedError(hash, accountAddress(account));
|
|
2670
2672
|
}
|
|
2671
2673
|
if (granted.length > 1) {
|
|
2672
|
-
throw new
|
|
2674
|
+
throw new chunk67OV5CX2_cjs.ReceiptEventAmbiguousError({
|
|
2673
2675
|
method: "getEncryptedFeeReserve",
|
|
2674
2676
|
eventName: "Allowed",
|
|
2675
2677
|
contractAddress: this.aclAddress,
|
|
@@ -3021,7 +3023,7 @@ var ConfidentialDisperseClient = class {
|
|
|
3021
3023
|
values: amounts
|
|
3022
3024
|
});
|
|
3023
3025
|
} catch (err) {
|
|
3024
|
-
throw
|
|
3026
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: "disperse[direct]", operation: "encrypt" });
|
|
3025
3027
|
}
|
|
3026
3028
|
let ethValue = gasFeeOverride;
|
|
3027
3029
|
if (ethValue === void 0) {
|
|
@@ -3067,7 +3069,7 @@ var ConfidentialDisperseClient = class {
|
|
|
3067
3069
|
values: allValues
|
|
3068
3070
|
});
|
|
3069
3071
|
} catch (err) {
|
|
3070
|
-
throw
|
|
3072
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: `disperse[${mode}]`, operation: "encrypt" });
|
|
3071
3073
|
}
|
|
3072
3074
|
const amountHandles = encrypted.handles.slice(0, count);
|
|
3073
3075
|
const subtotal0Handle = encrypted.handles[count];
|
|
@@ -3194,14 +3196,14 @@ var ConfidentialDisperseClient = class {
|
|
|
3194
3196
|
const hasAmount = amount !== void 0;
|
|
3195
3197
|
const hasInput = preEncrypted !== void 0;
|
|
3196
3198
|
if (hasAmount && hasInput) {
|
|
3197
|
-
throw new
|
|
3199
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
3198
3200
|
method,
|
|
3199
3201
|
argument: "amount/encryptedInput",
|
|
3200
3202
|
reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got both"
|
|
3201
3203
|
});
|
|
3202
3204
|
}
|
|
3203
3205
|
if (!hasAmount && !hasInput) {
|
|
3204
|
-
throw new
|
|
3206
|
+
throw new chunk67OV5CX2_cjs.InvalidArgumentError({
|
|
3205
3207
|
method,
|
|
3206
3208
|
argument: "amount/encryptedInput",
|
|
3207
3209
|
reason: "exactly one of `amount` (plaintext, SDK encrypts) or `encryptedInput` (pre-encrypted) must be supplied \u2014 got neither"
|
|
@@ -3210,7 +3212,7 @@ var ConfidentialDisperseClient = class {
|
|
|
3210
3212
|
if (hasInput) return preEncrypted;
|
|
3211
3213
|
const enc = encryptor ?? resolveEncryptor(this.encryptor);
|
|
3212
3214
|
if (!enc) {
|
|
3213
|
-
throw new
|
|
3215
|
+
throw new chunk67OV5CX2_cjs.MissingEncryptorError("encryptSingle", {
|
|
3214
3216
|
hint: "Pass `encryptor` to the call or the client config (eager or lazy factory)."
|
|
3215
3217
|
});
|
|
3216
3218
|
}
|
|
@@ -3222,19 +3224,19 @@ var ConfidentialDisperseClient = class {
|
|
|
3222
3224
|
value: amount
|
|
3223
3225
|
});
|
|
3224
3226
|
} catch (err) {
|
|
3225
|
-
throw
|
|
3227
|
+
throw chunkTEBM66WA_cjs.mapZamaError(err, { method: "encryptSingle", operation: "encrypt" });
|
|
3226
3228
|
}
|
|
3227
3229
|
}
|
|
3228
3230
|
#requireWallet(method) {
|
|
3229
3231
|
if (!this.walletClient) {
|
|
3230
|
-
throw new
|
|
3232
|
+
throw new chunk67OV5CX2_cjs.MissingWalletClientError(method);
|
|
3231
3233
|
}
|
|
3232
3234
|
return this.walletClient;
|
|
3233
3235
|
}
|
|
3234
3236
|
#resolveAccount(wallet, override, method) {
|
|
3235
3237
|
const acct = override ?? wallet.account;
|
|
3236
3238
|
if (!acct) {
|
|
3237
|
-
throw new
|
|
3239
|
+
throw new chunk67OV5CX2_cjs.MissingAccountError(method);
|
|
3238
3240
|
}
|
|
3239
3241
|
return acct;
|
|
3240
3242
|
}
|
|
@@ -3287,13 +3289,13 @@ var ConfidentialDisperseClient = class {
|
|
|
3287
3289
|
...value !== void 0 ? { value } : {}
|
|
3288
3290
|
});
|
|
3289
3291
|
} catch (err) {
|
|
3290
|
-
if (
|
|
3292
|
+
if (chunkMVDQMV25_cjs.isContractRevert(err)) {
|
|
3291
3293
|
throw this.#mapRevert(method, err, productContext, accountAddress(account));
|
|
3292
3294
|
}
|
|
3293
3295
|
}
|
|
3294
3296
|
}
|
|
3295
3297
|
#mapRevert(method, err, productContext, account) {
|
|
3296
|
-
return
|
|
3298
|
+
return chunkMVDQMV25_cjs.mapContractRevert(err, {
|
|
3297
3299
|
method,
|
|
3298
3300
|
contractAddress: this.address,
|
|
3299
3301
|
abi: disperseConfidentialAbi,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkFWHYQZ5E_cjs = require('./chunk-FWHYQZ5E.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkJK4XMMKM_cjs = require('./chunk-JK4XMMKM.cjs');
|
|
5
|
+
var chunk67OV5CX2_cjs = require('./chunk-67OV5CX2.cjs');
|
|
6
6
|
var chunkVJKZWYYJ_cjs = require('./chunk-VJKZWYYJ.cjs');
|
|
7
7
|
|
|
8
8
|
// src/fhe/operators.ts
|
|
@@ -21,19 +21,19 @@ var ERC7984_SET_OPERATOR_ABI = [
|
|
|
21
21
|
var ERC7984_OPERATOR_MAX_DEADLINE = (1n << 48n) - 1n;
|
|
22
22
|
async function setOperator(args) {
|
|
23
23
|
const { publicClient, walletClient, account, waitForReceipt = true, telemetry } = args;
|
|
24
|
-
const token =
|
|
25
|
-
const spender =
|
|
24
|
+
const token = chunkJK4XMMKM_cjs.normaliseAddress(args.token);
|
|
25
|
+
const spender = chunkJK4XMMKM_cjs.normaliseAddress(args.spender);
|
|
26
26
|
const deadline = args.deadline ?? ERC7984_OPERATOR_MAX_DEADLINE;
|
|
27
27
|
return chunkVJKZWYYJ_cjs.withTelemetry(telemetry, "fhe.setOperator", async () => {
|
|
28
28
|
const fromAccount = account ?? walletClient.account;
|
|
29
29
|
if (!fromAccount) {
|
|
30
|
-
throw new
|
|
30
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
31
31
|
"setOperator: no account available \u2014 pass `account` explicitly or attach an account to the walletClient",
|
|
32
32
|
{ contract: "ERC7984", call: "setOperator" }
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
if (deadline < 0n || deadline > ERC7984_OPERATOR_MAX_DEADLINE) {
|
|
36
|
-
throw new
|
|
36
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
37
37
|
`setOperator: deadline ${deadline} out of uint48 range [0, ${ERC7984_OPERATOR_MAX_DEADLINE}]`,
|
|
38
38
|
{ contract: "ERC7984", call: "setOperator", deadline: deadline.toString() }
|
|
39
39
|
);
|
|
@@ -54,7 +54,7 @@ async function setOperator(args) {
|
|
|
54
54
|
chain: walletClient.chain
|
|
55
55
|
});
|
|
56
56
|
} catch (err) {
|
|
57
|
-
throw new
|
|
57
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
58
58
|
`setOperator: writeContract failed (token=${token}, spender=${spender})`,
|
|
59
59
|
{
|
|
60
60
|
contract: "ERC7984",
|
|
@@ -69,7 +69,7 @@ async function setOperator(args) {
|
|
|
69
69
|
try {
|
|
70
70
|
await publicClient.waitForTransactionReceipt({ hash });
|
|
71
71
|
} catch (err) {
|
|
72
|
-
throw new
|
|
72
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(`setOperator: receipt wait failed (tx=${hash})`, {
|
|
73
73
|
contract: "ERC7984",
|
|
74
74
|
call: "setOperator",
|
|
75
75
|
tx: hash,
|
|
@@ -96,9 +96,9 @@ async function revokeOperator(args) {
|
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
async function isOperator(args) {
|
|
99
|
-
const token =
|
|
100
|
-
const holder =
|
|
101
|
-
const spender =
|
|
99
|
+
const token = chunkJK4XMMKM_cjs.normaliseAddress(args.token);
|
|
100
|
+
const holder = chunkJK4XMMKM_cjs.normaliseAddress(args.holder);
|
|
101
|
+
const spender = chunkJK4XMMKM_cjs.normaliseAddress(args.spender);
|
|
102
102
|
return chunkVJKZWYYJ_cjs.withTelemetry(args.telemetry, "fhe.isOperator", async () => {
|
|
103
103
|
try {
|
|
104
104
|
return await args.publicClient.readContract({
|
|
@@ -108,7 +108,7 @@ async function isOperator(args) {
|
|
|
108
108
|
args: [holder, spender]
|
|
109
109
|
});
|
|
110
110
|
} catch (err) {
|
|
111
|
-
throw new
|
|
111
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
112
112
|
`isOperator: readContract failed (token=${token}, holder=${holder}, spender=${spender})`,
|
|
113
113
|
{ contract: "ERC7984", call: "isOperator", token, holder, spender, cause: err }
|
|
114
114
|
);
|
|
@@ -118,14 +118,14 @@ async function isOperator(args) {
|
|
|
118
118
|
async function ensureOperator(args) {
|
|
119
119
|
return chunkVJKZWYYJ_cjs.withTelemetry(args.telemetry, "fhe.ensureOperator", async () => {
|
|
120
120
|
if (args.deadline <= 0n || args.deadline > ERC7984_OPERATOR_MAX_DEADLINE) {
|
|
121
|
-
throw new
|
|
121
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
122
122
|
`ensureOperator: deadline ${args.deadline} out of range (0, ${ERC7984_OPERATOR_MAX_DEADLINE}]`,
|
|
123
123
|
{ contract: "ERC7984", call: "ensureOperator", deadline: args.deadline.toString() }
|
|
124
124
|
);
|
|
125
125
|
}
|
|
126
126
|
const fromAccount = args.account ?? args.walletClient.account;
|
|
127
127
|
if (!fromAccount) {
|
|
128
|
-
throw new
|
|
128
|
+
throw new chunk67OV5CX2_cjs.TokenOpsContractError(
|
|
129
129
|
"ensureOperator: no account available \u2014 pass `account` explicitly or attach an account to the walletClient",
|
|
130
130
|
{ contract: "ERC7984", call: "ensureOperator" }
|
|
131
131
|
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/core/brands.ts
|
|
2
|
+
var asEncryptedHandle = (h) => h;
|
|
3
|
+
var asExternalInputProof = (h) => h;
|
|
4
|
+
var asTxHash = (h) => h;
|
|
5
|
+
var asVestingId = (h) => h;
|
|
6
|
+
var asAirdropId = (h) => h;
|
|
7
|
+
var asDisperseId = (h) => h;
|
|
8
|
+
var asRole = (h) => h;
|
|
9
|
+
var asSignature = (h) => h;
|
|
10
|
+
|
|
11
|
+
export { asAirdropId, asDisperseId, asEncryptedHandle, asExternalInputProof, asRole, asSignature, asTxHash, asVestingId };
|