@tokenops/sdk 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +158 -2
- package/SECURITY.md +7 -1
- package/dist/{chunk-67OV5CX2.cjs → chunk-2RNW4MIJ.cjs} +18 -0
- package/dist/{chunk-KLKI352M.cjs → chunk-43RFBQ73.cjs} +29 -29
- package/dist/{chunk-ZA673I3O.js → chunk-46T67CE2.js} +1 -1
- package/dist/{chunk-6BMP4ICG.js → chunk-4KJ66YRH.js} +61 -3
- package/dist/{chunk-JYOTGRSO.cjs → chunk-4ZCXK4VI.cjs} +68 -8
- package/dist/{chunk-SG65XWH7.js → chunk-6WSNS3UV.js} +1 -1
- package/dist/{chunk-V2PXZVBF.cjs → chunk-7G7UOQV4.cjs} +4 -4
- package/dist/{chunk-WENHUPZC.cjs → chunk-AYGRYDBX.cjs} +35 -36
- package/dist/{chunk-2NCLOQ56.cjs → chunk-BD4LZBVF.cjs} +85 -9
- package/dist/{chunk-5X5WL5CU.cjs → chunk-BK7YIVLK.cjs} +110 -149
- package/dist/{chunk-W7IGCOVL.cjs → chunk-CBRL2PJA.cjs} +12 -11
- package/dist/{chunk-ORFTDNFZ.js → chunk-CNP4L3GF.js} +4 -4
- package/dist/{chunk-QBJ7O2B4.js → chunk-DRSPMIZ7.js} +11 -1
- package/dist/{chunk-C7BRZXJA.cjs → chunk-EUKPOXWR.cjs} +15 -16
- package/dist/{chunk-YQIBBEFJ.js → chunk-HETNKZEE.js} +1 -1
- package/dist/{chunk-ODLTEGHB.js → chunk-KSDSXJ34.js} +1 -1
- package/dist/{chunk-TIUKIY5V.cjs → chunk-LBWRFZR3.cjs} +58 -40
- package/dist/{chunk-WMACINXO.js → chunk-NFW7AUEX.js} +1 -1
- package/dist/{chunk-4WPGQSNT.cjs → chunk-OL6SHN3D.cjs} +3 -3
- package/dist/{chunk-AOP6HMPW.js → chunk-PD7ME2BT.js} +75 -2
- package/dist/{chunk-2PWNH3UE.js → chunk-QET3Q4JP.js} +65 -9
- package/dist/{chunk-XGGTQQFH.js → chunk-QKKBBH7I.js} +2 -2
- package/dist/{chunk-6R4KNAPK.js → chunk-S2XD75JM.js} +10 -3
- package/dist/{chunk-MCRBVJGZ.cjs → chunk-SPGSO5SO.cjs} +29 -22
- package/dist/{chunk-FAXIIH5R.cjs → chunk-SYHNZSZZ.cjs} +3 -3
- package/dist/{chunk-IXLO7GO5.js → chunk-TN65XNTI.js} +47 -83
- package/dist/chunk-U57COLUE.js +56 -0
- package/dist/{chunk-DUZIIRPF.js → chunk-UE5XK2SY.js} +27 -9
- package/dist/{chunk-TEBM66WA.cjs → chunk-UJS4N2XM.cjs} +12 -12
- package/dist/{chunk-OXTLPTO3.js → chunk-V5D7BHW3.js} +4 -5
- package/dist/{chunk-NTZY6IB7.js → chunk-VHSNYUYV.js} +5 -4
- package/dist/{chunk-JK4XMMKM.cjs → chunk-VR3FREBX.cjs} +3 -3
- package/dist/{chunk-T46YXSBP.cjs → chunk-WO72UBQD.cjs} +11 -11
- package/dist/chunk-WOEETTH7.cjs +59 -0
- package/dist/{chunk-IJFQ5L4I.js → chunk-WTK6JDSI.js} +4 -5
- package/dist/{chunk-PUPKNW3R.cjs → chunk-WUXUWTFW.cjs} +3 -3
- package/dist/{chunk-PFXURMBZ.cjs → chunk-YFIWCYHC.cjs} +112 -54
- package/dist/{chunk-ZWXJTBZO.js → chunk-YPYCWLYP.js} +1 -1
- package/dist/core/addresses.d.ts +1 -1
- package/dist/core/errors.d.ts +1 -1
- package/dist/fhe/index.cjs +84 -64
- package/dist/fhe/index.d.cts +1 -0
- package/dist/fhe/index.d.ts +1 -0
- package/dist/fhe/index.js +21 -9
- package/dist/fhe/mock-erc7984.d.ts +4 -4
- package/dist/fhe/operators.d.ts +142 -2
- package/dist/fhe/react/index.cjs +21 -8
- package/dist/fhe/react/index.d.cts +2 -0
- package/dist/fhe/react/index.d.ts +2 -0
- package/dist/fhe/react/index.js +8 -3
- package/dist/fhe/react/useEnsureOperator.d.ts +56 -0
- package/dist/fhe/react/useIsOperator.d.ts +54 -0
- package/dist/fhe/sepolia-encryptor-web.d.ts +18 -3
- package/dist/fhe-airdrop/advanced/index.cjs +8 -9
- package/dist/fhe-airdrop/advanced/index.js +6 -7
- package/dist/fhe-airdrop/advanced/react/index.cjs +13 -14
- package/dist/fhe-airdrop/advanced/react/index.js +9 -10
- package/dist/fhe-airdrop/airdrop.d.ts +7 -0
- package/dist/fhe-airdrop/index.cjs +66 -67
- package/dist/fhe-airdrop/index.js +7 -8
- package/dist/fhe-airdrop/react/index.cjs +148 -137
- package/dist/fhe-airdrop/react/index.d.cts +3 -1
- package/dist/fhe-airdrop/react/index.d.ts +3 -1
- package/dist/fhe-airdrop/react/index.js +16 -14
- package/dist/fhe-airdrop/react/useAccessClaimAmount.d.ts +17 -11
- package/dist/fhe-airdrop/react/useClaim.d.ts +8 -0
- package/dist/fhe-airdrop/react/useSignClaimAuthorization.d.ts +1 -1
- package/dist/fhe-airdrop/types.d.ts +14 -3
- package/dist/fhe-disperse/errors.d.ts +55 -0
- package/dist/fhe-disperse/index.cjs +74 -67
- 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 -9
- package/dist/fhe-disperse/react/index.cjs +105 -88
- package/dist/fhe-disperse/react/index.d.cts +3 -1
- package/dist/fhe-disperse/react/index.d.ts +3 -1
- package/dist/fhe-disperse/react/index.js +12 -11
- package/dist/fhe-vesting/advanced/index.cjs +8 -9
- package/dist/fhe-vesting/advanced/index.js +6 -7
- package/dist/fhe-vesting/advanced/react/index.cjs +14 -15
- package/dist/fhe-vesting/advanced/react/index.js +11 -12
- package/dist/fhe-vesting/index.cjs +75 -76
- package/dist/fhe-vesting/index.js +9 -10
- package/dist/fhe-vesting/manager.d.ts +19 -0
- package/dist/fhe-vesting/react/index.cjs +245 -227
- package/dist/fhe-vesting/react/index.d.cts +6 -4
- package/dist/fhe-vesting/react/index.d.ts +6 -4
- package/dist/fhe-vesting/react/index.js +27 -21
- package/dist/fhe-vesting/react/useAccessClaimableAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessSettledAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessTotalAllocation.d.ts +11 -3
- package/dist/fhe-vesting/react/useAccessVestedAmount.d.ts +11 -3
- package/dist/fhe-vesting/react/useAdminGetClaimableAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetSettledAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetTotalAllocation.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminGetVestedAmount.d.ts +1 -1
- package/dist/fhe-vesting/react/useAdminPartialClaim.d.ts +8 -0
- package/dist/fhe-vesting/react/useClaim.d.ts +1 -1
- package/dist/fhe-vesting/react/useDiscloseHandleToParty.d.ts +1 -1
- package/dist/fhe-vesting/react/useManagerDiscloseHandleToParty.d.ts +1 -1
- package/dist/fhe-vesting/react/usePartialClaim.d.ts +1 -1
- package/dist/fhe-vesting/react/useVestingInfo.d.ts +1 -1
- package/dist/fhe-vesting/types.d.ts +12 -1
- package/dist/index.cjs +87 -88
- package/dist/index.js +2 -3
- package/dist/testnet-faucet/index.cjs +55 -56
- package/dist/testnet-faucet/index.js +5 -6
- package/dist/testnet-faucet/react/index.cjs +53 -54
- package/dist/testnet-faucet/react/index.js +7 -8
- package/package.json +13 -8
- package/dist/chunk-66IHPTOK.cjs +0 -20
- package/dist/chunk-KWFFIJYX.js +0 -11
- package/dist/fhe-airdrop/react/useAirdropClaim.d.ts +0 -27
- package/dist/fhe-airdrop/react/useGetClaimAmount.d.ts +0 -30
- package/dist/fhe-vesting/react/useGetClaimableAmount.d.ts +0 -13
- package/dist/fhe-vesting/react/useGetSettledAmount.d.ts +0 -14
- package/dist/fhe-vesting/react/useGetTotalAllocation.d.ts +0 -13
- package/dist/fhe-vesting/react/useGetVestedAmount.d.ts +0 -25
package/dist/fhe/react/index.cjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('../../chunk-
|
|
4
|
-
|
|
3
|
+
var chunkWOEETTH7_cjs = require('../../chunk-WOEETTH7.cjs');
|
|
4
|
+
require('../../chunk-ZQUE2B3Q.cjs');
|
|
5
|
+
require('../../chunk-4ZCXK4VI.cjs');
|
|
6
|
+
require('../../chunk-FWHYQZ5E.cjs');
|
|
7
|
+
require('../../chunk-VR3FREBX.cjs');
|
|
8
|
+
var chunk2RNW4MIJ_cjs = require('../../chunk-2RNW4MIJ.cjs');
|
|
9
|
+
require('../../chunk-VJKZWYYJ.cjs');
|
|
5
10
|
var react = require('react');
|
|
6
11
|
|
|
7
12
|
function resolveUserDecryptor(source) {
|
|
@@ -35,7 +40,7 @@ function useDecryptedHandle(opts) {
|
|
|
35
40
|
setState({
|
|
36
41
|
status: "error",
|
|
37
42
|
value: void 0,
|
|
38
|
-
error: new
|
|
43
|
+
error: new chunk2RNW4MIJ_cjs.TokenOpsValidationError(
|
|
39
44
|
"useDecryptedHandle: no `userDecryptor` resolved \u2014 pass `userDecryptor: () => useZamaSDK().relayer` (or an eager RelayerSDK / MockFhevmInstance).",
|
|
40
45
|
{ method: "useDecryptedHandle" }
|
|
41
46
|
)
|
|
@@ -52,7 +57,7 @@ function useDecryptedHandle(opts) {
|
|
|
52
57
|
});
|
|
53
58
|
const plain = result[handleStr];
|
|
54
59
|
if (plain === void 0) {
|
|
55
|
-
throw new
|
|
60
|
+
throw new chunk2RNW4MIJ_cjs.TokenOpsValidationError(
|
|
56
61
|
`useDecryptedHandle: relayer returned no value for handle ${handleStr} on contract ${contractStr} \u2014 check ACL grant + (handle, contractAddress, userAddress) triple`,
|
|
57
62
|
{ method: "useDecryptedHandle", contractAddress: contractStr }
|
|
58
63
|
);
|
|
@@ -83,20 +88,28 @@ function serializableSlice(v) {
|
|
|
83
88
|
return out;
|
|
84
89
|
}
|
|
85
90
|
|
|
91
|
+
Object.defineProperty(exports, "useEnsureOperator", {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () { return chunkWOEETTH7_cjs.useEnsureOperator; }
|
|
94
|
+
});
|
|
95
|
+
Object.defineProperty(exports, "useIsOperator", {
|
|
96
|
+
enumerable: true,
|
|
97
|
+
get: function () { return chunkWOEETTH7_cjs.useIsOperator; }
|
|
98
|
+
});
|
|
86
99
|
Object.defineProperty(exports, "TokenOpsContractError", {
|
|
87
100
|
enumerable: true,
|
|
88
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunk2RNW4MIJ_cjs.TokenOpsContractError; }
|
|
89
102
|
});
|
|
90
103
|
Object.defineProperty(exports, "TokenOpsSdkError", {
|
|
91
104
|
enumerable: true,
|
|
92
|
-
get: function () { return
|
|
105
|
+
get: function () { return chunk2RNW4MIJ_cjs.TokenOpsSdkError; }
|
|
93
106
|
});
|
|
94
107
|
Object.defineProperty(exports, "TokenOpsValidationError", {
|
|
95
108
|
enumerable: true,
|
|
96
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunk2RNW4MIJ_cjs.TokenOpsValidationError; }
|
|
97
110
|
});
|
|
98
111
|
Object.defineProperty(exports, "isTokenOpsSdkError", {
|
|
99
112
|
enumerable: true,
|
|
100
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunk2RNW4MIJ_cjs.isTokenOpsSdkError; }
|
|
101
114
|
});
|
|
102
115
|
exports.useDecryptedHandle = useDecryptedHandle;
|
|
@@ -7,4 +7,6 @@
|
|
|
7
7
|
* `EncryptedHandle` return value).
|
|
8
8
|
*/
|
|
9
9
|
export { useDecryptedHandle, type UseDecryptedHandleOptions, type UseDecryptedHandleResult, type UserDecryptor, type UserDecryptorSource, } from "./use-decrypted-handle.js";
|
|
10
|
+
export { useIsOperator, type UseIsOperatorOptions } from "./useIsOperator.js";
|
|
11
|
+
export { useEnsureOperator, type UseEnsureOperatorOptions, type EnsureOperatorVariables, } from "./useEnsureOperator.js";
|
|
10
12
|
export { TokenOpsSdkError, isTokenOpsSdkError, TokenOpsValidationError, TokenOpsContractError, } from "../../core/errors.js";
|
|
@@ -7,4 +7,6 @@
|
|
|
7
7
|
* `EncryptedHandle` return value).
|
|
8
8
|
*/
|
|
9
9
|
export { useDecryptedHandle, type UseDecryptedHandleOptions, type UseDecryptedHandleResult, type UserDecryptor, type UserDecryptorSource, } from "./use-decrypted-handle.js";
|
|
10
|
+
export { useIsOperator, type UseIsOperatorOptions } from "./useIsOperator.js";
|
|
11
|
+
export { useEnsureOperator, type UseEnsureOperatorOptions, type EnsureOperatorVariables, } from "./useEnsureOperator.js";
|
|
10
12
|
export { TokenOpsSdkError, isTokenOpsSdkError, TokenOpsValidationError, TokenOpsContractError, } from "../../core/errors.js";
|
package/dist/fhe/react/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
export { useEnsureOperator, useIsOperator } from '../../chunk-U57COLUE.js';
|
|
2
|
+
import '../../chunk-FT4LNBOS.js';
|
|
3
|
+
import '../../chunk-4KJ66YRH.js';
|
|
4
|
+
import '../../chunk-7VELUOMI.js';
|
|
5
|
+
import '../../chunk-46T67CE2.js';
|
|
6
|
+
import { TokenOpsValidationError } from '../../chunk-DRSPMIZ7.js';
|
|
7
|
+
export { TokenOpsContractError, TokenOpsSdkError, TokenOpsValidationError, isTokenOpsSdkError } from '../../chunk-DRSPMIZ7.js';
|
|
8
|
+
import '../../chunk-Q2GP5UDC.js';
|
|
4
9
|
import { useState, useRef, useEffect } from 'react';
|
|
5
10
|
|
|
6
11
|
function resolveUserDecryptor(source) {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-product mutation hook over {@link ensureOperator} — check-then-set
|
|
3
|
+
* operator authorization that sends no transaction when the grant already
|
|
4
|
+
* exists.
|
|
5
|
+
*
|
|
6
|
+
* Lives in `/fhe/react` (not a product subpath) because the operator
|
|
7
|
+
* prerequisite is identical across all three product flows; the product
|
|
8
|
+
* `react/` barrels re-export it for discoverability.
|
|
9
|
+
*/
|
|
10
|
+
import { type UseMutationResult } from "@tanstack/react-query";
|
|
11
|
+
import type { Account, Address } from "viem";
|
|
12
|
+
import type { SdkTelemetry } from "../../core/telemetry.js";
|
|
13
|
+
import { type EnsureOperatorResult } from "../operators.js";
|
|
14
|
+
/** Hook-level options for {@link useEnsureOperator}. */
|
|
15
|
+
export interface UseEnsureOperatorOptions {
|
|
16
|
+
/** Override the chain id used for client resolution. */
|
|
17
|
+
chainId?: number | undefined;
|
|
18
|
+
/** Optional telemetry adapter — forwarded to the headless helper. */
|
|
19
|
+
telemetry?: SdkTelemetry | undefined;
|
|
20
|
+
}
|
|
21
|
+
/** Per-mutation variables for {@link useEnsureOperator}. */
|
|
22
|
+
export interface EnsureOperatorVariables {
|
|
23
|
+
/** ERC-7984 token contract address. */
|
|
24
|
+
token: Address;
|
|
25
|
+
/** Address being authorized to pull tokens. */
|
|
26
|
+
spender: Address;
|
|
27
|
+
/**
|
|
28
|
+
* `uint48` unix timestamp after which the authorization expires. Required
|
|
29
|
+
* — the expiry window is an explicit caller decision (see
|
|
30
|
+
* {@link ensureOperator}). Pass `ERC7984_OPERATOR_MAX_DEADLINE` only when
|
|
31
|
+
* you explicitly want a never-expiring grant.
|
|
32
|
+
*/
|
|
33
|
+
deadline: bigint;
|
|
34
|
+
/** Override the from-account; defaults to the connected wallet's account. */
|
|
35
|
+
account?: Account | Address;
|
|
36
|
+
/** If `true` (default), waits for the transaction to be mined. */
|
|
37
|
+
waitForReceipt?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Ensure `spender` is an ERC-7984 operator for the connected account on
|
|
41
|
+
* `token`, sending a `setOperator` transaction only when the grant is
|
|
42
|
+
* missing. Resolves to `{ alreadyOperator, hash }` — `hash` is `null` on
|
|
43
|
+
* the no-op path.
|
|
44
|
+
*
|
|
45
|
+
* This is the mutation half of the operator-prerequisite pair; use
|
|
46
|
+
* {@link useIsOperator} for the read side, and invalidate/refetch it after
|
|
47
|
+
* this mutation succeeds.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```tsx
|
|
51
|
+
* const ensure = useEnsureOperator();
|
|
52
|
+
* const oneHour = BigInt(Math.floor(Date.now() / 1000) + 3600);
|
|
53
|
+
* ensure.mutate({ token, spender: manager, deadline: oneHour });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function useEnsureOperator(options?: UseEnsureOperatorOptions): UseMutationResult<EnsureOperatorResult, Error, EnsureOperatorVariables>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-product query hook over {@link isOperator} — "is `spender` currently
|
|
3
|
+
* an authorized ERC-7984 operator for `holder` on `token`?".
|
|
4
|
+
*
|
|
5
|
+
* Lives in `/fhe/react` (not a product subpath) because the operator
|
|
6
|
+
* prerequisite is identical across all three product flows; the product
|
|
7
|
+
* `react/` barrels re-export it for discoverability.
|
|
8
|
+
*/
|
|
9
|
+
import { type UseQueryResult } from "@tanstack/react-query";
|
|
10
|
+
import type { Address } from "viem";
|
|
11
|
+
import type { SdkTelemetry } from "../../core/telemetry.js";
|
|
12
|
+
/** Options accepted by {@link useIsOperator}. */
|
|
13
|
+
export interface UseIsOperatorOptions {
|
|
14
|
+
/** ERC-7984 token contract address. Query stays disabled while `undefined`. */
|
|
15
|
+
token?: Address | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Address whose operator status is being checked — typically a manager
|
|
18
|
+
* clone, an airdrop factory/clone, or the disperse singleton. Query stays
|
|
19
|
+
* disabled while `undefined`.
|
|
20
|
+
*/
|
|
21
|
+
spender?: Address | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Account that owns the tokens. Defaults to the connected wallet's
|
|
24
|
+
* account. Query stays disabled while neither is available.
|
|
25
|
+
*/
|
|
26
|
+
holder?: Address | undefined;
|
|
27
|
+
/** Override the chain id used for client resolution. */
|
|
28
|
+
chainId?: number | undefined;
|
|
29
|
+
/** Set `false` to pause the query without unmounting. Defaults to `true`. */
|
|
30
|
+
enabled?: boolean | undefined;
|
|
31
|
+
/** Optional telemetry adapter — forwarded to the headless helper. */
|
|
32
|
+
telemetry?: SdkTelemetry | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Read `spender`'s ERC-7984 operator status for `holder` on `token`.
|
|
36
|
+
*
|
|
37
|
+
* Typical use: gate the "create" call-to-action behind the operator
|
|
38
|
+
* prerequisite so builders never hit {@link OperatorNotApprovedError} — the
|
|
39
|
+
* SDK's mapping of the on-chain `ERC7984UnauthorizedSpender` revert, whose
|
|
40
|
+
* message is the canonical {@link OPERATOR_NOT_APPROVED_REMEDIATION} copy:
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* const { data: authorized } = useIsOperator({ token, spender: manager });
|
|
45
|
+
* return authorized
|
|
46
|
+
* ? <CreateVestingButton />
|
|
47
|
+
* : <ApproveOperatorButton />; // wire to useEnsureOperator
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* After a successful {@link useEnsureOperator} / `setOperator` mutation,
|
|
51
|
+
* invalidate this query (its key starts with
|
|
52
|
+
* `["tokenops-sdk", "fhe", "isOperator", ...]`) or refetch it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function useIsOperator(options?: UseIsOperatorOptions): UseQueryResult<boolean, Error>;
|
|
@@ -3,9 +3,10 @@ import type { Encryptor } from "../fhe-vesting/encryption.js";
|
|
|
3
3
|
import { type EncryptorInitPhase, type SepoliaEncryptorLogger } from "./sepolia-encryptor.js";
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for {@link createSepoliaEncryptorWeb}. Minimal by design:
|
|
6
|
-
* the browser path doesn't expose
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* the browser path doesn't expose storage knobs (`RelayerWeb` already
|
|
7
|
+
* defaults to `IndexedDBStorage` for FHE artifact caching). Worker-pool
|
|
8
|
+
* sizing is the one opt-in performance knob — see `threads`; the default
|
|
9
|
+
* stays single-threaded so no special headers are required.
|
|
9
10
|
*/
|
|
10
11
|
export interface CreateSepoliaEncryptorWebOpts {
|
|
11
12
|
/** Viem `PublicClient` — used only to resolve the chain id for the
|
|
@@ -68,6 +69,20 @@ export interface CreateSepoliaEncryptorWebOpts {
|
|
|
68
69
|
* swallowed so a UI observer can never break encryption.
|
|
69
70
|
*/
|
|
70
71
|
onPhase?: (phase: EncryptorInitPhase) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Opt-in WASM worker-pool size for multi-threaded encryption (forwarded
|
|
74
|
+
* to `RelayerWeb`'s config). `4`–`8` gives ~2–3× faster encryption but
|
|
75
|
+
* requires the page to be **cross-origin isolated** — headers
|
|
76
|
+
* `Cross-Origin-Opener-Policy: same-origin` and
|
|
77
|
+
* `Cross-Origin-Embedder-Policy: require-corp` — without which browsers
|
|
78
|
+
* hide `SharedArrayBuffer` and encryption silently falls back to
|
|
79
|
+
* single-threaded. The SDK logs a loud warning when `threads > 1` is set
|
|
80
|
+
* on a non-isolated page.
|
|
81
|
+
*
|
|
82
|
+
* Omit for the default single-threaded worker — no special headers
|
|
83
|
+
* required.
|
|
84
|
+
*/
|
|
85
|
+
threads?: number;
|
|
71
86
|
}
|
|
72
87
|
/**
|
|
73
88
|
* Returned by {@link createSepoliaEncryptorWeb}. Same structural
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var chunkOL6SHN3D_cjs = require('../../chunk-OL6SHN3D.cjs');
|
|
4
|
+
require('../../chunk-LBWRFZR3.cjs');
|
|
5
5
|
require('../../chunk-FWHYQZ5E.cjs');
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-
|
|
8
|
-
require('../../chunk-
|
|
6
|
+
require('../../chunk-43RFBQ73.cjs');
|
|
7
|
+
require('../../chunk-WUXUWTFW.cjs');
|
|
8
|
+
require('../../chunk-VR3FREBX.cjs');
|
|
9
|
+
require('../../chunk-2RNW4MIJ.cjs');
|
|
9
10
|
require('../../chunk-VJKZWYYJ.cjs');
|
|
10
|
-
require('../../chunk-66IHPTOK.cjs');
|
|
11
|
-
require('../../chunk-67OV5CX2.cjs');
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
|
|
15
14
|
Object.defineProperty(exports, "ConfidentialAirdropFactoryAdvancedClient", {
|
|
16
15
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
16
|
+
get: function () { return chunkOL6SHN3D_cjs.ConfidentialAirdropFactoryAdvancedClient; }
|
|
18
17
|
});
|
|
19
18
|
Object.defineProperty(exports, "createConfidentialAirdropFactoryAdvancedClient", {
|
|
20
19
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
20
|
+
get: function () { return chunkOL6SHN3D_cjs.createConfidentialAirdropFactoryAdvancedClient; }
|
|
22
21
|
});
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export { ConfidentialAirdropFactoryAdvancedClient, createConfidentialAirdropFactoryAdvancedClient } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
1
|
+
export { ConfidentialAirdropFactoryAdvancedClient, createConfidentialAirdropFactoryAdvancedClient } from '../../chunk-KSDSXJ34.js';
|
|
2
|
+
import '../../chunk-UE5XK2SY.js';
|
|
3
3
|
import '../../chunk-7VELUOMI.js';
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
4
|
+
import '../../chunk-6WSNS3UV.js';
|
|
5
|
+
import '../../chunk-QKKBBH7I.js';
|
|
6
|
+
import '../../chunk-46T67CE2.js';
|
|
7
|
+
import '../../chunk-DRSPMIZ7.js';
|
|
7
8
|
import '../../chunk-Q2GP5UDC.js';
|
|
8
|
-
import '../../chunk-KWFFIJYX.js';
|
|
9
|
-
import '../../chunk-QBJ7O2B4.js';
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../../chunk-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
require('../../../chunk-
|
|
3
|
+
var chunkWO72UBQD_cjs = require('../../../chunk-WO72UBQD.cjs');
|
|
4
|
+
require('../../../chunk-SPGSO5SO.cjs');
|
|
5
|
+
var chunkOL6SHN3D_cjs = require('../../../chunk-OL6SHN3D.cjs');
|
|
6
|
+
var chunkLBWRFZR3_cjs = require('../../../chunk-LBWRFZR3.cjs');
|
|
7
|
+
require('../../../chunk-SYHNZSZZ.cjs');
|
|
8
8
|
require('../../../chunk-FWHYQZ5E.cjs');
|
|
9
|
-
require('../../../chunk-
|
|
10
|
-
var
|
|
11
|
-
require('../../../chunk-
|
|
9
|
+
require('../../../chunk-43RFBQ73.cjs');
|
|
10
|
+
var chunkWUXUWTFW_cjs = require('../../../chunk-WUXUWTFW.cjs');
|
|
11
|
+
require('../../../chunk-VR3FREBX.cjs');
|
|
12
|
+
require('../../../chunk-2RNW4MIJ.cjs');
|
|
12
13
|
require('../../../chunk-VJKZWYYJ.cjs');
|
|
13
|
-
require('../../../chunk-66IHPTOK.cjs');
|
|
14
|
-
require('../../../chunk-67OV5CX2.cjs');
|
|
15
14
|
var react = require('react');
|
|
16
15
|
var reactQuery = require('@tanstack/react-query');
|
|
17
16
|
var wagmi = require('wagmi');
|
|
@@ -24,22 +23,22 @@ function usePredictAirdropAddress(args = {}) {
|
|
|
24
23
|
...chainId !== void 0 ? { chainId } : {}
|
|
25
24
|
});
|
|
26
25
|
const resolvedChainId = chainId ?? resolvedPublicClient?.chain?.id;
|
|
27
|
-
const resolvedAddress = address ?? (resolvedChainId === void 0 ? void 0 :
|
|
26
|
+
const resolvedAddress = address ?? (resolvedChainId === void 0 ? void 0 : chunkWUXUWTFW_cjs.DEPLOYED_ADDRESSES.fheAirdrop?.confidentialAirdropFactory?.[resolvedChainId] ?? void 0);
|
|
28
27
|
const encryptorSourceRef = react.useRef(encryptor);
|
|
29
28
|
encryptorSourceRef.current = encryptor;
|
|
30
29
|
const client = react.useMemo(() => {
|
|
31
30
|
if (!resolvedPublicClient) return void 0;
|
|
32
31
|
if (!resolvedAddress) return void 0;
|
|
33
|
-
return
|
|
32
|
+
return chunkOL6SHN3D_cjs.createConfidentialAirdropFactoryAdvancedClient({
|
|
34
33
|
publicClient: resolvedPublicClient,
|
|
35
34
|
...walletClient ? { walletClient } : {},
|
|
36
35
|
address: resolvedAddress,
|
|
37
36
|
...resolvedChainId !== void 0 ? { chainId: resolvedChainId } : {},
|
|
38
|
-
encryptor: () =>
|
|
37
|
+
encryptor: () => chunkLBWRFZR3_cjs.resolveEncryptor(encryptorSourceRef.current)
|
|
39
38
|
});
|
|
40
39
|
}, [resolvedPublicClient, walletClient, resolvedAddress, resolvedChainId]);
|
|
41
40
|
return reactQuery.useQuery({
|
|
42
|
-
queryKey:
|
|
41
|
+
queryKey: chunkWO72UBQD_cjs.buildQueryKey(
|
|
43
42
|
"factory:predictAirdropAddress",
|
|
44
43
|
resolvedChainId,
|
|
45
44
|
resolvedAddress,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { buildQueryKey } from '../../../chunk-
|
|
2
|
-
import '../../../chunk-
|
|
3
|
-
import { createConfidentialAirdropFactoryAdvancedClient } from '../../../chunk-
|
|
4
|
-
import { resolveEncryptor } from '../../../chunk-
|
|
5
|
-
import '../../../chunk-
|
|
1
|
+
import { buildQueryKey } from '../../../chunk-CNP4L3GF.js';
|
|
2
|
+
import '../../../chunk-S2XD75JM.js';
|
|
3
|
+
import { createConfidentialAirdropFactoryAdvancedClient } from '../../../chunk-KSDSXJ34.js';
|
|
4
|
+
import { resolveEncryptor } from '../../../chunk-UE5XK2SY.js';
|
|
5
|
+
import '../../../chunk-YPYCWLYP.js';
|
|
6
6
|
import '../../../chunk-7VELUOMI.js';
|
|
7
|
-
import '../../../chunk-
|
|
8
|
-
import { DEPLOYED_ADDRESSES } from '../../../chunk-
|
|
9
|
-
import '../../../chunk-
|
|
7
|
+
import '../../../chunk-6WSNS3UV.js';
|
|
8
|
+
import { DEPLOYED_ADDRESSES } from '../../../chunk-QKKBBH7I.js';
|
|
9
|
+
import '../../../chunk-46T67CE2.js';
|
|
10
|
+
import '../../../chunk-DRSPMIZ7.js';
|
|
10
11
|
import '../../../chunk-Q2GP5UDC.js';
|
|
11
|
-
import '../../../chunk-KWFFIJYX.js';
|
|
12
|
-
import '../../../chunk-QBJ7O2B4.js';
|
|
13
12
|
import { useRef, useMemo } from 'react';
|
|
14
13
|
import { useQuery } from '@tanstack/react-query';
|
|
15
14
|
import { usePublicClient, useWalletClient } from 'wagmi';
|
|
@@ -241,6 +241,13 @@ export declare class ConfidentialAirdropClient {
|
|
|
241
241
|
*
|
|
242
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
243
|
*
|
|
244
|
+
* **An unfunded pool is the opposite case — it reverts loudly.** Do not
|
|
245
|
+
* generalize the silent-zero rule above to a clone whose pool was never
|
|
246
|
+
* funded: that claim throws {@link FheHandleNotAllowedError} (the FHEVM ACL
|
|
247
|
+
* rejects `FHE.allowTransient` on an uninitialized handle), and
|
|
248
|
+
* {@link preflightClaim} cannot detect it because the pool balance is an
|
|
249
|
+
* encrypted `euint64` the SDK cannot read in plaintext.
|
|
250
|
+
*
|
|
244
251
|
* @returns Transaction hash.
|
|
245
252
|
* @example
|
|
246
253
|
* const fee = await airdrop.gasFee();
|