@tokenops/sdk 1.1.1 → 1.6.0
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 +158 -2
- package/README.md +18 -8
- package/SECURITY.md +7 -1
- package/dist/{chunk-56UI7LUR.cjs → chunk-2RNW4MIJ.cjs} +37 -0
- package/dist/{chunk-VDXVNZCO.cjs → chunk-43RFBQ73.cjs} +85 -29
- package/dist/{chunk-BE2AIZ3K.js → chunk-46T67CE2.js} +1 -1
- package/dist/{chunk-WRCUDSUJ.js → chunk-4KJ66YRH.js} +61 -3
- package/dist/{chunk-ITQ7WKVC.cjs → chunk-4ZCXK4VI.cjs} +68 -8
- package/dist/{chunk-JFLEEXKP.js → chunk-6WSNS3UV.js} +58 -2
- package/dist/{chunk-W7JHOK7G.cjs → chunk-7G7UOQV4.cjs} +4 -4
- package/dist/{chunk-5KHIQG7Y.cjs → chunk-AYGRYDBX.cjs} +35 -36
- package/dist/{chunk-5SGMJADP.cjs → chunk-BD4LZBVF.cjs} +85 -9
- package/dist/{chunk-OYLZEEHF.cjs → chunk-BK7YIVLK.cjs} +304 -179
- package/dist/{chunk-SEKC7H5Y.cjs → chunk-CBRL2PJA.cjs} +12 -11
- package/dist/{chunk-XWDVPV42.js → chunk-CNP4L3GF.js} +4 -4
- package/dist/{chunk-IVE3QEGD.js → chunk-DRSPMIZ7.js} +28 -1
- package/dist/{chunk-SAGJIEQK.cjs → chunk-EUKPOXWR.cjs} +15 -16
- package/dist/chunk-FT4LNBOS.js +11 -0
- package/dist/{chunk-ITQBDRWX.js → chunk-HETNKZEE.js} +1 -1
- package/dist/{chunk-JJ4R5QXF.js → chunk-KSDSXJ34.js} +1 -1
- package/dist/{chunk-SYHXDHWX.cjs → chunk-LBWRFZR3.cjs} +218 -31
- package/dist/{chunk-ZXCOJY2Z.js → chunk-NFW7AUEX.js} +1 -1
- package/dist/{chunk-FPQBFIUW.cjs → chunk-OL6SHN3D.cjs} +3 -3
- package/dist/{chunk-XSNLAS5M.js → chunk-PD7ME2BT.js} +75 -2
- package/dist/{chunk-FXCW7LVB.js → chunk-QET3Q4JP.js} +94 -9
- package/dist/{chunk-M7V2EDPB.js → chunk-QKKBBH7I.js} +2 -2
- package/dist/{chunk-XXXDQSHE.js → chunk-S2XD75JM.js} +12 -3
- package/dist/{chunk-5SA2HF2W.cjs → chunk-SPGSO5SO.cjs} +31 -22
- package/dist/{chunk-Q7ARQSUH.cjs → chunk-SYHNZSZZ.cjs} +3 -3
- package/dist/{chunk-X56UVEXS.js → chunk-TN65XNTI.js} +248 -120
- package/dist/chunk-U57COLUE.js +56 -0
- package/dist/{chunk-OQZAZIAS.js → chunk-UE5XK2SY.js} +193 -6
- package/dist/{chunk-NS44KBV5.cjs → chunk-UJS4N2XM.cjs} +12 -12
- package/dist/{chunk-IR5AK5U5.js → chunk-V5D7BHW3.js} +4 -5
- package/dist/{chunk-3PQ2RFPC.js → chunk-VHSNYUYV.js} +5 -4
- package/dist/{chunk-CQIPRNS7.cjs → chunk-VR3FREBX.cjs} +3 -3
- package/dist/{chunk-G7G75C46.cjs → chunk-WO72UBQD.cjs} +11 -11
- package/dist/chunk-WOEETTH7.cjs +59 -0
- package/dist/{chunk-QE7ZONJ2.js → chunk-WTK6JDSI.js} +4 -5
- package/dist/{chunk-3ZRHDTEX.cjs → chunk-WUXUWTFW.cjs} +3 -3
- package/dist/{chunk-23F7JIK5.cjs → chunk-YFIWCYHC.cjs} +141 -54
- package/dist/{chunk-FYQ2UW4T.js → chunk-YPYCWLYP.js} +1 -1
- package/dist/chunk-ZQUE2B3Q.cjs +33 -0
- package/dist/core/addresses.d.ts +1 -1
- package/dist/core/errors.d.ts +41 -1
- package/dist/core/revert-mapper.d.ts +77 -0
- package/dist/core/wagmi-compat.d.ts +40 -0
- package/dist/fhe/index.cjs +134 -68
- package/dist/fhe/index.d.cts +2 -1
- package/dist/fhe/index.d.ts +2 -1
- package/dist/fhe/index.js +64 -10
- package/dist/fhe/mock-erc7984.d.ts +4 -4
- package/dist/fhe/operators.d.ts +142 -2
- package/dist/fhe/react/index.cjs +21 -8
- package/dist/fhe/react/index.d.cts +2 -0
- package/dist/fhe/react/index.d.ts +2 -0
- package/dist/fhe/react/index.js +8 -3
- package/dist/fhe/react/useEnsureOperator.d.ts +56 -0
- package/dist/fhe/react/useIsOperator.d.ts +54 -0
- package/dist/fhe/sepolia-encryptor-web.d.ts +45 -4
- package/dist/fhe/sepolia-encryptor.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/index.cjs +9 -9
- package/dist/fhe-airdrop/advanced/index.js +7 -7
- package/dist/fhe-airdrop/advanced/react/index.cjs +14 -14
- package/dist/fhe-airdrop/advanced/react/index.js +10 -10
- package/dist/fhe-airdrop/airdrop.d.ts +9 -0
- package/dist/fhe-airdrop/encryption.d.ts +8 -0
- package/dist/fhe-airdrop/factory.d.ts +86 -1
- package/dist/fhe-airdrop/index.cjs +69 -66
- package/dist/fhe-airdrop/index.d.cts +3 -3
- package/dist/fhe-airdrop/index.d.ts +3 -3
- package/dist/fhe-airdrop/index.js +7 -8
- package/dist/fhe-airdrop/react/index.cjs +176 -135
- package/dist/fhe-airdrop/react/index.d.cts +7 -4
- package/dist/fhe-airdrop/react/index.d.ts +7 -4
- package/dist/fhe-airdrop/react/index.js +43 -16
- package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +17 -11
- package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
- package/dist/fhe-airdrop/react/useClaim.d.ts +10 -0
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdrop.d.ts +8 -0
- package/dist/fhe-airdrop/react/useCreateAndFundConfidentialAirdropAndGetAddress.d.ts +8 -0
- package/dist/fhe-airdrop/react/useFundConfidentialAirdrop.d.ts +8 -0
- package/dist/fhe-airdrop/react/usePreflightCreateAirdrop.d.ts +51 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +1 -1
- package/dist/fhe-airdrop/types.d.ts +56 -0
- package/dist/fhe-disperse/encryption.d.ts +8 -0
- package/dist/fhe-disperse/errors.d.ts +55 -0
- package/dist/fhe-disperse/index.cjs +77 -66
- package/dist/fhe-disperse/index.d.cts +2 -2
- package/dist/fhe-disperse/index.d.ts +2 -2
- package/dist/fhe-disperse/index.js +8 -9
- package/dist/fhe-disperse/react/index.cjs +108 -87
- package/dist/fhe-disperse/react/index.d.cts +4 -2
- package/dist/fhe-disperse/react/index.d.ts +4 -2
- package/dist/fhe-disperse/react/index.js +12 -11
- package/dist/fhe-disperse/react/useCalculateFee.d.ts +7 -0
- package/dist/fhe-disperse/react/useDisperse.d.ts +9 -0
- package/dist/fhe-disperse/react/usePreflightDisperse.d.ts +7 -0
- package/dist/fhe-disperse/react/useSingletonCalculateFee.d.ts +7 -0
- package/dist/fhe-disperse/react/useSingletonWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-disperse/react/useWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-disperse/singleton.d.ts +29 -0
- package/dist/fhe-disperse/subtotals.d.ts +6 -0
- package/dist/fhe-vesting/advanced/index.cjs +8 -9
- package/dist/fhe-vesting/advanced/index.js +6 -7
- package/dist/fhe-vesting/advanced/react/index.cjs +15 -15
- package/dist/fhe-vesting/advanced/react/index.js +12 -12
- package/dist/fhe-vesting/encryption.d.ts +8 -0
- package/dist/fhe-vesting/index.cjs +82 -79
- package/dist/fhe-vesting/index.d.cts +2 -2
- package/dist/fhe-vesting/index.d.ts +2 -2
- package/dist/fhe-vesting/index.js +9 -10
- package/dist/fhe-vesting/manager.d.ts +119 -1
- package/dist/fhe-vesting/react/index.cjs +264 -224
- package/dist/fhe-vesting/react/index.d.cts +9 -6
- package/dist/fhe-vesting/react/index.d.ts +9 -6
- package/dist/fhe-vesting/react/index.js +44 -21
- package/dist/fhe-vesting/react/useAccessClaimableAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessSettledAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessTotalAllocation.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessVestedAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useAdminGetClaimableAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetSettledAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetTotalAllocation.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetVestedAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +10 -0
- package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
- package/dist/fhe-vesting/react/useClaim.d.ts +3 -1
- package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
- package/dist/fhe-vesting/react/useDiscloseHandleToParty.d.ts +1 -1
- package/dist/fhe-vesting/react/useManagerDiscloseHandleToParty.d.ts +1 -1
- package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-vesting/react/usePartialClaim.d.ts +9 -1
- package/dist/fhe-vesting/react/usePreflightCreateVesting.d.ts +37 -0
- package/dist/fhe-vesting/react/useVestingClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useVestingInfo.d.ts +1 -1
- package/dist/fhe-vesting/react/useWithdrawAdmin.d.ts +6 -0
- package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-vesting/types.d.ts +45 -0
- package/dist/index.cjs +93 -86
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -3
- package/dist/testnet-faucet/index.cjs +58 -55
- package/dist/testnet-faucet/index.d.cts +1 -1
- package/dist/testnet-faucet/index.d.ts +1 -1
- package/dist/testnet-faucet/index.js +5 -6
- package/dist/testnet-faucet/react/index.cjs +60 -56
- package/dist/testnet-faucet/react/index.d.cts +3 -2
- package/dist/testnet-faucet/react/index.d.ts +3 -2
- package/dist/testnet-faucet/react/index.js +11 -11
- package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +3 -2
- package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +2 -2
- package/package.json +14 -8
- package/dist/chunk-66IHPTOK.cjs +0 -20
- package/dist/chunk-KWFFIJYX.js +0 -11
- package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +0 -25
- package/dist/fhe-airdrop/react/useGetClaimAmount.d.ts +0 -30
- package/dist/fhe-vesting/react/useGetClaimableAmount.d.ts +0 -13
- package/dist/fhe-vesting/react/useGetSettledAmount.d.ts +0 -14
- package/dist/fhe-vesting/react/useGetTotalAllocation.d.ts +0 -13
- package/dist/fhe-vesting/react/useGetVestedAmount.d.ts +0 -25
|
@@ -44,6 +44,7 @@ export { useFactoryDefaultGasFee } from "./useFactoryDefaultGasFee.js";
|
|
|
44
44
|
export { useFactoryFeeCollector } from "./useFactoryFeeCollector.js";
|
|
45
45
|
export { useFactoryCustomFee, type UseFactoryCustomFeeArgs } from "./useFactoryCustomFee.js";
|
|
46
46
|
export { useFactoryInitCodeHash, type UseFactoryInitCodeHashArgs, } from "./useFactoryInitCodeHash.js";
|
|
47
|
+
export { usePreflightCreateAirdrop, type UsePreflightCreateAirdropArgs, } from "./usePreflightCreateAirdrop.js";
|
|
47
48
|
export { useCreateConfidentialAirdropAndGetAddress } from "./useCreateConfidentialAirdropAndGetAddress.js";
|
|
48
49
|
export { useCreateConfidentialAirdrop } from "./useCreateConfidentialAirdrop.js";
|
|
49
50
|
export { useCreateAndFundConfidentialAirdrop } from "./useCreateAndFundConfidentialAirdrop.js";
|
|
@@ -70,7 +71,7 @@ export { useAirdropIsSignatureClaimed, type UseAirdropIsSignatureClaimedArgs, }
|
|
|
70
71
|
export { useAirdropIsSignatureValid, type UseAirdropIsSignatureValidArgs, } from "./useAirdropIsSignatureValid.js";
|
|
71
72
|
export { useAirdropHasRole, type UseAirdropHasRoleArgs } from "./useAirdropHasRole.js";
|
|
72
73
|
export { useClaim } from "./useClaim.js";
|
|
73
|
-
export { useGetClaimAmount } from "./
|
|
74
|
+
export { useAccessClaimAmount, useGetClaimAmount } from "./useAccessClaimAmount.js";
|
|
74
75
|
export { useWithdraw, type UseWithdrawArgs } from "./useWithdraw.js";
|
|
75
76
|
export { useSetPaused, type UseSetPausedArgs } from "./useSetPaused.js";
|
|
76
77
|
export { useExtendClaimWindow, type UseExtendClaimWindowArgs } from "./useExtendClaimWindow.js";
|
|
@@ -82,9 +83,11 @@ export { useAirdropRevokeRole, type UseAirdropRevokeRoleArgs } from "./useAirdro
|
|
|
82
83
|
export { useSignClaimAuthorization, type UseSignClaimAuthorizationArgs, type UseSignClaimAuthorizationOptions, } from "./useSignClaimAuthorization.js";
|
|
83
84
|
export type { BaseHookOptions, AirdropHookOptions, FactoryHookOptions } from "./_shared.js";
|
|
84
85
|
export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization, type Encryptor, type EncryptorSource, type EncryptUint64Args, type EncryptUint64BatchArgs, type FheValueInput, } from "../encryption.js";
|
|
85
|
-
export { type AirdropParams, type CustomFee, type EncryptedInput, type EncryptedInputs, } from "../types.js";
|
|
86
|
+
export { type AirdropParams, type CreateAirdropPreflightReport, type CustomFee, type EncryptedInput, type EncryptedInputs, } from "../types.js";
|
|
86
87
|
export type { ClaimArgs, EncryptedViewResult, GetClaimAmountArgs, IsSignatureValidArgs, } from "../airdrop.js";
|
|
87
|
-
export type { CreateAirdropResult, CreateAirdropArgs, CreateAndFundAirdropArgs, FundAirdropArgs, PredictAirdropArgs, } from "../factory.js";
|
|
88
|
-
export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ContractRevertError, PausedError, AccessDeniedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../../core/errors.js";
|
|
88
|
+
export type { CreateAirdropResult, CreateAirdropArgs, CreateAndFundAirdropArgs, FundAirdropArgs, PredictAirdropArgs, PreflightCreateAirdropArgs, } from "../factory.js";
|
|
89
|
+
export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ContractRevertError, PausedError, AccessDeniedError, OperatorNotApprovedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../../core/errors.js";
|
|
89
90
|
export { type PreflightResult } from "../../core/preflight.js";
|
|
90
91
|
export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from "../errors.js";
|
|
92
|
+
export { useIsOperator, type UseIsOperatorOptions } from "../../fhe/react/useIsOperator.js";
|
|
93
|
+
export { useEnsureOperator, type UseEnsureOperatorOptions, type EnsureOperatorVariables, } from "../../fhe/react/useEnsureOperator.js";
|
|
@@ -44,6 +44,7 @@ export { useFactoryDefaultGasFee } from "./useFactoryDefaultGasFee.js";
|
|
|
44
44
|
export { useFactoryFeeCollector } from "./useFactoryFeeCollector.js";
|
|
45
45
|
export { useFactoryCustomFee, type UseFactoryCustomFeeArgs } from "./useFactoryCustomFee.js";
|
|
46
46
|
export { useFactoryInitCodeHash, type UseFactoryInitCodeHashArgs, } from "./useFactoryInitCodeHash.js";
|
|
47
|
+
export { usePreflightCreateAirdrop, type UsePreflightCreateAirdropArgs, } from "./usePreflightCreateAirdrop.js";
|
|
47
48
|
export { useCreateConfidentialAirdropAndGetAddress } from "./useCreateConfidentialAirdropAndGetAddress.js";
|
|
48
49
|
export { useCreateConfidentialAirdrop } from "./useCreateConfidentialAirdrop.js";
|
|
49
50
|
export { useCreateAndFundConfidentialAirdrop } from "./useCreateAndFundConfidentialAirdrop.js";
|
|
@@ -70,7 +71,7 @@ export { useAirdropIsSignatureClaimed, type UseAirdropIsSignatureClaimedArgs, }
|
|
|
70
71
|
export { useAirdropIsSignatureValid, type UseAirdropIsSignatureValidArgs, } from "./useAirdropIsSignatureValid.js";
|
|
71
72
|
export { useAirdropHasRole, type UseAirdropHasRoleArgs } from "./useAirdropHasRole.js";
|
|
72
73
|
export { useClaim } from "./useClaim.js";
|
|
73
|
-
export { useGetClaimAmount } from "./
|
|
74
|
+
export { useAccessClaimAmount, useGetClaimAmount } from "./useAccessClaimAmount.js";
|
|
74
75
|
export { useWithdraw, type UseWithdrawArgs } from "./useWithdraw.js";
|
|
75
76
|
export { useSetPaused, type UseSetPausedArgs } from "./useSetPaused.js";
|
|
76
77
|
export { useExtendClaimWindow, type UseExtendClaimWindowArgs } from "./useExtendClaimWindow.js";
|
|
@@ -82,9 +83,11 @@ export { useAirdropRevokeRole, type UseAirdropRevokeRoleArgs } from "./useAirdro
|
|
|
82
83
|
export { useSignClaimAuthorization, type UseSignClaimAuthorizationArgs, type UseSignClaimAuthorizationOptions, } from "./useSignClaimAuthorization.js";
|
|
83
84
|
export type { BaseHookOptions, AirdropHookOptions, FactoryHookOptions } from "./_shared.js";
|
|
84
85
|
export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization, type Encryptor, type EncryptorSource, type EncryptUint64Args, type EncryptUint64BatchArgs, type FheValueInput, } from "../encryption.js";
|
|
85
|
-
export { type AirdropParams, type CustomFee, type EncryptedInput, type EncryptedInputs, } from "../types.js";
|
|
86
|
+
export { type AirdropParams, type CreateAirdropPreflightReport, type CustomFee, type EncryptedInput, type EncryptedInputs, } from "../types.js";
|
|
86
87
|
export type { ClaimArgs, EncryptedViewResult, GetClaimAmountArgs, IsSignatureValidArgs, } from "../airdrop.js";
|
|
87
|
-
export type { CreateAirdropResult, CreateAirdropArgs, CreateAndFundAirdropArgs, FundAirdropArgs, PredictAirdropArgs, } from "../factory.js";
|
|
88
|
-
export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ContractRevertError, PausedError, AccessDeniedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../../core/errors.js";
|
|
88
|
+
export type { CreateAirdropResult, CreateAirdropArgs, CreateAndFundAirdropArgs, FundAirdropArgs, PredictAirdropArgs, PreflightCreateAirdropArgs, } from "../factory.js";
|
|
89
|
+
export { TokenOpsSdkError, isTokenOpsSdkError, DeploymentAddressUnavailableError, UnsupportedChainError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, InvalidArgumentError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ContractRevertError, PausedError, AccessDeniedError, OperatorNotApprovedError, InsufficientFeeError, InsufficientBalanceError, BatchTooLargeError, FeatureDisabledError, TransferFailedError, FheHandleNotAllowedError, AlreadyInitializedError, ReentrancyError, InvalidSignatureError, WalletRejectedError, WalletChainMismatchError, NetworkError, InsufficientGasFundsError, UnknownWriteFailureError, UserRejectedSignatureError, SigningFailedError, RelayerUnreachableError, EncryptionFailedError, DecryptionFailedError, UserDecryptNotAllowedError, type DeploymentAddressUnavailableReason, type TokenOpsSdkErrorCode, } from "../../core/errors.js";
|
|
89
90
|
export { type PreflightResult } from "../../core/preflight.js";
|
|
90
91
|
export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from "../errors.js";
|
|
92
|
+
export { useIsOperator, type UseIsOperatorOptions } from "../../fhe/react/useIsOperator.js";
|
|
93
|
+
export { useEnsureOperator, type UseEnsureOperatorOptions, type EnsureOperatorVariables, } from "../../fhe/react/useEnsureOperator.js";
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { useMemoFactoryClient, buildQueryKey, useMemoAirdropClient } from '../../chunk-
|
|
2
|
-
export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from '../../chunk-
|
|
3
|
-
import { signClaimAuthorization } from '../../chunk-
|
|
4
|
-
export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-
|
|
5
|
-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
1
|
+
import { useMemoFactoryClient, buildQueryKey, useMemoAirdropClient } from '../../chunk-CNP4L3GF.js';
|
|
2
|
+
export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from '../../chunk-S2XD75JM.js';
|
|
3
|
+
import { signClaimAuthorization } from '../../chunk-UE5XK2SY.js';
|
|
4
|
+
export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-UE5XK2SY.js';
|
|
5
|
+
export { useEnsureOperator, useIsOperator } from '../../chunk-U57COLUE.js';
|
|
6
|
+
import { useWagmiAccount } from '../../chunk-FT4LNBOS.js';
|
|
7
|
+
import '../../chunk-4KJ66YRH.js';
|
|
8
|
+
import '../../chunk-YPYCWLYP.js';
|
|
9
|
+
import '../../chunk-7VELUOMI.js';
|
|
10
|
+
import '../../chunk-6WSNS3UV.js';
|
|
11
|
+
import '../../chunk-QKKBBH7I.js';
|
|
12
|
+
import '../../chunk-46T67CE2.js';
|
|
13
|
+
import { MissingClientError, MissingWalletClientError } from '../../chunk-DRSPMIZ7.js';
|
|
14
|
+
export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, OperatorNotApprovedError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-DRSPMIZ7.js';
|
|
9
15
|
import '../../chunk-Q2GP5UDC.js';
|
|
10
|
-
import '../../chunk-KWFFIJYX.js';
|
|
11
|
-
import { MissingClientError, MissingWalletClientError } from '../../chunk-IVE3QEGD.js';
|
|
12
|
-
export { AccessDeniedError, AlreadyInitializedError, BatchTooLargeError, ContractRevertError, DecryptionFailedError, DeploymentAddressUnavailableError, EncryptionFailedError, FeatureDisabledError, FheHandleNotAllowedError, InsufficientBalanceError, InsufficientFeeError, InsufficientGasFundsError, InvalidArgumentError, InvalidSignatureError, MissingAccountError, MissingClientError, MissingEncryptorError, MissingPublicClientError, MissingWalletClientError, NetworkError, PausedError, ReceiptEventAmbiguousError, ReceiptEventNotFoundError, ReentrancyError, RelayerUnreachableError, SigningFailedError, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-IVE3QEGD.js';
|
|
13
16
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
14
|
-
import {
|
|
17
|
+
import { useWalletClient } from 'wagmi';
|
|
15
18
|
|
|
16
19
|
function useConfidentialAirdropFactoryImplementation(options = {}) {
|
|
17
20
|
const { client, chainId, resolvedAddress } = useMemoFactoryClient(options);
|
|
@@ -60,6 +63,29 @@ function useFactoryInitCodeHash(args = {}) {
|
|
|
60
63
|
staleTime: 0
|
|
61
64
|
});
|
|
62
65
|
}
|
|
66
|
+
function usePreflightCreateAirdrop(args = {}) {
|
|
67
|
+
const { params, creator, userSalt, funding, ...base } = args;
|
|
68
|
+
const { client, chainId, resolvedAddress } = useMemoFactoryClient(base);
|
|
69
|
+
return useQuery({
|
|
70
|
+
queryKey: buildQueryKey(
|
|
71
|
+
"factory:preflightCreateAirdrop",
|
|
72
|
+
chainId,
|
|
73
|
+
resolvedAddress,
|
|
74
|
+
creator,
|
|
75
|
+
params,
|
|
76
|
+
userSalt,
|
|
77
|
+
funding
|
|
78
|
+
),
|
|
79
|
+
queryFn: () => client.preflightCreateAirdrop({
|
|
80
|
+
params,
|
|
81
|
+
creator,
|
|
82
|
+
...userSalt !== void 0 ? { userSalt } : {},
|
|
83
|
+
...funding !== void 0 ? { funding } : {}
|
|
84
|
+
}),
|
|
85
|
+
enabled: !!client && !!params && !!creator,
|
|
86
|
+
staleTime: 0
|
|
87
|
+
});
|
|
88
|
+
}
|
|
63
89
|
function useCreateConfidentialAirdropAndGetAddress(options = {}) {
|
|
64
90
|
const { client, resolutionError } = useMemoFactoryClient(options);
|
|
65
91
|
return useMutation({
|
|
@@ -290,7 +316,7 @@ function useAirdropIsSignatureClaimed(args) {
|
|
|
290
316
|
function useAirdropIsSignatureValid(args) {
|
|
291
317
|
const { encryptedAmountHandle, signature, caller, ...base } = args;
|
|
292
318
|
const { client, chainId } = useMemoAirdropClient(base);
|
|
293
|
-
const { address: connectedAddress } =
|
|
319
|
+
const { address: connectedAddress } = useWagmiAccount();
|
|
294
320
|
const resolvedCaller = caller ?? connectedAddress;
|
|
295
321
|
return useQuery({
|
|
296
322
|
queryKey: buildQueryKey(
|
|
@@ -329,15 +355,16 @@ function useClaim(options) {
|
|
|
329
355
|
}
|
|
330
356
|
});
|
|
331
357
|
}
|
|
332
|
-
function
|
|
358
|
+
function useAccessClaimAmount(options) {
|
|
333
359
|
const { client } = useMemoAirdropClient(options);
|
|
334
360
|
return useMutation({
|
|
335
361
|
mutationFn: async (args) => {
|
|
336
|
-
if (!client) throw new MissingClientError("
|
|
362
|
+
if (!client) throw new MissingClientError("useAccessClaimAmount", "airdrop");
|
|
337
363
|
return client.getClaimAmount(args);
|
|
338
364
|
}
|
|
339
365
|
});
|
|
340
366
|
}
|
|
367
|
+
var useGetClaimAmount = useAccessClaimAmount;
|
|
341
368
|
function useWithdraw(options) {
|
|
342
369
|
const { client } = useMemoAirdropClient(options);
|
|
343
370
|
return useMutation({
|
|
@@ -427,4 +454,4 @@ function useSignClaimAuthorization(options = {}) {
|
|
|
427
454
|
});
|
|
428
455
|
}
|
|
429
456
|
|
|
430
|
-
export { useAirdropCanExtendClaimWindow, useAirdropClaimTypehash, useAirdropClaimedSignatures, useAirdropDeploymentBlockNumber, useAirdropDomainSeparator, useAirdropEndTime, useAirdropGasFee, useAirdropGrantRole, useAirdropHasClaimEnded, useAirdropHasClaimStarted, useAirdropHasRole, useAirdropIsClaimWindowActive, useAirdropIsPaused, useAirdropIsSignatureClaimed, useAirdropIsSignatureValid, useAirdropRevokeRole, useAirdropStartTime, useAirdropToken, useAirdropWithdrawGasFee, useClaim, useConfidentialAirdropFactoryImplementation, useCreateAndFundConfidentialAirdrop, useCreateAndFundConfidentialAirdropAndGetAddress, useCreateConfidentialAirdrop, useCreateConfidentialAirdropAndGetAddress, useDisableCustomFee, useExtendClaimWindow, useFactoryCustomFee, useFactoryDefaultGasFee, useFactoryFeeCollector, useFactoryInitCodeHash, useFundConfidentialAirdrop, useGetClaimAmount, useSetCustomFee, useSetDefaultGasFee, useSetFeeCollector, useSetPaused, useSignClaimAuthorization, useWithdraw, useWithdrawOtherConfidentialToken, useWithdrawOtherToken };
|
|
457
|
+
export { useAccessClaimAmount, useAirdropCanExtendClaimWindow, useAirdropClaimTypehash, useAirdropClaimedSignatures, useAirdropDeploymentBlockNumber, useAirdropDomainSeparator, useAirdropEndTime, useAirdropGasFee, useAirdropGrantRole, useAirdropHasClaimEnded, useAirdropHasClaimStarted, useAirdropHasRole, useAirdropIsClaimWindowActive, useAirdropIsPaused, useAirdropIsSignatureClaimed, useAirdropIsSignatureValid, useAirdropRevokeRole, useAirdropStartTime, useAirdropToken, useAirdropWithdrawGasFee, useClaim, useConfidentialAirdropFactoryImplementation, useCreateAndFundConfidentialAirdrop, useCreateAndFundConfidentialAirdropAndGetAddress, useCreateConfidentialAirdrop, useCreateConfidentialAirdropAndGetAddress, useDisableCustomFee, useExtendClaimWindow, useFactoryCustomFee, useFactoryDefaultGasFee, useFactoryFeeCollector, useFactoryInitCodeHash, useFundConfidentialAirdrop, useGetClaimAmount, usePreflightCreateAirdrop, useSetCustomFee, useSetDefaultGasFee, useSetFeeCollector, useSetPaused, useSignClaimAuthorization, useWithdraw, useWithdrawOtherConfidentialToken, useWithdrawOtherToken };
|
|
@@ -12,20 +12,26 @@ import { type AirdropHookOptions } from "./_shared.js";
|
|
|
12
12
|
* plaintext amount. The handle is only valid after the tx lands.
|
|
13
13
|
*
|
|
14
14
|
* Does **not** consume the claim (the `claimedSignatures` bit is not set).
|
|
15
|
-
* Call {@link
|
|
15
|
+
* Call {@link useClaim} when the user is ready to transfer tokens.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* also pass `encryptor` per-mutation via `args.encryptor` to override it. If
|
|
20
|
-
* neither is present, the SDK throws `Missing encryptor — pass encryptor…`
|
|
21
|
-
* verbatim.
|
|
17
|
+
* Submits the admin-issued `{ encryptedInput, signature }` pair verbatim. The
|
|
18
|
+
* SDK does NOT re-encrypt — the signature commits to the exact handle.
|
|
22
19
|
*
|
|
23
20
|
* @example
|
|
24
|
-
* // `signature`
|
|
25
|
-
* //
|
|
26
|
-
* // server API or, for admin-dashboard flows,
|
|
27
|
-
*
|
|
28
|
-
*
|
|
21
|
+
* // `encryptedInput` + `signature` are the admin-issued payload delivered to
|
|
22
|
+
* // the recipient (same pair the recipient passes to `useClaim`). Sourced
|
|
23
|
+
* // from your server API or, for admin-dashboard flows, by combining
|
|
24
|
+
* // `encryptUint64({ userAddress: recipient, ... })` with
|
|
25
|
+
* // `useSignClaimAuthorization`.
|
|
26
|
+
* const view = useAccessClaimAmount({ address: airdropAddress });
|
|
27
|
+
* view.mutate({ encryptedInput, signature });
|
|
29
28
|
* // view.data → { handle: "0x...", hash: "0x..." }
|
|
30
29
|
*/
|
|
31
30
|
export declare function useAccessClaimAmount(options: AirdropHookOptions): UseMutationResult<EncryptedViewResult, Error, GetClaimAmountArgs>;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Renamed to {@link useAccessClaimAmount}. Both submit a transaction, and the
|
|
33
|
+
* `useGet*` name reads as a free query — which misled bounty builders. This
|
|
34
|
+
* is the same function object, not a wrapper: behavior, argument types and
|
|
35
|
+
* thrown errors are identical. Removed in the next major.
|
|
36
|
+
*/
|
|
37
|
+
export declare const useGetClaimAmount: typeof useAccessClaimAmount;
|
|
@@ -9,8 +9,9 @@ export interface UseAirdropIsSignatureValidArgs extends AirdropHookOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* Caller address — the contract recomputes the struct hash over
|
|
11
11
|
* `(msg.sender, encryptedAmount)`, so validity is caller-specific.
|
|
12
|
-
* Defaults to the connected wallet via
|
|
13
|
-
* explicitly to check on
|
|
12
|
+
* Defaults to the connected wallet via wagmi's account hook (v2
|
|
13
|
+
* `useAccount()` / v3 `useConnection()`); pass explicitly to check on
|
|
14
|
+
* behalf of another address.
|
|
14
15
|
*/
|
|
15
16
|
caller?: Address;
|
|
16
17
|
}
|
|
@@ -22,6 +22,16 @@ import { type AirdropHookOptions } from "./_shared.js";
|
|
|
22
22
|
* `useAirdropIsSignatureClaimed({ user, encryptedAmountHandle })` and any
|
|
23
23
|
* UI counts you computed off it.
|
|
24
24
|
*
|
|
25
|
+
* **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
|
|
26
|
+
*
|
|
27
|
+
* **An unfunded pool is the opposite case — it reverts loudly.** Do not
|
|
28
|
+
* generalize the silent-zero rule above to a clone whose pool was never
|
|
29
|
+
* funded: that claim throws {@link FheHandleNotAllowedError} (the FHEVM ACL
|
|
30
|
+
* rejects `FHE.allowTransient` on an uninitialized handle). It is not
|
|
31
|
+
* preflight-detectable either — the pool balance is an encrypted `euint64` the
|
|
32
|
+
* SDK cannot read in plaintext — so surface the error rather than reporting a
|
|
33
|
+
* silent no-op success. See `preflightClaim` for the same caveat.
|
|
34
|
+
*
|
|
25
35
|
* @example
|
|
26
36
|
* const claim = useClaim({ address: airdropAddress });
|
|
27
37
|
* claim.mutate({ encryptedInput, signature });
|
|
@@ -15,6 +15,14 @@ import { type FactoryHookOptions } from "./_shared.js";
|
|
|
15
15
|
* **Prerequisites:** caller must have set the factory as an operator on the
|
|
16
16
|
* token: `token.setOperator(factoryAddress, deadline)`.
|
|
17
17
|
*
|
|
18
|
+
* **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
|
|
19
|
+
*
|
|
20
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
21
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
22
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
23
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
24
|
+
* transparent TTT test token uses 18 decimals.
|
|
25
|
+
*
|
|
18
26
|
* After success, invalidate factory queries that depend on per-creator state:
|
|
19
27
|
*
|
|
20
28
|
* ```ts
|
|
@@ -13,6 +13,14 @@ import { type FactoryHookOptions } from "./_shared.js";
|
|
|
13
13
|
* Internally: `createAndFundConfidentialAirdrop` → `waitForTransactionReceipt`
|
|
14
14
|
* → `parseEventLogs({ eventName: "ConfidentialAirdropCreated" })`.
|
|
15
15
|
*
|
|
16
|
+
* **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
|
|
17
|
+
*
|
|
18
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
19
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
20
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
21
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
22
|
+
* transparent TTT test token uses 18 decimals.
|
|
23
|
+
*
|
|
16
24
|
* After a successful create, invalidate factory queries that depend on
|
|
17
25
|
* per-creator state:
|
|
18
26
|
*
|
|
@@ -17,6 +17,14 @@ import { type FactoryHookOptions } from "./_shared.js";
|
|
|
17
17
|
* **Prerequisites:** caller must have set the factory as an operator on the
|
|
18
18
|
* token: `token.setOperator(factoryAddress, deadline)`.
|
|
19
19
|
*
|
|
20
|
+
* **Silent-zero transfers.** ERC-7984 transfers do not revert when the sender's encrypted balance is insufficient — the transfer succeeds and moves an encrypted zero instead. This is by design: reverting would leak balance information. The transaction receipt alone cannot tell you whether value actually moved.
|
|
21
|
+
*
|
|
22
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
23
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
24
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
25
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
26
|
+
* transparent TTT test token uses 18 decimals.
|
|
27
|
+
*
|
|
20
28
|
* **`args.gasFee` MUST match the fee active for `deployer` at airdrop creation
|
|
21
29
|
* time** — custom fee if `getCustomFee(deployer).enabled`, otherwise
|
|
22
30
|
* `defaultGasFee`. The factory derives the target clone address from this
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { AirdropParams, CreateAirdropPreflightReport } from "../types.js";
|
|
4
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
5
|
+
export interface UsePreflightCreateAirdropArgs extends BaseHookOptions {
|
|
6
|
+
/** The airdrop parameters that will be passed to the create call. */
|
|
7
|
+
params?: AirdropParams;
|
|
8
|
+
/** The address that will send the create transaction (`msg.sender`). */
|
|
9
|
+
creator?: Address;
|
|
10
|
+
/**
|
|
11
|
+
* The `userSalt` planned for the create call. Optional — when supplied, the
|
|
12
|
+
* report also carries `predictedAirdrop` and `alreadyDeployed`.
|
|
13
|
+
*/
|
|
14
|
+
userSalt?: Hex;
|
|
15
|
+
/**
|
|
16
|
+
* Set `true` when the plan is `useCreateAndFundConfidentialAirdrop` — a
|
|
17
|
+
* missing factory-operator approval then becomes a blocker instead of
|
|
18
|
+
* informational `isFactoryOperator` state.
|
|
19
|
+
*/
|
|
20
|
+
funding?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Read-only preflight for `useCreateConfidentialAirdrop` /
|
|
24
|
+
* `useCreateAndFundConfidentialAirdrop` — wraps
|
|
25
|
+
* {@link ConfidentialAirdropFactoryClient.preflightCreateAirdrop} as a
|
|
26
|
+
* TanStack query.
|
|
27
|
+
*
|
|
28
|
+
* The report carries `isFactoryOperator`, `gasFee`, `predictedAirdrop`,
|
|
29
|
+
* `alreadyDeployed`, `ready`, `blockers` (human-readable strings) and
|
|
30
|
+
* `blockerErrors` (typed `TokenOpsSdkError`s, index-aligned with `blockers` —
|
|
31
|
+
* branch on `error.code`).
|
|
32
|
+
*
|
|
33
|
+
* Checks: structural `params` validation (non-zero token/admin, timestamp
|
|
34
|
+
* ordering, end time in the future), ERC-7984 operator approval of the
|
|
35
|
+
* factory on `params.token` (blocker only with `funding: true`), and — when
|
|
36
|
+
* `userSalt` is set — whether a clone already exists at the predicted CREATE2
|
|
37
|
+
* address. The creator's confidential token balance is NOT checked
|
|
38
|
+
* (encrypted; an underfunded create-and-fund silently moves an encrypted
|
|
39
|
+
* zero) — see the headless method's TSDoc.
|
|
40
|
+
*
|
|
41
|
+
* Hook is disabled until `params` and `creator` are both set. Refetch after
|
|
42
|
+
* the user calls `setOperator` (e.g. via `queryClient.invalidateQueries` or a
|
|
43
|
+
* `refetchInterval`).
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* const { data: report } = usePreflightCreateAirdrop({
|
|
47
|
+
* params, creator, userSalt, funding: true,
|
|
48
|
+
* });
|
|
49
|
+
* if (report?.ready) { /* enable submit *\/ }
|
|
50
|
+
*/
|
|
51
|
+
export declare function usePreflightCreateAirdrop(args?: UsePreflightCreateAirdropArgs): UseQueryResult<CreateAirdropPreflightReport, Error>;
|
|
@@ -16,7 +16,7 @@ export interface UseSignClaimAuthorizationOptions {
|
|
|
16
16
|
* Sign a `Claim(address recipient, bytes32 encryptedAmount)` EIP-712
|
|
17
17
|
* authorization. The signer (pulled from wagmi's `useWalletClient()`) must
|
|
18
18
|
* hold `DEFAULT_ADMIN_ROLE` on the airdrop clone for the produced signature
|
|
19
|
-
* to be accepted by {@link useClaim} / {@link
|
|
19
|
+
* to be accepted by {@link useClaim} / {@link useAccessClaimAmount}.
|
|
20
20
|
*
|
|
21
21
|
* Mutation throws {@link TokenOpsSdkError} if no wallet is connected.
|
|
22
22
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
import type { TokenOpsSdkError } from "../core/errors.js";
|
|
2
3
|
export type { EncryptedInput, EncryptedInputs, EncryptedViewResult } from "../fhe/types.js";
|
|
3
4
|
/**
|
|
4
5
|
* Parameters for creating a confidential airdrop.
|
|
@@ -19,3 +20,58 @@ export interface CustomFee {
|
|
|
19
20
|
enabled: boolean;
|
|
20
21
|
gasFee: bigint;
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Report returned by `ConfidentialAirdropFactoryClient.preflightCreateAirdrop`.
|
|
25
|
+
*
|
|
26
|
+
* Fields:
|
|
27
|
+
* - `isFactoryOperator` — `true` when the creator has approved the factory as
|
|
28
|
+
* an ERC-7984 operator on `params.token`. Only required when funding in the
|
|
29
|
+
* same transaction (`createAndFundConfidentialAirdrop` /
|
|
30
|
+
* `fundConfidentialAirdrop`).
|
|
31
|
+
*
|
|
32
|
+
* **`false` does not mean "not approved" on its own** — it is also `false`
|
|
33
|
+
* when approval could not be determined at all: the token address was
|
|
34
|
+
* structurally invalid (read skipped), or the address is not an ERC-7984
|
|
35
|
+
* token (read failed). Do not render an "approve the factory" prompt off
|
|
36
|
+
* this field alone; check `blockerErrors` for
|
|
37
|
+
* `TOKENOPS_OPERATOR_NOT_APPROVED` first, which is present only when the
|
|
38
|
+
* approval genuinely is the missing step.
|
|
39
|
+
* - `gasFee` — the per-claim gas fee (wei) the factory will embed into the
|
|
40
|
+
* clone for this creator: the creator's custom fee when one is enabled,
|
|
41
|
+
* otherwise `defaultGasFee`. This is the `gasFee` to use for address
|
|
42
|
+
* prediction and later `fundConfidentialAirdrop` calls.
|
|
43
|
+
* - `predictedAirdrop` — deterministic CREATE2 clone address for
|
|
44
|
+
* `(params, userSalt, creator, gasFee)`. `undefined` when `userSalt` was not
|
|
45
|
+
* supplied or the params were structurally invalid.
|
|
46
|
+
* - `alreadyDeployed` — `true` when bytecode already exists at
|
|
47
|
+
* `predictedAirdrop` (a repeat create with the same salt would revert).
|
|
48
|
+
* `undefined` when `predictedAirdrop` is `undefined`.
|
|
49
|
+
* - `ready` — `true` when no blockers were detected.
|
|
50
|
+
* - `blockers` — human-readable blocker descriptions. Empty when
|
|
51
|
+
* `ready === true`.
|
|
52
|
+
* - `blockerErrors` — the same blockers as typed `TokenOpsSdkError`s, index-
|
|
53
|
+
* aligned with `blockers`. Branch on `error.code` to render UI.
|
|
54
|
+
*/
|
|
55
|
+
export interface CreateAirdropPreflightReport {
|
|
56
|
+
/**
|
|
57
|
+
* `true` when the creator has approved the factory as operator on
|
|
58
|
+
* `params.token`. `false` also covers "could not determine" — an invalid or
|
|
59
|
+
* non-ERC-7984 token; branch on `blockerErrors` rather than this field alone.
|
|
60
|
+
*/
|
|
61
|
+
isFactoryOperator: boolean;
|
|
62
|
+
/** Per-claim gas fee (wei) the factory will embed into the clone for this creator. */
|
|
63
|
+
gasFee: bigint;
|
|
64
|
+
/** Predicted CREATE2 clone address. `undefined` without `userSalt` or with invalid params. */
|
|
65
|
+
predictedAirdrop?: Address;
|
|
66
|
+
/** `true` when bytecode already exists at `predictedAirdrop`. `undefined` when not predicted. */
|
|
67
|
+
alreadyDeployed?: boolean;
|
|
68
|
+
/** `true` when no blockers were detected — green light to submit the write. */
|
|
69
|
+
ready: boolean;
|
|
70
|
+
/** Human-readable blocker descriptions. Empty when `ready === true`. */
|
|
71
|
+
blockers: string[];
|
|
72
|
+
/**
|
|
73
|
+
* Typed errors that would otherwise surface at write time, index-aligned
|
|
74
|
+
* with `blockers`. Empty when `ready === true`.
|
|
75
|
+
*/
|
|
76
|
+
blockerErrors: TokenOpsSdkError[];
|
|
77
|
+
}
|
|
@@ -62,6 +62,14 @@ export interface EncryptUint64BatchArgs {
|
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Encrypt a single `uint64` value into an `externalEuint64` handle + KMS input proof.
|
|
65
|
+
*
|
|
66
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
67
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
68
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
69
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
70
|
+
* transparent TTT test token uses 18 decimals. `value` (and each entry of
|
|
71
|
+
* `values` in {@link encryptUint64Batch}) follows this convention when it
|
|
72
|
+
* encodes a token amount.
|
|
65
73
|
*/
|
|
66
74
|
export declare function encryptUint64({ encryptor, contractAddress, userAddress, value, }: EncryptUint64Args): Promise<EncryptedInput>;
|
|
67
75
|
/**
|
|
@@ -18,6 +18,61 @@ export declare class NotRegisteredError extends TokenOpsSdkError {
|
|
|
18
18
|
cause?: unknown;
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Wallet-mode disperse: the user's registered sub-wallet pair has not (fully)
|
|
23
|
+
* approved the singleton as an ERC-7984 operator on the token, so the
|
|
24
|
+
* singleton cannot move funds held by the sub-wallets. Surfaced by
|
|
25
|
+
* `preflightDisperse` in `wallet` / `wallet-token-fee` mode.
|
|
26
|
+
*
|
|
27
|
+
* Remediation: call `approveUserWalletsForToken(token)` on the singleton —
|
|
28
|
+
* the per-wallet approval states are in `context` (and mirrored on
|
|
29
|
+
* `PreflightReport.hasApprovedSubwallets`).
|
|
30
|
+
*/
|
|
31
|
+
export declare class SubwalletsNotApprovedError extends TokenOpsSdkError {
|
|
32
|
+
readonly name = "SubwalletsNotApprovedError";
|
|
33
|
+
readonly context: {
|
|
34
|
+
method: string;
|
|
35
|
+
contractAddress: Address;
|
|
36
|
+
user: Address;
|
|
37
|
+
token: Address;
|
|
38
|
+
wallet0Approved: boolean;
|
|
39
|
+
wallet1Approved: boolean;
|
|
40
|
+
};
|
|
41
|
+
constructor(args: {
|
|
42
|
+
method: string;
|
|
43
|
+
contractAddress: Address;
|
|
44
|
+
user: Address;
|
|
45
|
+
token: Address;
|
|
46
|
+
wallet0Approved: boolean;
|
|
47
|
+
wallet1Approved: boolean;
|
|
48
|
+
cause?: unknown;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Direct-mode disperse: the sender has not approved the singleton as an
|
|
53
|
+
* ERC-7984 operator on the token, so `disperseConfidentialTokenDirect` would
|
|
54
|
+
* revert with the raw `ERC7984UnauthorizedSpender` selector (`0x79f2cb38`).
|
|
55
|
+
* Surfaced by `preflightDisperse` in `direct` mode.
|
|
56
|
+
*
|
|
57
|
+
* Remediation: call `setOperator()` / `ensureOperator()` (exported from
|
|
58
|
+
* `@tokenops/sdk/fhe`) with the singleton address before dispersing.
|
|
59
|
+
*/
|
|
60
|
+
export declare class SingletonNotApprovedError extends TokenOpsSdkError {
|
|
61
|
+
readonly name = "SingletonNotApprovedError";
|
|
62
|
+
readonly context: {
|
|
63
|
+
method: string;
|
|
64
|
+
contractAddress: Address;
|
|
65
|
+
user: Address;
|
|
66
|
+
token: Address;
|
|
67
|
+
};
|
|
68
|
+
constructor(args: {
|
|
69
|
+
method: string;
|
|
70
|
+
contractAddress: Address;
|
|
71
|
+
user: Address;
|
|
72
|
+
token: Address;
|
|
73
|
+
cause?: unknown;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
21
76
|
/**
|
|
22
77
|
* The user has already registered — `register(token)` is single-use per user.
|
|
23
78
|
* Use `approveUserWalletsForToken(token)` to grant the existing wallet pair
|