@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
|
@@ -5,6 +5,24 @@ import type { Encryptor } from "../fhe-vesting/encryption.js";
|
|
|
5
5
|
export declare const SEPOLIA_CHAIN_ID: 11155111;
|
|
6
6
|
/** Mainnet chain id (`1`). Same use as {@link SEPOLIA_CHAIN_ID}. */
|
|
7
7
|
export declare const MAINNET_CHAIN_ID: 1;
|
|
8
|
+
/**
|
|
9
|
+
* Lifecycle phase reported by the `onPhase` callback of
|
|
10
|
+
* {@link createSepoliaEncryptor} / `createSepoliaEncryptorWeb`.
|
|
11
|
+
*
|
|
12
|
+
* - `"initializing"` — the helper started constructing the underlying Zama
|
|
13
|
+
* relayer instance (module resolution + constructor; cheap and local).
|
|
14
|
+
* - `"downloading-params"` — the relayer's real lazy initialization began:
|
|
15
|
+
* worker bring-up plus fetching the FHE public key and public params
|
|
16
|
+
* (several MB on a cold cache; near-instant when served from cache).
|
|
17
|
+
* - `"ready"` — initialization completed; subsequent encrypts skip the
|
|
18
|
+
* download entirely.
|
|
19
|
+
*
|
|
20
|
+
* Phases carry **no** percentages, byte counts, or time estimates — neither
|
|
21
|
+
* `@zama-fhe/sdk@3` nor the underlying relayer SDK exposes any
|
|
22
|
+
* download-progress API, so anything finer-grained would be fabricated.
|
|
23
|
+
* If upstream later exposes real progress this union will widen.
|
|
24
|
+
*/
|
|
25
|
+
export type EncryptorInitPhase = "initializing" | "downloading-params" | "ready";
|
|
8
26
|
/** Subset of `@zama-fhe/sdk/node`'s `GenericLogger` we accept. Mirrored
|
|
9
27
|
* structurally so consumers don't need to import the optional peer dep just
|
|
10
28
|
* to type-narrow a logger arg. */
|
|
@@ -69,6 +87,26 @@ export interface CreateSepoliaEncryptorOptions {
|
|
|
69
87
|
* that want to exercise the fetch path).
|
|
70
88
|
*/
|
|
71
89
|
fheArtifactCacheTTL?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Observe the encryptor's initialization lifecycle (see
|
|
92
|
+
* {@link EncryptorInitPhase}). `RelayerNode` initializes its worker pool
|
|
93
|
+
* lazily and exposes no status events, so the phases bracket the first
|
|
94
|
+
* operation that triggers the real init:
|
|
95
|
+
*
|
|
96
|
+
* - `"initializing"` fires when this helper starts (module load +
|
|
97
|
+
* `RelayerNode` construction).
|
|
98
|
+
* - `"downloading-params"` fires immediately before the first `encrypt`
|
|
99
|
+
* call, which is what actually spawns the worker pool and fetches the
|
|
100
|
+
* FHE public key + params.
|
|
101
|
+
* - `"ready"` fires once that first `encrypt` resolves. If it rejects,
|
|
102
|
+
* `"ready"` is not fired and the next attempt re-fires
|
|
103
|
+
* `"downloading-params"` (the underlying SDK retries init from scratch).
|
|
104
|
+
*
|
|
105
|
+
* No fake progress: no percentages, byte counts, or timers — upstream
|
|
106
|
+
* exposes no download-progress API. Callback exceptions are swallowed so
|
|
107
|
+
* a UI observer can never break encryption.
|
|
108
|
+
*/
|
|
109
|
+
onPhase?: (phase: EncryptorInitPhase) => void;
|
|
72
110
|
}
|
|
73
111
|
/**
|
|
74
112
|
* Returned by {@link createSepoliaEncryptor}. Carries the underlying
|
|
@@ -4,9 +4,9 @@ import { ConfidentialAirdropFactoryClient, type ConfidentialAirdropFactoryClient
|
|
|
4
4
|
* Advanced extension of {@link ConfidentialAirdropFactoryClient} that re-exposes
|
|
5
5
|
* the CREATE2 address prediction read.
|
|
6
6
|
*
|
|
7
|
-
* **Why this is "advanced" surface.**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* **Why this is "advanced" surface.** Most consumers want one call back —
|
|
8
|
+
* `createConfidentialAirdrop` (rich-return, `{ hash, airdrop }`). The factory
|
|
9
|
+
* still emits
|
|
10
10
|
* `ConfidentialAirdropCreated`, the SDK still parses it, so consumers never
|
|
11
11
|
* need to ask "what address will this deploy to before mining?" Hoisting
|
|
12
12
|
* `predictAirdropAddress` onto the headline client surface gave consumers a
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-
|
|
3
|
+
var chunk4WPGQSNT_cjs = require('../../chunk-4WPGQSNT.cjs');
|
|
4
|
+
require('../../chunk-TIUKIY5V.cjs');
|
|
5
|
+
require('../../chunk-FWHYQZ5E.cjs');
|
|
6
|
+
require('../../chunk-KLKI352M.cjs');
|
|
7
|
+
require('../../chunk-PUPKNW3R.cjs');
|
|
8
|
+
require('../../chunk-JK4XMMKM.cjs');
|
|
8
9
|
require('../../chunk-VJKZWYYJ.cjs');
|
|
9
10
|
require('../../chunk-66IHPTOK.cjs');
|
|
10
|
-
require('../../chunk-
|
|
11
|
+
require('../../chunk-67OV5CX2.cjs');
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
Object.defineProperty(exports, "ConfidentialAirdropFactoryAdvancedClient", {
|
|
15
16
|
enumerable: true,
|
|
16
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk4WPGQSNT_cjs.ConfidentialAirdropFactoryAdvancedClient; }
|
|
17
18
|
});
|
|
18
19
|
Object.defineProperty(exports, "createConfidentialAirdropFactoryAdvancedClient", {
|
|
19
20
|
enumerable: true,
|
|
20
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk4WPGQSNT_cjs.createConfidentialAirdropFactoryAdvancedClient; }
|
|
21
22
|
});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Advanced FHE-airdrop primitives — power-user surface kept off the headline
|
|
3
|
-
* client to keep the
|
|
3
|
+
* client to keep the common path lean.
|
|
4
4
|
*
|
|
5
5
|
* Re-exports the {@link ConfidentialAirdropFactoryAdvancedClient} subclass,
|
|
6
6
|
* which extends the headline factory client with `predictAirdropAddress`. Use
|
|
7
7
|
* this subpath when you genuinely need to compute a clone address before
|
|
8
8
|
* deploying — historical recovery, deterministic same-tx flows. For the
|
|
9
9
|
* common "deploy and learn the address" case, the headline factory's
|
|
10
|
-
* `createConfidentialAirdrop` returns `{ hash, airdrop }` directly
|
|
10
|
+
* `createConfidentialAirdrop` returns `{ hash, airdrop }` directly.
|
|
11
11
|
*/
|
|
12
12
|
export { ConfidentialAirdropFactoryAdvancedClient, createConfidentialAirdropFactoryAdvancedClient, } from "./factory-advanced.js";
|
|
13
13
|
export type { PredictAirdropArgs } from "../factory.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Advanced FHE-airdrop primitives — power-user surface kept off the headline
|
|
3
|
-
* client to keep the
|
|
3
|
+
* client to keep the common path lean.
|
|
4
4
|
*
|
|
5
5
|
* Re-exports the {@link ConfidentialAirdropFactoryAdvancedClient} subclass,
|
|
6
6
|
* which extends the headline factory client with `predictAirdropAddress`. Use
|
|
7
7
|
* this subpath when you genuinely need to compute a clone address before
|
|
8
8
|
* deploying — historical recovery, deterministic same-tx flows. For the
|
|
9
9
|
* common "deploy and learn the address" case, the headline factory's
|
|
10
|
-
* `createConfidentialAirdrop` returns `{ hash, airdrop }` directly
|
|
10
|
+
* `createConfidentialAirdrop` returns `{ hash, airdrop }` directly.
|
|
11
11
|
*/
|
|
12
12
|
export { ConfidentialAirdropFactoryAdvancedClient, createConfidentialAirdropFactoryAdvancedClient, } from "./factory-advanced.js";
|
|
13
13
|
export type { PredictAirdropArgs } from "../factory.js";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export { ConfidentialAirdropFactoryAdvancedClient, createConfidentialAirdropFactoryAdvancedClient } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
1
|
+
export { ConfidentialAirdropFactoryAdvancedClient, createConfidentialAirdropFactoryAdvancedClient } from '../../chunk-ODLTEGHB.js';
|
|
2
|
+
import '../../chunk-DUZIIRPF.js';
|
|
3
|
+
import '../../chunk-7VELUOMI.js';
|
|
4
|
+
import '../../chunk-SG65XWH7.js';
|
|
5
|
+
import '../../chunk-XGGTQQFH.js';
|
|
6
|
+
import '../../chunk-ZA673I3O.js';
|
|
6
7
|
import '../../chunk-Q2GP5UDC.js';
|
|
7
8
|
import '../../chunk-KWFFIJYX.js';
|
|
8
|
-
import '../../chunk-
|
|
9
|
+
import '../../chunk-QBJ7O2B4.js';
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../../chunk-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
require('../../../chunk-
|
|
8
|
-
require('../../../chunk-
|
|
9
|
-
|
|
10
|
-
require('../../../chunk-
|
|
3
|
+
var chunkT46YXSBP_cjs = require('../../../chunk-T46YXSBP.cjs');
|
|
4
|
+
require('../../../chunk-MCRBVJGZ.cjs');
|
|
5
|
+
var chunk4WPGQSNT_cjs = require('../../../chunk-4WPGQSNT.cjs');
|
|
6
|
+
var chunkTIUKIY5V_cjs = require('../../../chunk-TIUKIY5V.cjs');
|
|
7
|
+
require('../../../chunk-FAXIIH5R.cjs');
|
|
8
|
+
require('../../../chunk-FWHYQZ5E.cjs');
|
|
9
|
+
require('../../../chunk-KLKI352M.cjs');
|
|
10
|
+
var chunkPUPKNW3R_cjs = require('../../../chunk-PUPKNW3R.cjs');
|
|
11
|
+
require('../../../chunk-JK4XMMKM.cjs');
|
|
11
12
|
require('../../../chunk-VJKZWYYJ.cjs');
|
|
12
13
|
require('../../../chunk-66IHPTOK.cjs');
|
|
13
|
-
require('../../../chunk-
|
|
14
|
+
require('../../../chunk-67OV5CX2.cjs');
|
|
14
15
|
var react = require('react');
|
|
15
16
|
var reactQuery = require('@tanstack/react-query');
|
|
16
17
|
var wagmi = require('wagmi');
|
|
@@ -23,22 +24,22 @@ function usePredictAirdropAddress(args = {}) {
|
|
|
23
24
|
...chainId !== void 0 ? { chainId } : {}
|
|
24
25
|
});
|
|
25
26
|
const resolvedChainId = chainId ?? resolvedPublicClient?.chain?.id;
|
|
26
|
-
const resolvedAddress = address ?? (resolvedChainId === void 0 ? void 0 :
|
|
27
|
+
const resolvedAddress = address ?? (resolvedChainId === void 0 ? void 0 : chunkPUPKNW3R_cjs.DEPLOYED_ADDRESSES.fheAirdrop?.confidentialAirdropFactory?.[resolvedChainId] ?? void 0);
|
|
27
28
|
const encryptorSourceRef = react.useRef(encryptor);
|
|
28
29
|
encryptorSourceRef.current = encryptor;
|
|
29
30
|
const client = react.useMemo(() => {
|
|
30
31
|
if (!resolvedPublicClient) return void 0;
|
|
31
32
|
if (!resolvedAddress) return void 0;
|
|
32
|
-
return
|
|
33
|
+
return chunk4WPGQSNT_cjs.createConfidentialAirdropFactoryAdvancedClient({
|
|
33
34
|
publicClient: resolvedPublicClient,
|
|
34
35
|
...walletClient ? { walletClient } : {},
|
|
35
36
|
address: resolvedAddress,
|
|
36
37
|
...resolvedChainId !== void 0 ? { chainId: resolvedChainId } : {},
|
|
37
|
-
encryptor: () =>
|
|
38
|
+
encryptor: () => chunkTIUKIY5V_cjs.resolveEncryptor(encryptorSourceRef.current)
|
|
38
39
|
});
|
|
39
40
|
}, [resolvedPublicClient, walletClient, resolvedAddress, resolvedChainId]);
|
|
40
41
|
return reactQuery.useQuery({
|
|
41
|
-
queryKey:
|
|
42
|
+
queryKey: chunkT46YXSBP_cjs.buildQueryKey(
|
|
42
43
|
"factory:predictAirdropAddress",
|
|
43
44
|
resolvedChainId,
|
|
44
45
|
resolvedAddress,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React hooks for `@tokenops/sdk/fhe-airdrop/advanced`. The headline React
|
|
3
|
-
* subpath stays lean; pre-mine address prediction lives here
|
|
3
|
+
* subpath stays lean; pre-mine address prediction lives here.
|
|
4
4
|
*/
|
|
5
5
|
export { usePredictAirdropAddress, type UsePredictAirdropAddressArgs, } from "./usePredictAirdropAddress.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* React hooks for `@tokenops/sdk/fhe-airdrop/advanced`. The headline React
|
|
3
|
-
* subpath stays lean; pre-mine address prediction lives here
|
|
3
|
+
* subpath stays lean; pre-mine address prediction lives here.
|
|
4
4
|
*/
|
|
5
5
|
export { usePredictAirdropAddress, type UsePredictAirdropAddressArgs, } from "./usePredictAirdropAddress.js";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { buildQueryKey } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
3
|
-
import { createConfidentialAirdropFactoryAdvancedClient } from '../../../chunk-
|
|
4
|
-
import { resolveEncryptor } from '../../../chunk-
|
|
5
|
-
import '../../../chunk-
|
|
6
|
-
import '../../../chunk-
|
|
7
|
-
import
|
|
8
|
-
import '../../../chunk-
|
|
1
|
+
import { buildQueryKey } from '../../../chunk-ORFTDNFZ.js';
|
|
2
|
+
import '../../../chunk-6R4KNAPK.js';
|
|
3
|
+
import { createConfidentialAirdropFactoryAdvancedClient } from '../../../chunk-ODLTEGHB.js';
|
|
4
|
+
import { resolveEncryptor } from '../../../chunk-DUZIIRPF.js';
|
|
5
|
+
import '../../../chunk-ZWXJTBZO.js';
|
|
6
|
+
import '../../../chunk-7VELUOMI.js';
|
|
7
|
+
import '../../../chunk-SG65XWH7.js';
|
|
8
|
+
import { DEPLOYED_ADDRESSES } from '../../../chunk-XGGTQQFH.js';
|
|
9
|
+
import '../../../chunk-ZA673I3O.js';
|
|
9
10
|
import '../../../chunk-Q2GP5UDC.js';
|
|
10
11
|
import '../../../chunk-KWFFIJYX.js';
|
|
11
|
-
import '../../../chunk-
|
|
12
|
+
import '../../../chunk-QBJ7O2B4.js';
|
|
12
13
|
import { useRef, useMemo } from 'react';
|
|
13
14
|
import { useQuery } from '@tanstack/react-query';
|
|
14
15
|
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
@@ -239,6 +239,8 @@ export declare class ConfidentialAirdropClient {
|
|
|
239
239
|
* {@link signClaimAuthorization}. The signature commits to that handle, so the SDK
|
|
240
240
|
* does NOT re-encrypt — submit the admin-issued payload as-is.
|
|
241
241
|
*
|
|
242
|
+
* **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.
|
|
243
|
+
*
|
|
242
244
|
* @returns Transaction hash.
|
|
243
245
|
* @example
|
|
244
246
|
* const fee = await airdrop.gasFee();
|
|
@@ -71,6 +71,14 @@ export interface EncryptUint64BatchArgs {
|
|
|
71
71
|
* `userAddress` MUST be the **recipient** (not the admin), because the contract's
|
|
72
72
|
* `FHE.fromExternal` rejects proofs bound to any other address.
|
|
73
73
|
*
|
|
74
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
75
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
76
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
77
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
78
|
+
* transparent TTT test token uses 18 decimals. `value` (and each entry of
|
|
79
|
+
* `values` in {@link encryptUint64Batch}) follows this convention when it
|
|
80
|
+
* encodes a token amount.
|
|
81
|
+
*
|
|
74
82
|
* @param args Encryption request; `value` must fit in `uint64` (0 to 2^64-1).
|
|
75
83
|
* @returns `{ handle: Hex, inputProof: Hex }` — pass both to the contract.
|
|
76
84
|
* @example
|
|
@@ -2,7 +2,7 @@ import type { Account, Address, Hex, PublicClient, WalletClient } from "viem";
|
|
|
2
2
|
import { type TxHash } from "../core/brands.js";
|
|
3
3
|
import { type SdkTelemetry } from "../core/telemetry.js";
|
|
4
4
|
import { type Encryptor, type EncryptorSource } from "./encryption.js";
|
|
5
|
-
import type { AirdropParams, CustomFee, EncryptedInput } from "./types.js";
|
|
5
|
+
import type { AirdropParams, CreateAirdropPreflightReport, CustomFee, EncryptedInput } from "./types.js";
|
|
6
6
|
export interface ConfidentialAirdropFactoryClientConfig {
|
|
7
7
|
publicClient: PublicClient;
|
|
8
8
|
walletClient?: WalletClient;
|
|
@@ -106,7 +106,7 @@ export type FundAirdropArgs = (FundAirdropArgsCommon & {
|
|
|
106
106
|
* and {@link ConfidentialAirdropFactoryClient.createAndFundConfidentialAirdrop}.
|
|
107
107
|
*
|
|
108
108
|
* Branded `hash: TxHash` and `airdrop: Address` so consumers can't accidentally
|
|
109
|
-
* swap them at the destructure site
|
|
109
|
+
* swap them at the destructure site.
|
|
110
110
|
*/
|
|
111
111
|
export interface CreateAirdropResult {
|
|
112
112
|
/** Tx hash that deployed the clone. */
|
|
@@ -114,6 +114,27 @@ export interface CreateAirdropResult {
|
|
|
114
114
|
/** Address of the deployed clone, parsed from the `ConfidentialAirdropCreated` event. */
|
|
115
115
|
airdrop: Address;
|
|
116
116
|
}
|
|
117
|
+
/** Arguments for {@link ConfidentialAirdropFactoryClient.preflightCreateAirdrop}. */
|
|
118
|
+
export interface PreflightCreateAirdropArgs {
|
|
119
|
+
/** The airdrop parameters that will be passed to the create call. */
|
|
120
|
+
params: AirdropParams;
|
|
121
|
+
/** The address that will send the create transaction (`msg.sender`). */
|
|
122
|
+
creator: Address;
|
|
123
|
+
/**
|
|
124
|
+
* The `userSalt` planned for the create call. Optional — when supplied, the
|
|
125
|
+
* preflight also predicts the CREATE2 clone address and reports whether a
|
|
126
|
+
* clone already exists there (a repeat create with the same salt reverts).
|
|
127
|
+
*/
|
|
128
|
+
userSalt?: Hex;
|
|
129
|
+
/**
|
|
130
|
+
* Set `true` when the plan is `createAndFundConfidentialAirdrop` (or a
|
|
131
|
+
* follow-up `fundConfidentialAirdrop`). Funding pulls tokens from the
|
|
132
|
+
* creator via `confidentialTransferFrom`, so a missing factory-operator
|
|
133
|
+
* approval becomes a blocker. When `false`/omitted, the operator state is
|
|
134
|
+
* still reported (`isFactoryOperator`) but does not block a create-only tx.
|
|
135
|
+
*/
|
|
136
|
+
funding?: boolean;
|
|
137
|
+
}
|
|
117
138
|
export interface PredictAirdropArgs {
|
|
118
139
|
params: AirdropParams;
|
|
119
140
|
userSalt: Hex;
|
|
@@ -146,11 +167,10 @@ export declare class ConfidentialAirdropFactoryClient {
|
|
|
146
167
|
* Deploy a new airdrop clone via the factory and return its address, parsed
|
|
147
168
|
* from the `ConfidentialAirdropCreated` event in the tx receipt.
|
|
148
169
|
*
|
|
149
|
-
* **This is the headline factory entry point.**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* themselves.
|
|
170
|
+
* **This is the headline factory entry point.** It returns one rich-return
|
|
171
|
+
* shape: most consumers want the deployed address back, and the SDK already
|
|
172
|
+
* waits for and parses the event, so there's no reason to make consumers do
|
|
173
|
+
* it themselves.
|
|
154
174
|
*
|
|
155
175
|
* Internally: `writeContract` → {@link PublicClient.waitForTransactionReceipt} →
|
|
156
176
|
* `parseEventLogs({ eventName: "ConfidentialAirdropCreated" })`.
|
|
@@ -173,9 +193,17 @@ export declare class ConfidentialAirdropFactoryClient {
|
|
|
173
193
|
* Prerequisites: caller must have set this factory as an operator on the
|
|
174
194
|
* token: `token.setOperator(factoryAddress, deadline)`.
|
|
175
195
|
*
|
|
196
|
+
* **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.
|
|
197
|
+
*
|
|
198
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
199
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
200
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
201
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
202
|
+
* transparent TTT test token uses 18 decimals.
|
|
203
|
+
*
|
|
176
204
|
* Symmetric with {@link ConfidentialAirdropFactoryClient.createConfidentialAirdrop}
|
|
177
205
|
* — both return `{ hash, airdrop }` parsed from the
|
|
178
|
-
* `ConfidentialAirdropCreated` event
|
|
206
|
+
* `ConfidentialAirdropCreated` event.
|
|
179
207
|
*
|
|
180
208
|
* @example
|
|
181
209
|
* const { hash, airdrop } = await factory.createAndFundConfidentialAirdrop({
|
|
@@ -189,6 +217,14 @@ export declare class ConfidentialAirdropFactoryClient {
|
|
|
189
217
|
* Prerequisites: caller must have set this factory as an operator on the token:
|
|
190
218
|
* `token.setOperator(factoryAddress, deadline)`
|
|
191
219
|
*
|
|
220
|
+
* **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.
|
|
221
|
+
*
|
|
222
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
223
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
224
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
225
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
226
|
+
* transparent TTT test token uses 18 decimals.
|
|
227
|
+
*
|
|
192
228
|
* @returns Transaction hash.
|
|
193
229
|
*/
|
|
194
230
|
fundConfidentialAirdrop(args: FundAirdropArgs): Promise<Hex>;
|
|
@@ -219,6 +255,14 @@ export declare class ConfidentialAirdropFactoryClient {
|
|
|
219
255
|
* Symmetry with {@link ConfidentialAirdropFactoryClient.createConfidentialAirdropAndGetAddress}
|
|
220
256
|
* — use this when you also need to seed the pool in the same transaction.
|
|
221
257
|
*
|
|
258
|
+
* **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.
|
|
259
|
+
*
|
|
260
|
+
* **Amount units:** TokenOps confidential (ERC-7984) tokens use a 6-decimals
|
|
261
|
+
* convention (1 token = 1_000_000 base units), not the 18 decimals typical of
|
|
262
|
+
* ERC-20. Amount parameters are base units of the token's actual decimals:
|
|
263
|
+
* for the CTTT test token (6 decimals) `1_000_000n` = 1 CTTT, while the
|
|
264
|
+
* transparent TTT test token uses 18 decimals.
|
|
265
|
+
*
|
|
222
266
|
* Internally: {@link ConfidentialAirdropFactoryClient.createAndFundConfidentialAirdrop} →
|
|
223
267
|
* {@link PublicClient.waitForTransactionReceipt} →
|
|
224
268
|
* `parseEventLogs({ eventName: "ConfidentialAirdropCreated" })`.
|
|
@@ -243,9 +287,8 @@ export declare class ConfidentialAirdropFactoryClient {
|
|
|
243
287
|
* Alias for {@link ConfidentialAirdropFactoryClient.implementation} that matches
|
|
244
288
|
* the contract's storage field name (`_airdropImplementation`).
|
|
245
289
|
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
* backend-integrator-r14 minor). The airdrop factory has the same
|
|
290
|
+
* Provided for parity with `fhe-vesting`'s `managerImplementation()` alias.
|
|
291
|
+
* The airdrop factory has the same
|
|
249
292
|
* LibClone shape mirroring `_airdropImplementation` storage, so server
|
|
250
293
|
* devs reading the Solidity first reach for `factory.airdropImplementation()`
|
|
251
294
|
* via autocomplete and would otherwise hit a TS2551 on the SDK's
|
|
@@ -270,6 +313,46 @@ export declare class ConfidentialAirdropFactoryClient {
|
|
|
270
313
|
params: AirdropParams;
|
|
271
314
|
gasFee: bigint;
|
|
272
315
|
}): Promise<Hex>;
|
|
316
|
+
/**
|
|
317
|
+
* Read-only preflight for {@link createConfidentialAirdrop} /
|
|
318
|
+
* {@link createAndFundConfidentialAirdrop}. Runs the
|
|
319
|
+
* deterministic-from-off-chain checks and reports blockers both as
|
|
320
|
+
* human-readable strings (`blockers`) and as typed {@link TokenOpsSdkError}s
|
|
321
|
+
* (`blockerErrors`), index-aligned.
|
|
322
|
+
*
|
|
323
|
+
* Preflight is **opt-in**. Consumers who have already validated state can
|
|
324
|
+
* skip this call and invoke the write directly — they'll receive the same
|
|
325
|
+
* typed errors at write time via the revert mapper.
|
|
326
|
+
*
|
|
327
|
+
* Report fields: `isFactoryOperator`, `gasFee`, `predictedAirdrop`,
|
|
328
|
+
* `alreadyDeployed`, `ready`, `blockers`, `blockerErrors` — see
|
|
329
|
+
* {@link CreateAirdropPreflightReport} for the meaning of each.
|
|
330
|
+
*
|
|
331
|
+
* Checks performed (all read-only, no gas):
|
|
332
|
+
* - Structural `params` validation mirroring the factory + clone
|
|
333
|
+
* `initialize` requirements (`InvalidArgumentError` blockers): `token` and
|
|
334
|
+
* `admin` are checksummed non-zero addresses,
|
|
335
|
+
* `startTimestamp < endTimestamp`, and `endTimestamp` is in the future
|
|
336
|
+
* (the clone's `initialize` reverts with `EndTimeInPast`).
|
|
337
|
+
* - Operator: creator has approved this factory as an ERC-7984 operator on
|
|
338
|
+
* `params.token` — a blocker only when `funding: true`
|
|
339
|
+
* ({@link OperatorNotApprovedError}); otherwise informational via
|
|
340
|
+
* `isFactoryOperator`.
|
|
341
|
+
* - Collision (only when `userSalt` is supplied): bytecode already at the
|
|
342
|
+
* predicted CREATE2 address means a repeat create with the same
|
|
343
|
+
* `(params, userSalt, gasFee)` would revert
|
|
344
|
+
* ({@link AlreadyInitializedError} blocker).
|
|
345
|
+
*
|
|
346
|
+
* **Not preflight-detectable — read before trusting `ready: true`:** the
|
|
347
|
+
* creator's confidential token balance is an encrypted `euint64` the SDK
|
|
348
|
+
* cannot read in plaintext, and an underfunded `createAndFund` does **not**
|
|
349
|
+
* revert — the ERC-7984 transfer silently moves an encrypted zero. Confirm
|
|
350
|
+
* the creator's balance covers the pool before submitting.
|
|
351
|
+
*
|
|
352
|
+
* @param args See {@link PreflightCreateAirdropArgs}.
|
|
353
|
+
* @returns A {@link CreateAirdropPreflightReport}.
|
|
354
|
+
*/
|
|
355
|
+
preflightCreateAirdrop(args: PreflightCreateAirdropArgs): Promise<CreateAirdropPreflightReport>;
|
|
273
356
|
}
|
|
274
357
|
/**
|
|
275
358
|
* Create a {@link ConfidentialAirdropFactoryClient}. Mirrors viem's `create*` convention.
|