@tokenops/sdk 1.0.0 → 1.5.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/README.md +120 -26
- package/dist/{chunk-5SGMJADP.cjs → chunk-2NCLOQ56.cjs} +9 -9
- package/dist/{chunk-QIHZVLIK.js → chunk-2PWNH3UE.js} +35 -6
- package/dist/{chunk-T5LVV3KY.cjs → chunk-4WPGQSNT.cjs} +3 -3
- package/dist/{chunk-SUOG3BQS.cjs → chunk-5X5WL5CU.cjs} +266 -103
- package/dist/{chunk-56UI7LUR.cjs → chunk-67OV5CX2.cjs} +19 -0
- package/dist/{chunk-WRCUDSUJ.js → chunk-6BMP4ICG.js} +2 -2
- package/dist/{chunk-XXXDQSHE.js → chunk-6R4KNAPK.js} +5 -3
- package/dist/{chunk-XSNLAS5M.js → chunk-AOP6HMPW.js} +1 -1
- package/dist/{chunk-62DF53UQ.cjs → chunk-C7BRZXJA.cjs} +19 -21
- package/dist/{chunk-UOG4PJL5.js → chunk-DUZIIRPF.js} +181 -14
- package/dist/{chunk-Q7ARQSUH.cjs → chunk-FAXIIH5R.cjs} +3 -3
- package/dist/chunk-FT4LNBOS.js +11 -0
- package/dist/chunk-IJFQ5L4I.js +2171 -0
- package/dist/{chunk-52TC6BF7.js → chunk-IXLO7GO5.js} +210 -47
- package/dist/{chunk-CQIPRNS7.cjs → chunk-JK4XMMKM.cjs} +3 -3
- package/dist/{chunk-ITQ7WKVC.cjs → chunk-JYOTGRSO.cjs} +8 -8
- package/dist/{chunk-VDXVNZCO.cjs → chunk-KLKI352M.cjs} +85 -29
- package/dist/{chunk-5SA2HF2W.cjs → chunk-MCRBVJGZ.cjs} +24 -22
- package/dist/{chunk-ECT3NL2L.js → chunk-NTZY6IB7.js} +4 -4
- package/dist/{chunk-ZHFLRKFY.js → chunk-ODLTEGHB.js} +1 -1
- package/dist/{chunk-HGXNRR25.js → chunk-ORFTDNFZ.js} +4 -4
- package/dist/{chunk-72YGZEQE.js → chunk-OXTLPTO3.js} +9 -11
- package/dist/{chunk-HTOMTEA3.cjs → chunk-PFXURMBZ.cjs} +77 -48
- package/dist/{chunk-OLDGMKW2.cjs → chunk-PUPKNW3R.cjs} +35 -2
- package/dist/{chunk-IVE3QEGD.js → chunk-QBJ7O2B4.js} +18 -1
- package/dist/{chunk-JFLEEXKP.js → chunk-SG65XWH7.js} +58 -2
- package/dist/{chunk-K6MFFDBJ.cjs → chunk-T46YXSBP.cjs} +11 -11
- package/dist/{chunk-NS44KBV5.cjs → chunk-TEBM66WA.cjs} +12 -12
- package/dist/{chunk-6ECAHP5O.cjs → chunk-TIUKIY5V.cjs} +200 -33
- package/dist/{chunk-QCA7O2Q5.cjs → chunk-V2PXZVBF.cjs} +4 -4
- package/dist/{chunk-JFR5J4FL.cjs → chunk-W7IGCOVL.cjs} +11 -11
- package/dist/chunk-WENHUPZC.cjs +2180 -0
- package/dist/{chunk-ZXCOJY2Z.js → chunk-WMACINXO.js} +1 -1
- package/dist/{chunk-COPFW5Z4.js → chunk-XGGTQQFH.js} +31 -2
- package/dist/{chunk-CMRETRZO.js → chunk-YQIBBEFJ.js} +1 -1
- package/dist/{chunk-BE2AIZ3K.js → chunk-ZA673I3O.js} +1 -1
- package/dist/chunk-ZQUE2B3Q.cjs +33 -0
- package/dist/{chunk-FYQ2UW4T.js → chunk-ZWXJTBZO.js} +1 -1
- package/dist/core/addresses.d.ts +22 -0
- package/dist/core/errors.d.ts +41 -1
- package/dist/core/revert-mapper.d.ts +77 -0
- package/dist/core/telemetry.d.ts +0 -3
- package/dist/core/wagmi-compat.d.ts +40 -0
- package/dist/fhe/index.cjs +112 -66
- package/dist/fhe/index.d.cts +1 -1
- package/dist/fhe/index.d.ts +1 -1
- package/dist/fhe/index.js +50 -8
- package/dist/fhe/operators.d.ts +1 -1
- package/dist/fhe/react/index.cjs +7 -7
- package/dist/fhe/react/index.js +2 -2
- package/dist/fhe/sepolia-encryptor-web.d.ts +27 -1
- package/dist/fhe/sepolia-encryptor.d.ts +38 -0
- package/dist/fhe-airdrop/advanced/factory-advanced.d.ts +3 -3
- package/dist/fhe-airdrop/advanced/index.cjs +9 -8
- package/dist/fhe-airdrop/advanced/index.d.cts +2 -2
- package/dist/fhe-airdrop/advanced/index.d.ts +2 -2
- package/dist/fhe-airdrop/advanced/index.js +7 -6
- package/dist/fhe-airdrop/advanced/react/index.cjs +14 -13
- package/dist/fhe-airdrop/advanced/react/index.d.cts +1 -1
- package/dist/fhe-airdrop/advanced/react/index.d.ts +1 -1
- package/dist/fhe-airdrop/advanced/react/index.js +10 -9
- package/dist/fhe-airdrop/airdrop.d.ts +2 -0
- package/dist/fhe-airdrop/encryption.d.ts +8 -0
- package/dist/fhe-airdrop/factory.d.ts +94 -11
- package/dist/fhe-airdrop/index.cjs +61 -57
- 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 -7
- package/dist/fhe-airdrop/react/index.cjs +163 -133
- package/dist/fhe-airdrop/react/index.d.cts +4 -3
- package/dist/fhe-airdrop/react/index.d.ts +4 -3
- package/dist/fhe-airdrop/react/index.js +38 -13
- package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +2 -0
- package/dist/fhe-airdrop/react/useAirdropIsSignatureValid.d.ts +3 -2
- package/dist/fhe-airdrop/react/useClaim.d.ts +2 -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/types.d.ts +45 -0
- package/dist/fhe-disperse/encryption.d.ts +8 -0
- package/dist/fhe-disperse/index.cjs +69 -65
- package/dist/fhe-disperse/index.d.cts +1 -1
- package/dist/fhe-disperse/index.d.ts +1 -1
- package/dist/fhe-disperse/index.js +8 -8
- package/dist/fhe-disperse/react/index.cjs +90 -86
- package/dist/fhe-disperse/react/index.d.cts +1 -1
- package/dist/fhe-disperse/react/index.d.ts +1 -1
- package/dist/fhe-disperse/react/index.js +10 -10
- 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 +8 -2
- 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/factory-advanced.d.ts +2 -2
- package/dist/fhe-vesting/advanced/index.cjs +8 -8
- package/dist/fhe-vesting/advanced/index.d.cts +2 -2
- package/dist/fhe-vesting/advanced/index.d.ts +2 -2
- package/dist/fhe-vesting/advanced/index.js +6 -6
- package/dist/fhe-vesting/advanced/react/index.cjs +15 -14
- package/dist/fhe-vesting/advanced/react/index.d.cts +1 -1
- package/dist/fhe-vesting/advanced/react/index.d.ts +1 -1
- package/dist/fhe-vesting/advanced/react/index.js +12 -11
- package/dist/fhe-vesting/encryption.d.ts +8 -0
- package/dist/fhe-vesting/factory.d.ts +6 -8
- package/dist/fhe-vesting/index.cjs +79 -75
- 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 -9
- package/dist/fhe-vesting/manager.d.ts +101 -3
- package/dist/fhe-vesting/react/index.cjs +241 -219
- package/dist/fhe-vesting/react/index.d.cts +3 -2
- package/dist/fhe-vesting/react/index.d.ts +3 -2
- package/dist/fhe-vesting/react/index.js +29 -12
- package/dist/fhe-vesting/react/useAdminClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useBatchCreateVesting.d.ts +8 -0
- package/dist/fhe-vesting/react/useClaim.d.ts +2 -0
- package/dist/fhe-vesting/react/useCreateVesting.d.ts +8 -0
- package/dist/fhe-vesting/react/useManagerWithdrawTokenFee.d.ts +7 -1
- package/dist/fhe-vesting/react/usePartialClaim.d.ts +8 -0
- 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/useWithdrawAdmin.d.ts +6 -0
- package/dist/fhe-vesting/react/useWithdrawTokenFee.d.ts +6 -0
- package/dist/fhe-vesting/types.d.ts +34 -2
- package/dist/index.cjs +73 -49
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/testnet-faucet/abis/confidential-test-token.d.ts +1039 -0
- package/dist/testnet-faucet/abis/index.d.ts +2 -0
- package/dist/testnet-faucet/abis/test-token.d.ts +253 -0
- package/dist/testnet-faucet/errors.d.ts +21 -0
- package/dist/testnet-faucet/faucet.d.ts +173 -0
- package/dist/testnet-faucet/index.cjs +212 -0
- package/dist/testnet-faucet/index.d.cts +8 -0
- package/dist/testnet-faucet/index.d.ts +8 -0
- package/dist/testnet-faucet/index.js +7 -0
- package/dist/testnet-faucet/react/_shared.d.ts +61 -0
- package/dist/testnet-faucet/react/index.cjs +384 -0
- package/dist/testnet-faucet/react/index.d.cts +39 -0
- package/dist/testnet-faucet/react/index.d.ts +39 -0
- package/dist/testnet-faucet/react/index.js +220 -0
- package/dist/testnet-faucet/react/useConfidentialBalance.d.ts +25 -0
- package/dist/testnet-faucet/react/useFaucetDecimals.d.ts +9 -0
- package/dist/testnet-faucet/react/useFaucetMetadata.d.ts +14 -0
- package/dist/testnet-faucet/react/useFaucetRate.d.ts +11 -0
- package/dist/testnet-faucet/react/useInferredTotalSupply.d.ts +11 -0
- package/dist/testnet-faucet/react/useMaxTotalSupply.d.ts +10 -0
- package/dist/testnet-faucet/react/useMintConfidential.d.ts +35 -0
- package/dist/testnet-faucet/react/useMintUnderlying.d.ts +31 -0
- package/dist/testnet-faucet/react/useUnderlyingBalance.d.ts +19 -0
- package/dist/testnet-faucet/react/useUnderlyingDecimals.d.ts +9 -0
- package/dist/testnet-faucet/react/useUnderlyingTokenAddress.d.ts +12 -0
- package/dist/testnet-faucet/types.d.ts +92 -0
- package/dist/testnet-faucet/validate.d.ts +44 -0
- package/package.json +79 -30
|
@@ -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";
|
|
@@ -82,9 +83,9 @@ 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";
|
|
@@ -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";
|
|
@@ -82,9 +83,9 @@ 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";
|
|
@@ -1,17 +1,19 @@
|
|
|
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
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
1
|
+
import { useMemoFactoryClient, buildQueryKey, useMemoAirdropClient } from '../../chunk-ORFTDNFZ.js';
|
|
2
|
+
export { AlreadyClaimedError, ClaimNotStartedError, ClaimWindowClosedError } from '../../chunk-6R4KNAPK.js';
|
|
3
|
+
import { signClaimAuthorization } from '../../chunk-DUZIIRPF.js';
|
|
4
|
+
export { encryptUint64, encryptUint64Batch, resolveEncryptor, signClaimAuthorization } from '../../chunk-DUZIIRPF.js';
|
|
5
|
+
import { useWagmiAccount } from '../../chunk-FT4LNBOS.js';
|
|
6
|
+
import '../../chunk-ZWXJTBZO.js';
|
|
7
|
+
import '../../chunk-7VELUOMI.js';
|
|
8
|
+
import '../../chunk-SG65XWH7.js';
|
|
9
|
+
import '../../chunk-XGGTQQFH.js';
|
|
10
|
+
import '../../chunk-ZA673I3O.js';
|
|
9
11
|
import '../../chunk-Q2GP5UDC.js';
|
|
10
12
|
import '../../chunk-KWFFIJYX.js';
|
|
11
|
-
import { MissingClientError, MissingWalletClientError } from '../../chunk-
|
|
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-
|
|
13
|
+
import { MissingClientError, MissingWalletClientError } from '../../chunk-QBJ7O2B4.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-QBJ7O2B4.js';
|
|
13
15
|
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
14
|
-
import {
|
|
16
|
+
import { useWalletClient } from 'wagmi';
|
|
15
17
|
|
|
16
18
|
function useConfidentialAirdropFactoryImplementation(options = {}) {
|
|
17
19
|
const { client, chainId, resolvedAddress } = useMemoFactoryClient(options);
|
|
@@ -60,6 +62,29 @@ function useFactoryInitCodeHash(args = {}) {
|
|
|
60
62
|
staleTime: 0
|
|
61
63
|
});
|
|
62
64
|
}
|
|
65
|
+
function usePreflightCreateAirdrop(args = {}) {
|
|
66
|
+
const { params, creator, userSalt, funding, ...base } = args;
|
|
67
|
+
const { client, chainId, resolvedAddress } = useMemoFactoryClient(base);
|
|
68
|
+
return useQuery({
|
|
69
|
+
queryKey: buildQueryKey(
|
|
70
|
+
"factory:preflightCreateAirdrop",
|
|
71
|
+
chainId,
|
|
72
|
+
resolvedAddress,
|
|
73
|
+
creator,
|
|
74
|
+
params,
|
|
75
|
+
userSalt,
|
|
76
|
+
funding
|
|
77
|
+
),
|
|
78
|
+
queryFn: () => client.preflightCreateAirdrop({
|
|
79
|
+
params,
|
|
80
|
+
creator,
|
|
81
|
+
...userSalt !== void 0 ? { userSalt } : {},
|
|
82
|
+
...funding !== void 0 ? { funding } : {}
|
|
83
|
+
}),
|
|
84
|
+
enabled: !!client && !!params && !!creator,
|
|
85
|
+
staleTime: 0
|
|
86
|
+
});
|
|
87
|
+
}
|
|
63
88
|
function useCreateConfidentialAirdropAndGetAddress(options = {}) {
|
|
64
89
|
const { client, resolutionError } = useMemoFactoryClient(options);
|
|
65
90
|
return useMutation({
|
|
@@ -290,7 +315,7 @@ function useAirdropIsSignatureClaimed(args) {
|
|
|
290
315
|
function useAirdropIsSignatureValid(args) {
|
|
291
316
|
const { encryptedAmountHandle, signature, caller, ...base } = args;
|
|
292
317
|
const { client, chainId } = useMemoAirdropClient(base);
|
|
293
|
-
const { address: connectedAddress } =
|
|
318
|
+
const { address: connectedAddress } = useWagmiAccount();
|
|
294
319
|
const resolvedCaller = caller ?? connectedAddress;
|
|
295
320
|
return useQuery({
|
|
296
321
|
queryKey: buildQueryKey(
|
|
@@ -427,4 +452,4 @@ function useSignClaimAuthorization(options = {}) {
|
|
|
427
452
|
});
|
|
428
453
|
}
|
|
429
454
|
|
|
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 };
|
|
455
|
+
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, usePreflightCreateAirdrop, useSetCustomFee, useSetDefaultGasFee, useSetFeeCollector, useSetPaused, useSignClaimAuthorization, useWithdraw, useWithdrawOtherConfidentialToken, useWithdrawOtherToken };
|
|
@@ -18,6 +18,8 @@ import { type AirdropHookOptions } from "./_shared.js";
|
|
|
18
18
|
* `useAirdropIsSignatureClaimed({ user, encryptedAmountHandle })` and any
|
|
19
19
|
* UI counts you computed off it.
|
|
20
20
|
*
|
|
21
|
+
* **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.
|
|
22
|
+
*
|
|
21
23
|
* @example
|
|
22
24
|
* const claim = useAirdropClaim({ address: airdropAddress, encryptor: () => useZamaSDK().relayer });
|
|
23
25
|
* claim.mutate({ amount: 1_000_000n, signature });
|
|
@@ -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,8 @@ 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
|
+
*
|
|
25
27
|
* @example
|
|
26
28
|
* const claim = useClaim({ address: airdropAddress });
|
|
27
29
|
* 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>;
|
|
@@ -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,47 @@ 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`); `false` also when the token address was
|
|
31
|
+
* structurally invalid and the read was skipped.
|
|
32
|
+
* - `gasFee` — the per-claim gas fee (wei) the factory will embed into the
|
|
33
|
+
* clone for this creator: the creator's custom fee when one is enabled,
|
|
34
|
+
* otherwise `defaultGasFee`. This is the `gasFee` to use for address
|
|
35
|
+
* prediction and later `fundConfidentialAirdrop` calls.
|
|
36
|
+
* - `predictedAirdrop` — deterministic CREATE2 clone address for
|
|
37
|
+
* `(params, userSalt, creator, gasFee)`. `undefined` when `userSalt` was not
|
|
38
|
+
* supplied or the params were structurally invalid.
|
|
39
|
+
* - `alreadyDeployed` — `true` when bytecode already exists at
|
|
40
|
+
* `predictedAirdrop` (a repeat create with the same salt would revert).
|
|
41
|
+
* `undefined` when `predictedAirdrop` is `undefined`.
|
|
42
|
+
* - `ready` — `true` when no blockers were detected.
|
|
43
|
+
* - `blockers` — human-readable blocker descriptions. Empty when
|
|
44
|
+
* `ready === true`.
|
|
45
|
+
* - `blockerErrors` — the same blockers as typed `TokenOpsSdkError`s, index-
|
|
46
|
+
* aligned with `blockers`. Branch on `error.code` to render UI.
|
|
47
|
+
*/
|
|
48
|
+
export interface CreateAirdropPreflightReport {
|
|
49
|
+
/** `true` when the creator has approved the factory as operator on `params.token`. */
|
|
50
|
+
isFactoryOperator: boolean;
|
|
51
|
+
/** Per-claim gas fee (wei) the factory will embed into the clone for this creator. */
|
|
52
|
+
gasFee: bigint;
|
|
53
|
+
/** Predicted CREATE2 clone address. `undefined` without `userSalt` or with invalid params. */
|
|
54
|
+
predictedAirdrop?: Address;
|
|
55
|
+
/** `true` when bytecode already exists at `predictedAirdrop`. `undefined` when not predicted. */
|
|
56
|
+
alreadyDeployed?: boolean;
|
|
57
|
+
/** `true` when no blockers were detected — green light to submit the write. */
|
|
58
|
+
ready: boolean;
|
|
59
|
+
/** Human-readable blocker descriptions. Empty when `ready === true`. */
|
|
60
|
+
blockers: string[];
|
|
61
|
+
/**
|
|
62
|
+
* Typed errors that would otherwise surface at write time, index-aligned
|
|
63
|
+
* with `blockers`. Empty when `ready === true`.
|
|
64
|
+
*/
|
|
65
|
+
blockerErrors: TokenOpsSdkError[];
|
|
66
|
+
}
|
|
@@ -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
|
/**
|