@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
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { useWagmiAccount } from '../../chunk-FT4LNBOS.js';
|
|
2
|
+
import { createTestnetFaucetClient, isTestnetFaucetChainId } from '../../chunk-IJFQ5L4I.js';
|
|
3
|
+
export { FaucetSupplyExhaustedError } from '../../chunk-IJFQ5L4I.js';
|
|
4
|
+
import '../../chunk-SG65XWH7.js';
|
|
5
|
+
import { getConfidentialTestTokenAddress } from '../../chunk-XGGTQQFH.js';
|
|
6
|
+
import '../../chunk-ZA673I3O.js';
|
|
7
|
+
import '../../chunk-Q2GP5UDC.js';
|
|
8
|
+
import '../../chunk-KWFFIJYX.js';
|
|
9
|
+
import { MissingClientError, UnsupportedChainError, DeploymentAddressUnavailableError } from '../../chunk-QBJ7O2B4.js';
|
|
10
|
+
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, TokenOpsContractError, TokenOpsSdkError, TransferFailedError, UnknownWriteFailureError, UnsupportedChainError, UserDecryptNotAllowedError, UserRejectedSignatureError, WalletChainMismatchError, WalletRejectedError, isTokenOpsSdkError } from '../../chunk-QBJ7O2B4.js';
|
|
11
|
+
import { useQuery, useMutation } from '@tanstack/react-query';
|
|
12
|
+
import { useMemo } from 'react';
|
|
13
|
+
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
14
|
+
|
|
15
|
+
var TESTNET_FAUCET_KEY = "tokenops-sdk";
|
|
16
|
+
var TESTNET_FAUCET_NAMESPACE = "testnet-faucet";
|
|
17
|
+
function tryResolveSingletonAddress(override, chainId) {
|
|
18
|
+
if (chainId !== void 0 && !isTestnetFaucetChainId(chainId)) return void 0;
|
|
19
|
+
if (override) return override;
|
|
20
|
+
if (chainId === void 0) return void 0;
|
|
21
|
+
return getConfidentialTestTokenAddress(chainId);
|
|
22
|
+
}
|
|
23
|
+
function useMemoFaucetClient(opts = {}) {
|
|
24
|
+
const publicClient = usePublicClient({ chainId: opts.chainId });
|
|
25
|
+
const { data: walletClient } = useWalletClient({ chainId: opts.chainId });
|
|
26
|
+
const chainId = opts.chainId ?? publicClient?.chain?.id;
|
|
27
|
+
const resolvedAddress = tryResolveSingletonAddress(opts.address, chainId);
|
|
28
|
+
const resolutionError = computeSingletonResolutionError(opts.address, chainId);
|
|
29
|
+
const client = useMemo(() => {
|
|
30
|
+
if (!publicClient) return void 0;
|
|
31
|
+
if (!resolvedAddress) return void 0;
|
|
32
|
+
return createTestnetFaucetClient({
|
|
33
|
+
publicClient,
|
|
34
|
+
...walletClient ? { walletClient } : {},
|
|
35
|
+
...opts.address ? { address: resolvedAddress } : {},
|
|
36
|
+
...chainId !== void 0 ? { chainId } : {}
|
|
37
|
+
});
|
|
38
|
+
}, [publicClient, walletClient, resolvedAddress, chainId]);
|
|
39
|
+
return {
|
|
40
|
+
client,
|
|
41
|
+
resolutionError,
|
|
42
|
+
publicClient,
|
|
43
|
+
walletClient: walletClient ?? void 0,
|
|
44
|
+
chainId,
|
|
45
|
+
resolvedAddress
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function computeSingletonResolutionError(override, chainId) {
|
|
49
|
+
if (chainId !== void 0 && !isTestnetFaucetChainId(chainId)) {
|
|
50
|
+
return new UnsupportedChainError(chainId);
|
|
51
|
+
}
|
|
52
|
+
if (override) return void 0;
|
|
53
|
+
if (chainId === void 0) {
|
|
54
|
+
return new DeploymentAddressUnavailableError({
|
|
55
|
+
reason: "chain-id-missing",
|
|
56
|
+
product: "testnetFaucet",
|
|
57
|
+
contract: "confidentialTestToken",
|
|
58
|
+
clientLabel: "TestnetFaucetClient"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const resolved = getConfidentialTestTokenAddress(chainId);
|
|
62
|
+
if (!resolved) {
|
|
63
|
+
return new DeploymentAddressUnavailableError({
|
|
64
|
+
reason: "registry-not-deployed",
|
|
65
|
+
product: "testnetFaucet",
|
|
66
|
+
contract: "confidentialTestToken",
|
|
67
|
+
chainId,
|
|
68
|
+
clientLabel: "TestnetFaucetClient"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
73
|
+
function buildQueryKey(method, chainId, address, ...args) {
|
|
74
|
+
return [
|
|
75
|
+
TESTNET_FAUCET_KEY,
|
|
76
|
+
TESTNET_FAUCET_NAMESPACE,
|
|
77
|
+
method,
|
|
78
|
+
chainId ?? null,
|
|
79
|
+
address ? address.toLowerCase() : null,
|
|
80
|
+
...args.map(normalizeKeyArg)
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
function normalizeKeyArg(value) {
|
|
84
|
+
if (typeof value === "bigint") return value.toString();
|
|
85
|
+
if (Array.isArray(value)) return value.map(normalizeKeyArg);
|
|
86
|
+
if (value && typeof value === "object") {
|
|
87
|
+
return Object.fromEntries(
|
|
88
|
+
Object.entries(value).map(([k, v]) => [k, normalizeKeyArg(v)])
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
if (typeof value === "string" && value.startsWith("0x")) return value.toLowerCase();
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/testnet-faucet/react/useConfidentialBalance.ts
|
|
96
|
+
function useConfidentialBalance(args = {}) {
|
|
97
|
+
const { account, ...base } = args;
|
|
98
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(base);
|
|
99
|
+
const { address: connected } = useWagmiAccount();
|
|
100
|
+
const resolvedAccount = account ?? connected;
|
|
101
|
+
return useQuery({
|
|
102
|
+
queryKey: buildQueryKey("confidentialBalanceOf", chainId, resolvedAddress, resolvedAccount),
|
|
103
|
+
queryFn: () => client.confidentialBalanceOf(resolvedAccount),
|
|
104
|
+
enabled: !!client && !!resolvedAccount,
|
|
105
|
+
staleTime: 0
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
function useUnderlyingBalance(args = {}) {
|
|
109
|
+
const { account, ...base } = args;
|
|
110
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(base);
|
|
111
|
+
const { address: connected } = useWagmiAccount();
|
|
112
|
+
const resolvedAccount = account ?? connected;
|
|
113
|
+
return useQuery({
|
|
114
|
+
// The TTT is derived from the CTTT, which is already keyed via
|
|
115
|
+
// `resolvedAddress` — no separate underlying segment needed.
|
|
116
|
+
queryKey: buildQueryKey("underlyingBalanceOf", chainId, resolvedAddress, resolvedAccount),
|
|
117
|
+
queryFn: () => client.underlyingBalanceOf(resolvedAccount),
|
|
118
|
+
enabled: !!client && !!resolvedAccount,
|
|
119
|
+
staleTime: 0
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
function useFaucetRate(options = {}) {
|
|
123
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(options);
|
|
124
|
+
return useQuery({
|
|
125
|
+
queryKey: buildQueryKey("rate", chainId, resolvedAddress),
|
|
126
|
+
queryFn: () => client.rate(),
|
|
127
|
+
enabled: !!client,
|
|
128
|
+
// The conversion rate is fixed per deployment — never goes stale.
|
|
129
|
+
staleTime: Infinity
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function useFaucetDecimals(options = {}) {
|
|
133
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(options);
|
|
134
|
+
return useQuery({
|
|
135
|
+
queryKey: buildQueryKey("decimals", chainId, resolvedAddress),
|
|
136
|
+
queryFn: () => client.decimals(),
|
|
137
|
+
enabled: !!client,
|
|
138
|
+
// CTTT decimals are fixed per deployment — never goes stale.
|
|
139
|
+
staleTime: Infinity
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function useUnderlyingDecimals(options = {}) {
|
|
143
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(options);
|
|
144
|
+
return useQuery({
|
|
145
|
+
// The TTT is derived from the CTTT, which is already keyed via
|
|
146
|
+
// `resolvedAddress` — no separate underlying segment needed.
|
|
147
|
+
queryKey: buildQueryKey("underlyingDecimals", chainId, resolvedAddress),
|
|
148
|
+
queryFn: () => client.underlyingDecimals(),
|
|
149
|
+
enabled: !!client,
|
|
150
|
+
// TTT decimals are fixed per deployment — never goes stale.
|
|
151
|
+
staleTime: Infinity
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function useUnderlyingTokenAddress(options = {}) {
|
|
155
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(options);
|
|
156
|
+
return useQuery({
|
|
157
|
+
// The TTT is derived from the CTTT, which is already keyed via
|
|
158
|
+
// `resolvedAddress` — no separate underlying segment needed.
|
|
159
|
+
queryKey: buildQueryKey("underlyingToken", chainId, resolvedAddress),
|
|
160
|
+
queryFn: () => client.underlyingToken(),
|
|
161
|
+
enabled: !!client,
|
|
162
|
+
// The backing token address is fixed per deployment — never goes stale.
|
|
163
|
+
staleTime: Infinity
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function useInferredTotalSupply(options = {}) {
|
|
167
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(options);
|
|
168
|
+
return useQuery({
|
|
169
|
+
queryKey: buildQueryKey("inferredTotalSupply", chainId, resolvedAddress),
|
|
170
|
+
queryFn: () => client.inferredTotalSupply(),
|
|
171
|
+
enabled: !!client,
|
|
172
|
+
staleTime: 0
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function useMaxTotalSupply(options = {}) {
|
|
176
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(options);
|
|
177
|
+
return useQuery({
|
|
178
|
+
queryKey: buildQueryKey("maxTotalSupply", chainId, resolvedAddress),
|
|
179
|
+
queryFn: () => client.maxTotalSupply(),
|
|
180
|
+
enabled: !!client,
|
|
181
|
+
// `type(uint64).max` is fixed per deployment — never goes stale.
|
|
182
|
+
staleTime: Infinity
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
function useFaucetMetadata(options = {}) {
|
|
186
|
+
const { client, chainId, resolvedAddress } = useMemoFaucetClient(options);
|
|
187
|
+
return useQuery({
|
|
188
|
+
// The `underlying` half of the metadata is derived from the CTTT, which is
|
|
189
|
+
// already keyed via `resolvedAddress` — no separate underlying segment needed.
|
|
190
|
+
queryKey: buildQueryKey("getMetadata", chainId, resolvedAddress),
|
|
191
|
+
queryFn: () => client.getMetadata(),
|
|
192
|
+
enabled: !!client,
|
|
193
|
+
// name/symbol/decimals/rate/maxTotalSupply are all fixed per deployment.
|
|
194
|
+
staleTime: Infinity
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function useMintConfidential(options = {}) {
|
|
198
|
+
const { client, resolutionError } = useMemoFaucetClient(options);
|
|
199
|
+
return useMutation({
|
|
200
|
+
mutationFn: async (args) => {
|
|
201
|
+
if (!client) {
|
|
202
|
+
throw resolutionError ?? new MissingClientError("useMintConfidential", "testnet-faucet");
|
|
203
|
+
}
|
|
204
|
+
return client.mintConfidential(args);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function useMintUnderlying(options = {}) {
|
|
209
|
+
const { client, resolutionError } = useMemoFaucetClient(options);
|
|
210
|
+
return useMutation({
|
|
211
|
+
mutationFn: async (args) => {
|
|
212
|
+
if (!client) {
|
|
213
|
+
throw resolutionError ?? new MissingClientError("useMintUnderlying", "testnet-faucet");
|
|
214
|
+
}
|
|
215
|
+
return client.mintUnderlying(args);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export { TESTNET_FAUCET_KEY, TESTNET_FAUCET_NAMESPACE, useConfidentialBalance, useFaucetDecimals, useFaucetMetadata, useFaucetRate, useInferredTotalSupply, useMaxTotalSupply, useMintConfidential, useMintUnderlying, useUnderlyingBalance, useUnderlyingDecimals, useUnderlyingTokenAddress };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address, Hex } from "viem";
|
|
3
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
4
|
+
export interface UseConfidentialBalanceArgs extends BaseHookOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Account whose confidential balance handle to read. Defaults to the
|
|
7
|
+
* connected wallet (wagmi v2 `useAccount().address` / v3
|
|
8
|
+
* `useConnection().address`). The hook stays disabled until an account is
|
|
9
|
+
* available.
|
|
10
|
+
*/
|
|
11
|
+
account?: Address;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Read the encrypted confidential balance handle (`euint64` ciphertext) for
|
|
15
|
+
* `account` — defaults to the connected wallet.
|
|
16
|
+
*
|
|
17
|
+
* Returns the `bytes32` handle. The account holds persistent ACL on its own
|
|
18
|
+
* balance, so pass this handle — with the CTTT contract address and the
|
|
19
|
+
* account's signer — to the Zama relayer's `userDecrypt` to obtain the
|
|
20
|
+
* plaintext. The SDK is the producer side only.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const { data: handle } = useConfidentialBalance(); // my own balance handle
|
|
24
|
+
*/
|
|
25
|
+
export declare function useConfidentialBalance(args?: UseConfidentialBalanceArgs): UseQueryResult<Hex, Error>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* Read the decimals of the confidential token (CTTT) — `6`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const { data: decimals } = useFaucetDecimals(); // 6
|
|
8
|
+
*/
|
|
9
|
+
export declare function useFaucetDecimals(options?: BaseHookOptions): UseQueryResult<number, Error>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type FaucetMetadata } from "../types.js";
|
|
3
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Read consolidated faucet metadata in a single hook — both tokens'
|
|
6
|
+
* name/symbol/decimals/address, the conversion `rate`, and the
|
|
7
|
+
* `maxTotalSupply` ceiling. Handy for rendering a faucet panel without
|
|
8
|
+
* composing several reads.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const { data: meta } = useFaucetMetadata();
|
|
12
|
+
* // meta?.confidential.symbol, meta?.underlying.decimals, meta?.rate, ...
|
|
13
|
+
*/
|
|
14
|
+
export declare function useFaucetMetadata(options?: BaseHookOptions): UseQueryResult<FaucetMetadata, Error>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* Read the decimal-conversion `rate` between underlying and confidential units:
|
|
5
|
+
* `1` CTTT 6-decimal unit is backed by `rate` TTT 18-decimal base units
|
|
6
|
+
* (`10^(18-6) = 10^12`).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const { data: rate } = useFaucetRate(); // 1_000_000_000_000n
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFaucetRate(options?: BaseHookOptions): UseQueryResult<bigint, Error>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* Read the wrapper's inferred total supply: underlying held in custody divided
|
|
5
|
+
* by `rate`, an upper bound on the confidential total supply, in CTTT
|
|
6
|
+
* 6-decimal units.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const { data: supply } = useInferredTotalSupply();
|
|
10
|
+
*/
|
|
11
|
+
export declare function useInferredTotalSupply(options?: BaseHookOptions): UseQueryResult<bigint, Error>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* Read the max confidential total supply the wrapper supports
|
|
5
|
+
* (`type(uint64).max`).
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { data: max } = useMaxTotalSupply();
|
|
9
|
+
*/
|
|
10
|
+
export declare function useMaxTotalSupply(options?: BaseHookOptions): UseQueryResult<bigint, Error>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import { type MintConfidentialArgs, type MintConfidentialResult } from "../types.js";
|
|
3
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
4
|
+
/** Args for {@link useMintConfidential} — same shape as the headless `MintConfidentialArgs`. */
|
|
5
|
+
export type UseMintConfidentialArgs = MintConfidentialArgs;
|
|
6
|
+
/**
|
|
7
|
+
* Mint backed confidential test tokens (CTTT) to a recipient. Open and
|
|
8
|
+
* permissionless on testnet — anyone can mint any `uint64` amount, fully backed
|
|
9
|
+
* by freshly minted underlying TTT.
|
|
10
|
+
*
|
|
11
|
+
* The amount is PUBLIC (plaintext calldata + `ConfidentialMint` event); only
|
|
12
|
+
* the recipient's aggregated balance and later confidential transfers are
|
|
13
|
+
* private. Delegates 1:1 to {@link TestnetFaucetClient.mintConfidential} and
|
|
14
|
+
* returns its `MintConfidentialResult` (decoded from the `ConfidentialMint`
|
|
15
|
+
* event).
|
|
16
|
+
*
|
|
17
|
+
* Mutations do NOT auto-invalidate read queries — that's a consumer decision.
|
|
18
|
+
* After a successful mint, invalidate every faucet query for fresh balances:
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const queryClient = useQueryClient();
|
|
22
|
+
* const mint = useMintConfidential();
|
|
23
|
+
* mint.mutate({ amount: 1_000_000_000n }, {
|
|
24
|
+
* onSuccess: () => {
|
|
25
|
+
* queryClient.invalidateQueries({ queryKey: ["tokenops-sdk", "testnet-faucet"] });
|
|
26
|
+
* },
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* const mint = useMintConfidential();
|
|
32
|
+
* mint.mutate({ amount: 1_000_000_000n }); // 1,000 CTTT (6-decimal units)
|
|
33
|
+
* // mint.data → { hash, to, amount, underlyingMinted, handle }
|
|
34
|
+
*/
|
|
35
|
+
export declare function useMintConfidential(options?: BaseHookOptions): UseMutationResult<MintConfidentialResult, Error, UseMintConfidentialArgs>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
+
import { type MintUnderlyingArgs, type MintUnderlyingResult } from "../types.js";
|
|
3
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
4
|
+
/** Args for {@link useMintUnderlying} — same shape as the headless `MintUnderlyingArgs`. */
|
|
5
|
+
export type UseMintUnderlyingArgs = MintUnderlyingArgs;
|
|
6
|
+
/**
|
|
7
|
+
* Mint standard (non-confidential) ERC-20 test tokens (TTT) to a recipient.
|
|
8
|
+
* Open and permissionless on testnet. Use this when you want plain TTT — e.g.
|
|
9
|
+
* to then `approve` + `wrap` it into CTTT through the standard ERC-7984 flow.
|
|
10
|
+
*
|
|
11
|
+
* Delegates 1:1 to {@link TestnetFaucetClient.mintUnderlying}.
|
|
12
|
+
*
|
|
13
|
+
* Mutations do NOT auto-invalidate read queries. After a successful mint,
|
|
14
|
+
* invalidate every faucet query for fresh balances:
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* const queryClient = useQueryClient();
|
|
18
|
+
* const mint = useMintUnderlying();
|
|
19
|
+
* mint.mutate({ amount: 1_000_000_000_000_000_000_000n }, {
|
|
20
|
+
* onSuccess: () => {
|
|
21
|
+
* queryClient.invalidateQueries({ queryKey: ["tokenops-sdk", "testnet-faucet"] });
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const mint = useMintUnderlying();
|
|
28
|
+
* mint.mutate({ amount: 1_000_000_000_000_000_000_000n }); // 1,000 TTT (18-decimal units)
|
|
29
|
+
* // mint.data → { hash, to, amount }
|
|
30
|
+
*/
|
|
31
|
+
export declare function useMintUnderlying(options?: BaseHookOptions): UseMutationResult<MintUnderlyingResult, Error, UseMintUnderlyingArgs>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
4
|
+
export interface UseUnderlyingBalanceArgs extends BaseHookOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Account whose underlying TTT balance to read. Defaults to the connected
|
|
7
|
+
* wallet (wagmi v2 `useAccount().address` / v3 `useConnection().address`).
|
|
8
|
+
* The hook stays disabled until an account is available.
|
|
9
|
+
*/
|
|
10
|
+
account?: Address;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Read the plaintext underlying `TokenopsTestToken` (TTT) balance for
|
|
14
|
+
* `account` (defaults to the connected wallet), in TTT 18-decimal base units.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const { data: balance } = useUnderlyingBalance(); // my own TTT balance
|
|
18
|
+
*/
|
|
19
|
+
export declare function useUnderlyingBalance(args?: UseUnderlyingBalanceArgs): UseQueryResult<bigint, Error>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
3
|
+
/**
|
|
4
|
+
* Read the decimals of the underlying token (TTT) — `18`.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const { data: decimals } = useUnderlyingDecimals(); // 18
|
|
8
|
+
*/
|
|
9
|
+
export declare function useUnderlyingDecimals(options?: BaseHookOptions): UseQueryResult<number, Error>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import { type BaseHookOptions } from "./_shared.js";
|
|
4
|
+
/**
|
|
5
|
+
* Read the underlying `TokenopsTestToken` (TTT) address backing the CTTT
|
|
6
|
+
* wrapper. Resolution order inside the client: registry → the wrapper's own
|
|
7
|
+
* `underlying()` getter.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const { data: tttAddress } = useUnderlyingTokenAddress();
|
|
11
|
+
*/
|
|
12
|
+
export declare function useUnderlyingTokenAddress(options?: BaseHookOptions): UseQueryResult<Address, Error>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Account, Address } from "viem";
|
|
2
|
+
import type { EncryptedHandle, TxHash } from "../core/brands.js";
|
|
3
|
+
/**
|
|
4
|
+
* Arguments for {@link TestnetFaucetClient.mintConfidential} — the open,
|
|
5
|
+
* fully-backed faucet mint on `ConfidentialTokenopsTestToken` (CTTT).
|
|
6
|
+
*/
|
|
7
|
+
export interface MintConfidentialArgs {
|
|
8
|
+
/**
|
|
9
|
+
* Recipient of the confidential balance. Defaults to the signing account
|
|
10
|
+
* (`account` override, else the wallet's account).
|
|
11
|
+
*/
|
|
12
|
+
to?: Address;
|
|
13
|
+
/**
|
|
14
|
+
* Amount to mint, in CTTT's **6-decimal** units (a `uint64`).
|
|
15
|
+
*
|
|
16
|
+
* NOTE: this amount is PUBLIC — it is passed as plaintext calldata, emitted
|
|
17
|
+
* in the `ConfidentialMint` event, and wrapped via a trivial (non-secret)
|
|
18
|
+
* encryption. Only the recipient's *aggregated* balance and subsequent
|
|
19
|
+
* confidential transfers are private; the per-mint amount is not.
|
|
20
|
+
*/
|
|
21
|
+
amount: bigint;
|
|
22
|
+
/** Signer override. Accepts a viem `Account` object or an `Address` string. */
|
|
23
|
+
account?: Account | Address;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Result of {@link TestnetFaucetClient.mintConfidential}, decoded from the
|
|
27
|
+
* `ConfidentialMint` event in the transaction receipt.
|
|
28
|
+
*/
|
|
29
|
+
export interface MintConfidentialResult {
|
|
30
|
+
/** Transaction hash of the mint. */
|
|
31
|
+
hash: TxHash;
|
|
32
|
+
/** Recipient credited with the confidential balance. */
|
|
33
|
+
to: Address;
|
|
34
|
+
/** Plaintext amount minted, in CTTT 6-decimal units (echoed — the faucet mint amount is public). */
|
|
35
|
+
amount: bigint;
|
|
36
|
+
/** Underlying TTT minted into the wrapper as 1:1 backing (= `amount * rate`, in TTT 18-decimal base units). */
|
|
37
|
+
underlyingMinted: bigint;
|
|
38
|
+
/**
|
|
39
|
+
* The minted ciphertext handle from the `ConfidentialMint` event. Informational —
|
|
40
|
+
* the recipient holds persistent ACL on their *balance*, which you read via
|
|
41
|
+
* {@link TestnetFaucetClient.confidentialBalanceOf} and pass to the Zama
|
|
42
|
+
* relayer's `userDecrypt`. The caller only receives transient ACL on this
|
|
43
|
+
* handle (valid within the mint tx), so it is not itself user-decryptable
|
|
44
|
+
* afterwards.
|
|
45
|
+
*/
|
|
46
|
+
handle: EncryptedHandle;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Arguments for {@link TestnetFaucetClient.mintUnderlying} — the open mint on
|
|
50
|
+
* the standard ERC-20 `TokenopsTestToken` (TTT).
|
|
51
|
+
*/
|
|
52
|
+
export interface MintUnderlyingArgs {
|
|
53
|
+
/** Recipient of the TTT. Defaults to the signing account. */
|
|
54
|
+
to?: Address;
|
|
55
|
+
/** Amount to mint, in TTT's **18-decimal** base units (a `uint256`). */
|
|
56
|
+
amount: bigint;
|
|
57
|
+
/** Signer override. */
|
|
58
|
+
account?: Account | Address;
|
|
59
|
+
}
|
|
60
|
+
/** Result of {@link TestnetFaucetClient.mintUnderlying}. */
|
|
61
|
+
export interface MintUnderlyingResult {
|
|
62
|
+
/** Transaction hash of the mint. */
|
|
63
|
+
hash: TxHash;
|
|
64
|
+
/** Recipient credited with the TTT. */
|
|
65
|
+
to: Address;
|
|
66
|
+
/** Plaintext amount minted, in TTT 18-decimal base units. */
|
|
67
|
+
amount: bigint;
|
|
68
|
+
}
|
|
69
|
+
/** Static metadata for one side of the faucet token pair. */
|
|
70
|
+
export interface FaucetTokenMetadata {
|
|
71
|
+
address: Address;
|
|
72
|
+
name: string;
|
|
73
|
+
symbol: string;
|
|
74
|
+
decimals: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Consolidated faucet metadata — both tokens, the wrapper `rate`, and the
|
|
78
|
+
* `maxTotalSupply` ceiling. One convenience read for UI surfaces.
|
|
79
|
+
*/
|
|
80
|
+
export interface FaucetMetadata {
|
|
81
|
+
/** The confidential ERC-7984 wrapper (CTTT). */
|
|
82
|
+
confidential: FaucetTokenMetadata;
|
|
83
|
+
/** The underlying ERC-20 (TTT). */
|
|
84
|
+
underlying: FaucetTokenMetadata;
|
|
85
|
+
/**
|
|
86
|
+
* Decimal-conversion rate between underlying and confidential units:
|
|
87
|
+
* `1` CTTT unit is backed by `rate` TTT base units (`10^(18-6) = 10^12`).
|
|
88
|
+
*/
|
|
89
|
+
rate: bigint;
|
|
90
|
+
/** Max confidential total supply the wrapper supports (`type(uint64).max`). */
|
|
91
|
+
maxTotalSupply: bigint;
|
|
92
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Chain ids on which the testnet faucet is allowed to operate.
|
|
4
|
+
*
|
|
5
|
+
* The faucet mints **value-less** test tokens to anyone, so it must never be
|
|
6
|
+
* usable on a value-bearing network. We allow Sepolia (the canonical public
|
|
7
|
+
* testnet deployment) and the local Anvil/Hardhat dev chain id `31337` (used
|
|
8
|
+
* by the SDK's own FHEVM test fixtures, which deploy the token pair at test
|
|
9
|
+
* time). Every other chain — mainnet above all — is rejected at construction.
|
|
10
|
+
*/
|
|
11
|
+
export declare const TESTNET_FAUCET_SUPPORTED_CHAIN_IDS: readonly [11155111, 31337];
|
|
12
|
+
/** `true` when `chainId` is a chain the faucet is permitted to run on. */
|
|
13
|
+
export declare function isTestnetFaucetChainId(chainId: number): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Hard testnet-only guard. Throws {@link UnsupportedChainError} when `chainId`
|
|
16
|
+
* is a known non-testnet chain (mainnet, or anything outside
|
|
17
|
+
* {@link TESTNET_FAUCET_SUPPORTED_CHAIN_IDS}).
|
|
18
|
+
*
|
|
19
|
+
* A `undefined` chain id is intentionally NOT rejected here — the client can
|
|
20
|
+
* still be constructed with an explicit `address` override on an
|
|
21
|
+
* unknown-chain `publicClient`, and address resolution raises the precise
|
|
22
|
+
* `DeploymentAddressUnavailableError("chain-id-missing")` when no override is
|
|
23
|
+
* present. The guard's job is to slam the door on mainnet, not to second-guess
|
|
24
|
+
* a deliberate local override.
|
|
25
|
+
*/
|
|
26
|
+
export declare function assertTestnetFaucetChain(chainId: number | undefined): void;
|
|
27
|
+
/**
|
|
28
|
+
* Assert that `value` fits the confidential faucet's `uint64` amount domain.
|
|
29
|
+
* CTTT balances are `euint64`, so `mint(to, amount)` takes a `uint64`. Amounts
|
|
30
|
+
* are denominated in CTTT's 6-decimal units.
|
|
31
|
+
*/
|
|
32
|
+
export declare function assertUint64Amount(value: bigint, argument: string, method: string): void;
|
|
33
|
+
/**
|
|
34
|
+
* Assert that `value` fits the underlying ERC-20's `uint256` amount domain.
|
|
35
|
+
* TTT amounts are denominated in 18-decimal base units.
|
|
36
|
+
*/
|
|
37
|
+
export declare function assertUint256Amount(value: bigint, argument: string, method: string): void;
|
|
38
|
+
/**
|
|
39
|
+
* Normalise an address to EIP-55 checksum form, rejecting the zero address.
|
|
40
|
+
* Faucet recipients (`to`) must be a real account — the contracts revert with
|
|
41
|
+
* `ERC7984InvalidReceiver` / `ERC20InvalidReceiver` on the zero address, but
|
|
42
|
+
* catching it here gives a clearer, pre-flight `InvalidArgumentError`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function assertNonZeroRecipient(input: Address, argument: string, method: string): Address;
|