@zama-fhe/sdk 3.7.0-beta.2 → 3.7.0-beta.3
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/dist/cjs/base-signer.cjs +1 -1
- package/dist/cjs/base-signer.cjs.map +1 -1
- package/dist/cjs/chains/index.cjs +1 -1
- package/dist/cjs/chains.cjs +1 -1
- package/dist/cjs/chains.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/esm/{base-signer-DIYZwDnc.d.ts → base-signer-D902THgk.d.ts} +2 -2
- package/dist/esm/base-signer-ws-wq22y.js +2 -0
- package/dist/esm/{base-signer-D5Cwv7yb.js.map → base-signer-ws-wq22y.js.map} +1 -1
- package/dist/esm/chains/index.d.ts +2 -2
- package/dist/esm/chains/index.js +1 -1
- package/dist/esm/{chains-ByyCdrrd.js → chains-iPpnjXql.js} +2 -2
- package/dist/esm/{chains-ByyCdrrd.js.map → chains-iPpnjXql.js.map} +1 -1
- package/dist/esm/cleartext/index.d.ts +2 -2
- package/dist/esm/{cleartext-3HOk1BAg.d.ts → cleartext-B6vrnBzO.d.ts} +2 -2
- package/dist/esm/ethers/index.d.ts +4 -4
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/{index-ijgDL4IC.d.ts → index-Cdbp_93f.d.ts} +24 -4
- package/dist/esm/{index-DJYq1rAB.d.ts → index-CnIEp8zv.d.ts} +1521 -1080
- package/dist/esm/{index-BHrjck_q.d.ts → index-CsuDB4UI.d.ts} +4 -4
- package/dist/esm/index.d.ts +99 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +5 -5
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/query/index.d.ts +4 -495
- package/dist/esm/{types-Bz5-wHPv.d.ts → types-Crf7ymyj.d.ts} +2 -2
- package/dist/esm/{types-v0_sfkli.d.ts → types-CuldbZne.d.ts} +3 -3
- package/dist/esm/{types-CI6BtpB7.d.ts → types-DnJSNoEC.d.ts} +3 -3
- package/dist/esm/vaults/index.d.ts +2 -3
- package/dist/esm/viem/index.d.ts +4 -4
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/web/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/esm/base-signer-D5Cwv7yb.js +0 -2
- package/dist/esm/invalidation-CJ-pzOUG.d.ts +0 -46
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as GenericSigner, O as WalletAccount, S as TransactionKind, St as WrapOptions, Tt as UnshieldCallbacks, _ as PrepareTransactionRequest, _t as ShieldOptions, bt as UnshieldOptions, c as GenericStorage, cn as EncryptedValue, dn as FhevmRelayerOptions, en as TransactionResult, g as PrepareOptions, i as ZamaConfig, l as GenericProvider, mn as RelayerSDK, nn as DecryptPublicValuesResult, o as ZamaConfigGeneric, on as EncryptParams, sn as EncryptResult, tn as ClearValue, v as PreparedFor, wt as TransferCallbacks, xt as UnwrapResult, yt as TransferOptions } from "./types-
|
|
3
|
-
import "./cleartext-
|
|
4
|
-
import "./types-
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import { Address,
|
|
1
|
+
import { p as FheChain } from "./index-Cdbp_93f.js";
|
|
2
|
+
import { D as GenericSigner, O as WalletAccount, S as TransactionKind, St as WrapOptions, Tt as UnshieldCallbacks, _ as PrepareTransactionRequest, _t as ShieldOptions, bt as UnshieldOptions, c as GenericStorage, cn as EncryptedValue, dn as FhevmRelayerOptions, en as TransactionResult, g as PrepareOptions, i as ZamaConfig, l as GenericProvider, mn as RelayerSDK, nn as DecryptPublicValuesResult, o as ZamaConfigGeneric, on as EncryptParams, sn as EncryptResult, tn as ClearValue, v as PreparedFor, wt as TransferCallbacks, xt as UnwrapResult, yt as TransferOptions } from "./types-Crf7ymyj.js";
|
|
3
|
+
import "./cleartext-B6vrnBzO.js";
|
|
4
|
+
import "./types-CuldbZne.js";
|
|
5
|
+
import "./types-DnJSNoEC.js";
|
|
6
|
+
import "./index-CsuDB4UI.js";
|
|
7
|
+
import { Address, Hex } from "viem";
|
|
8
8
|
import { z } from "zod/mini";
|
|
9
9
|
import { MutationFunctionContext, QueryKey, QueryObserverOptions, skipToken } from "@tanstack/query-core";
|
|
10
10
|
//#region src/config/create.d.ts
|
|
@@ -20683,1192 +20683,1504 @@ declare class Delegations {
|
|
|
20683
20683
|
}): Promise<DelegationStatus>;
|
|
20684
20684
|
}
|
|
20685
20685
|
//#endregion
|
|
20686
|
-
//#region src/
|
|
20686
|
+
//#region src/query/utils.d.ts
|
|
20687
|
+
/** Union of TanStack Query option keys stripped by {@link filterQueryOptions}, leaving only domain parameters. */
|
|
20688
|
+
type StrippedQueryOptionKeys = "gcTime" | "staleTime" | "enabled" | "select" | "refetchInterval" | "refetchOnMount" | "refetchOnWindowFocus" | "refetchOnReconnect" | "retry" | "retryDelay" | "retryOnMount" | "queryFn" | "queryKey" | "queryKeyHashFn" | "initialData" | "initialDataUpdatedAt" | "placeholderData" | "structuralSharing" | "throwOnError" | "meta" | "query" | "pollingInterval";
|
|
20687
20689
|
/**
|
|
20688
|
-
*
|
|
20689
|
-
*
|
|
20690
|
-
*
|
|
20691
|
-
*
|
|
20690
|
+
* Remove TanStack behavioral options from a query config object so only domain
|
|
20691
|
+
* parameters remain for the lower-level factory.
|
|
20692
|
+
*
|
|
20693
|
+
* @example
|
|
20694
|
+
* ```ts
|
|
20695
|
+
* const params = filterQueryOptions({
|
|
20696
|
+
* query: { enabled: false },
|
|
20697
|
+
* gcTime: 60_000,
|
|
20698
|
+
* owner: "0xabc",
|
|
20699
|
+
* });
|
|
20700
|
+
* // => { owner: "0xabc" }
|
|
20701
|
+
* ```
|
|
20692
20702
|
*/
|
|
20693
|
-
declare
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
|
|
20699
|
-
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
|
|
20703
|
-
|
|
20704
|
-
|
|
20705
|
-
|
|
20706
|
-
|
|
20707
|
-
|
|
20708
|
-
|
|
20709
|
-
|
|
20710
|
-
|
|
20711
|
-
|
|
20712
|
-
|
|
20713
|
-
|
|
20714
|
-
|
|
20715
|
-
|
|
20716
|
-
|
|
20717
|
-
|
|
20718
|
-
/**
|
|
20719
|
-
|
|
20720
|
-
|
|
20721
|
-
|
|
20722
|
-
*
|
|
20723
|
-
* Not a `prepare()` transaction kind: a permit is not a transaction —
|
|
20724
|
-
* nothing is broadcast, and registering the signature is a local operation,
|
|
20725
|
-
* not a relayer round-trip.
|
|
20726
|
-
*
|
|
20727
|
-
* Signer-optional, like {@link prepare}: `request.signer` is an explicit
|
|
20728
|
-
* address, not a connected wallet account. Building the typed data still
|
|
20729
|
-
* reads the chain's KMS signers context on-chain — signer-offline, not
|
|
20730
|
-
* network-offline.
|
|
20731
|
-
*
|
|
20732
|
-
* One permit per call: unlike `sdk.permits.grantPermit`, this never widens
|
|
20733
|
-
* an existing permit or chunks over 10 contracts — `request.contracts` maps
|
|
20734
|
-
* to exactly one signature.
|
|
20735
|
-
*
|
|
20736
|
-
* @throws if `request.contracts` is empty or exceeds 10 addresses, `request.delegator`
|
|
20737
|
-
* equals `request.signer`, or `request.durationDays` exceeds the V1 permit maximum
|
|
20738
|
-
* of 365 days. {@link ConfigurationError}
|
|
20739
|
-
* @throws if a concurrent `permits.revokeTransportKeyPair()` rotates the transport key
|
|
20740
|
-
* pair while this call is generating one. {@link TransportKeyPairChangedError}
|
|
20741
|
-
*/
|
|
20742
|
-
preparePermit(request: PreparePermitRequest): Promise<PreparedPermit>;
|
|
20703
|
+
declare function filterQueryOptions<TOptions extends Record<string, unknown>>(options: TOptions): Omit<TOptions, StrippedQueryOptionKeys>;
|
|
20704
|
+
/**
|
|
20705
|
+
* Stable hash function for query keys.
|
|
20706
|
+
* Sorts object keys recursively and converts bigint values to strings.
|
|
20707
|
+
*
|
|
20708
|
+
* @remarks
|
|
20709
|
+
* bigint values are serialized as decimal strings, so `42n` and `"42"` hash to
|
|
20710
|
+
* the same token when they occupy the same position. This collision is accepted
|
|
20711
|
+
* by design for the current query-key conventions in this package.
|
|
20712
|
+
*/
|
|
20713
|
+
declare function hashFn(queryKey: readonly unknown[]): string;
|
|
20714
|
+
//#endregion
|
|
20715
|
+
//#region src/query/factory-types.d.ts
|
|
20716
|
+
/**
|
|
20717
|
+
* TanStack Query options object returned by the SDK's `*QueryOptions` factories:
|
|
20718
|
+
* `QueryObserverOptions` with `queryKey` and `queryFn` required and the
|
|
20719
|
+
* cache-internal keys (`queryHash`, `queryKeyHashFn`, `throwOnError`) removed.
|
|
20720
|
+
*/
|
|
20721
|
+
type QueryFactoryOptions<TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<Omit<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, "queryKey"> & Required<Pick<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, "queryKey">>, "queryFn" | "queryHash" | "queryKeyHashFn" | "throwOnError"> & {
|
|
20722
|
+
queryFn: Exclude<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>["queryFn"], typeof skipToken | undefined>;
|
|
20723
|
+
};
|
|
20724
|
+
/** TanStack Query mutation options object returned by the SDK's `*MutationOptions` factories. */
|
|
20725
|
+
interface MutationFactoryOptions<TMutationKey extends readonly unknown[], TVariables, TData, TOnMutateResult = unknown> {
|
|
20726
|
+
/** Cache key identifying the mutation. */
|
|
20727
|
+
mutationKey: TMutationKey;
|
|
20728
|
+
/** Runs the mutation for the given variables. */
|
|
20729
|
+
mutationFn: (variables: TVariables) => Promise<TData>;
|
|
20730
|
+
/** Optional callback invoked after the mutation succeeds. */
|
|
20731
|
+
onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => void;
|
|
20743
20732
|
}
|
|
20744
20733
|
//#endregion
|
|
20745
|
-
//#region src/
|
|
20746
|
-
/**
|
|
20747
|
-
interface
|
|
20748
|
-
/**
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
|
|
20763
|
-
|
|
20764
|
-
|
|
20734
|
+
//#region src/query/signer-query-context.d.ts
|
|
20735
|
+
/** Connected-wallet context threaded into query factories to scope cache keys and gate signer-dependent queries. */
|
|
20736
|
+
interface SignerQueryContext {
|
|
20737
|
+
/** Connected wallet account; queries that need a signer stay disabled until it is set. */
|
|
20738
|
+
walletAccount?: WalletAccount;
|
|
20739
|
+
}
|
|
20740
|
+
//#endregion
|
|
20741
|
+
//#region src/query/query-keys.d.ts
|
|
20742
|
+
/**
|
|
20743
|
+
* Canonical query-key namespace for `@zama-fhe/sdk/query`.
|
|
20744
|
+
*
|
|
20745
|
+
* @example
|
|
20746
|
+
* ```ts
|
|
20747
|
+
* queryClient.invalidateQueries({
|
|
20748
|
+
* queryKey: zamaQueryKeys.confidentialBalance.token("0xToken"),
|
|
20749
|
+
* });
|
|
20750
|
+
* ```
|
|
20751
|
+
*/
|
|
20752
|
+
declare const zamaQueryKeys: {
|
|
20753
|
+
readonly confidentialBalance: {
|
|
20754
|
+
readonly all: readonly ["zama.confidentialBalance"];
|
|
20755
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.confidentialBalance", {
|
|
20756
|
+
readonly tokenAddress: `0x${string}`;
|
|
20757
|
+
}];
|
|
20758
|
+
readonly owner: (tokenAddress: Address, owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalance", {
|
|
20759
|
+
readonly owner?: `0x${string}` | undefined;
|
|
20760
|
+
readonly walletAddress: `0x${string}`;
|
|
20761
|
+
readonly walletChainId: number;
|
|
20762
|
+
readonly tokenAddress: `0x${string}`;
|
|
20763
|
+
} | {
|
|
20764
|
+
readonly owner?: `0x${string}` | undefined;
|
|
20765
|
+
readonly walletAddress?: undefined;
|
|
20766
|
+
readonly walletChainId?: undefined;
|
|
20767
|
+
readonly tokenAddress: `0x${string}`;
|
|
20768
|
+
}];
|
|
20769
|
+
};
|
|
20770
|
+
readonly confidentialBalances: {
|
|
20771
|
+
readonly all: readonly ["zama.confidentialBalances"];
|
|
20772
|
+
readonly tokens: (tokenAddresses: Address[], owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalances", {
|
|
20773
|
+
readonly owner?: `0x${string}` | undefined;
|
|
20774
|
+
readonly walletAddress: `0x${string}`;
|
|
20775
|
+
readonly walletChainId: number;
|
|
20776
|
+
readonly tokenAddresses: `0x${string}`[];
|
|
20777
|
+
} | {
|
|
20778
|
+
readonly owner?: `0x${string}` | undefined;
|
|
20779
|
+
readonly walletAddress?: undefined;
|
|
20780
|
+
readonly walletChainId?: undefined;
|
|
20781
|
+
readonly tokenAddresses: `0x${string}`[];
|
|
20782
|
+
}];
|
|
20783
|
+
};
|
|
20784
|
+
readonly tokenMetadata: {
|
|
20785
|
+
readonly all: readonly ["zama.tokenMetadata"];
|
|
20786
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.tokenMetadata", {
|
|
20787
|
+
readonly tokenAddress: `0x${string}`;
|
|
20788
|
+
}];
|
|
20789
|
+
};
|
|
20790
|
+
readonly isConfidential: {
|
|
20791
|
+
readonly all: readonly ["zama.isConfidential"];
|
|
20792
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.isConfidential", {
|
|
20793
|
+
readonly tokenAddress: `0x${string}`;
|
|
20794
|
+
}];
|
|
20795
|
+
};
|
|
20796
|
+
readonly isWrapper: {
|
|
20797
|
+
readonly all: readonly ["zama.isWrapper"];
|
|
20798
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.isWrapper", {
|
|
20799
|
+
readonly tokenAddress: `0x${string}`;
|
|
20800
|
+
}];
|
|
20801
|
+
};
|
|
20802
|
+
readonly wrapperDiscovery: {
|
|
20803
|
+
readonly all: readonly ["zama.wrapperDiscovery"];
|
|
20804
|
+
readonly token: (tokenAddress?: Address, erc20Address?: Address, registryAddress?: Address) => readonly ["zama.wrapperDiscovery", {
|
|
20805
|
+
readonly registryAddress?: `0x${string}` | undefined;
|
|
20806
|
+
readonly erc20Address?: `0x${string}` | undefined;
|
|
20807
|
+
readonly tokenAddress?: `0x${string}` | undefined;
|
|
20808
|
+
}];
|
|
20809
|
+
};
|
|
20810
|
+
readonly underlyingAllowance: {
|
|
20811
|
+
readonly all: readonly ["zama.underlyingAllowance"];
|
|
20812
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.underlyingAllowance", {
|
|
20813
|
+
readonly tokenAddress: `0x${string}`;
|
|
20814
|
+
}];
|
|
20815
|
+
readonly scope: (tokenAddress: Address, owner?: Address) => readonly ["zama.underlyingAllowance", {
|
|
20816
|
+
readonly owner?: `0x${string}` | undefined;
|
|
20817
|
+
readonly tokenAddress: `0x${string}`;
|
|
20818
|
+
}];
|
|
20819
|
+
};
|
|
20820
|
+
readonly confidentialIsOperator: {
|
|
20821
|
+
readonly all: readonly ["zama.confidentialIsOperator"];
|
|
20822
|
+
readonly token: (tokenAddress?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
20823
|
+
tokenAddress: `0x${string}`;
|
|
20824
|
+
} | {
|
|
20825
|
+
tokenAddress?: undefined;
|
|
20826
|
+
}];
|
|
20827
|
+
readonly scope: (tokenAddress?: Address, holder?: Address, spender?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
20828
|
+
readonly spender?: `0x${string}` | undefined;
|
|
20829
|
+
readonly holder?: `0x${string}` | undefined;
|
|
20830
|
+
readonly tokenAddress?: `0x${string}` | undefined;
|
|
20831
|
+
}];
|
|
20832
|
+
};
|
|
20833
|
+
readonly totalSupply: {
|
|
20834
|
+
readonly all: readonly ["zama.totalSupply"];
|
|
20835
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.totalSupply", {
|
|
20836
|
+
readonly tokenAddress: `0x${string}`;
|
|
20837
|
+
}];
|
|
20838
|
+
};
|
|
20839
|
+
readonly pendingUnshield: {
|
|
20840
|
+
readonly all: readonly ["zama.pendingUnshield"];
|
|
20841
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.pendingUnshield", {
|
|
20842
|
+
readonly tokenAddress: `0x${string}`;
|
|
20843
|
+
}];
|
|
20844
|
+
};
|
|
20845
|
+
readonly hasPermit: {
|
|
20846
|
+
readonly all: readonly ["zama.hasPermit"];
|
|
20847
|
+
readonly scope: (contractAddresses: Address[], walletAccount?: WalletAccount) => readonly ["zama.hasPermit", {
|
|
20848
|
+
readonly contractAddresses: `0x${string}`[];
|
|
20849
|
+
readonly walletAddress: `0x${string}`;
|
|
20850
|
+
readonly walletChainId: number;
|
|
20851
|
+
} | {
|
|
20852
|
+
readonly contractAddresses: `0x${string}`[];
|
|
20853
|
+
readonly walletAddress?: undefined;
|
|
20854
|
+
readonly walletChainId?: undefined;
|
|
20855
|
+
}];
|
|
20856
|
+
};
|
|
20857
|
+
readonly delegationStatus: {
|
|
20858
|
+
readonly all: readonly ["zama.delegationStatus"];
|
|
20859
|
+
readonly contract: (contractAddress?: Address) => readonly ["zama.delegationStatus", {
|
|
20860
|
+
contractAddress: `0x${string}`;
|
|
20861
|
+
} | {
|
|
20862
|
+
contractAddress?: undefined;
|
|
20863
|
+
}];
|
|
20864
|
+
readonly scope: (contractAddress?: Address, delegator?: Address, delegate?: Address) => readonly ["zama.delegationStatus", {
|
|
20865
|
+
readonly delegateAddress?: `0x${string}` | undefined;
|
|
20866
|
+
readonly delegatorAddress?: `0x${string}` | undefined;
|
|
20867
|
+
readonly contractAddress?: `0x${string}` | undefined;
|
|
20868
|
+
}];
|
|
20869
|
+
};
|
|
20870
|
+
readonly decryption: {
|
|
20871
|
+
readonly all: readonly ["zama.decryption"];
|
|
20872
|
+
readonly encryptedValue: (encryptedValue: string, contractAddress?: Address) => readonly ["zama.decryption", {
|
|
20873
|
+
readonly contractAddress?: `0x${string}` | undefined;
|
|
20874
|
+
readonly encryptedValue: string;
|
|
20875
|
+
}];
|
|
20876
|
+
readonly encryptedInputs: (encryptedInputs: readonly {
|
|
20877
|
+
encryptedValue: string;
|
|
20878
|
+
contractAddress: Address;
|
|
20879
|
+
}[], walletAccount?: WalletAccount) => readonly ["zama.decryption", {
|
|
20880
|
+
readonly encryptedInputs: {
|
|
20881
|
+
encryptedValue: Hex;
|
|
20882
|
+
contractAddress: `0x${string}`;
|
|
20883
|
+
}[];
|
|
20884
|
+
readonly walletAddress: `0x${string}`;
|
|
20885
|
+
readonly walletChainId: number;
|
|
20886
|
+
} | {
|
|
20887
|
+
readonly encryptedInputs: {
|
|
20888
|
+
encryptedValue: Hex;
|
|
20889
|
+
contractAddress: `0x${string}`;
|
|
20890
|
+
}[];
|
|
20891
|
+
readonly walletAddress?: undefined;
|
|
20892
|
+
readonly walletChainId?: undefined;
|
|
20893
|
+
}];
|
|
20894
|
+
};
|
|
20895
|
+
readonly wrappersRegistry: {
|
|
20896
|
+
readonly all: readonly ["zama.wrappersRegistry"];
|
|
20897
|
+
readonly chainId: () => readonly ["zama.wrappersRegistry", {
|
|
20898
|
+
readonly type: "chainId";
|
|
20899
|
+
}];
|
|
20900
|
+
readonly tokenPairs: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
20901
|
+
readonly type: "tokenPairs";
|
|
20902
|
+
readonly registryAddress: `0x${string}`;
|
|
20903
|
+
}];
|
|
20904
|
+
readonly confidentialTokenAddress: (registryAddress: Address, tokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
20905
|
+
readonly type: "confidentialTokenAddress";
|
|
20906
|
+
readonly registryAddress: `0x${string}`;
|
|
20907
|
+
readonly tokenAddress: `0x${string}`;
|
|
20908
|
+
}];
|
|
20909
|
+
readonly tokenAddress: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
20910
|
+
readonly type: "tokenAddress";
|
|
20911
|
+
readonly registryAddress: `0x${string}`;
|
|
20912
|
+
readonly confidentialTokenAddress: `0x${string}`;
|
|
20913
|
+
}];
|
|
20914
|
+
readonly tokenPairsLength: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
20915
|
+
readonly type: "tokenPairsLength";
|
|
20916
|
+
readonly registryAddress: `0x${string}`;
|
|
20917
|
+
}];
|
|
20918
|
+
readonly tokenPairsSlice: (registryAddress: Address, fromIndex: string, toIndex: string) => readonly ["zama.wrappersRegistry", {
|
|
20919
|
+
readonly type: "tokenPairsSlice";
|
|
20920
|
+
readonly registryAddress: `0x${string}`;
|
|
20921
|
+
readonly fromIndex: string;
|
|
20922
|
+
readonly toIndex: string;
|
|
20923
|
+
}];
|
|
20924
|
+
readonly tokenPair: (registryAddress: Address, index: string) => readonly ["zama.wrappersRegistry", {
|
|
20925
|
+
readonly type: "tokenPair";
|
|
20926
|
+
readonly registryAddress: `0x${string}`;
|
|
20927
|
+
readonly index: string;
|
|
20928
|
+
}];
|
|
20929
|
+
readonly isConfidentialTokenValid: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
20930
|
+
readonly type: "isConfidentialTokenValid";
|
|
20931
|
+
readonly registryAddress: `0x${string}`;
|
|
20932
|
+
readonly confidentialTokenAddress: `0x${string}`;
|
|
20933
|
+
}];
|
|
20934
|
+
readonly listPairs: (registryAddress: Address, page: number, pageSize: number, metadata: boolean) => readonly ["zama.wrappersRegistry", {
|
|
20935
|
+
readonly type: "listPairs";
|
|
20936
|
+
readonly registryAddress: `0x${string}`;
|
|
20937
|
+
readonly page: number;
|
|
20938
|
+
readonly pageSize: number;
|
|
20939
|
+
readonly metadata: boolean;
|
|
20940
|
+
}];
|
|
20941
|
+
};
|
|
20942
|
+
};
|
|
20943
|
+
//#endregion
|
|
20944
|
+
//#region src/query/invalidation.d.ts
|
|
20945
|
+
/** Minimal query shape read by the invalidation predicates. */
|
|
20946
|
+
interface QueryLike {
|
|
20947
|
+
/** The query's cache key. */
|
|
20948
|
+
queryKey: readonly unknown[];
|
|
20949
|
+
}
|
|
20950
|
+
/** Minimal filter shape accepted by the invalidation helpers, matching TanStack Query's `QueryFilters`. */
|
|
20951
|
+
interface QueryFilterLike {
|
|
20952
|
+
/** Match queries whose key starts with this prefix. */
|
|
20953
|
+
queryKey?: readonly unknown[];
|
|
20954
|
+
/** Match queries for which this returns `true`. */
|
|
20955
|
+
predicate?: (query: QueryLike) => boolean;
|
|
20956
|
+
}
|
|
20957
|
+
/** Minimal `QueryClient` surface used by the invalidation helpers. */
|
|
20958
|
+
interface QueryClientLike {
|
|
20959
|
+
/** Mark matching queries stale so they refetch. */
|
|
20960
|
+
invalidateQueries(filters: QueryFilterLike): void | Promise<void>;
|
|
20961
|
+
/** Remove matching queries from the cache entirely. */
|
|
20962
|
+
removeQueries(filters: QueryFilterLike): void;
|
|
20963
|
+
}
|
|
20964
|
+
/** Invalidates the caches affected by an unwrap: confidential balances, underlying allowance, and pending unshields. */
|
|
20965
|
+
declare function invalidateAfterUnwrap(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20966
|
+
/** Invalidates the caches affected by a wrap: confidential balances and underlying allowance. */
|
|
20967
|
+
declare function invalidateAfterWrap(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20968
|
+
/** Invalidates the confidential balance queries for a token (single-token and batched). */
|
|
20969
|
+
declare function invalidateBalanceQueries(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20970
|
+
/** Invalidates the caches affected by a shield: confidential balances and underlying allowance. */
|
|
20971
|
+
declare function invalidateAfterShield(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20972
|
+
/** Invalidates the caches affected by an unshield request: confidential balances, underlying allowance, and pending unshields. */
|
|
20973
|
+
declare function invalidateAfterUnshield(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20974
|
+
/** Invalidates the pending-unshield cache once an unshield has settled on-chain. */
|
|
20975
|
+
declare function invalidateAfterUnshieldSettled(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20976
|
+
/** Invalidates the confidential balance caches affected by a transfer. */
|
|
20977
|
+
declare function invalidateAfterTransfer(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20978
|
+
/** Invalidates the underlying-allowance cache after approving the underlying ERC-20. */
|
|
20979
|
+
declare function invalidateAfterApproveUnderlying(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20980
|
+
/** Invalidates the operator-status cache after changing a token operator. */
|
|
20981
|
+
declare function invalidateAfterSetOperator(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
20982
|
+
/** Invalidates any wagmi `useBalance`/`readContract` balance queries so ERC-20 balances refresh. */
|
|
20983
|
+
declare function invalidateWagmiBalanceQueries(queryClient: QueryClientLike): void;
|
|
20984
|
+
/** Clears wallet-local caches (decryption, permits) and invalidates all Zama queries — call on wallet connect/disconnect so a stale entitlement can't leak across accounts. */
|
|
20985
|
+
declare function invalidateWalletLifecycleQueries(queryClient: QueryClientLike): void;
|
|
20986
|
+
//#endregion
|
|
20987
|
+
//#region src/query/token-metadata.d.ts
|
|
20988
|
+
/** ERC-20 token metadata returned by {@link tokenMetadataQueryOptions}. */
|
|
20989
|
+
interface TokenMetadata {
|
|
20990
|
+
/** Human-readable token name. */
|
|
20991
|
+
name: string;
|
|
20992
|
+
/** Token ticker symbol. */
|
|
20993
|
+
symbol: string;
|
|
20994
|
+
/** Number of decimals the token uses. */
|
|
20995
|
+
decimals: number;
|
|
20996
|
+
}
|
|
20997
|
+
/** Configuration for {@link tokenMetadataQueryOptions}. */
|
|
20998
|
+
interface TokenMetadataQueryConfig {
|
|
20999
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21000
|
+
query?: Record<string, unknown>;
|
|
20765
21001
|
}
|
|
20766
|
-
/**
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
|
|
20771
|
-
|
|
21002
|
+
/** Builds TanStack Query options for reading an ERC-20 token's name, symbol, and decimals. */
|
|
21003
|
+
declare function tokenMetadataQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: TokenMetadataQueryConfig): QueryFactoryOptions<TokenMetadata, Error, TokenMetadata, ReturnType<typeof zamaQueryKeys.tokenMetadata.token>>;
|
|
21004
|
+
//#endregion
|
|
21005
|
+
//#region src/query/is-confidential.d.ts
|
|
21006
|
+
/** Configuration for {@link isConfidentialQueryOptions} and {@link isWrapperQueryOptions}. */
|
|
21007
|
+
interface IsConfidentialQueryConfig {
|
|
21008
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21009
|
+
query?: Record<string, unknown>;
|
|
21010
|
+
}
|
|
21011
|
+
/** Builds TanStack Query options for reading whether a token address implements the confidential (ERC-7984) token interface. */
|
|
21012
|
+
declare function isConfidentialQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isConfidential.token>>;
|
|
21013
|
+
/** Builds TanStack Query options for reading whether a token address is a confidential wrapper (ERC-7984 wrapper) contract. */
|
|
21014
|
+
declare function isWrapperQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isWrapper.token>>;
|
|
21015
|
+
//#endregion
|
|
21016
|
+
//#region src/query/total-supply.d.ts
|
|
21017
|
+
/** Configuration for {@link totalSupplyQueryOptions}. */
|
|
21018
|
+
interface TotalSupplyQueryConfig {
|
|
21019
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21020
|
+
query?: Record<string, unknown>;
|
|
20772
21021
|
}
|
|
21022
|
+
/** Builds TanStack Query options for reading a token's total supply. */
|
|
21023
|
+
declare function totalSupplyQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: TotalSupplyQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.totalSupply.token>>;
|
|
21024
|
+
//#endregion
|
|
21025
|
+
//#region src/wrappers-registry.d.ts
|
|
20773
21026
|
/**
|
|
20774
|
-
*
|
|
20775
|
-
*
|
|
20776
|
-
* familiar ERC-20-like methods.
|
|
20777
|
-
*
|
|
20778
|
-
* For ERC-7984 wrappers (shield/unshield), use {@link WrappedToken} instead —
|
|
20779
|
-
* it extends `Token` with wrapper-specific operations.
|
|
21027
|
+
* Default wrappers registry addresses for known chains.
|
|
21028
|
+
* Only includes chains where a registry is deployed (excludes Hardhat).
|
|
20780
21029
|
*
|
|
20781
|
-
*
|
|
20782
|
-
*
|
|
20783
|
-
* that delegate to `sdk.decryption.decryptValues` and `sdk.permits.grantPermit`.
|
|
21030
|
+
* @deprecated Read `registryAddress` from the chain presets instead (e.g.
|
|
21031
|
+
* `sepolia.registryAddress`). Will be removed in the next major version.
|
|
20784
21032
|
*/
|
|
20785
|
-
declare
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
readonly address: Address;
|
|
20791
|
-
constructor(sdk: ZamaSDK, address: Address);
|
|
20792
|
-
/** Read the token name from the contract. */
|
|
20793
|
-
name(): Promise<string>;
|
|
20794
|
-
/** Read the token symbol from the contract. */
|
|
20795
|
-
symbol(): Promise<string>;
|
|
20796
|
-
/** Read the token decimals from the contract. */
|
|
20797
|
-
decimals(): Promise<number>;
|
|
20798
|
-
/**
|
|
20799
|
-
* ERC-165 check for {@link ERC7984_INTERFACE_ID} support.
|
|
20800
|
-
*
|
|
20801
|
-
* @returns `true` if the contract implements the ERC-7984 confidential token interface.
|
|
20802
|
-
*/
|
|
20803
|
-
isConfidential(): Promise<boolean>;
|
|
20804
|
-
/**
|
|
20805
|
-
* ERC-165 check for IERC7984ERC20Wrapper support.
|
|
20806
|
-
*
|
|
20807
|
-
* @returns `true` if the contract implements the ERC-7984 wrapper interface
|
|
20808
|
-
* ({@link ERC7984_WRAPPER_INTERFACE_ID}, `0x1f1c62b2`).
|
|
20809
|
-
*/
|
|
20810
|
-
isWrapper(): Promise<boolean>;
|
|
20811
|
-
/**
|
|
20812
|
-
* Decrypt and return the plaintext balance for the given owner.
|
|
20813
|
-
* Acquires FHE credentials via a wallet signature if none are cached.
|
|
20814
|
-
*
|
|
20815
|
-
* @param owner - Balance owner address.
|
|
20816
|
-
* @returns The decrypted plaintext balance as a bigint.
|
|
20817
|
-
* @throws if FHE decryption fails. {@link DecryptionFailedError}
|
|
20818
|
-
*
|
|
20819
|
-
* @example
|
|
20820
|
-
* ```ts
|
|
20821
|
-
* const balance = await token.balanceOf("0xOwner");
|
|
20822
|
-
* ```
|
|
20823
|
-
*/
|
|
20824
|
-
balanceOf(owner: Address): Promise<bigint>;
|
|
21033
|
+
declare const DefaultRegistryAddresses: Record<number, Address>;
|
|
21034
|
+
/** Configuration for {@link WrappersRegistry}. */
|
|
21035
|
+
interface WrappersRegistryConfig {
|
|
21036
|
+
/** Read-only chain provider used for every registry lookup. */
|
|
21037
|
+
provider: GenericProvider;
|
|
20825
21038
|
/**
|
|
20826
|
-
*
|
|
20827
|
-
*
|
|
20828
|
-
*
|
|
20829
|
-
* @returns The encrypted balance as a hex string.
|
|
21039
|
+
* Per-chain registry address overrides, merged on top of
|
|
21040
|
+
* {@link DefaultRegistryAddresses}. Use this to supply a registry
|
|
21041
|
+
* address for custom or local chains (e.g. Hardhat).
|
|
20830
21042
|
*
|
|
20831
21043
|
* @example
|
|
20832
21044
|
* ```ts
|
|
20833
|
-
*
|
|
21045
|
+
* new WrappersRegistry({
|
|
21046
|
+
* provider,
|
|
21047
|
+
* registryAddresses: { [31337]: "0xYourHardhatRegistry" },
|
|
21048
|
+
* });
|
|
20834
21049
|
* ```
|
|
20835
21050
|
*/
|
|
20836
|
-
|
|
21051
|
+
registryAddresses?: Record<number, Address>;
|
|
20837
21052
|
/**
|
|
20838
|
-
*
|
|
20839
|
-
*
|
|
20840
|
-
* by the delegator to decrypt their balance.
|
|
20841
|
-
*
|
|
20842
|
-
* Clear values are cached in storage keyed by `(account, token, encryptedValue)`.
|
|
20843
|
-
* Because every on-chain balance change produces a new encrypted value,
|
|
20844
|
-
* stale cache entries are never served. Cache write failures are silently
|
|
20845
|
-
* ignored — they do not affect the returned value.
|
|
20846
|
-
*
|
|
20847
|
-
* @param delegatorAddress - The address of the account that delegated decryption rights.
|
|
20848
|
-
* @param accountAddress - The account whose on-chain balance to read. Defaults
|
|
20849
|
-
* to the delegator address.
|
|
20850
|
-
* @returns The decrypted plaintext balance as a bigint.
|
|
20851
|
-
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
20852
|
-
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
20853
|
-
* @throws if delegated decryption fails. {@link DecryptionFailedError}
|
|
20854
|
-
*
|
|
20855
|
-
* @example
|
|
20856
|
-
* ```ts
|
|
20857
|
-
* const balance = await token.decryptBalanceAs({
|
|
20858
|
-
* delegatorAddress: "0xDelegator",
|
|
20859
|
-
* });
|
|
20860
|
-
* ```
|
|
21053
|
+
* How long cached registry results remain valid, in seconds.
|
|
21054
|
+
* Default: `86400` (24 hours).
|
|
20861
21055
|
*/
|
|
20862
|
-
|
|
20863
|
-
|
|
20864
|
-
|
|
20865
|
-
|
|
21056
|
+
registryTTL?: number;
|
|
21057
|
+
}
|
|
21058
|
+
/** Options for {@link WrappersRegistry.listPairs}. */
|
|
21059
|
+
interface ListPairsOptions {
|
|
21060
|
+
/** Page number (1-indexed). Default: `1`. */
|
|
21061
|
+
page?: number;
|
|
21062
|
+
/** Number of items per page. Default: `100`. */
|
|
21063
|
+
pageSize?: number;
|
|
20866
21064
|
/**
|
|
20867
|
-
*
|
|
20868
|
-
*
|
|
20869
|
-
*
|
|
20870
|
-
* `sdk.decryption.decryptValues`.
|
|
20871
|
-
*
|
|
20872
|
-
* Tokens that fail to decrypt land in `errors`; the batch keeps going.
|
|
20873
|
-
*
|
|
20874
|
-
* @param tokens - Array of {@link Token} instances bound to the same SDK.
|
|
20875
|
-
* @param owner - Balance owner address.
|
|
20876
|
-
* @returns `{ results, errors }` partitioning the per-token outcomes.
|
|
20877
|
-
* @throws A failure that affects the whole session (rejected signature,
|
|
20878
|
-
* misconfiguration, RPC rate limit, key unwrapping failure, revoked KMS
|
|
20879
|
-
* context) rejects the call instead of landing in `errors`.
|
|
20880
|
-
*
|
|
20881
|
-
* @example
|
|
20882
|
-
* ```ts
|
|
20883
|
-
* const { results, errors } = await Token.batchBalancesOf(tokens, owner);
|
|
20884
|
-
* ```
|
|
21065
|
+
* When `true`, fetches on-chain metadata (name, symbol, decimals) for both
|
|
21066
|
+
* the ERC-20 and confidential token, plus totalSupply for the ERC-20.
|
|
21067
|
+
* Default: `false`.
|
|
20885
21068
|
*/
|
|
20886
|
-
|
|
21069
|
+
metadata?: boolean;
|
|
21070
|
+
}
|
|
21071
|
+
/**
|
|
21072
|
+
* High-level interface for the on-chain token wrappers registry.
|
|
21073
|
+
*
|
|
21074
|
+
* Uses the configured {@link GenericProvider} to resolve the correct registry
|
|
21075
|
+
* contract address for the current chain and exposes typed read helpers for
|
|
21076
|
+
* every registry query. Results are cached in memory with a configurable TTL
|
|
21077
|
+
* (default 24 hours).
|
|
21078
|
+
*
|
|
21079
|
+
* @example
|
|
21080
|
+
* ```ts
|
|
21081
|
+
* const registry = new WrappersRegistry({ provider });
|
|
21082
|
+
*
|
|
21083
|
+
* // Paginated listing
|
|
21084
|
+
* const page1 = await registry.listPairs({ page: 1, pageSize: 20 });
|
|
21085
|
+
*
|
|
21086
|
+
* // Structured lookups
|
|
21087
|
+
* const result = await registry.getConfidentialToken(erc20Address);
|
|
21088
|
+
* if (result) console.log(result.confidentialTokenAddress);
|
|
21089
|
+
*
|
|
21090
|
+
* // Force refresh
|
|
21091
|
+
* registry.refresh();
|
|
21092
|
+
* ```
|
|
21093
|
+
*/
|
|
21094
|
+
declare class WrappersRegistry {
|
|
21095
|
+
#private;
|
|
21096
|
+
/** Read-only chain access used for registry contract reads. */
|
|
21097
|
+
readonly provider: GenericProvider;
|
|
21098
|
+
constructor(config: WrappersRegistryConfig);
|
|
20887
21099
|
/**
|
|
20888
|
-
*
|
|
20889
|
-
*
|
|
20890
|
-
*
|
|
20891
|
-
* **Error handling:** If a per-token decryption fails and no `onError` callback
|
|
20892
|
-
* is provided, errors are collected and thrown as an aggregated
|
|
20893
|
-
* `DecryptionFailedError`. When the relayer returns no value for an encrypted value,
|
|
20894
|
-
* a `DecryptionFailedError` is thrown for that token (never silently returns `0n`).
|
|
20895
|
-
* Pass `onError: () => 0n` to opt into the silent zero behavior.
|
|
20896
|
-
*
|
|
20897
|
-
* @param tokens - Array of Token instances to decrypt balances for.
|
|
20898
|
-
* @param options - Delegated decryption configuration.
|
|
20899
|
-
* @returns A Map from token address to decrypted balance.
|
|
20900
|
-
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
20901
|
-
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
20902
|
-
* @throws if any decryption fails and no `onError` is provided. {@link DecryptionFailedError}
|
|
20903
|
-
* @throws A failure that affects the whole session (rejected signature, RPC
|
|
20904
|
-
* rate limit, revoked KMS context) rejects the call even when `onError` is
|
|
20905
|
-
* provided.
|
|
20906
|
-
*
|
|
20907
|
-
* @example
|
|
20908
|
-
* ```ts
|
|
20909
|
-
* const balances = await Token.batchDecryptBalancesAs(tokens, {
|
|
20910
|
-
* delegatorAddress: "0xDelegator",
|
|
20911
|
-
* onError: (err, addr) => { console.error(addr, err); return 0n; },
|
|
20912
|
-
* });
|
|
20913
|
-
* ```
|
|
21100
|
+
* Synchronous lookup of the registry address for a given chain ID.
|
|
21101
|
+
* Returns `undefined` if no address is configured for that chain.
|
|
20914
21102
|
*/
|
|
20915
|
-
|
|
20916
|
-
private static readBalanceHandlesBatch;
|
|
21103
|
+
getAddress(chainId: number): Address | undefined;
|
|
20917
21104
|
/**
|
|
20918
|
-
*
|
|
20919
|
-
*
|
|
20920
|
-
* By default, the SDK validates the confidential balance before submitting.
|
|
20921
|
-
* If a cached plaintext balance exists it is used; otherwise, if credentials
|
|
20922
|
-
* are cached, it decrypts on the fly. Set `skipBalanceCheck: true` to bypass
|
|
20923
|
-
* this validation (e.g. for smart wallets).
|
|
20924
|
-
*
|
|
20925
|
-
* @param to - Recipient address.
|
|
20926
|
-
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
20927
|
-
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
20928
|
-
* @returns The transaction hash and mined receipt.
|
|
20929
|
-
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
20930
|
-
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
20931
|
-
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
20932
|
-
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
20933
|
-
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
20934
|
-
*
|
|
20935
|
-
* @example
|
|
20936
|
-
* ```ts
|
|
20937
|
-
* const txHash = await token.confidentialTransfer("0xRecipient", 1000n);
|
|
20938
|
-
* ```
|
|
21105
|
+
* Force-invalidate the in-memory cache. The next call to any read method
|
|
21106
|
+
* will fetch fresh data from the chain.
|
|
20939
21107
|
*/
|
|
20940
|
-
|
|
21108
|
+
refresh(): void;
|
|
20941
21109
|
/**
|
|
20942
|
-
*
|
|
20943
|
-
*
|
|
20944
|
-
*
|
|
20945
|
-
* @param from - The address to transfer from (caller must be an approved operator).
|
|
20946
|
-
* @param to - Recipient address.
|
|
20947
|
-
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
20948
|
-
* @returns The transaction hash and mined receipt.
|
|
20949
|
-
*
|
|
20950
|
-
* @example
|
|
20951
|
-
* ```ts
|
|
20952
|
-
* const txHash = await token.confidentialTransferFrom("0xFrom", "0xTo", 500n);
|
|
20953
|
-
* ```
|
|
21110
|
+
* The cache TTL in milliseconds.
|
|
21111
|
+
* Exposed so query option factories can set a matching `staleTime`.
|
|
20954
21112
|
*/
|
|
20955
|
-
|
|
21113
|
+
get ttlMs(): number;
|
|
20956
21114
|
/**
|
|
20957
|
-
*
|
|
20958
|
-
* the recipient's receiver hook (`onConfidentialTransferReceived`) in a single
|
|
20959
|
-
* transaction. The caller crafts the opaque `data` payload — the SDK does not
|
|
20960
|
-
* encode, validate, or interpret it.
|
|
20961
|
-
*
|
|
20962
|
-
* Balance validation follows the same rules as {@link Token.confidentialTransfer}.
|
|
20963
|
-
*
|
|
20964
|
-
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
20965
|
-
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
20966
|
-
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
20967
|
-
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
20968
|
-
* @returns The transaction hash and mined receipt.
|
|
21115
|
+
* Resolve the registry contract address for the current chain.
|
|
20969
21116
|
*
|
|
20970
|
-
*
|
|
20971
|
-
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
20972
|
-
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
20973
|
-
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
20974
|
-
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
21117
|
+
* Priority: `registryAddresses[chainId]` \> built-in default.
|
|
20975
21118
|
*
|
|
20976
|
-
* @
|
|
20977
|
-
*
|
|
20978
|
-
* const txHash = await token.confidentialTransferAndCall(
|
|
20979
|
-
* "0xRecipient",
|
|
20980
|
-
* 1000n,
|
|
20981
|
-
* "0xabcd", // caller-encoded payload forwarded to the receiver hook
|
|
20982
|
-
* );
|
|
20983
|
-
* ```
|
|
21119
|
+
* @returns The registry contract address for the connected chain.
|
|
21120
|
+
* @throws if no address is configured for the chain. {@link ConfigurationError}
|
|
20984
21121
|
*/
|
|
20985
|
-
|
|
21122
|
+
getRegistryAddress(): Promise<Address>;
|
|
20986
21123
|
/**
|
|
20987
|
-
*
|
|
20988
|
-
* transfer that also invokes the recipient's receiver hook in a single
|
|
20989
|
-
* transaction. The caller must be an approved operator for `from` and crafts
|
|
20990
|
-
* the opaque `data` payload — the SDK does not encode or interpret it.
|
|
21124
|
+
* List token wrapper pairs with page-based pagination.
|
|
20991
21125
|
*
|
|
20992
|
-
*
|
|
20993
|
-
*
|
|
20994
|
-
* @param
|
|
20995
|
-
* @
|
|
20996
|
-
* @param callbacks - Optional progress callbacks.
|
|
20997
|
-
* @returns The transaction hash and mined receipt.
|
|
21126
|
+
* Internally maps to `getTokenConfidentialTokenPairsSlice` on-chain.
|
|
21127
|
+
*
|
|
21128
|
+
* @param options - Pagination and enrichment options.
|
|
21129
|
+
* @returns A {@link PaginatedResult} of pairs.
|
|
20998
21130
|
*
|
|
20999
21131
|
* @example
|
|
21000
21132
|
* ```ts
|
|
21001
|
-
* const
|
|
21002
|
-
*
|
|
21003
|
-
*
|
|
21004
|
-
*
|
|
21005
|
-
*
|
|
21006
|
-
* )
|
|
21133
|
+
* const result = await registry.listPairs({ page: 1, pageSize: 20 });
|
|
21134
|
+
* console.log(`${result.total} pairs, showing page ${result.page}`);
|
|
21135
|
+
*
|
|
21136
|
+
* // With on-chain metadata
|
|
21137
|
+
* const withMeta = await registry.listPairs({ metadata: true, pageSize: 10 });
|
|
21138
|
+
* for (const pair of withMeta.items) {
|
|
21139
|
+
* console.log(pair.underlying.symbol, "→", pair.confidential.symbol);
|
|
21140
|
+
* }
|
|
21007
21141
|
* ```
|
|
21008
21142
|
*/
|
|
21009
|
-
|
|
21143
|
+
listPairs(options: ListPairsOptions & {
|
|
21144
|
+
metadata: true;
|
|
21145
|
+
}): Promise<PaginatedResult<TokenWrapperPairWithMetadata>>;
|
|
21146
|
+
/** Lists registered underlying/confidential token pairs; pass `{ metadata: true }` to include on-chain token metadata. */
|
|
21147
|
+
listPairs(options?: ListPairsOptions): Promise<PaginatedResult<TokenWrapperPair>>;
|
|
21010
21148
|
/**
|
|
21011
|
-
*
|
|
21012
|
-
* Defaults to 1 hour from now if `until` is not specified.
|
|
21149
|
+
* Look up the confidential token for a given plain ERC-20 address.
|
|
21013
21150
|
*
|
|
21014
|
-
* @param
|
|
21015
|
-
* @
|
|
21016
|
-
*
|
|
21151
|
+
* @param tokenAddress - The plain ERC-20 token address.
|
|
21152
|
+
* @returns The lookup result, or `null` if the token has never been registered.
|
|
21153
|
+
* **Note:** revoked tokens (registered then invalidated) return a non-null result
|
|
21154
|
+
* with `isValid: false`. Check `result.isValid` explicitly rather than using
|
|
21155
|
+
* `if (result)` to guard against processing revoked tokens.
|
|
21017
21156
|
*
|
|
21018
21157
|
* @example
|
|
21019
21158
|
* ```ts
|
|
21020
|
-
* const
|
|
21159
|
+
* const result = await registry.getConfidentialToken(usdcAddress);
|
|
21160
|
+
* if (result?.isValid) {
|
|
21161
|
+
* console.log(result.confidentialTokenAddress);
|
|
21162
|
+
* }
|
|
21021
21163
|
* ```
|
|
21022
21164
|
*/
|
|
21023
|
-
|
|
21165
|
+
getConfidentialToken(tokenAddress: Address): Promise<{
|
|
21166
|
+
confidentialTokenAddress: Address;
|
|
21167
|
+
isValid: boolean;
|
|
21168
|
+
} | null>;
|
|
21024
21169
|
/**
|
|
21025
|
-
*
|
|
21170
|
+
* Reverse lookup — find the plain ERC-20 for a given confidential token.
|
|
21026
21171
|
*
|
|
21027
|
-
* @param
|
|
21028
|
-
* @
|
|
21029
|
-
* @returns `true` if the spender is an approved operator for the holder.
|
|
21172
|
+
* @param confidentialTokenAddress - The confidential token address.
|
|
21173
|
+
* @returns The lookup result, or `null` if no pair is registered.
|
|
21030
21174
|
*
|
|
21031
21175
|
* @example
|
|
21032
21176
|
* ```ts
|
|
21033
|
-
*
|
|
21034
|
-
*
|
|
21177
|
+
* const result = await registry.getUnderlyingToken(cUsdcAddress);
|
|
21178
|
+
* if (result) {
|
|
21179
|
+
* console.log(result.tokenAddress, result.isValid);
|
|
21035
21180
|
* }
|
|
21036
21181
|
* ```
|
|
21037
21182
|
*/
|
|
21038
|
-
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
}
|
|
21042
|
-
//#endregion
|
|
21043
|
-
//#region src/token/wrapped-token.d.ts
|
|
21044
|
-
/**
|
|
21045
|
-
* Confidential ERC-20 wrapper (ERC-7984 ERC20Wrapper).
|
|
21046
|
-
*
|
|
21047
|
-
* Extends {@link Token} with wrapper-specific operations:
|
|
21048
|
-
* - `shield` / `unshield` — convert between the underlying ERC-20 and confidential balance
|
|
21049
|
-
* - `unwrap` / `unwrapAll` / `finalizeUnwrap` — low-level two-phase primitives
|
|
21050
|
-
* - `underlying` / `allowance` — wrapper reads
|
|
21051
|
-
*
|
|
21052
|
-
* `WrappedToken.address` is the wrapper contract address itself — the wrapper
|
|
21053
|
-
* IS the confidential token.
|
|
21054
|
-
*/
|
|
21055
|
-
declare class WrappedToken extends Token {
|
|
21056
|
-
#private;
|
|
21183
|
+
getUnderlyingToken(confidentialTokenAddress: Address): Promise<{
|
|
21184
|
+
tokenAddress: Address;
|
|
21185
|
+
isValid: boolean;
|
|
21186
|
+
} | null>;
|
|
21057
21187
|
/**
|
|
21058
|
-
*
|
|
21188
|
+
* Fetch all token wrapper pairs from the registry.
|
|
21059
21189
|
*
|
|
21060
|
-
* @returns
|
|
21190
|
+
* @returns All registered `TokenWrapperPair` entries.
|
|
21061
21191
|
*/
|
|
21062
|
-
|
|
21192
|
+
getTokenPairs(): Promise<readonly TokenWrapperPair[]>;
|
|
21063
21193
|
/**
|
|
21064
|
-
*
|
|
21065
|
-
*
|
|
21066
|
-
*
|
|
21067
|
-
* go straight to the `approve` + `wrap` path without re-probing.
|
|
21194
|
+
* Get the total number of token wrapper pairs.
|
|
21195
|
+
*
|
|
21196
|
+
* @returns The count as a bigint.
|
|
21068
21197
|
*/
|
|
21069
|
-
|
|
21198
|
+
getTokenPairsLength(): Promise<bigint>;
|
|
21070
21199
|
/**
|
|
21071
|
-
*
|
|
21072
|
-
* underlying token.
|
|
21200
|
+
* Fetch a range of token wrapper pairs (paginated by index).
|
|
21073
21201
|
*
|
|
21074
|
-
* @param
|
|
21075
|
-
* @
|
|
21202
|
+
* @param fromIndex - Start index (inclusive).
|
|
21203
|
+
* @param toIndex - End index (exclusive).
|
|
21204
|
+
* @returns The slice of `TokenWrapperPair` entries.
|
|
21076
21205
|
*/
|
|
21077
|
-
|
|
21206
|
+
getTokenPairsSlice(fromIndex: bigint, toIndex: bigint): Promise<readonly TokenWrapperPair[]>;
|
|
21078
21207
|
/**
|
|
21079
|
-
*
|
|
21080
|
-
*
|
|
21081
|
-
* The execution path is decided automatically by ERC-165 introspection on
|
|
21082
|
-
* the underlying ERC-20:
|
|
21083
|
-
* - **`transferAndCall`** (single tx): when the underlying supports
|
|
21084
|
-
* ERC-1363, no approval is required — the wrapper's `onTransferReceived`
|
|
21085
|
-
* callback mints confidential tokens directly. `approvalStrategy` is
|
|
21086
|
-
* **ignored** on this path. See {@link ShieldPath}.
|
|
21087
|
-
* - **`approveAndWrap`** (two-tx fallback): otherwise, an `approve` is
|
|
21088
|
-
* followed by a `wrap`. Approval is controlled by `approvalStrategy`
|
|
21089
|
-
* (`"exact"` by default, `"max"` for unlimited, `"skip"` to opt out).
|
|
21090
|
-
*
|
|
21091
|
-
* The ERC-20 balance is validated before submitting (public read, no
|
|
21092
|
-
* signing required) so the call works for all wallet types, including
|
|
21093
|
-
* smart wallets.
|
|
21094
|
-
*
|
|
21095
|
-
* @param amount - The plaintext amount to shield.
|
|
21096
|
-
* @param options - Optional: `approvalStrategy`, `to`, callbacks.
|
|
21097
|
-
* @returns The transaction hash and mined receipt.
|
|
21098
|
-
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
21099
|
-
* @throws if the ERC-20 balance is less than `amount`. {@link InsufficientERC20BalanceError}
|
|
21100
|
-
* @throws if the ERC-20 approval or shield transaction reverts. {@link TransactionRevertedError}
|
|
21208
|
+
* Fetch a single token wrapper pair by index.
|
|
21101
21209
|
*
|
|
21102
|
-
* @
|
|
21103
|
-
*
|
|
21104
|
-
* const txHash = await wrappedToken.shield(1000n);
|
|
21105
|
-
* ```
|
|
21210
|
+
* @param index - Zero-based pair index.
|
|
21211
|
+
* @returns The `TokenWrapperPair` at that index.
|
|
21106
21212
|
*/
|
|
21107
|
-
|
|
21213
|
+
getTokenPair(index: bigint): Promise<TokenWrapperPair>;
|
|
21108
21214
|
/**
|
|
21109
|
-
*
|
|
21110
|
-
*
|
|
21111
|
-
* Escape hatch for splitting shield across two signatures: call
|
|
21112
|
-
* {@link approveUnderlying} first, then `wrap`. Most callers should use
|
|
21113
|
-
* {@link shield}, which routes and orchestrates approval automatically.
|
|
21114
|
-
*
|
|
21115
|
-
* Validates the ERC-20 balance and the allowance granted to this wrapper
|
|
21116
|
-
* (public reads, no signing) and fails early with a clear error.
|
|
21117
|
-
*
|
|
21118
|
-
* @param amount - The plaintext amount to wrap.
|
|
21119
|
-
* @param options - Optional `to` recipient and `onWrapSubmitted` callback.
|
|
21120
|
-
* @returns The transaction hash and mined receipt.
|
|
21121
|
-
* @throws if reading the ERC-20 balance or allowance fails. {@link ERC20ReadFailedError}
|
|
21122
|
-
* @throws if the ERC-20 balance is less than `amount`. {@link InsufficientERC20BalanceError}
|
|
21123
|
-
* @throws if the allowance granted to the wrapper is less than `amount`. {@link InsufficientAllowanceError}
|
|
21215
|
+
* Look up the confidential token address for a given plain ERC-20 token.
|
|
21124
21216
|
*
|
|
21125
|
-
* @
|
|
21126
|
-
*
|
|
21127
|
-
*
|
|
21128
|
-
*
|
|
21129
|
-
* ```
|
|
21217
|
+
* @param tokenAddress - The plain ERC-20 token address.
|
|
21218
|
+
* @returns A tuple `[isValid, confidentialTokenAddress]`. `isValid` is `true` only for a
|
|
21219
|
+
* registered, non-revoked wrapper. The address is the zero address when no pair is registered.
|
|
21220
|
+
* A non-zero address with `isValid=false` means the wrapper was registered but later revoked.
|
|
21130
21221
|
*/
|
|
21131
|
-
|
|
21222
|
+
getConfidentialTokenAddress(tokenAddress: Address): Promise<readonly [boolean, Address]>;
|
|
21132
21223
|
/**
|
|
21133
|
-
*
|
|
21134
|
-
* Defaults to max uint256. Resets to zero first if there's an existing
|
|
21135
|
-
* non-zero allowance (required by tokens like USDT).
|
|
21136
|
-
*
|
|
21137
|
-
* @param amount - Optional approval amount. Defaults to max uint256.
|
|
21138
|
-
* @returns The transaction hash and mined receipt.
|
|
21224
|
+
* Reverse lookup — find the plain ERC-20 for a given confidential token.
|
|
21139
21225
|
*
|
|
21140
|
-
* @
|
|
21141
|
-
*
|
|
21142
|
-
*
|
|
21143
|
-
*
|
|
21144
|
-
* ```
|
|
21226
|
+
* @param confidentialTokenAddress - The confidential token address.
|
|
21227
|
+
* @returns A tuple `[isValid, tokenAddress]`. `isValid` is `true` only for a registered,
|
|
21228
|
+
* non-revoked wrapper. The address is the zero address when no pair is registered.
|
|
21229
|
+
* A non-zero address with `isValid=false` means the wrapper was registered but later revoked.
|
|
21145
21230
|
*/
|
|
21146
|
-
|
|
21231
|
+
getTokenAddress(confidentialTokenAddress: Address): Promise<readonly [boolean, Address]>;
|
|
21147
21232
|
/**
|
|
21148
|
-
*
|
|
21149
|
-
* Orchestrates: unshield → wait for receipt → parse event → finalize.
|
|
21150
|
-
*
|
|
21151
|
-
* By default, the SDK validates the confidential balance before submitting.
|
|
21152
|
-
* Set `skipBalanceCheck: true` to bypass this validation (e.g. for smart wallets).
|
|
21153
|
-
*
|
|
21154
|
-
* @param amount - The plaintext amount to unshield.
|
|
21155
|
-
* @param options - Optional: `skipBalanceCheck` (default `false`), callbacks.
|
|
21156
|
-
* @returns The finalize transaction hash and mined receipt.
|
|
21233
|
+
* Check whether a confidential token is registered and valid.
|
|
21157
21234
|
*
|
|
21158
|
-
* @
|
|
21159
|
-
*
|
|
21160
|
-
* const txHash = await wrappedToken.unshield(500n);
|
|
21161
|
-
* ```
|
|
21235
|
+
* @param confidentialTokenAddress - The confidential token address to check.
|
|
21236
|
+
* @returns `true` if the token is a known valid wrapper in the registry.
|
|
21162
21237
|
*/
|
|
21163
|
-
|
|
21238
|
+
isConfidentialTokenValid(confidentialTokenAddress: Address): Promise<boolean>;
|
|
21239
|
+
}
|
|
21240
|
+
//#endregion
|
|
21241
|
+
//#region src/query/wrapper-discovery.d.ts
|
|
21242
|
+
/** Configuration for {@link wrapperDiscoveryQueryOptions}. */
|
|
21243
|
+
interface WrapperDiscoveryQueryConfig {
|
|
21164
21244
|
/**
|
|
21165
|
-
*
|
|
21166
|
-
*
|
|
21167
|
-
*
|
|
21168
|
-
|
|
21169
|
-
|
|
21170
|
-
|
|
21245
|
+
* Address of any confidential token you control.
|
|
21246
|
+
* Used to scope the query cache key and to gate whether the query
|
|
21247
|
+
* is enabled — it does not affect which wrapper the registry returns.
|
|
21248
|
+
*/
|
|
21249
|
+
tokenAddress?: Address;
|
|
21250
|
+
/**
|
|
21251
|
+
* The ERC-20 token address to discover the confidential wrapper for.
|
|
21252
|
+
* The registry is resolved automatically from chain config.
|
|
21253
|
+
*/
|
|
21254
|
+
erc20Address?: Address;
|
|
21255
|
+
/**
|
|
21256
|
+
* The resolved registry contract address for the current chain.
|
|
21257
|
+
* Included in the query key so that switching chains invalidates
|
|
21258
|
+
* stale cached results. Pass `undefined` when the chain ID is not
|
|
21259
|
+
* yet known — the query will be disabled.
|
|
21260
|
+
*/
|
|
21261
|
+
registryAddress?: Address;
|
|
21262
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21263
|
+
query?: Record<string, unknown>;
|
|
21264
|
+
}
|
|
21265
|
+
/** Builds TanStack Query options for discovering the confidential wrapper address for a given ERC-20 token (resolves to `null` when none is registered). */
|
|
21266
|
+
declare function wrapperDiscoveryQueryOptions(registry: WrappersRegistry, config: WrapperDiscoveryQueryConfig): QueryFactoryOptions<Address | null, Error, Address | null, ReturnType<typeof zamaQueryKeys.wrapperDiscovery.token>>;
|
|
21267
|
+
//#endregion
|
|
21268
|
+
//#region src/query/underlying-allowance.d.ts
|
|
21269
|
+
/** Configuration for {@link underlyingAllowanceQueryOptions}. */
|
|
21270
|
+
interface UnderlyingAllowanceQueryConfig {
|
|
21271
|
+
/** Owner whose underlying-token allowance to read; the query stays disabled until provided. */
|
|
21272
|
+
owner?: Address;
|
|
21273
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21274
|
+
query?: Record<string, unknown>;
|
|
21275
|
+
}
|
|
21276
|
+
/** Builds TanStack Query options for reading the ERC-20 allowance the owner has granted a confidential wrapper on its underlying token. */
|
|
21277
|
+
declare function underlyingAllowanceQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config: UnderlyingAllowanceQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.underlyingAllowance.scope>>;
|
|
21278
|
+
//#endregion
|
|
21279
|
+
//#region src/query/pending-unshield.d.ts
|
|
21280
|
+
/** Configuration for {@link pendingUnshieldQueryOptions}. */
|
|
21281
|
+
interface PendingUnshieldQueryConfig {
|
|
21282
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21283
|
+
query?: Record<string, unknown>;
|
|
21284
|
+
}
|
|
21285
|
+
/**
|
|
21286
|
+
* Query options for reading the unwrap tx hash of an unshield that was
|
|
21287
|
+
* interrupted between its two phases (returns `null` if none is pending).
|
|
21288
|
+
*
|
|
21289
|
+
* Backed by {@link ZamaSDK} storage via `WrappedToken.getPendingUnshield()`.
|
|
21290
|
+
* `staleTime: 0` so the value reflects storage on mount; the unshield/unwrap
|
|
21291
|
+
* mutations also invalidate this key on success.
|
|
21292
|
+
*/
|
|
21293
|
+
declare function pendingUnshieldQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: PendingUnshieldQueryConfig): QueryFactoryOptions<Hex | null, Error, Hex | null, ReturnType<typeof zamaQueryKeys.pendingUnshield.token>>;
|
|
21294
|
+
//#endregion
|
|
21295
|
+
//#region src/query/confidential-is-operator.d.ts
|
|
21296
|
+
/** Configuration for {@link confidentialIsOperatorQueryOptions}. */
|
|
21297
|
+
interface ConfidentialIsOperatorQueryConfig {
|
|
21298
|
+
/** Token holder whose operator authorization to check; the query stays disabled until provided. */
|
|
21299
|
+
holder?: Address;
|
|
21300
|
+
/** Spender address to check for operator authorization; the query stays disabled until provided. */
|
|
21301
|
+
spender?: Address;
|
|
21302
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21303
|
+
query?: Record<string, unknown>;
|
|
21304
|
+
}
|
|
21305
|
+
/** Builds TanStack Query options for reading whether a spender is an authorized operator of a holder on a confidential token. */
|
|
21306
|
+
declare function confidentialIsOperatorQueryOptions(sdk: ZamaSDK, tokenAddress: Address | undefined, config: ConfidentialIsOperatorQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.confidentialIsOperator.scope>>;
|
|
21307
|
+
//#endregion
|
|
21308
|
+
//#region src/token/token.d.ts
|
|
21309
|
+
/** Options for {@link Token.batchDecryptBalancesAs}. */
|
|
21310
|
+
interface BatchDecryptAsOptions {
|
|
21311
|
+
/** The address of the account that delegated decryption rights. */
|
|
21312
|
+
delegatorAddress: Address;
|
|
21313
|
+
/** Pre-fetched encrypted values. When omitted, they are fetched from the chain. */
|
|
21314
|
+
encryptedValues?: EncryptedValue[];
|
|
21315
|
+
/**
|
|
21316
|
+
* The account whose on-chain balance to read. Defaults to the delegator
|
|
21317
|
+
* address, which is the common case (the delegator grants permission to
|
|
21318
|
+
* decrypt their own balance). Only set this when the account differs
|
|
21319
|
+
* from the delegator.
|
|
21171
21320
|
*
|
|
21172
|
-
*
|
|
21173
|
-
* ```ts
|
|
21174
|
-
* const txHash = await wrappedToken.unshieldAll();
|
|
21175
|
-
* ```
|
|
21321
|
+
* Matches the `account` parameter of `confidentialBalanceOf(account)` on-chain.
|
|
21176
21322
|
*/
|
|
21177
|
-
|
|
21323
|
+
accountAddress?: Address;
|
|
21324
|
+
/** Maximum number of concurrent decrypt calls. Default: 10. */
|
|
21325
|
+
maxConcurrency?: number;
|
|
21326
|
+
/** Called when decryption fails for a single token. Return a fallback bigint. */
|
|
21327
|
+
onError?: (error: Error, address: Address) => bigint;
|
|
21328
|
+
}
|
|
21329
|
+
/** Result of {@link Token.batchBalancesOf}. */
|
|
21330
|
+
interface BatchBalancesResult {
|
|
21331
|
+
/** Successfully decrypted balances, keyed by token address. */
|
|
21332
|
+
results: Map<Address, bigint>;
|
|
21333
|
+
/** Per-token errors for tokens that failed to decrypt. */
|
|
21334
|
+
errors: Map<Address, ZamaError>;
|
|
21335
|
+
}
|
|
21336
|
+
/**
|
|
21337
|
+
* High-level interface for an ERC-7984 confidential token.
|
|
21338
|
+
* Hides FHE complexity (encryption, decryption, EIP-712 signing) behind
|
|
21339
|
+
* familiar ERC-20-like methods.
|
|
21340
|
+
*
|
|
21341
|
+
* For ERC-7984 wrappers (shield/unshield), use {@link WrappedToken} instead —
|
|
21342
|
+
* it extends `Token` with wrapper-specific operations.
|
|
21343
|
+
*
|
|
21344
|
+
* Decryption, credentials, caching, and event emission are handled by the
|
|
21345
|
+
* owning {@link ZamaSDK} — this class only exposes token-scoped helpers
|
|
21346
|
+
* that delegate to `sdk.decryption.decryptValues` and `sdk.permits.grantPermit`.
|
|
21347
|
+
*/
|
|
21348
|
+
declare class Token {
|
|
21349
|
+
#private;
|
|
21350
|
+
/** The SDK instance this token operates through. */
|
|
21351
|
+
readonly sdk: ZamaSDK;
|
|
21352
|
+
/** Checksummed address of the confidential token contract. */
|
|
21353
|
+
readonly address: Address;
|
|
21354
|
+
constructor(sdk: ZamaSDK, address: Address);
|
|
21355
|
+
/** Read the token name from the contract. */
|
|
21356
|
+
name(): Promise<string>;
|
|
21357
|
+
/** Read the token symbol from the contract. */
|
|
21358
|
+
symbol(): Promise<string>;
|
|
21359
|
+
/** Read the token decimals from the contract. */
|
|
21360
|
+
decimals(): Promise<number>;
|
|
21178
21361
|
/**
|
|
21179
|
-
*
|
|
21180
|
-
* Useful when the user already submitted the unwrap but the finalize step
|
|
21181
|
-
* was interrupted (e.g. page reload, network error).
|
|
21182
|
-
*
|
|
21183
|
-
* @param unwrapTxHash - The transaction hash of the previously submitted unwrap.
|
|
21184
|
-
* @param callbacks - Optional progress callbacks.
|
|
21185
|
-
* @returns The finalize transaction hash and mined receipt.
|
|
21186
|
-
* @throws if the unwrap request was already finalized on-chain; the persisted
|
|
21187
|
-
* pending-unshield state is cleared first. {@link UnshieldAlreadyFinalizedError}
|
|
21362
|
+
* ERC-165 check for {@link ERC7984_INTERFACE_ID} support.
|
|
21188
21363
|
*
|
|
21189
|
-
* @
|
|
21190
|
-
* ```ts
|
|
21191
|
-
* const txHash = await wrappedToken.resumeUnshield(previousUnwrapTxHash);
|
|
21192
|
-
* ```
|
|
21364
|
+
* @returns `true` if the contract implements the ERC-7984 confidential token interface.
|
|
21193
21365
|
*/
|
|
21194
|
-
|
|
21366
|
+
isConfidential(): Promise<boolean>;
|
|
21195
21367
|
/**
|
|
21196
|
-
*
|
|
21197
|
-
* two phases, or `null` if none is pending for this wrapper.
|
|
21198
|
-
*
|
|
21199
|
-
* The SDK persists this automatically when {@link unshield}/{@link unshieldAll}
|
|
21200
|
-
* submit phase 1, and clears it once phase 2 finalizes. Use the returned hash
|
|
21201
|
-
* to surface a "resume" affordance, then pass it to {@link resumeUnshield}.
|
|
21202
|
-
* Resuming is intentionally caller-driven — auto-resuming on load would fire a
|
|
21203
|
-
* wallet transaction unprompted.
|
|
21204
|
-
*
|
|
21205
|
-
* The pointer is verified on-chain before it is reported: if the unwrap
|
|
21206
|
-
* request was already finalized (e.g. the tab closed before the SDK could
|
|
21207
|
-
* clear storage), the stale pointer is cleared and `null` is returned. When
|
|
21208
|
-
* the verification read fails, the pointer is returned unverified: a
|
|
21209
|
-
* network error never deletes recovery state.
|
|
21210
|
-
*
|
|
21211
|
-
* @returns The pending unwrap tx hash, or `null`.
|
|
21368
|
+
* ERC-165 check for IERC7984ERC20Wrapper support.
|
|
21212
21369
|
*
|
|
21213
|
-
* @
|
|
21214
|
-
*
|
|
21215
|
-
* const unwrapTxHash = await wrappedToken.getPendingUnshield();
|
|
21216
|
-
* if (unwrapTxHash) await wrappedToken.resumeUnshield(unwrapTxHash);
|
|
21217
|
-
* ```
|
|
21370
|
+
* @returns `true` if the contract implements the ERC-7984 wrapper interface
|
|
21371
|
+
* ({@link ERC7984_WRAPPER_INTERFACE_ID}, `0x1f1c62b2`).
|
|
21218
21372
|
*/
|
|
21219
|
-
|
|
21373
|
+
isWrapper(): Promise<boolean>;
|
|
21220
21374
|
/**
|
|
21221
|
-
*
|
|
21222
|
-
*
|
|
21223
|
-
* request is processed on-chain.
|
|
21375
|
+
* Decrypt and return the plaintext balance for the given owner.
|
|
21376
|
+
* Acquires FHE credentials via a wallet signature if none are cached.
|
|
21224
21377
|
*
|
|
21225
|
-
* @param
|
|
21226
|
-
* @returns The
|
|
21378
|
+
* @param owner - Balance owner address.
|
|
21379
|
+
* @returns The decrypted plaintext balance as a bigint.
|
|
21380
|
+
* @throws if FHE decryption fails. {@link DecryptionFailedError}
|
|
21227
21381
|
*
|
|
21228
21382
|
* @example
|
|
21229
21383
|
* ```ts
|
|
21230
|
-
* const
|
|
21231
|
-
* await wrappedToken.finalizeUnwrap(result.unwrapRequestId);
|
|
21384
|
+
* const balance = await token.balanceOf("0xOwner");
|
|
21232
21385
|
* ```
|
|
21233
21386
|
*/
|
|
21234
|
-
|
|
21387
|
+
balanceOf(owner: Address): Promise<bigint>;
|
|
21235
21388
|
/**
|
|
21236
|
-
*
|
|
21237
|
-
* Uses the on-chain encrypted balance directly (no encryption needed).
|
|
21238
|
-
* Throws if the balance is zero.
|
|
21389
|
+
* Return the raw encrypted balance without decrypting.
|
|
21239
21390
|
*
|
|
21240
|
-
* @
|
|
21241
|
-
* @
|
|
21391
|
+
* @param owner - Balance owner address.
|
|
21392
|
+
* @returns The encrypted balance as a hex string.
|
|
21242
21393
|
*
|
|
21243
21394
|
* @example
|
|
21244
21395
|
* ```ts
|
|
21245
|
-
* const
|
|
21246
|
-
* await wrappedToken.finalizeUnwrap(result.unwrapRequestId);
|
|
21396
|
+
* const encryptedValue = await token.confidentialBalanceOf("0xOwner");
|
|
21247
21397
|
* ```
|
|
21248
21398
|
*/
|
|
21249
|
-
|
|
21399
|
+
confidentialBalanceOf(owner: Address): Promise<EncryptedValue>;
|
|
21250
21400
|
/**
|
|
21251
|
-
*
|
|
21252
|
-
*
|
|
21401
|
+
* Decrypt the balance of a delegator using delegated decryption credentials.
|
|
21402
|
+
* The connected signer acts as the delegatee who has been granted permission
|
|
21403
|
+
* by the delegator to decrypt their balance.
|
|
21253
21404
|
*
|
|
21254
|
-
*
|
|
21255
|
-
*
|
|
21256
|
-
*
|
|
21257
|
-
*
|
|
21258
|
-
* @returns The transaction hash and mined receipt.
|
|
21405
|
+
* Clear values are cached in storage keyed by `(account, token, encryptedValue)`.
|
|
21406
|
+
* Because every on-chain balance change produces a new encrypted value,
|
|
21407
|
+
* stale cache entries are never served. Cache write failures are silently
|
|
21408
|
+
* ignored — they do not affect the returned value.
|
|
21259
21409
|
*
|
|
21260
|
-
* @
|
|
21261
|
-
*
|
|
21262
|
-
*
|
|
21263
|
-
*
|
|
21264
|
-
*
|
|
21265
|
-
|
|
21266
|
-
|
|
21267
|
-
}
|
|
21268
|
-
//#endregion
|
|
21269
|
-
//#region src/wrappers-registry.d.ts
|
|
21270
|
-
/**
|
|
21271
|
-
* Default wrappers registry addresses for known chains.
|
|
21272
|
-
* Only includes chains where a registry is deployed (excludes Hardhat).
|
|
21273
|
-
*
|
|
21274
|
-
* @deprecated Read `registryAddress` from the chain presets instead (e.g.
|
|
21275
|
-
* `sepolia.registryAddress`). Will be removed in the next major version.
|
|
21276
|
-
*/
|
|
21277
|
-
declare const DefaultRegistryAddresses: Record<number, Address>;
|
|
21278
|
-
/** Configuration for {@link WrappersRegistry}. */
|
|
21279
|
-
interface WrappersRegistryConfig {
|
|
21280
|
-
/** Read-only chain provider used for every registry lookup. */
|
|
21281
|
-
provider: GenericProvider;
|
|
21282
|
-
/**
|
|
21283
|
-
* Per-chain registry address overrides, merged on top of
|
|
21284
|
-
* {@link DefaultRegistryAddresses}. Use this to supply a registry
|
|
21285
|
-
* address for custom or local chains (e.g. Hardhat).
|
|
21410
|
+
* @param delegatorAddress - The address of the account that delegated decryption rights.
|
|
21411
|
+
* @param accountAddress - The account whose on-chain balance to read. Defaults
|
|
21412
|
+
* to the delegator address.
|
|
21413
|
+
* @returns The decrypted plaintext balance as a bigint.
|
|
21414
|
+
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
21415
|
+
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
21416
|
+
* @throws if delegated decryption fails. {@link DecryptionFailedError}
|
|
21286
21417
|
*
|
|
21287
21418
|
* @example
|
|
21288
21419
|
* ```ts
|
|
21289
|
-
*
|
|
21290
|
-
*
|
|
21291
|
-
* registryAddresses: { [31337]: "0xYourHardhatRegistry" },
|
|
21420
|
+
* const balance = await token.decryptBalanceAs({
|
|
21421
|
+
* delegatorAddress: "0xDelegator",
|
|
21292
21422
|
* });
|
|
21293
21423
|
* ```
|
|
21294
21424
|
*/
|
|
21295
|
-
|
|
21296
|
-
|
|
21297
|
-
|
|
21298
|
-
|
|
21299
|
-
*/
|
|
21300
|
-
registryTTL?: number;
|
|
21301
|
-
}
|
|
21302
|
-
/** Options for {@link WrappersRegistry.listPairs}. */
|
|
21303
|
-
interface ListPairsOptions {
|
|
21304
|
-
/** Page number (1-indexed). Default: `1`. */
|
|
21305
|
-
page?: number;
|
|
21306
|
-
/** Number of items per page. Default: `100`. */
|
|
21307
|
-
pageSize?: number;
|
|
21308
|
-
/**
|
|
21309
|
-
* When `true`, fetches on-chain metadata (name, symbol, decimals) for both
|
|
21310
|
-
* the ERC-20 and confidential token, plus totalSupply for the ERC-20.
|
|
21311
|
-
* Default: `false`.
|
|
21312
|
-
*/
|
|
21313
|
-
metadata?: boolean;
|
|
21314
|
-
}
|
|
21315
|
-
/**
|
|
21316
|
-
* High-level interface for the on-chain token wrappers registry.
|
|
21317
|
-
*
|
|
21318
|
-
* Uses the configured {@link GenericProvider} to resolve the correct registry
|
|
21319
|
-
* contract address for the current chain and exposes typed read helpers for
|
|
21320
|
-
* every registry query. Results are cached in memory with a configurable TTL
|
|
21321
|
-
* (default 24 hours).
|
|
21322
|
-
*
|
|
21323
|
-
* @example
|
|
21324
|
-
* ```ts
|
|
21325
|
-
* const registry = new WrappersRegistry({ provider });
|
|
21326
|
-
*
|
|
21327
|
-
* // Paginated listing
|
|
21328
|
-
* const page1 = await registry.listPairs({ page: 1, pageSize: 20 });
|
|
21329
|
-
*
|
|
21330
|
-
* // Structured lookups
|
|
21331
|
-
* const result = await registry.getConfidentialToken(erc20Address);
|
|
21332
|
-
* if (result) console.log(result.confidentialTokenAddress);
|
|
21333
|
-
*
|
|
21334
|
-
* // Force refresh
|
|
21335
|
-
* registry.refresh();
|
|
21336
|
-
* ```
|
|
21337
|
-
*/
|
|
21338
|
-
declare class WrappersRegistry {
|
|
21339
|
-
#private;
|
|
21340
|
-
/** Read-only chain access used for registry contract reads. */
|
|
21341
|
-
readonly provider: GenericProvider;
|
|
21342
|
-
constructor(config: WrappersRegistryConfig);
|
|
21343
|
-
/**
|
|
21344
|
-
* Synchronous lookup of the registry address for a given chain ID.
|
|
21345
|
-
* Returns `undefined` if no address is configured for that chain.
|
|
21346
|
-
*/
|
|
21347
|
-
getAddress(chainId: number): Address | undefined;
|
|
21348
|
-
/**
|
|
21349
|
-
* Force-invalidate the in-memory cache. The next call to any read method
|
|
21350
|
-
* will fetch fresh data from the chain.
|
|
21351
|
-
*/
|
|
21352
|
-
refresh(): void;
|
|
21353
|
-
/**
|
|
21354
|
-
* The cache TTL in milliseconds.
|
|
21355
|
-
* Exposed so query option factories can set a matching `staleTime`.
|
|
21356
|
-
*/
|
|
21357
|
-
get ttlMs(): number;
|
|
21425
|
+
decryptBalanceAs({ delegatorAddress, accountAddress }: {
|
|
21426
|
+
delegatorAddress: Address;
|
|
21427
|
+
accountAddress?: Address;
|
|
21428
|
+
}): Promise<bigint>;
|
|
21358
21429
|
/**
|
|
21359
|
-
*
|
|
21430
|
+
* Decrypt confidential balances for multiple tokens in parallel, returning
|
|
21431
|
+
* successes and per-token errors separately. Pre-authorizes all token
|
|
21432
|
+
* addresses in a single wallet signature, then delegates each decrypt to
|
|
21433
|
+
* `sdk.decryption.decryptValues`.
|
|
21360
21434
|
*
|
|
21361
|
-
*
|
|
21435
|
+
* Tokens that fail to decrypt land in `errors`; the batch keeps going.
|
|
21436
|
+
*
|
|
21437
|
+
* @param tokens - Array of {@link Token} instances bound to the same SDK.
|
|
21438
|
+
* @param owner - Balance owner address.
|
|
21439
|
+
* @returns `{ results, errors }` partitioning the per-token outcomes.
|
|
21440
|
+
* @throws A failure that affects the whole session (rejected signature,
|
|
21441
|
+
* misconfiguration, RPC rate limit, key unwrapping failure, revoked KMS
|
|
21442
|
+
* context) rejects the call instead of landing in `errors`.
|
|
21362
21443
|
*
|
|
21363
|
-
* @
|
|
21364
|
-
*
|
|
21444
|
+
* @example
|
|
21445
|
+
* ```ts
|
|
21446
|
+
* const { results, errors } = await Token.batchBalancesOf(tokens, owner);
|
|
21447
|
+
* ```
|
|
21365
21448
|
*/
|
|
21366
|
-
|
|
21449
|
+
static batchBalancesOf(tokens: Token[], owner: Address): Promise<BatchBalancesResult>;
|
|
21367
21450
|
/**
|
|
21368
|
-
*
|
|
21451
|
+
* Batch decrypt confidential balances as a delegate across multiple tokens.
|
|
21452
|
+
* Mirrors {@link batchBalancesOf} but uses delegated credentials.
|
|
21369
21453
|
*
|
|
21370
|
-
*
|
|
21454
|
+
* **Error handling:** If a per-token decryption fails and no `onError` callback
|
|
21455
|
+
* is provided, errors are collected and thrown as an aggregated
|
|
21456
|
+
* `DecryptionFailedError`. When the relayer returns no value for an encrypted value,
|
|
21457
|
+
* a `DecryptionFailedError` is thrown for that token (never silently returns `0n`).
|
|
21458
|
+
* Pass `onError: () => 0n` to opt into the silent zero behavior.
|
|
21371
21459
|
*
|
|
21372
|
-
* @param
|
|
21373
|
-
* @
|
|
21460
|
+
* @param tokens - Array of Token instances to decrypt balances for.
|
|
21461
|
+
* @param options - Delegated decryption configuration.
|
|
21462
|
+
* @returns A Map from token address to decrypted balance.
|
|
21463
|
+
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
21464
|
+
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
21465
|
+
* @throws if any decryption fails and no `onError` is provided. {@link DecryptionFailedError}
|
|
21466
|
+
* @throws A failure that affects the whole session (rejected signature, RPC
|
|
21467
|
+
* rate limit, revoked KMS context) rejects the call even when `onError` is
|
|
21468
|
+
* provided.
|
|
21374
21469
|
*
|
|
21375
21470
|
* @example
|
|
21376
21471
|
* ```ts
|
|
21377
|
-
* const
|
|
21378
|
-
*
|
|
21379
|
-
*
|
|
21380
|
-
*
|
|
21381
|
-
* const withMeta = await registry.listPairs({ metadata: true, pageSize: 10 });
|
|
21382
|
-
* for (const pair of withMeta.items) {
|
|
21383
|
-
* console.log(pair.underlying.symbol, "→", pair.confidential.symbol);
|
|
21384
|
-
* }
|
|
21472
|
+
* const balances = await Token.batchDecryptBalancesAs(tokens, {
|
|
21473
|
+
* delegatorAddress: "0xDelegator",
|
|
21474
|
+
* onError: (err, addr) => { console.error(addr, err); return 0n; },
|
|
21475
|
+
* });
|
|
21385
21476
|
* ```
|
|
21386
21477
|
*/
|
|
21387
|
-
|
|
21388
|
-
|
|
21389
|
-
}): Promise<PaginatedResult<TokenWrapperPairWithMetadata>>;
|
|
21390
|
-
/** Lists registered underlying/confidential token pairs; pass `{ metadata: true }` to include on-chain token metadata. */
|
|
21391
|
-
listPairs(options?: ListPairsOptions): Promise<PaginatedResult<TokenWrapperPair>>;
|
|
21478
|
+
static batchDecryptBalancesAs(tokens: Token[], options: BatchDecryptAsOptions): Promise<Map<Address, bigint>>;
|
|
21479
|
+
private static readBalanceHandlesBatch;
|
|
21392
21480
|
/**
|
|
21393
|
-
*
|
|
21481
|
+
* Confidential transfer. Encrypts the amount via FHE, then calls the contract.
|
|
21394
21482
|
*
|
|
21395
|
-
*
|
|
21396
|
-
*
|
|
21397
|
-
*
|
|
21398
|
-
*
|
|
21399
|
-
*
|
|
21483
|
+
* By default, the SDK validates the confidential balance before submitting.
|
|
21484
|
+
* If a cached plaintext balance exists it is used; otherwise, if credentials
|
|
21485
|
+
* are cached, it decrypts on the fly. Set `skipBalanceCheck: true` to bypass
|
|
21486
|
+
* this validation (e.g. for smart wallets).
|
|
21487
|
+
*
|
|
21488
|
+
* @param to - Recipient address.
|
|
21489
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
21490
|
+
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
21491
|
+
* @returns The transaction hash and mined receipt.
|
|
21492
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
21493
|
+
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
21494
|
+
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
21495
|
+
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
21496
|
+
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
21400
21497
|
*
|
|
21401
21498
|
* @example
|
|
21402
21499
|
* ```ts
|
|
21403
|
-
* const
|
|
21404
|
-
* if (result?.isValid) {
|
|
21405
|
-
* console.log(result.confidentialTokenAddress);
|
|
21406
|
-
* }
|
|
21500
|
+
* const txHash = await token.confidentialTransfer("0xRecipient", 1000n);
|
|
21407
21501
|
* ```
|
|
21408
21502
|
*/
|
|
21409
|
-
|
|
21410
|
-
confidentialTokenAddress: Address;
|
|
21411
|
-
isValid: boolean;
|
|
21412
|
-
} | null>;
|
|
21503
|
+
confidentialTransfer(to: Address, amount: bigint, options?: TransferOptions): Promise<TransactionResult>;
|
|
21413
21504
|
/**
|
|
21414
|
-
*
|
|
21505
|
+
* Operator encrypted transfer on behalf of another address.
|
|
21506
|
+
* The caller must be an approved operator for `from`.
|
|
21415
21507
|
*
|
|
21416
|
-
* @param
|
|
21417
|
-
* @
|
|
21508
|
+
* @param from - The address to transfer from (caller must be an approved operator).
|
|
21509
|
+
* @param to - Recipient address.
|
|
21510
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
21511
|
+
* @returns The transaction hash and mined receipt.
|
|
21418
21512
|
*
|
|
21419
21513
|
* @example
|
|
21420
21514
|
* ```ts
|
|
21421
|
-
* const
|
|
21422
|
-
* if (result) {
|
|
21423
|
-
* console.log(result.tokenAddress, result.isValid);
|
|
21424
|
-
* }
|
|
21515
|
+
* const txHash = await token.confidentialTransferFrom("0xFrom", "0xTo", 500n);
|
|
21425
21516
|
* ```
|
|
21426
21517
|
*/
|
|
21427
|
-
|
|
21428
|
-
tokenAddress: Address;
|
|
21429
|
-
isValid: boolean;
|
|
21430
|
-
} | null>;
|
|
21518
|
+
confidentialTransferFrom(from: Address, to: Address, amount: bigint, callbacks?: TransferCallbacks): Promise<TransactionResult>;
|
|
21431
21519
|
/**
|
|
21432
|
-
*
|
|
21520
|
+
* ERC-7984 `confidentialTransferAndCall`: encrypted transfer that also invokes
|
|
21521
|
+
* the recipient's receiver hook (`onConfidentialTransferReceived`) in a single
|
|
21522
|
+
* transaction. The caller crafts the opaque `data` payload — the SDK does not
|
|
21523
|
+
* encode, validate, or interpret it.
|
|
21433
21524
|
*
|
|
21434
|
-
*
|
|
21435
|
-
*/
|
|
21436
|
-
getTokenPairs(): Promise<readonly TokenWrapperPair[]>;
|
|
21437
|
-
/**
|
|
21438
|
-
* Get the total number of token wrapper pairs.
|
|
21525
|
+
* Balance validation follows the same rules as {@link Token.confidentialTransfer}.
|
|
21439
21526
|
*
|
|
21440
|
-
* @
|
|
21441
|
-
|
|
21442
|
-
|
|
21443
|
-
|
|
21444
|
-
*
|
|
21527
|
+
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
21528
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
21529
|
+
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
21530
|
+
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
21531
|
+
* @returns The transaction hash and mined receipt.
|
|
21445
21532
|
*
|
|
21446
|
-
* @
|
|
21447
|
-
* @
|
|
21448
|
-
* @
|
|
21449
|
-
|
|
21450
|
-
|
|
21451
|
-
/**
|
|
21452
|
-
* Fetch a single token wrapper pair by index.
|
|
21533
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
21534
|
+
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
21535
|
+
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
21536
|
+
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
21537
|
+
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
21453
21538
|
*
|
|
21454
|
-
* @
|
|
21455
|
-
*
|
|
21539
|
+
* @example
|
|
21540
|
+
* ```ts
|
|
21541
|
+
* const txHash = await token.confidentialTransferAndCall(
|
|
21542
|
+
* "0xRecipient",
|
|
21543
|
+
* 1000n,
|
|
21544
|
+
* "0xabcd", // caller-encoded payload forwarded to the receiver hook
|
|
21545
|
+
* );
|
|
21546
|
+
* ```
|
|
21456
21547
|
*/
|
|
21457
|
-
|
|
21548
|
+
confidentialTransferAndCall(to: Address, amount: bigint, data: Hex, options?: TransferOptions): Promise<TransactionResult>;
|
|
21458
21549
|
/**
|
|
21459
|
-
*
|
|
21550
|
+
* ERC-7984 `confidentialTransferFromAndCall`: operator-initiated encrypted
|
|
21551
|
+
* transfer that also invokes the recipient's receiver hook in a single
|
|
21552
|
+
* transaction. The caller must be an approved operator for `from` and crafts
|
|
21553
|
+
* the opaque `data` payload — the SDK does not encode or interpret it.
|
|
21460
21554
|
*
|
|
21461
|
-
* @param
|
|
21462
|
-
* @
|
|
21463
|
-
*
|
|
21464
|
-
*
|
|
21555
|
+
* @param from - The address to transfer from (caller must be an approved operator).
|
|
21556
|
+
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
21557
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
21558
|
+
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
21559
|
+
* @param callbacks - Optional progress callbacks.
|
|
21560
|
+
* @returns The transaction hash and mined receipt.
|
|
21561
|
+
*
|
|
21562
|
+
* @example
|
|
21563
|
+
* ```ts
|
|
21564
|
+
* const txHash = await token.confidentialTransferFromAndCall(
|
|
21565
|
+
* "0xFrom",
|
|
21566
|
+
* "0xRecipient",
|
|
21567
|
+
* 500n,
|
|
21568
|
+
* "0xabcd",
|
|
21569
|
+
* );
|
|
21570
|
+
* ```
|
|
21465
21571
|
*/
|
|
21466
|
-
|
|
21572
|
+
confidentialTransferFromAndCall(from: Address, to: Address, amount: bigint, data: Hex, callbacks?: TransferCallbacks): Promise<TransactionResult>;
|
|
21467
21573
|
/**
|
|
21468
|
-
*
|
|
21574
|
+
* Set operator approval for the confidential token.
|
|
21575
|
+
* Defaults to 1 hour from now if `until` is not specified.
|
|
21469
21576
|
*
|
|
21470
|
-
* @param
|
|
21471
|
-
* @
|
|
21472
|
-
*
|
|
21473
|
-
*
|
|
21577
|
+
* @param operator - The address to set as an operator.
|
|
21578
|
+
* @param until - Optional Unix timestamp for approval expiry. Defaults to now + 1 hour.
|
|
21579
|
+
* @returns The transaction hash and mined receipt.
|
|
21580
|
+
*
|
|
21581
|
+
* @example
|
|
21582
|
+
* ```ts
|
|
21583
|
+
* const txHash = await token.setOperator("0xOperator");
|
|
21584
|
+
* ```
|
|
21474
21585
|
*/
|
|
21475
|
-
|
|
21586
|
+
setOperator(operator: Address, until?: number): Promise<TransactionResult>;
|
|
21476
21587
|
/**
|
|
21477
|
-
* Check
|
|
21588
|
+
* Check if a spender is an approved operator for a given holder.
|
|
21478
21589
|
*
|
|
21479
|
-
* @param
|
|
21480
|
-
* @
|
|
21590
|
+
* @param holder - The token holder address.
|
|
21591
|
+
* @param spender - The address to check operator approval for.
|
|
21592
|
+
* @returns `true` if the spender is an approved operator for the holder.
|
|
21593
|
+
*
|
|
21594
|
+
* @example
|
|
21595
|
+
* ```ts
|
|
21596
|
+
* if (await token.isOperator("0xHolder", "0xSpender")) {
|
|
21597
|
+
* // spender can call transferFrom on behalf of holder
|
|
21598
|
+
* }
|
|
21599
|
+
* ```
|
|
21481
21600
|
*/
|
|
21482
|
-
|
|
21601
|
+
isOperator(holder: Address, spender: Address): Promise<boolean>;
|
|
21602
|
+
/** Verify all tokens share the same SDK instance and return it. */
|
|
21603
|
+
private static assertSameSdk;
|
|
21483
21604
|
}
|
|
21484
21605
|
//#endregion
|
|
21485
|
-
//#region src/
|
|
21486
|
-
/** Instance-level options that are deliberately not part of the shareable config object. */
|
|
21487
|
-
interface ZamaSDKOptions {
|
|
21488
|
-
/**
|
|
21489
|
-
* Encrypts the transport key pair's private half at rest. Headless environments only
|
|
21490
|
-
* (CLI tools, servers, agents); the constructor rejects it in browser contexts. Supply
|
|
21491
|
-
* at least 32 random bytes, or a string of at least 64 characters, from a CSPRNG or
|
|
21492
|
-
* secrets manager. The SDK copies a Uint8Array secret and zeroizes its own copy after
|
|
21493
|
-
* key import; it never touches your buffer, so zeroize yours after construction.
|
|
21494
|
-
* The SDK never persists or exposes this value. Omit for the default:
|
|
21495
|
-
* plaintext at rest, security delegated to the storage backend.
|
|
21496
|
-
*/
|
|
21497
|
-
transportKeyPairDerivationSecret?: string | Uint8Array;
|
|
21498
|
-
}
|
|
21606
|
+
//#region src/token/wrapped-token.d.ts
|
|
21499
21607
|
/**
|
|
21500
|
-
*
|
|
21608
|
+
* Confidential ERC-20 wrapper (ERC-7984 ERC20Wrapper).
|
|
21501
21609
|
*
|
|
21502
|
-
*
|
|
21503
|
-
*
|
|
21504
|
-
*
|
|
21505
|
-
*
|
|
21506
|
-
*
|
|
21610
|
+
* Extends {@link Token} with wrapper-specific operations:
|
|
21611
|
+
* - `shield` / `unshield` — convert between the underlying ERC-20 and confidential balance
|
|
21612
|
+
* - `unwrap` / `unwrapAll` / `finalizeUnwrap` — low-level two-phase primitives
|
|
21613
|
+
* - `underlying` / `allowance` — wrapper reads
|
|
21614
|
+
*
|
|
21615
|
+
* `WrappedToken.address` is the wrapper contract address itself — the wrapper
|
|
21616
|
+
* IS the confidential token.
|
|
21507
21617
|
*/
|
|
21508
|
-
declare class
|
|
21618
|
+
declare class WrappedToken extends Token {
|
|
21509
21619
|
#private;
|
|
21510
|
-
/** Read-only chain access used for all contract reads. */
|
|
21511
|
-
readonly provider: GenericProvider;
|
|
21512
|
-
/** Wallet signer used for write operations, or `undefined` when the SDK is read-only. */
|
|
21513
|
-
readonly signer: GenericSigner | undefined;
|
|
21514
|
-
/** Storage for cached permits and transport key pairs. */
|
|
21515
|
-
readonly storage: GenericStorage;
|
|
21516
21620
|
/**
|
|
21517
|
-
*
|
|
21518
|
-
*
|
|
21621
|
+
* Read the underlying ERC-20 token address from the wrapper contract.
|
|
21622
|
+
*
|
|
21623
|
+
* @returns The underlying ERC-20 token address.
|
|
21624
|
+
*/
|
|
21625
|
+
underlying(): Promise<Address>;
|
|
21626
|
+
/**
|
|
21627
|
+
* Check whether the underlying ERC-20 supports ERC-1363 (payable token).
|
|
21628
|
+
* Result is cached per WrappedToken instance (negative results included):
|
|
21629
|
+
* once we know an underlying does not support ERC-1363, subsequent shields
|
|
21630
|
+
* go straight to the `approve` + `wrap` path without re-probing.
|
|
21631
|
+
*/
|
|
21632
|
+
isPayable(): Promise<boolean>;
|
|
21633
|
+
/**
|
|
21634
|
+
* Read the ERC-20 allowance granted by `owner` to this wrapper for the
|
|
21635
|
+
* underlying token.
|
|
21636
|
+
*
|
|
21637
|
+
* @param owner - The owner address whose allowance to read.
|
|
21638
|
+
* @returns The current allowance as a bigint.
|
|
21519
21639
|
*/
|
|
21520
|
-
|
|
21521
|
-
/** Permit and keypair management. */
|
|
21522
|
-
readonly permits: Permits;
|
|
21523
|
-
/** On-chain decryption-delegation management. */
|
|
21524
|
-
readonly delegations: Delegations;
|
|
21525
|
-
/** FHE decryption (user, delegated user, public). */
|
|
21526
|
-
readonly decryption: Decryption;
|
|
21527
|
-
/** Offline-signing pipeline: `prepare` builds an unsigned tx the caller signs and broadcasts out-of-process — for HSM, policy-engine, and cross-process custody workflows. */
|
|
21528
|
-
readonly offline: Offline;
|
|
21529
|
-
constructor(config: ZamaConfig, options?: ZamaSDKOptions);
|
|
21640
|
+
allowance(owner: Address): Promise<bigint>;
|
|
21530
21641
|
/**
|
|
21531
|
-
*
|
|
21642
|
+
* Shield public ERC-20 tokens into confidential tokens.
|
|
21643
|
+
*
|
|
21644
|
+
* The execution path is decided automatically by ERC-165 introspection on
|
|
21645
|
+
* the underlying ERC-20:
|
|
21646
|
+
* - **`transferAndCall`** (single tx): when the underlying supports
|
|
21647
|
+
* ERC-1363, no approval is required — the wrapper's `onTransferReceived`
|
|
21648
|
+
* callback mints confidential tokens directly. `approvalStrategy` is
|
|
21649
|
+
* **ignored** on this path. See {@link ShieldPath}.
|
|
21650
|
+
* - **`approveAndWrap`** (two-tx fallback): otherwise, an `approve` is
|
|
21651
|
+
* followed by a `wrap`. Approval is controlled by `approvalStrategy`
|
|
21652
|
+
* (`"exact"` by default, `"max"` for unlimited, `"skip"` to opt out).
|
|
21653
|
+
*
|
|
21654
|
+
* The ERC-20 balance is validated before submitting (public read, no
|
|
21655
|
+
* signing required) so the call works for all wallet types, including
|
|
21656
|
+
* smart wallets.
|
|
21657
|
+
*
|
|
21658
|
+
* @param amount - The plaintext amount to shield.
|
|
21659
|
+
* @param options - Optional: `approvalStrategy`, `to`, callbacks.
|
|
21660
|
+
* @returns The transaction hash and mined receipt.
|
|
21661
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
21662
|
+
* @throws if the ERC-20 balance is less than `amount`. {@link InsufficientERC20BalanceError}
|
|
21663
|
+
* @throws if the ERC-20 approval or shield transaction reverts. {@link TransactionRevertedError}
|
|
21664
|
+
*
|
|
21665
|
+
* @example
|
|
21666
|
+
* ```ts
|
|
21667
|
+
* const txHash = await wrappedToken.shield(1000n);
|
|
21668
|
+
* ```
|
|
21532
21669
|
*/
|
|
21533
|
-
|
|
21670
|
+
shield(amount: bigint, options?: ShieldOptions): Promise<TransactionResult>;
|
|
21534
21671
|
/**
|
|
21535
|
-
*
|
|
21536
|
-
* Inherits the registry addresses derived from the SDK's chain configs, so
|
|
21537
|
-
* the result is consistent with {@link ZamaSDK.registry}.
|
|
21672
|
+
* Wrap already-approved underlying ERC-20 into confidential tokens.
|
|
21538
21673
|
*
|
|
21539
|
-
*
|
|
21540
|
-
*
|
|
21674
|
+
* Escape hatch for splitting shield across two signatures: call
|
|
21675
|
+
* {@link approveUnderlying} first, then `wrap`. Most callers should use
|
|
21676
|
+
* {@link shield}, which routes and orchestrates approval automatically.
|
|
21677
|
+
*
|
|
21678
|
+
* Validates the ERC-20 balance and the allowance granted to this wrapper
|
|
21679
|
+
* (public reads, no signing) and fails early with a clear error.
|
|
21680
|
+
*
|
|
21681
|
+
* @param amount - The plaintext amount to wrap.
|
|
21682
|
+
* @param options - Optional `to` recipient and `onWrapSubmitted` callback.
|
|
21683
|
+
* @returns The transaction hash and mined receipt.
|
|
21684
|
+
* @throws if reading the ERC-20 balance or allowance fails. {@link ERC20ReadFailedError}
|
|
21685
|
+
* @throws if the ERC-20 balance is less than `amount`. {@link InsufficientERC20BalanceError}
|
|
21686
|
+
* @throws if the allowance granted to the wrapper is less than `amount`. {@link InsufficientAllowanceError}
|
|
21541
21687
|
*
|
|
21542
21688
|
* @example
|
|
21543
21689
|
* ```ts
|
|
21544
|
-
*
|
|
21545
|
-
*
|
|
21690
|
+
* await wrappedToken.approveUnderlying(1000n);
|
|
21691
|
+
* await wrappedToken.wrap(1000n);
|
|
21692
|
+
* ```
|
|
21693
|
+
*/
|
|
21694
|
+
wrap(amount: bigint, options?: WrapOptions): Promise<TransactionResult>;
|
|
21695
|
+
/**
|
|
21696
|
+
* Approve this wrapper contract to spend the underlying ERC-20.
|
|
21697
|
+
* Defaults to max uint256. Resets to zero first if there's an existing
|
|
21698
|
+
* non-zero allowance (required by tokens like USDT).
|
|
21546
21699
|
*
|
|
21547
|
-
*
|
|
21548
|
-
*
|
|
21700
|
+
* @param amount - Optional approval amount. Defaults to max uint256.
|
|
21701
|
+
* @returns The transaction hash and mined receipt.
|
|
21549
21702
|
*
|
|
21550
|
-
*
|
|
21703
|
+
* @example
|
|
21704
|
+
* ```ts
|
|
21705
|
+
* await wrappedToken.approveUnderlying(); // max approval
|
|
21706
|
+
* await wrappedToken.approveUnderlying(1000n); // exact amount
|
|
21551
21707
|
* ```
|
|
21552
21708
|
*/
|
|
21553
|
-
|
|
21709
|
+
approveUnderlying(amount?: bigint): Promise<TransactionResult>;
|
|
21554
21710
|
/**
|
|
21555
|
-
*
|
|
21711
|
+
* Unshield a specific amount and finalize in one call.
|
|
21712
|
+
* Orchestrates: unshield → wait for receipt → parse event → finalize.
|
|
21556
21713
|
*
|
|
21557
|
-
*
|
|
21558
|
-
*
|
|
21559
|
-
*
|
|
21714
|
+
* By default, the SDK validates the confidential balance before submitting.
|
|
21715
|
+
* Set `skipBalanceCheck: true` to bypass this validation (e.g. for smart wallets).
|
|
21716
|
+
*
|
|
21717
|
+
* @param amount - The plaintext amount to unshield.
|
|
21718
|
+
* @param options - Optional: `skipBalanceCheck` (default `false`), callbacks.
|
|
21719
|
+
* @returns The finalize transaction hash and mined receipt.
|
|
21560
21720
|
*
|
|
21561
21721
|
* @example
|
|
21562
21722
|
* ```ts
|
|
21563
|
-
* const
|
|
21564
|
-
* values: [{ value: 1000n, type: "euint64" }],
|
|
21565
|
-
* contractAddress: "0xToken",
|
|
21566
|
-
* userAddress: "0xUser",
|
|
21567
|
-
* });
|
|
21723
|
+
* const txHash = await wrappedToken.unshield(500n);
|
|
21568
21724
|
* ```
|
|
21569
21725
|
*/
|
|
21570
|
-
|
|
21726
|
+
unshield(amount: bigint, options?: UnshieldOptions): Promise<TransactionResult>;
|
|
21571
21727
|
/**
|
|
21572
|
-
*
|
|
21573
|
-
*
|
|
21728
|
+
* Unshield the entire balance and finalize in one call.
|
|
21729
|
+
* Orchestrates: unshieldAll → wait for receipt → parse event → finalize.
|
|
21574
21730
|
*
|
|
21575
|
-
*
|
|
21731
|
+
* @param callbacks - Optional progress callbacks for each phase.
|
|
21732
|
+
* @returns The finalize transaction hash and mined receipt.
|
|
21733
|
+
* @throws if the balance is zero. {@link DecryptionFailedError}
|
|
21576
21734
|
*
|
|
21577
|
-
* @
|
|
21578
|
-
*
|
|
21735
|
+
* @example
|
|
21736
|
+
* ```ts
|
|
21737
|
+
* const txHash = await wrappedToken.unshieldAll();
|
|
21738
|
+
* ```
|
|
21739
|
+
*/
|
|
21740
|
+
unshieldAll(callbacks?: UnshieldCallbacks): Promise<TransactionResult>;
|
|
21741
|
+
/**
|
|
21742
|
+
* Resume an in-progress unshield from an existing unwrap tx hash.
|
|
21743
|
+
* Useful when the user already submitted the unwrap but the finalize step
|
|
21744
|
+
* was interrupted (e.g. page reload, network error).
|
|
21745
|
+
*
|
|
21746
|
+
* @param unwrapTxHash - The transaction hash of the previously submitted unwrap.
|
|
21747
|
+
* @param callbacks - Optional progress callbacks.
|
|
21748
|
+
* @returns The finalize transaction hash and mined receipt.
|
|
21749
|
+
* @throws if the unwrap request was already finalized on-chain; the persisted
|
|
21750
|
+
* pending-unshield state is cleared first. {@link UnshieldAlreadyFinalizedError}
|
|
21579
21751
|
*
|
|
21580
21752
|
* @example
|
|
21581
21753
|
* ```ts
|
|
21582
|
-
* const
|
|
21583
|
-
* const balance = await token.balanceOf(userAddress);
|
|
21754
|
+
* const txHash = await wrappedToken.resumeUnshield(previousUnwrapTxHash);
|
|
21584
21755
|
* ```
|
|
21585
21756
|
*/
|
|
21586
|
-
|
|
21757
|
+
resumeUnshield(unwrapTxHash: Hex, callbacks?: UnshieldCallbacks): Promise<TransactionResult>;
|
|
21587
21758
|
/**
|
|
21588
|
-
*
|
|
21589
|
-
*
|
|
21759
|
+
* Return the unwrap tx hash of an unshield that was interrupted between its
|
|
21760
|
+
* two phases, or `null` if none is pending for this wrapper.
|
|
21590
21761
|
*
|
|
21591
|
-
*
|
|
21592
|
-
*
|
|
21762
|
+
* The SDK persists this automatically when {@link unshield}/{@link unshieldAll}
|
|
21763
|
+
* submit phase 1, and clears it once phase 2 finalizes. Use the returned hash
|
|
21764
|
+
* to surface a "resume" affordance, then pass it to {@link resumeUnshield}.
|
|
21765
|
+
* Resuming is intentionally caller-driven — auto-resuming on load would fire a
|
|
21766
|
+
* wallet transaction unprompted.
|
|
21767
|
+
*
|
|
21768
|
+
* The pointer is verified on-chain before it is reported: if the unwrap
|
|
21769
|
+
* request was already finalized (e.g. the tab closed before the SDK could
|
|
21770
|
+
* clear storage), the stale pointer is cleared and `null` is returned. When
|
|
21771
|
+
* the verification read fails, the pointer is returned unverified: a
|
|
21772
|
+
* network error never deletes recovery state.
|
|
21773
|
+
*
|
|
21774
|
+
* @returns The pending unwrap tx hash, or `null`.
|
|
21593
21775
|
*
|
|
21594
21776
|
* @example
|
|
21595
21777
|
* ```ts
|
|
21596
|
-
* const
|
|
21597
|
-
* await
|
|
21778
|
+
* const unwrapTxHash = await wrappedToken.getPendingUnshield();
|
|
21779
|
+
* if (unwrapTxHash) await wrappedToken.resumeUnshield(unwrapTxHash);
|
|
21598
21780
|
* ```
|
|
21599
21781
|
*/
|
|
21600
|
-
|
|
21782
|
+
getPendingUnshield(): Promise<Hex | null>;
|
|
21601
21783
|
/**
|
|
21602
|
-
*
|
|
21603
|
-
*
|
|
21604
|
-
*
|
|
21605
|
-
*
|
|
21606
|
-
*
|
|
21784
|
+
* Request an unwrap for a specific amount. Encrypts the amount first.
|
|
21785
|
+
* Pass the result's `unwrapRequestId` to {@link finalizeUnwrap} once the
|
|
21786
|
+
* request is processed on-chain.
|
|
21787
|
+
*
|
|
21788
|
+
* @param amount - The plaintext amount to unwrap (encrypted automatically).
|
|
21789
|
+
* @returns The tx hash, mined receipt, and the `unwrapRequestId` for `finalizeUnwrap`.
|
|
21790
|
+
*
|
|
21791
|
+
* @example
|
|
21792
|
+
* ```ts
|
|
21793
|
+
* const result = await wrappedToken.unwrap(500n);
|
|
21794
|
+
* await wrappedToken.finalizeUnwrap(result.unwrapRequestId);
|
|
21795
|
+
* ```
|
|
21607
21796
|
*/
|
|
21608
|
-
|
|
21797
|
+
unwrap(amount: bigint): Promise<UnwrapResult>;
|
|
21609
21798
|
/**
|
|
21610
|
-
*
|
|
21611
|
-
*
|
|
21799
|
+
* Request an unwrap for the entire confidential balance.
|
|
21800
|
+
* Uses the on-chain encrypted balance directly (no encryption needed).
|
|
21801
|
+
* Throws if the balance is zero.
|
|
21802
|
+
*
|
|
21803
|
+
* @returns The tx hash, mined receipt, and the `unwrapRequestId` for `finalizeUnwrap`.
|
|
21804
|
+
* @throws if the balance is zero. {@link DecryptionFailedError}
|
|
21805
|
+
*
|
|
21806
|
+
* @example
|
|
21807
|
+
* ```ts
|
|
21808
|
+
* const result = await wrappedToken.unwrapAll();
|
|
21809
|
+
* await wrappedToken.finalizeUnwrap(result.unwrapRequestId);
|
|
21810
|
+
* ```
|
|
21612
21811
|
*/
|
|
21613
|
-
|
|
21812
|
+
unwrapAll(): Promise<UnwrapResult>;
|
|
21614
21813
|
/**
|
|
21615
|
-
*
|
|
21616
|
-
*
|
|
21617
|
-
*
|
|
21814
|
+
* Complete an unwrap by fetching the public decryption proof and finalizing.
|
|
21815
|
+
* Call this once the unwrap request has been processed on-chain.
|
|
21816
|
+
*
|
|
21817
|
+
* @param unwrapRequestId - The `unwrapRequestId` from an {@link UnwrapResult}
|
|
21818
|
+
* (`result.unwrapRequestId`) returned by {@link unwrap} / {@link unwrapAll},
|
|
21819
|
+
* or one decoded from an `UnwrapRequested` event (e.g. when finalizing
|
|
21820
|
+
* across sessions).
|
|
21821
|
+
* @returns The transaction hash and mined receipt.
|
|
21618
21822
|
*
|
|
21619
21823
|
* @example
|
|
21620
21824
|
* ```ts
|
|
21621
|
-
* {
|
|
21622
|
-
*
|
|
21623
|
-
* await sdk.permits.grantPermit([cUSDT]);
|
|
21624
|
-
* const balance = await sdk.createToken(cUSDT).balanceOf(userAddress);
|
|
21625
|
-
* } // sdk.terminate() called automatically here
|
|
21825
|
+
* const { unwrapRequestId } = await wrappedToken.unwrap(500n);
|
|
21826
|
+
* await wrappedToken.finalizeUnwrap(unwrapRequestId);
|
|
21626
21827
|
* ```
|
|
21627
21828
|
*/
|
|
21628
|
-
|
|
21829
|
+
finalizeUnwrap(unwrapRequestId: EncryptedValue): Promise<TransactionResult>;
|
|
21830
|
+
}
|
|
21831
|
+
//#endregion
|
|
21832
|
+
//#region src/query/confidential-balance.d.ts
|
|
21833
|
+
/** Configuration for {@link confidentialBalanceQueryOptions}. */
|
|
21834
|
+
interface ConfidentialBalanceQueryConfig {
|
|
21835
|
+
/** Address of the confidential token to read the balance of. */
|
|
21836
|
+
tokenAddress: Address;
|
|
21837
|
+
/** Account whose confidential balance to read; the query stays disabled until provided. */
|
|
21838
|
+
account?: Address;
|
|
21839
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21840
|
+
query?: Record<string, unknown>;
|
|
21841
|
+
}
|
|
21842
|
+
/** Query options for a single confidential token balance. Auto-gated on `account`. */
|
|
21843
|
+
declare function confidentialBalanceQueryOptions(token: Token, config: ConfidentialBalanceQueryConfig, signerContext?: SignerQueryContext): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.confidentialBalance.owner>>;
|
|
21844
|
+
//#endregion
|
|
21845
|
+
//#region src/query/confidential-balances.d.ts
|
|
21846
|
+
/** Configuration for {@link confidentialBalancesQueryOptions}. */
|
|
21847
|
+
interface ConfidentialBalancesQueryConfig {
|
|
21848
|
+
/** Account whose confidential balances to read; the query stays disabled until provided. */
|
|
21849
|
+
account?: Address;
|
|
21850
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21851
|
+
query?: Record<string, unknown>;
|
|
21852
|
+
}
|
|
21853
|
+
/** Builds TanStack Query options for reading the confidential balances of several tokens for one account in a single batch. */
|
|
21854
|
+
declare function confidentialBalancesQueryOptions(tokens: Token[], config?: ConfidentialBalancesQueryConfig, signerContext?: SignerQueryContext): QueryFactoryOptions<BatchBalancesResult, Error, BatchBalancesResult, ReturnType<typeof zamaQueryKeys.confidentialBalances.tokens>>;
|
|
21855
|
+
//#endregion
|
|
21856
|
+
//#region src/query/wrappers-registry.d.ts
|
|
21857
|
+
/** Base configuration shared by the wrappers-registry query option factories. */
|
|
21858
|
+
interface WrappersRegistryQueryConfig {
|
|
21859
|
+
/** Registry contract address for the current chain; used as a query key discriminator. */
|
|
21860
|
+
registryAddress: Address | undefined;
|
|
21861
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21862
|
+
query?: Record<string, unknown>;
|
|
21863
|
+
}
|
|
21864
|
+
/** Builds TanStack Query options for reading all token wrapper pairs registered in the wrappers registry. */
|
|
21865
|
+
declare function tokenPairsQueryOptions(sdk: ZamaSDK, config: WrappersRegistryQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairs>>;
|
|
21866
|
+
/** Configuration for {@link confidentialTokenAddressQueryOptions}. */
|
|
21867
|
+
interface ConfidentialTokenAddressQueryConfig extends WrappersRegistryQueryConfig {
|
|
21868
|
+
/** Underlying ERC-20 token address whose confidential counterpart to look up. */
|
|
21869
|
+
tokenAddress?: Address;
|
|
21870
|
+
}
|
|
21871
|
+
/** Builds TanStack Query options for reading the confidential token address registered for a given underlying ERC-20 token. */
|
|
21872
|
+
declare function confidentialTokenAddressQueryOptions(sdk: ZamaSDK, config: ConfidentialTokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.confidentialTokenAddress>>;
|
|
21873
|
+
/** Configuration for {@link tokenAddressQueryOptions}. */
|
|
21874
|
+
interface TokenAddressQueryConfig extends WrappersRegistryQueryConfig {
|
|
21875
|
+
/** Confidential token address whose underlying ERC-20 counterpart to look up. */
|
|
21876
|
+
confidentialTokenAddress?: Address;
|
|
21877
|
+
}
|
|
21878
|
+
/** Builds TanStack Query options for reading the underlying ERC-20 token address registered for a given confidential token. */
|
|
21879
|
+
declare function tokenAddressQueryOptions(sdk: ZamaSDK, config: TokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenAddress>>;
|
|
21880
|
+
/** Builds TanStack Query options for reading the total number of token wrapper pairs in the registry. */
|
|
21881
|
+
declare function tokenPairsLengthQueryOptions(sdk: ZamaSDK, config: WrappersRegistryQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsLength>>;
|
|
21882
|
+
/** Configuration for {@link tokenPairsSliceQueryOptions}. */
|
|
21883
|
+
interface TokenPairsSliceQueryConfig extends WrappersRegistryQueryConfig {
|
|
21884
|
+
/** Zero-based index of the first pair in the slice (inclusive). */
|
|
21885
|
+
fromIndex?: bigint;
|
|
21886
|
+
/** Index bounding the end of the slice. */
|
|
21887
|
+
toIndex?: bigint;
|
|
21888
|
+
}
|
|
21889
|
+
/** Builds TanStack Query options for reading a contiguous slice of the registry's token wrapper pairs. */
|
|
21890
|
+
declare function tokenPairsSliceQueryOptions(sdk: ZamaSDK, config: TokenPairsSliceQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsSlice>>;
|
|
21891
|
+
/** Configuration for {@link tokenPairQueryOptions}. */
|
|
21892
|
+
interface TokenPairQueryConfig extends WrappersRegistryQueryConfig {
|
|
21893
|
+
/** Zero-based index of the token wrapper pair to read. */
|
|
21894
|
+
index?: bigint;
|
|
21895
|
+
}
|
|
21896
|
+
/** Builds TanStack Query options for reading a single token wrapper pair by its index in the registry. */
|
|
21897
|
+
declare function tokenPairQueryOptions(sdk: ZamaSDK, config: TokenPairQueryConfig): QueryFactoryOptions<TokenWrapperPair, Error, TokenWrapperPair, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPair>>;
|
|
21898
|
+
/** Configuration for {@link isConfidentialTokenValidQueryOptions}. */
|
|
21899
|
+
interface IsConfidentialTokenValidQueryConfig extends WrappersRegistryQueryConfig {
|
|
21900
|
+
/** Confidential token address to validate against the registry. */
|
|
21901
|
+
confidentialTokenAddress?: Address;
|
|
21902
|
+
}
|
|
21903
|
+
/** Builds TanStack Query options for checking whether a confidential token is registered and valid in the registry. */
|
|
21904
|
+
declare function isConfidentialTokenValidQueryOptions(sdk: ZamaSDK, config: IsConfidentialTokenValidQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.wrappersRegistry.isConfidentialTokenValid>>;
|
|
21905
|
+
/** Configuration for {@link listPairsQueryOptions}. */
|
|
21906
|
+
interface ListPairsQueryConfig {
|
|
21907
|
+
/**
|
|
21908
|
+
* The registry address for this chain — used as a query key discriminator.
|
|
21909
|
+
* The registry instance already knows how to resolve the address for the
|
|
21910
|
+
* current chain; this field just keeps the TanStack Query cache isolated
|
|
21911
|
+
* per registry contract.
|
|
21912
|
+
*/
|
|
21913
|
+
registryAddress: Address | undefined;
|
|
21914
|
+
/** 1-based page number to fetch; defaults to `1`. */
|
|
21915
|
+
page?: number;
|
|
21916
|
+
/** Number of pairs per page; defaults to `100`. */
|
|
21917
|
+
pageSize?: number;
|
|
21918
|
+
/** When `true`, resolve each pair's on-chain metadata; defaults to `false`. */
|
|
21919
|
+
metadata?: boolean;
|
|
21920
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21921
|
+
query?: Record<string, unknown>;
|
|
21922
|
+
}
|
|
21923
|
+
/**
|
|
21924
|
+
* Query options for paginated listing of token wrapper pairs.
|
|
21925
|
+
*
|
|
21926
|
+
* Accepts a {@link WrappersRegistry} instance rather than a raw provider so that the
|
|
21927
|
+
* class-level TTL cache is shared across multiple `queryFn` executions. Pass
|
|
21928
|
+
* `sdk.registry` (the ZamaSDK lazy singleton) to ensure a single shared cache.
|
|
21929
|
+
*/
|
|
21930
|
+
declare function listPairsQueryOptions(registry: WrappersRegistry, config: ListPairsQueryConfig): QueryFactoryOptions<PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>, Error, PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>, ReturnType<typeof zamaQueryKeys.wrappersRegistry.listPairs>>;
|
|
21931
|
+
//#endregion
|
|
21932
|
+
//#region src/query/shield.d.ts
|
|
21933
|
+
/** Variables for {@link shieldMutationOptions}. */
|
|
21934
|
+
interface ShieldParams extends ShieldOptions {
|
|
21935
|
+
/** Amount of the public ERC-20 to shield, in the token's base units. */
|
|
21936
|
+
amount: bigint;
|
|
21937
|
+
}
|
|
21938
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.shield | shielding} a public ERC-20 into its confidential form. @see {@link ShieldParams} */
|
|
21939
|
+
declare function shieldMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.shield", Address], ShieldParams, TransactionResult>;
|
|
21940
|
+
//#endregion
|
|
21941
|
+
//#region src/query/transfer.d.ts
|
|
21942
|
+
/** Variables for {@link confidentialTransferMutationOptions}. */
|
|
21943
|
+
interface ConfidentialTransferParams extends TransferOptions {
|
|
21944
|
+
/** Recipient address. */
|
|
21945
|
+
to: Address;
|
|
21946
|
+
/** Amount of tokens to transfer, in the token's base units. */
|
|
21947
|
+
amount: bigint;
|
|
21948
|
+
}
|
|
21949
|
+
/** Builds TanStack Query mutation options for {@link Token.confidentialTransfer | transferring} confidential tokens. @see {@link ConfidentialTransferParams} */
|
|
21950
|
+
declare function confidentialTransferMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransfer", Address], ConfidentialTransferParams, TransactionResult>;
|
|
21951
|
+
//#endregion
|
|
21952
|
+
//#region src/query/transfer-and-call.d.ts
|
|
21953
|
+
/** Variables for {@link confidentialTransferAndCallMutationOptions}. */
|
|
21954
|
+
interface ConfidentialTransferAndCallParams extends TransferOptions {
|
|
21955
|
+
/** Recipient address. */
|
|
21956
|
+
to: Address;
|
|
21957
|
+
/** Amount of tokens to transfer, in the token's base units. */
|
|
21958
|
+
amount: bigint;
|
|
21959
|
+
/** Opaque bytes forwarded to the recipient's ERC-7984 receiver hook. */
|
|
21960
|
+
data: Hex;
|
|
21961
|
+
}
|
|
21962
|
+
/** Builds TanStack Query mutation options for {@link Token.confidentialTransferAndCall | transferring} confidential tokens and invoking the recipient's receiver hook. @see {@link ConfidentialTransferAndCallParams} */
|
|
21963
|
+
declare function confidentialTransferAndCallMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransferAndCall", Address], ConfidentialTransferAndCallParams, TransactionResult>;
|
|
21964
|
+
//#endregion
|
|
21965
|
+
//#region src/query/transfer-from.d.ts
|
|
21966
|
+
/** Variables for {@link confidentialTransferFromMutationOptions}. */
|
|
21967
|
+
interface ConfidentialTransferFromParams {
|
|
21968
|
+
/** Address to transfer from. */
|
|
21969
|
+
from: Address;
|
|
21970
|
+
/** Recipient address. */
|
|
21971
|
+
to: Address;
|
|
21972
|
+
/** Amount of tokens to transfer, in the token's base units. */
|
|
21973
|
+
amount: bigint;
|
|
21974
|
+
/** Optional progress callbacks for the multi-step transfer flow. */
|
|
21975
|
+
callbacks?: TransferCallbacks;
|
|
21976
|
+
}
|
|
21977
|
+
/** Builds TanStack Query mutation options for {@link Token.confidentialTransferFrom | transferring} confidential tokens from another account (operator flow). @see {@link ConfidentialTransferFromParams} */
|
|
21978
|
+
declare function confidentialTransferFromMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransferFrom", Address], ConfidentialTransferFromParams, TransactionResult>;
|
|
21979
|
+
//#endregion
|
|
21980
|
+
//#region src/query/transfer-from-and-call.d.ts
|
|
21981
|
+
/** Variables for {@link confidentialTransferFromAndCallMutationOptions}. */
|
|
21982
|
+
interface ConfidentialTransferFromAndCallParams {
|
|
21983
|
+
/** Address to transfer from. */
|
|
21984
|
+
from: Address;
|
|
21985
|
+
/** Recipient address. */
|
|
21986
|
+
to: Address;
|
|
21987
|
+
/** Amount of tokens to transfer, in the token's base units. */
|
|
21988
|
+
amount: bigint;
|
|
21989
|
+
/** Opaque bytes forwarded to the recipient's ERC-7984 receiver hook. */
|
|
21990
|
+
data: Hex;
|
|
21991
|
+
/** Optional progress callbacks for the multi-step transfer flow. */
|
|
21992
|
+
callbacks?: TransferCallbacks;
|
|
21993
|
+
}
|
|
21994
|
+
/** Builds TanStack Query mutation options for {@link Token.confidentialTransferFromAndCall | transferring} confidential tokens from another account and invoking the recipient's receiver hook. @see {@link ConfidentialTransferFromAndCallParams} */
|
|
21995
|
+
declare function confidentialTransferFromAndCallMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransferFromAndCall", Address], ConfidentialTransferFromAndCallParams, TransactionResult>;
|
|
21996
|
+
//#endregion
|
|
21997
|
+
//#region src/query/set-operator.d.ts
|
|
21998
|
+
/** Variables for {@link confidentialSetOperatorMutationOptions}. */
|
|
21999
|
+
interface ConfidentialSetOperatorParams {
|
|
22000
|
+
/** Operator address to authorize. */
|
|
22001
|
+
operator: Address;
|
|
22002
|
+
/** Unix timestamp (seconds) when the operator authorization expires; defaults to one hour from now. */
|
|
22003
|
+
until?: number;
|
|
22004
|
+
}
|
|
22005
|
+
/** Builds TanStack Query mutation options for {@link Token.setOperator | authorizing} an operator on a confidential token. @see {@link ConfidentialSetOperatorParams} */
|
|
22006
|
+
declare function confidentialSetOperatorMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialSetOperator", Address], ConfidentialSetOperatorParams, TransactionResult>;
|
|
22007
|
+
//#endregion
|
|
22008
|
+
//#region src/query/approve-underlying.d.ts
|
|
22009
|
+
/** Variables for {@link approveUnderlyingMutationOptions}. */
|
|
22010
|
+
interface ApproveUnderlyingParams {
|
|
22011
|
+
/** Amount of the underlying ERC-20 to approve, in its base units; omit for a max approval. */
|
|
22012
|
+
amount?: bigint;
|
|
22013
|
+
}
|
|
22014
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.approveUnderlying | approving} the wrapper to spend the underlying ERC-20. @see {@link ApproveUnderlyingParams} */
|
|
22015
|
+
declare function approveUnderlyingMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.approveUnderlying", Address], ApproveUnderlyingParams, TransactionResult>;
|
|
22016
|
+
//#endregion
|
|
22017
|
+
//#region src/query/unshield.d.ts
|
|
22018
|
+
/** Variables for {@link unshieldMutationOptions}. */
|
|
22019
|
+
interface UnshieldParams extends UnshieldOptions {
|
|
22020
|
+
/** Amount of tokens to unshield, in the token's base units. */
|
|
22021
|
+
amount: bigint;
|
|
22022
|
+
}
|
|
22023
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.unshield | unshielding} a confidential token back into its public ERC-20. @see {@link UnshieldParams} */
|
|
22024
|
+
declare function unshieldMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.unshield", Address], UnshieldParams, TransactionResult>;
|
|
22025
|
+
//#endregion
|
|
22026
|
+
//#region src/query/unshield-all.d.ts
|
|
22027
|
+
/** Variables for {@link unshieldAllMutationOptions}. */
|
|
22028
|
+
interface UnshieldAllParams extends UnshieldCallbacks {}
|
|
22029
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.unshieldAll | unshielding} the entire confidential balance back into the public ERC-20. @see {@link UnshieldAllParams} */
|
|
22030
|
+
declare function unshieldAllMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.unshieldAll", Address], UnshieldAllParams | void, TransactionResult>;
|
|
22031
|
+
//#endregion
|
|
22032
|
+
//#region src/query/resume-unshield.d.ts
|
|
22033
|
+
/** Variables for {@link resumeUnshieldMutationOptions}. */
|
|
22034
|
+
interface ResumeUnshieldParams extends UnshieldCallbacks {
|
|
22035
|
+
/** Hash of the earlier unwrap request transaction to resume from. */
|
|
22036
|
+
unwrapTxHash: Hex;
|
|
21629
22037
|
}
|
|
22038
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.resumeUnshield | resuming} an interrupted unshield from its unwrap request transaction. @see {@link ResumeUnshieldParams} */
|
|
22039
|
+
declare function resumeUnshieldMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.resumeUnshield", Address], ResumeUnshieldParams, TransactionResult>;
|
|
21630
22040
|
//#endregion
|
|
21631
|
-
//#region src/query/
|
|
21632
|
-
/**
|
|
21633
|
-
|
|
21634
|
-
|
|
21635
|
-
|
|
21636
|
-
*/
|
|
21637
|
-
type QueryFactoryOptions<TQueryFnData = unknown, TError = Error, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey> = Omit<Omit<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, "queryKey"> & Required<Pick<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>, "queryKey">>, "queryFn" | "queryHash" | "queryKeyHashFn" | "throwOnError"> & {
|
|
21638
|
-
queryFn: Exclude<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>["queryFn"], typeof skipToken | undefined>;
|
|
21639
|
-
};
|
|
21640
|
-
/** TanStack Query mutation options object returned by the SDK's `*MutationOptions` factories. */
|
|
21641
|
-
interface MutationFactoryOptions<TMutationKey extends readonly unknown[], TVariables, TData, TOnMutateResult = unknown> {
|
|
21642
|
-
/** Cache key identifying the mutation. */
|
|
21643
|
-
mutationKey: TMutationKey;
|
|
21644
|
-
/** Runs the mutation for the given variables. */
|
|
21645
|
-
mutationFn: (variables: TVariables) => Promise<TData>;
|
|
21646
|
-
/** Optional callback invoked after the mutation succeeds. */
|
|
21647
|
-
onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => void;
|
|
22041
|
+
//#region src/query/unwrap.d.ts
|
|
22042
|
+
/** Variables for {@link unwrapMutationOptions}. */
|
|
22043
|
+
interface UnwrapParams {
|
|
22044
|
+
/** Amount of tokens to unwrap, in the token's base units. */
|
|
22045
|
+
amount: bigint;
|
|
21648
22046
|
}
|
|
22047
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.unwrap | unwrapping} a confidential token (request phase of the two-phase unwrap). @see {@link UnwrapParams} */
|
|
22048
|
+
declare function unwrapMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.unwrap", Address], UnwrapParams, UnwrapResult>;
|
|
21649
22049
|
//#endregion
|
|
21650
|
-
//#region src/query/
|
|
21651
|
-
/**
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21655
|
-
|
|
21656
|
-
|
|
21657
|
-
|
|
21658
|
-
|
|
21659
|
-
|
|
21660
|
-
*/
|
|
21661
|
-
declare
|
|
21662
|
-
|
|
21663
|
-
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
|
|
21667
|
-
|
|
21668
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21669
|
-
readonly walletAddress: `0x${string}`;
|
|
21670
|
-
readonly walletChainId: number;
|
|
21671
|
-
readonly tokenAddress: `0x${string}`;
|
|
21672
|
-
} | {
|
|
21673
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21674
|
-
readonly walletAddress?: undefined;
|
|
21675
|
-
readonly walletChainId?: undefined;
|
|
21676
|
-
readonly tokenAddress: `0x${string}`;
|
|
21677
|
-
}];
|
|
21678
|
-
};
|
|
21679
|
-
readonly confidentialBalances: {
|
|
21680
|
-
readonly all: readonly ["zama.confidentialBalances"];
|
|
21681
|
-
readonly tokens: (tokenAddresses: Address[], owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalances", {
|
|
21682
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21683
|
-
readonly walletAddress: `0x${string}`;
|
|
21684
|
-
readonly walletChainId: number;
|
|
21685
|
-
readonly tokenAddresses: `0x${string}`[];
|
|
21686
|
-
} | {
|
|
21687
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21688
|
-
readonly walletAddress?: undefined;
|
|
21689
|
-
readonly walletChainId?: undefined;
|
|
21690
|
-
readonly tokenAddresses: `0x${string}`[];
|
|
21691
|
-
}];
|
|
21692
|
-
};
|
|
21693
|
-
readonly tokenMetadata: {
|
|
21694
|
-
readonly all: readonly ["zama.tokenMetadata"];
|
|
21695
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.tokenMetadata", {
|
|
21696
|
-
readonly tokenAddress: `0x${string}`;
|
|
21697
|
-
}];
|
|
21698
|
-
};
|
|
21699
|
-
readonly isConfidential: {
|
|
21700
|
-
readonly all: readonly ["zama.isConfidential"];
|
|
21701
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.isConfidential", {
|
|
21702
|
-
readonly tokenAddress: `0x${string}`;
|
|
21703
|
-
}];
|
|
21704
|
-
};
|
|
21705
|
-
readonly isWrapper: {
|
|
21706
|
-
readonly all: readonly ["zama.isWrapper"];
|
|
21707
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.isWrapper", {
|
|
21708
|
-
readonly tokenAddress: `0x${string}`;
|
|
21709
|
-
}];
|
|
21710
|
-
};
|
|
21711
|
-
readonly wrapperDiscovery: {
|
|
21712
|
-
readonly all: readonly ["zama.wrapperDiscovery"];
|
|
21713
|
-
readonly token: (tokenAddress?: Address, erc20Address?: Address, registryAddress?: Address) => readonly ["zama.wrapperDiscovery", {
|
|
21714
|
-
readonly registryAddress?: `0x${string}` | undefined;
|
|
21715
|
-
readonly erc20Address?: `0x${string}` | undefined;
|
|
21716
|
-
readonly tokenAddress?: `0x${string}` | undefined;
|
|
21717
|
-
}];
|
|
21718
|
-
};
|
|
21719
|
-
readonly underlyingAllowance: {
|
|
21720
|
-
readonly all: readonly ["zama.underlyingAllowance"];
|
|
21721
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.underlyingAllowance", {
|
|
21722
|
-
readonly tokenAddress: `0x${string}`;
|
|
21723
|
-
}];
|
|
21724
|
-
readonly scope: (tokenAddress: Address, owner?: Address) => readonly ["zama.underlyingAllowance", {
|
|
21725
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21726
|
-
readonly tokenAddress: `0x${string}`;
|
|
21727
|
-
}];
|
|
21728
|
-
};
|
|
21729
|
-
readonly confidentialIsOperator: {
|
|
21730
|
-
readonly all: readonly ["zama.confidentialIsOperator"];
|
|
21731
|
-
readonly token: (tokenAddress?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
21732
|
-
tokenAddress: `0x${string}`;
|
|
21733
|
-
} | {
|
|
21734
|
-
tokenAddress?: undefined;
|
|
21735
|
-
}];
|
|
21736
|
-
readonly scope: (tokenAddress?: Address, holder?: Address, spender?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
21737
|
-
readonly spender?: `0x${string}` | undefined;
|
|
21738
|
-
readonly holder?: `0x${string}` | undefined;
|
|
21739
|
-
readonly tokenAddress?: `0x${string}` | undefined;
|
|
21740
|
-
}];
|
|
21741
|
-
};
|
|
21742
|
-
readonly totalSupply: {
|
|
21743
|
-
readonly all: readonly ["zama.totalSupply"];
|
|
21744
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.totalSupply", {
|
|
21745
|
-
readonly tokenAddress: `0x${string}`;
|
|
21746
|
-
}];
|
|
21747
|
-
};
|
|
21748
|
-
readonly pendingUnshield: {
|
|
21749
|
-
readonly all: readonly ["zama.pendingUnshield"];
|
|
21750
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.pendingUnshield", {
|
|
21751
|
-
readonly tokenAddress: `0x${string}`;
|
|
21752
|
-
}];
|
|
21753
|
-
};
|
|
21754
|
-
readonly hasPermit: {
|
|
21755
|
-
readonly all: readonly ["zama.hasPermit"];
|
|
21756
|
-
readonly scope: (contractAddresses: Address[], walletAccount?: WalletAccount) => readonly ["zama.hasPermit", {
|
|
21757
|
-
readonly contractAddresses: `0x${string}`[];
|
|
21758
|
-
readonly walletAddress: `0x${string}`;
|
|
21759
|
-
readonly walletChainId: number;
|
|
21760
|
-
} | {
|
|
21761
|
-
readonly contractAddresses: `0x${string}`[];
|
|
21762
|
-
readonly walletAddress?: undefined;
|
|
21763
|
-
readonly walletChainId?: undefined;
|
|
21764
|
-
}];
|
|
21765
|
-
};
|
|
21766
|
-
readonly delegationStatus: {
|
|
21767
|
-
readonly all: readonly ["zama.delegationStatus"];
|
|
21768
|
-
readonly contract: (contractAddress?: Address) => readonly ["zama.delegationStatus", {
|
|
21769
|
-
contractAddress: `0x${string}`;
|
|
21770
|
-
} | {
|
|
21771
|
-
contractAddress?: undefined;
|
|
21772
|
-
}];
|
|
21773
|
-
readonly scope: (contractAddress?: Address, delegator?: Address, delegate?: Address) => readonly ["zama.delegationStatus", {
|
|
21774
|
-
readonly delegateAddress?: `0x${string}` | undefined;
|
|
21775
|
-
readonly delegatorAddress?: `0x${string}` | undefined;
|
|
21776
|
-
readonly contractAddress?: `0x${string}` | undefined;
|
|
21777
|
-
}];
|
|
21778
|
-
};
|
|
21779
|
-
readonly decryption: {
|
|
21780
|
-
readonly all: readonly ["zama.decryption"];
|
|
21781
|
-
readonly encryptedValue: (encryptedValue: string, contractAddress?: Address) => readonly ["zama.decryption", {
|
|
21782
|
-
readonly contractAddress?: `0x${string}` | undefined;
|
|
21783
|
-
readonly encryptedValue: string;
|
|
21784
|
-
}];
|
|
21785
|
-
readonly encryptedInputs: (encryptedInputs: readonly {
|
|
21786
|
-
encryptedValue: string;
|
|
21787
|
-
contractAddress: Address;
|
|
21788
|
-
}[], walletAccount?: WalletAccount) => readonly ["zama.decryption", {
|
|
21789
|
-
readonly encryptedInputs: {
|
|
21790
|
-
encryptedValue: Hex;
|
|
21791
|
-
contractAddress: `0x${string}`;
|
|
21792
|
-
}[];
|
|
21793
|
-
readonly walletAddress: `0x${string}`;
|
|
21794
|
-
readonly walletChainId: number;
|
|
21795
|
-
} | {
|
|
21796
|
-
readonly encryptedInputs: {
|
|
21797
|
-
encryptedValue: Hex;
|
|
21798
|
-
contractAddress: `0x${string}`;
|
|
21799
|
-
}[];
|
|
21800
|
-
readonly walletAddress?: undefined;
|
|
21801
|
-
readonly walletChainId?: undefined;
|
|
21802
|
-
}];
|
|
21803
|
-
};
|
|
21804
|
-
readonly wrappersRegistry: {
|
|
21805
|
-
readonly all: readonly ["zama.wrappersRegistry"];
|
|
21806
|
-
readonly chainId: () => readonly ["zama.wrappersRegistry", {
|
|
21807
|
-
readonly type: "chainId";
|
|
21808
|
-
}];
|
|
21809
|
-
readonly tokenPairs: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21810
|
-
readonly type: "tokenPairs";
|
|
21811
|
-
readonly registryAddress: `0x${string}`;
|
|
21812
|
-
}];
|
|
21813
|
-
readonly confidentialTokenAddress: (registryAddress: Address, tokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21814
|
-
readonly type: "confidentialTokenAddress";
|
|
21815
|
-
readonly registryAddress: `0x${string}`;
|
|
21816
|
-
readonly tokenAddress: `0x${string}`;
|
|
21817
|
-
}];
|
|
21818
|
-
readonly tokenAddress: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21819
|
-
readonly type: "tokenAddress";
|
|
21820
|
-
readonly registryAddress: `0x${string}`;
|
|
21821
|
-
readonly confidentialTokenAddress: `0x${string}`;
|
|
21822
|
-
}];
|
|
21823
|
-
readonly tokenPairsLength: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21824
|
-
readonly type: "tokenPairsLength";
|
|
21825
|
-
readonly registryAddress: `0x${string}`;
|
|
21826
|
-
}];
|
|
21827
|
-
readonly tokenPairsSlice: (registryAddress: Address, fromIndex: string, toIndex: string) => readonly ["zama.wrappersRegistry", {
|
|
21828
|
-
readonly type: "tokenPairsSlice";
|
|
21829
|
-
readonly registryAddress: `0x${string}`;
|
|
21830
|
-
readonly fromIndex: string;
|
|
21831
|
-
readonly toIndex: string;
|
|
21832
|
-
}];
|
|
21833
|
-
readonly tokenPair: (registryAddress: Address, index: string) => readonly ["zama.wrappersRegistry", {
|
|
21834
|
-
readonly type: "tokenPair";
|
|
21835
|
-
readonly registryAddress: `0x${string}`;
|
|
21836
|
-
readonly index: string;
|
|
21837
|
-
}];
|
|
21838
|
-
readonly isConfidentialTokenValid: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21839
|
-
readonly type: "isConfidentialTokenValid";
|
|
21840
|
-
readonly registryAddress: `0x${string}`;
|
|
21841
|
-
readonly confidentialTokenAddress: `0x${string}`;
|
|
21842
|
-
}];
|
|
21843
|
-
readonly listPairs: (registryAddress: Address, page: number, pageSize: number, metadata: boolean) => readonly ["zama.wrappersRegistry", {
|
|
21844
|
-
readonly type: "listPairs";
|
|
21845
|
-
readonly registryAddress: `0x${string}`;
|
|
21846
|
-
readonly page: number;
|
|
21847
|
-
readonly pageSize: number;
|
|
21848
|
-
readonly metadata: boolean;
|
|
21849
|
-
}];
|
|
21850
|
-
};
|
|
22050
|
+
//#region src/query/wrap.d.ts
|
|
22051
|
+
/** Variables for {@link wrapMutationOptions}. */
|
|
22052
|
+
interface WrapParams extends WrapOptions {
|
|
22053
|
+
/** Amount of the public ERC-20 to wrap, in the token's base units. */
|
|
22054
|
+
amount: bigint;
|
|
22055
|
+
}
|
|
22056
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.wrap | wrapping} a public ERC-20 into its confidential form. @see {@link WrapParams} */
|
|
22057
|
+
declare function wrapMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.wrap", Address], WrapParams, TransactionResult>;
|
|
22058
|
+
//#endregion
|
|
22059
|
+
//#region src/query/unwrap-all.d.ts
|
|
22060
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.unwrapAll | unwrapping} the entire confidential balance. */
|
|
22061
|
+
declare function unwrapAllMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.unwrapAll", Address], void, UnwrapResult>;
|
|
22062
|
+
//#endregion
|
|
22063
|
+
//#region src/query/finalize-unwrap.d.ts
|
|
22064
|
+
/** Variables for {@link finalizeUnwrapMutationOptions}. */
|
|
22065
|
+
type FinalizeUnwrapParams = {
|
|
22066
|
+
/** Identifier from an `UnwrapRequested` event. */
|
|
22067
|
+
unwrapRequestId: EncryptedValue;
|
|
21851
22068
|
};
|
|
22069
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.finalizeUnwrap | finalizing} a previously requested unwrap. @see {@link FinalizeUnwrapParams} */
|
|
22070
|
+
declare function finalizeUnwrapMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.finalizeUnwrap", Address], FinalizeUnwrapParams, TransactionResult>;
|
|
21852
22071
|
//#endregion
|
|
21853
|
-
//#region src/query/
|
|
21854
|
-
/**
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
22072
|
+
//#region src/query/encrypt.d.ts
|
|
22073
|
+
/** Builds TanStack Query mutation options for {@link ZamaSDK.encrypt | encrypting} plaintext inputs into an encrypted payload. */
|
|
22074
|
+
declare function encryptMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.encrypt"], EncryptParams, EncryptResult>;
|
|
22075
|
+
//#endregion
|
|
22076
|
+
//#region src/query/delegated-decrypt.d.ts
|
|
22077
|
+
/** Variables for {@link delegatedDecryptValuesMutationOptions}. */
|
|
22078
|
+
interface DelegatedDecryptValuesMutationParams {
|
|
22079
|
+
/** Encrypted values (with their contract addresses) to decrypt. */
|
|
22080
|
+
encryptedInputs: EncryptedInput[];
|
|
22081
|
+
/** Address of the account that delegated decryption rights to the connected wallet. */
|
|
22082
|
+
delegatorAddress: Address;
|
|
21858
22083
|
}
|
|
22084
|
+
/** Builds TanStack Query mutation options for {@link Decryption.delegatedDecryptValues | decrypting} encrypted values via delegated decryption credentials. @see {@link DelegatedDecryptValuesMutationParams} */
|
|
22085
|
+
declare function delegatedDecryptValuesMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.delegatedDecryptValues"], DelegatedDecryptValuesMutationParams, Readonly<Record<EncryptedValue, ClearValue>>>;
|
|
21859
22086
|
//#endregion
|
|
21860
|
-
//#region src/query/
|
|
21861
|
-
/**
|
|
21862
|
-
|
|
21863
|
-
|
|
21864
|
-
|
|
21865
|
-
|
|
21866
|
-
|
|
22087
|
+
//#region src/query/public-decrypt.d.ts
|
|
22088
|
+
/** Builds TanStack Query mutation options for {@link Decryption.decryptPublicValues | publicly decrypting} encrypted values, caching each clear result. */
|
|
22089
|
+
declare function decryptPublicValuesMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.decryptPublicValues"], EncryptedValue[], DecryptPublicValuesResult>;
|
|
22090
|
+
//#endregion
|
|
22091
|
+
//#region src/query/grant-permit.d.ts
|
|
22092
|
+
/** Builds TanStack Query mutation options for {@link Permits.grantPermit | granting} decryption permits for the given contract addresses. */
|
|
22093
|
+
declare function grantPermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.grantPermit"], Address[], void>;
|
|
22094
|
+
//#endregion
|
|
22095
|
+
//#region src/query/prepare-permit.d.ts
|
|
22096
|
+
/** Builds TanStack Query mutation options for {@link Offline.preparePermit | preparing} an offline decryption permit. */
|
|
22097
|
+
declare function preparePermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.preparePermit"], PreparePermitRequest, PreparedPermit>;
|
|
22098
|
+
//#endregion
|
|
22099
|
+
//#region src/query/register-permit.d.ts
|
|
22100
|
+
/** Parameters for {@link registerPermitMutationOptions}. */
|
|
22101
|
+
interface RegisterPermitParams {
|
|
22102
|
+
/** The payload `sdk.offline.preparePermit` returned. */
|
|
22103
|
+
prepared: PreparedPermit;
|
|
22104
|
+
/** The `eth_signTypedData_v4` signature over `prepared.eip712`. */
|
|
22105
|
+
signature: Hex;
|
|
22106
|
+
}
|
|
22107
|
+
/** Builds TanStack Query mutation options for {@link Permits.registerPermit | registering} a signed offline permit. */
|
|
22108
|
+
declare function registerPermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.registerPermit"], RegisterPermitParams, void>;
|
|
22109
|
+
//#endregion
|
|
22110
|
+
//#region src/query/has-permit.d.ts
|
|
22111
|
+
/** Configuration for {@link hasPermitQueryOptions}. */
|
|
22112
|
+
interface HasPermitQueryConfig {
|
|
22113
|
+
/** Contract addresses to check credentials against. */
|
|
22114
|
+
contractAddresses: Address[];
|
|
22115
|
+
/**
|
|
22116
|
+
* Standard TanStack query options. `hasPermit` intentionally overrides cache
|
|
22117
|
+
* timing because permit state is wallet-local, not server state: every fetch
|
|
22118
|
+
* should read the SDK credential service directly.
|
|
22119
|
+
*/
|
|
22120
|
+
query?: Record<string, unknown>;
|
|
22121
|
+
}
|
|
22122
|
+
/** Builds TanStack Query options for reading whether the connected wallet holds a valid decryption permit for the given contracts. */
|
|
22123
|
+
declare function hasPermitQueryOptions(sdk: ZamaSDK, config: HasPermitQueryConfig, signerContext?: SignerQueryContext): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.hasPermit.scope>>;
|
|
22124
|
+
//#endregion
|
|
22125
|
+
//#region src/query/revoke-permits.d.ts
|
|
22126
|
+
/** TanStack Query mutation factory for {@link Permits.revokePermits}. */
|
|
22127
|
+
declare function revokePermitsMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.revokePermits"], Address[] | void, void>;
|
|
22128
|
+
//#endregion
|
|
22129
|
+
//#region src/query/clear-credentials.d.ts
|
|
22130
|
+
/** TanStack Query mutation factory for {@link Permits.clear}. */
|
|
22131
|
+
declare function clearCredentialsMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.clearCredentials"], void, void>;
|
|
22132
|
+
//#endregion
|
|
22133
|
+
//#region src/query/delegate-decryption.d.ts
|
|
22134
|
+
/** Variables for {@link delegateDecryptionMutationOptions}. */
|
|
22135
|
+
interface DelegateDecryptionParams {
|
|
22136
|
+
/** Address to grant delegated decryption rights to. */
|
|
22137
|
+
delegateAddress: Address;
|
|
22138
|
+
/** When the delegation expires; omit for no expiry. */
|
|
22139
|
+
expirationDate?: Date;
|
|
22140
|
+
}
|
|
22141
|
+
/** Builds TanStack Query mutation options for {@link Delegations.delegateDecryption | granting} delegated decryption rights on a contract. @see {@link DelegateDecryptionParams} */
|
|
22142
|
+
declare function delegateDecryptionMutationOptions(sdk: ZamaSDK, contractAddress: Address): MutationFactoryOptions<readonly ["zama.delegateDecryption", Address], DelegateDecryptionParams, TransactionResult>;
|
|
22143
|
+
//#endregion
|
|
22144
|
+
//#region src/query/decrypt-balance-as.d.ts
|
|
22145
|
+
/** Variables for {@link decryptBalanceAsMutationOptions}. */
|
|
22146
|
+
interface DecryptBalanceAsParams {
|
|
22147
|
+
/** Address of the account that delegated decryption rights to the connected wallet. */
|
|
22148
|
+
delegatorAddress: Address;
|
|
22149
|
+
/** Account whose on-chain balance to read; defaults to the delegator address. */
|
|
22150
|
+
accountAddress?: Address;
|
|
22151
|
+
}
|
|
22152
|
+
/** Builds TanStack Query mutation options for {@link Token.decryptBalanceAs | decrypting} a balance via delegated decryption credentials. @see {@link DecryptBalanceAsParams} */
|
|
22153
|
+
declare function decryptBalanceAsMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.decryptBalanceAs", Address], DecryptBalanceAsParams, bigint>;
|
|
22154
|
+
//#endregion
|
|
22155
|
+
//#region src/query/batch-decrypt-balances-as.d.ts
|
|
22156
|
+
/** Variables for {@link batchDecryptBalancesAsMutationOptions}. */
|
|
22157
|
+
type BatchDecryptBalancesAsParams = BatchDecryptAsOptions;
|
|
22158
|
+
/** Builds TanStack Query mutation options for {@link Token.batchDecryptBalancesAs | decrypting} multiple token balances via delegated decryption credentials. @see {@link BatchDecryptBalancesAsParams} */
|
|
22159
|
+
declare function batchDecryptBalancesAsMutationOptions(tokens: Token[]): MutationFactoryOptions<readonly ["zama.batchDecryptBalancesAs", ...Address[]], BatchDecryptBalancesAsParams, Map<Address, bigint>>;
|
|
22160
|
+
//#endregion
|
|
22161
|
+
//#region src/query/revoke-delegation.d.ts
|
|
22162
|
+
/** Variables for {@link revokeDelegationMutationOptions}. */
|
|
22163
|
+
interface RevokeDelegationParams {
|
|
22164
|
+
/** Address whose delegated decryption rights to revoke. */
|
|
22165
|
+
delegateAddress: Address;
|
|
21867
22166
|
}
|
|
21868
|
-
/**
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
|
|
22167
|
+
/** Builds TanStack Query mutation options for {@link Delegations.revokeDelegation | revoking} delegated decryption rights on a contract. @see {@link RevokeDelegationParams} */
|
|
22168
|
+
declare function revokeDelegationMutationOptions(sdk: ZamaSDK, contractAddress: Address): MutationFactoryOptions<readonly ["zama.revokeDelegation", Address], RevokeDelegationParams, TransactionResult>;
|
|
22169
|
+
//#endregion
|
|
22170
|
+
//#region src/query/delegation-status.d.ts
|
|
22171
|
+
/** Configuration for {@link delegationStatusQueryOptions}. */
|
|
22172
|
+
interface DelegationStatusQueryConfig {
|
|
22173
|
+
/** Contract the delegation applies to; pass `undefined` to keep the query disabled. */
|
|
22174
|
+
contractAddress: Address | undefined;
|
|
22175
|
+
/** Address granting the delegated decryption rights; the query stays disabled until provided. */
|
|
22176
|
+
delegatorAddress?: Address;
|
|
22177
|
+
/** Address receiving the delegated decryption rights; the query stays disabled until provided. */
|
|
22178
|
+
delegateAddress?: Address;
|
|
22179
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
22180
|
+
query?: Record<string, unknown>;
|
|
22181
|
+
}
|
|
22182
|
+
/** Builds TanStack Query options for reading the decryption-delegation status between a delegator and a delegate on a contract. */
|
|
22183
|
+
declare function delegationStatusQueryOptions(sdk: ZamaSDK, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatus, Error, DelegationStatus, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
|
|
21872
22184
|
//#endregion
|
|
21873
22185
|
//#region src/services/decryption-service.d.ts
|
|
21874
22186
|
/** Options shared by the delegated-decrypt entry points. */
|
|
@@ -21898,6 +22210,224 @@ interface BatchDecryptResult {
|
|
|
21898
22210
|
items: BatchDecryptItem[];
|
|
21899
22211
|
}
|
|
21900
22212
|
//#endregion
|
|
22213
|
+
//#region src/namespaces/offline.d.ts
|
|
22214
|
+
/**
|
|
22215
|
+
* Namespace for the offline-signing pipeline —
|
|
22216
|
+
* `prepare → [external sign + self-publish]` — for institutional custody, HSM
|
|
22217
|
+
* ceremonies, and policy-engine workflows where signing runs out-of-process and
|
|
22218
|
+
* cannot happen synchronously in a single Promise.
|
|
22219
|
+
*/
|
|
22220
|
+
declare class Offline {
|
|
22221
|
+
#private;
|
|
22222
|
+
/**
|
|
22223
|
+
* Build an RLP-encoded unsigned transaction for the given request. The
|
|
22224
|
+
* caller signs it externally — via an HSM ceremony, an out-of-process
|
|
22225
|
+
* custodian, or any signer holding the key — and broadcasts the signed bytes
|
|
22226
|
+
* through its own channel.
|
|
22227
|
+
*
|
|
22228
|
+
* Signer-optional: works without a configured signer (canonical shape for
|
|
22229
|
+
* cross-process custody — the back-end signer service consumes
|
|
22230
|
+
* `prepared.unsignedTx` and returns signed bytes).
|
|
22231
|
+
*
|
|
22232
|
+
* @remarks
|
|
22233
|
+
* `request.from` is only a declaration — the SDK does not prove the caller
|
|
22234
|
+
* controls it, and an EIP-1559 unsigned tx carries no `from` field at all
|
|
22235
|
+
* (the on-chain sender is whichever key signs the bytes). Point `from` at
|
|
22236
|
+
* the account the custodian will sign with; custodians enforce key-control
|
|
22237
|
+
* at sign time — a signing request for a key the credential can't use fails
|
|
22238
|
+
* there — so a mismatched `from` cannot make the custodian sign from an
|
|
22239
|
+
* account you don't control. Verifying control of `from` up front is still
|
|
22240
|
+
* the application's responsibility.
|
|
22241
|
+
*/
|
|
22242
|
+
prepare<K extends TransactionKind>(request: Extract<PrepareTransactionRequest, {
|
|
22243
|
+
kind: K;
|
|
22244
|
+
}>, options?: PrepareOptions): Promise<PreparedFor<K>>;
|
|
22245
|
+
/**
|
|
22246
|
+
* Build the offline-signing payload for a decryption permit: the unsigned
|
|
22247
|
+
* EIP-712 typed data plus everything `sdk.permits.registerPermit` needs to
|
|
22248
|
+
* verify and persist the signature an out-of-process signer returns for it.
|
|
22249
|
+
*
|
|
22250
|
+
* Not a `prepare()` transaction kind: a permit is not a transaction —
|
|
22251
|
+
* nothing is broadcast, and registering the signature is a local operation,
|
|
22252
|
+
* not a relayer round-trip.
|
|
22253
|
+
*
|
|
22254
|
+
* Signer-optional, like {@link prepare}: `request.signer` is an explicit
|
|
22255
|
+
* address, not a connected wallet account. Building the typed data still
|
|
22256
|
+
* reads the chain's KMS signers context on-chain — signer-offline, not
|
|
22257
|
+
* network-offline.
|
|
22258
|
+
*
|
|
22259
|
+
* One permit per call: unlike `sdk.permits.grantPermit`, this never widens
|
|
22260
|
+
* an existing permit or chunks over 10 contracts — `request.contracts` maps
|
|
22261
|
+
* to exactly one signature.
|
|
22262
|
+
*
|
|
22263
|
+
* @throws if `request.contracts` is empty or exceeds 10 addresses, `request.delegator`
|
|
22264
|
+
* equals `request.signer`, or `request.durationDays` exceeds the V1 permit maximum
|
|
22265
|
+
* of 365 days. {@link ConfigurationError}
|
|
22266
|
+
* @throws if a concurrent `permits.revokeTransportKeyPair()` rotates the transport key
|
|
22267
|
+
* pair while this call is generating one. {@link TransportKeyPairChangedError}
|
|
22268
|
+
*/
|
|
22269
|
+
preparePermit(request: PreparePermitRequest): Promise<PreparedPermit>;
|
|
22270
|
+
}
|
|
22271
|
+
//#endregion
|
|
22272
|
+
//#region src/zama-sdk.d.ts
|
|
22273
|
+
/** Instance-level options that are deliberately not part of the shareable config object. */
|
|
22274
|
+
interface ZamaSDKOptions {
|
|
22275
|
+
/**
|
|
22276
|
+
* Encrypts the transport key pair's private half at rest. Headless environments only
|
|
22277
|
+
* (CLI tools, servers, agents); the constructor rejects it in browser contexts. Supply
|
|
22278
|
+
* at least 32 random bytes, or a string of at least 64 characters, from a CSPRNG or
|
|
22279
|
+
* secrets manager. The SDK copies a Uint8Array secret and zeroizes its own copy after
|
|
22280
|
+
* key import; it never touches your buffer, so zeroize yours after construction.
|
|
22281
|
+
* The SDK never persists or exposes this value. Omit for the default:
|
|
22282
|
+
* plaintext at rest, security delegated to the storage backend.
|
|
22283
|
+
*/
|
|
22284
|
+
transportKeyPairDerivationSecret?: string | Uint8Array;
|
|
22285
|
+
}
|
|
22286
|
+
/**
|
|
22287
|
+
* ZamaSDK — composes a RelayerSDK with contract abstraction.
|
|
22288
|
+
*
|
|
22289
|
+
* Exposes domain namespaces for permits, delegations, decryption, offline
|
|
22290
|
+
* signing, and tokens, plus an unchanged registry, a top-level `encrypt`, and
|
|
22291
|
+
* lifecycle methods. Internal `*Service` classes do the work; the namespace
|
|
22292
|
+
* classes own SDK-level guards (chain alignment, signer requirement, event
|
|
22293
|
+
* emission).
|
|
22294
|
+
*/
|
|
22295
|
+
declare class ZamaSDK {
|
|
22296
|
+
#private;
|
|
22297
|
+
/** Read-only chain access used for all contract reads. */
|
|
22298
|
+
readonly provider: GenericProvider;
|
|
22299
|
+
/** Wallet signer used for write operations, or `undefined` when the SDK is read-only. */
|
|
22300
|
+
readonly signer: GenericSigner | undefined;
|
|
22301
|
+
/** Storage for cached permits and transport key pairs. */
|
|
22302
|
+
readonly storage: GenericStorage;
|
|
22303
|
+
/**
|
|
22304
|
+
* A {@link WrappersRegistry} instance auto-configured for the current chain.
|
|
22305
|
+
* Uses built-in defaults from chain configs, and the SDK's `registryTTL` if configured.
|
|
22306
|
+
*/
|
|
22307
|
+
readonly registry: WrappersRegistry;
|
|
22308
|
+
/** Permit and keypair management. */
|
|
22309
|
+
readonly permits: Permits;
|
|
22310
|
+
/** On-chain decryption-delegation management. */
|
|
22311
|
+
readonly delegations: Delegations;
|
|
22312
|
+
/** FHE decryption (user, delegated user, public). */
|
|
22313
|
+
readonly decryption: Decryption;
|
|
22314
|
+
/** Offline-signing pipeline: `prepare` builds an unsigned tx the caller signs and broadcasts out-of-process — for HSM, policy-engine, and cross-process custody workflows. */
|
|
22315
|
+
readonly offline: Offline;
|
|
22316
|
+
constructor(config: ZamaConfig, options?: ZamaSDKOptions);
|
|
22317
|
+
/**
|
|
22318
|
+
* The single-chain relayer backend for the **currently active** chain.
|
|
22319
|
+
*/
|
|
22320
|
+
get relayer(): RelayerSDK;
|
|
22321
|
+
/**
|
|
22322
|
+
* Create a {@link WrappersRegistry} instance bound to this SDK's provider.
|
|
22323
|
+
* Inherits the registry addresses derived from the SDK's chain configs, so
|
|
22324
|
+
* the result is consistent with {@link ZamaSDK.registry}.
|
|
22325
|
+
*
|
|
22326
|
+
* @param registryAddresses - Optional per-chain overrides for this registry instance.
|
|
22327
|
+
* @returns A {@link WrappersRegistry} instance.
|
|
22328
|
+
*
|
|
22329
|
+
* @example
|
|
22330
|
+
* ```ts
|
|
22331
|
+
* // Addresses resolved from the SDK's chain configs
|
|
22332
|
+
* const registry = sdk.createWrappersRegistry();
|
|
22333
|
+
*
|
|
22334
|
+
* // Hardhat or custom chain — override per chain for this registry instance
|
|
22335
|
+
* const registry = sdk.createWrappersRegistry({ [31337]: "0xYourRegistry" });
|
|
22336
|
+
*
|
|
22337
|
+
* const pairs = await registry.getTokenPairs();
|
|
22338
|
+
* ```
|
|
22339
|
+
*/
|
|
22340
|
+
createWrappersRegistry(registryAddresses?: Record<number, Address>): WrappersRegistry;
|
|
22341
|
+
/**
|
|
22342
|
+
* Encrypt one or more plaintext values into FHE ciphertexts.
|
|
22343
|
+
*
|
|
22344
|
+
* @param params - Typed FHE inputs, the target contract address, and the user address.
|
|
22345
|
+
* @returns External encrypted values and the input proof for on-chain submission.
|
|
22346
|
+
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
22347
|
+
*
|
|
22348
|
+
* @example
|
|
22349
|
+
* ```ts
|
|
22350
|
+
* const { encryptedValues, inputProof } = await sdk.encrypt({
|
|
22351
|
+
* values: [{ value: 1000n, type: "euint64" }],
|
|
22352
|
+
* contractAddress: "0xToken",
|
|
22353
|
+
* userAddress: "0xUser",
|
|
22354
|
+
* });
|
|
22355
|
+
* ```
|
|
22356
|
+
*/
|
|
22357
|
+
encrypt(params: EncryptParams, options?: Pick<FhevmRelayerOptions, "signal" | "timeout">): Promise<EncryptResult>;
|
|
22358
|
+
/**
|
|
22359
|
+
* Create a high-level ERC-20-style interface for an ERC-7984 confidential token.
|
|
22360
|
+
* Supports balance queries, transfers, operator approvals, and decryption.
|
|
22361
|
+
*
|
|
22362
|
+
* For ERC-7984 wrappers (shield/unshield/allowance), use {@link createWrappedToken} instead.
|
|
22363
|
+
*
|
|
22364
|
+
* @param address - The confidential token contract address.
|
|
22365
|
+
* @returns A {@link Token} instance bound to this SDK.
|
|
22366
|
+
*
|
|
22367
|
+
* @example
|
|
22368
|
+
* ```ts
|
|
22369
|
+
* const token = sdk.createToken(cUSDT);
|
|
22370
|
+
* const balance = await token.balanceOf(userAddress);
|
|
22371
|
+
* ```
|
|
22372
|
+
*/
|
|
22373
|
+
createToken(address: Address): Token;
|
|
22374
|
+
/**
|
|
22375
|
+
* Create a high-level interface for an ERC-7984 wrapper token.
|
|
22376
|
+
* Extends {@link Token} with shield/unshield/allowance/finalize-unwrap operations.
|
|
22377
|
+
*
|
|
22378
|
+
* @param address - The wrapper token contract address.
|
|
22379
|
+
* @returns A {@link WrappedToken} instance bound to this SDK.
|
|
22380
|
+
*
|
|
22381
|
+
* @example
|
|
22382
|
+
* ```ts
|
|
22383
|
+
* const wrapped = sdk.createWrappedToken(wUSDT);
|
|
22384
|
+
* await wrapped.shield(1_000_000n);
|
|
22385
|
+
* ```
|
|
22386
|
+
*/
|
|
22387
|
+
createWrappedToken(address: Address): WrappedToken;
|
|
22388
|
+
/**
|
|
22389
|
+
* Release the SDK-owned resources: signer lifecycle subscriptions and the
|
|
22390
|
+
* relayer backend's resources, an encrypt worker included. Call this when the
|
|
22391
|
+
* SDK instance is being replaced (e.g. React provider unmount or a Strict Mode
|
|
22392
|
+
* remount). Work already in flight runs to completion, and the instance stays
|
|
22393
|
+
* usable: the next encryption spawns a fresh worker.
|
|
22394
|
+
*/
|
|
22395
|
+
dispose(): void;
|
|
22396
|
+
/**
|
|
22397
|
+
* {@link dispose} plus the signer's own disposal. Call this when the SDK is no
|
|
22398
|
+
* longer needed (e.g. on shutdown). Work already in flight runs to completion.
|
|
22399
|
+
*/
|
|
22400
|
+
terminate(): void;
|
|
22401
|
+
/**
|
|
22402
|
+
* Implements the TC39 Explicit Resource Management protocol.
|
|
22403
|
+
* Calls {@link terminate} when the `using` binding goes out of scope,
|
|
22404
|
+
* unsubscribing signer events and releasing the relayer's resources.
|
|
22405
|
+
*
|
|
22406
|
+
* @example
|
|
22407
|
+
* ```ts
|
|
22408
|
+
* {
|
|
22409
|
+
* using sdk = new ZamaSDK({ relayer, provider, signer, storage });
|
|
22410
|
+
* await sdk.permits.grantPermit([cUSDT]);
|
|
22411
|
+
* const balance = await sdk.createToken(cUSDT).balanceOf(userAddress);
|
|
22412
|
+
* } // sdk.terminate() called automatically here
|
|
22413
|
+
* ```
|
|
22414
|
+
*/
|
|
22415
|
+
[Symbol.dispose](): void;
|
|
22416
|
+
}
|
|
22417
|
+
//#endregion
|
|
22418
|
+
//#region src/query/user-decrypt.d.ts
|
|
22419
|
+
/** A single encrypted value to decrypt, paired with the contract that owns it. */
|
|
22420
|
+
interface EncryptedInput {
|
|
22421
|
+
/** Encrypted handle to decrypt. */
|
|
22422
|
+
encryptedValue: EncryptedValue;
|
|
22423
|
+
/** Address of the contract the encrypted value belongs to. */
|
|
22424
|
+
contractAddress: Address;
|
|
22425
|
+
}
|
|
22426
|
+
/** Decrypted clear values keyed by encrypted handle. */
|
|
22427
|
+
type DecryptResult = Readonly<Record<EncryptedValue, ClearValue>>;
|
|
22428
|
+
/** Builds TanStack Query options for decrypting a batch of encrypted handles into their clear values. */
|
|
22429
|
+
declare function decryptValuesQueryOptions(sdk: ZamaSDK, encryptedInputs: EncryptedInput[], signerContext?: SignerQueryContext): QueryFactoryOptions<DecryptResult, Error, DecryptResult, ReturnType<typeof zamaQueryKeys.decryption.encryptedInputs>>;
|
|
22430
|
+
//#endregion
|
|
21901
22431
|
//#region src/namespaces/decryption.d.ts
|
|
21902
22432
|
/**
|
|
21903
22433
|
* Public namespace for FHE decryption — the canonical way to decrypt.
|
|
@@ -22038,94 +22568,5 @@ declare class Decryption {
|
|
|
22038
22568
|
} & DelegatedDecryptOptions): Promise<BatchDecryptResult>;
|
|
22039
22569
|
}
|
|
22040
22570
|
//#endregion
|
|
22041
|
-
|
|
22042
|
-
|
|
22043
|
-
declare class MemoryStorage implements GenericStorage {
|
|
22044
|
-
#private;
|
|
22045
|
-
/**
|
|
22046
|
-
* Retrieve a value by key.
|
|
22047
|
-
* @returns The stored value, or `null` if the key does not exist.
|
|
22048
|
-
*/
|
|
22049
|
-
get<T = unknown>(key: string): Promise<T | null>;
|
|
22050
|
-
/** Store a value under the given key, overwriting any existing entry. */
|
|
22051
|
-
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
22052
|
-
/** Remove the entry for the given key (no-op if absent). */
|
|
22053
|
-
delete(key: string): Promise<void>;
|
|
22054
|
-
}
|
|
22055
|
-
/** Default singleton for application-wide use. */
|
|
22056
|
-
declare const memoryStorage: MemoryStorage;
|
|
22057
|
-
//#endregion
|
|
22058
|
-
//#region src/storage/indexeddb-storage.d.ts
|
|
22059
|
-
/**
|
|
22060
|
-
* IndexedDB-backed {@link GenericStorage}.
|
|
22061
|
-
*
|
|
22062
|
-
* Stores keypair and permit objects keyed by a hashed wallet address. The
|
|
22063
|
-
* SDK delegates security to the storage backend — values are persisted
|
|
22064
|
-
* verbatim with no SDK-layer encryption.
|
|
22065
|
-
*/
|
|
22066
|
-
declare class IndexedDBStorage implements GenericStorage {
|
|
22067
|
-
#private;
|
|
22068
|
-
constructor(dbName?: string, dbVersion?: number, storeName?: string);
|
|
22069
|
-
/**
|
|
22070
|
-
* Retrieve a value by key.
|
|
22071
|
-
* @returns The stored value, or `null` if the key does not exist.
|
|
22072
|
-
*/
|
|
22073
|
-
get<T = unknown>(key: string): Promise<T | null>;
|
|
22074
|
-
/** Store a value under the given key, overwriting any existing entry. */
|
|
22075
|
-
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
22076
|
-
/** Remove the entry for the given key (no-op if absent). */
|
|
22077
|
-
delete(key: string): Promise<void>;
|
|
22078
|
-
/** Remove all stored entries. */
|
|
22079
|
-
clear(): Promise<void>;
|
|
22080
|
-
}
|
|
22081
|
-
/** Default singleton for application-wide use. */
|
|
22082
|
-
declare const indexedDBStorage: IndexedDBStorage;
|
|
22083
|
-
//#endregion
|
|
22084
|
-
//#region src/storage/chrome-session-storage.d.ts
|
|
22085
|
-
/**
|
|
22086
|
-
* {@link GenericStorage} backed by `chrome.storage.session`.
|
|
22087
|
-
*
|
|
22088
|
-
* Use this in MV3 web extensions so the wallet signature survives
|
|
22089
|
-
* service worker restarts and is shared across popup, background,
|
|
22090
|
-
* and content script contexts.
|
|
22091
|
-
*
|
|
22092
|
-
* @example
|
|
22093
|
-
* ```ts
|
|
22094
|
-
* import { ZamaSDK, indexedDBStorage, chromeSessionStorage } from "@zama-fhe/sdk";
|
|
22095
|
-
* import { createConfig } from "@zama-fhe/sdk/viem";
|
|
22096
|
-
*
|
|
22097
|
-
* const config = createConfig({
|
|
22098
|
-
* chains: [mySepolia],
|
|
22099
|
-
* publicClient,
|
|
22100
|
-
* walletClient,
|
|
22101
|
-
* relayers: { [mySepolia.id]: web() },
|
|
22102
|
-
* storage: indexedDBStorage, // encrypted transport key pair — persistent
|
|
22103
|
-
* permitStorage: chromeSessionStorage, // signed permits — ephemeral
|
|
22104
|
-
* });
|
|
22105
|
-
* const sdk = new ZamaSDK(config);
|
|
22106
|
-
* ```
|
|
22107
|
-
*/
|
|
22108
|
-
declare class ChromeSessionStorage implements GenericStorage {
|
|
22109
|
-
/**
|
|
22110
|
-
* Retrieve a value by key.
|
|
22111
|
-
* @returns The stored value, or `null` if the key does not exist.
|
|
22112
|
-
*/
|
|
22113
|
-
get<T = unknown>(key: string): Promise<T | null>;
|
|
22114
|
-
/** Store a value under the given key, overwriting any existing entry. */
|
|
22115
|
-
set(key: string, value: unknown): Promise<void>;
|
|
22116
|
-
/** Remove the entry for the given key (no-op if absent). */
|
|
22117
|
-
delete(key: string): Promise<void>;
|
|
22118
|
-
}
|
|
22119
|
-
/** Default singleton for application-wide use. */
|
|
22120
|
-
declare const chromeSessionStorage: ChromeSessionStorage;
|
|
22121
|
-
//#endregion
|
|
22122
|
-
//#region src/utils/handles.d.ts
|
|
22123
|
-
/** All-zero encrypted-value sentinel — a 32-byte zero handle representing the cleartext value `0`. */
|
|
22124
|
-
declare const ZERO_ENCRYPTED_VALUE: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
22125
|
-
/**
|
|
22126
|
-
* Check whether an encrypted value represents the zero value.
|
|
22127
|
-
*/
|
|
22128
|
-
declare function isEncryptedValueZero(encryptedValue: string): boolean;
|
|
22129
|
-
//#endregion
|
|
22130
|
-
export { BalanceErrorDetails as $, ERC7984_INTERFACE_ID as $t, BatchDecryptAsOptions as A, Permission as At, TransactionRevertedError as B, getConfidentialTokenAddressContract as Bt, ZamaSDKOptions as C, wrapContract as Cn, TransportKeyPairChangedError as Ct, WrappersRegistryConfig as D, ZamaErrorCode as Dt, WrappersRegistry as E, ZamaError as Et, Permits as F, SerializedTransportKeyPair as Ft, SignerRequiredError as G, getTokenPairsSliceContract as Gt, SigningFailedError as H, getTokenPairContract as Ht, ErrorForCode as I, ChecksummedAddress as It, RpcRateLimitError as J, getDelegationExpiryContract as Jt, WalletAccountNotReadyError as K, isConfidentialTokenValidContract as Kt, matchZamaError as L, PaginatedResult as Lt, Offline as M, PreparedPermit as Mt, Delegations as N, SerializedPermit as Nt, WrappedToken as O, isRetryable as Ot, DelegationStatus as P, SerializedPermitEip712 as Pt, BalanceCheckUnavailableError as Q, ERC1363_INTERFACE_ID as Qt, UnshieldAlreadyFinalizedDetails as R, TokenWrapperPair as Rt, ZamaSDK as S, unwrapRequesterContract as Sn, RevokedKmsContextError as St, ListPairsOptions as T, ChainMismatchError as Tt, SigningRejectedError as U, getTokenPairsContract as Ut, SigningErrorMetadata as V, getTokenAddressContract as Vt, SignerNotConfiguredError as W, getTokenPairsLengthContract as Wt, ConfigurationError as X, revokeDelegationContract as Xt, NotEntitledError as Y, isHandleDelegatedContract as Yt, RelayerRequestFailedError as Z, transferAndCallContract as Zt, decryptValuesQueryOptions as _, rateContract as _n, InvalidTransportKeyPairError as _t, ChromeSessionStorage as a, approveContract as an, EncryptOffloadUnavailableError as at, MutationFactoryOptions as b, unwrapContract as bn, PreparedPermitChainMismatchError as bt, indexedDBStorage as c, nameContract as cn, DelegationContractIsSelfError as ct, Decryption as d, confidentialTotalSupplyContract as dn, DelegationExpirationTooSoonError as dt, ERC7984_WRAPPER_INTERFACE_ID as en, ERC20ReadFailedError as et, BatchDecryptItem as f, confidentialTransferContract as fn, DelegationExpiredError as ft, EncryptedInput as g, isOperatorContract as gn, DelegationSelfNotAllowedError as gt, DecryptResult as h, inferredTotalSupplyContract as hn, DelegationNotPropagatedError as ht, isEncryptedValueZero as i, allowanceContract as in, DecryptionFailedError as it, Token as j, PreparePermitRequest as jt, BatchBalancesResult as k, retryAfterSeconds as kt, MemoryStorage as l, symbolContract as ln, DelegationCooldownError as lt, DelegatedDecryptOptions as m, finalizeUnwrapContract as mn, DelegationNotFoundError as mt, Hex$1 as n, isConfidentialWrapperContract as nn, InsufficientConfidentialBalanceError as nt, chromeSessionStorage as o, balanceOfContract as on, EncryptionFailedError as ot, BatchDecryptResult as p, confidentialTransferFromContract as pn, DelegationExpiryUnchangedError as pt, WalletNotConnectedError as q, delegateForUserDecryptionContract as qt, ZERO_ENCRYPTED_VALUE as r, supportsInterfaceContract as rn, InsufficientERC20BalanceError as rt, IndexedDBStorage as s, decimalsContract as sn, AclPausedError as st, Address$1 as t, isConfidentialTokenContract as tn, InsufficientAllowanceError as tt, memoryStorage as u, confidentialBalanceOfContract as un, DelegationDelegateEqualsContractError as ut, SignerQueryContext as v, setOperatorContract as vn, KeyWrappingError as vt, DefaultRegistryAddresses as w, createConfig as wn, TransportKeyPairExpiredError as wt, QueryFactoryOptions as x, unwrapFromBalanceContract as xn, PreparedPermitExpiredError as xt, zamaQueryKeys as y, underlyingContract as yn, NoCiphertextError as yt, UnshieldAlreadyFinalizedError as z, TokenWrapperPairWithMetadata as zt };
|
|
22131
|
-
//# sourceMappingURL=index-DJYq1rAB.d.ts.map
|
|
22571
|
+
export { confidentialTransferFromMutationOptions as $, DelegationSelfNotAllowedError as $n, isOperatorContract as $r, invalidateAfterSetOperator as $t, DelegatedDecryptValuesMutationParams as A, WalletNotConnectedError as An, delegateForUserDecryptionContract as Ar, confidentialIsOperatorQueryOptions as At, ResumeUnshieldParams as B, InsufficientERC20BalanceError as Bn, supportsInterfaceContract as Br, WrappersRegistryConfig as Bt, HasPermitQueryConfig as C, TransactionRevertedError as Cn, getConfidentialTokenAddressContract as Cr, ConfidentialBalanceQueryConfig as Ct, preparePermitMutationOptions as D, SignerNotConfiguredError as Dn, getTokenPairsLengthContract as Dr, BatchDecryptAsOptions as Dt, registerPermitMutationOptions as E, SigningRejectedError as En, getTokenPairsContract as Er, BatchBalancesResult as Et, unwrapAllMutationOptions as F, BalanceCheckUnavailableError as Fn, ERC1363_INTERFACE_ID as Fr, WrapperDiscoveryQueryConfig as Ft, unshieldMutationOptions as G, DelegationContractIsSelfError as Gn, nameContract as Gr, isWrapperQueryOptions as Gt, UnshieldAllParams as H, EncryptOffloadUnavailableError as Hn, approveContract as Hr, totalSupplyQueryOptions as Ht, WrapParams as I, BalanceErrorDetails as In, ERC7984_INTERFACE_ID as Ir, wrapperDiscoveryQueryOptions as It, ConfidentialSetOperatorParams as J, DelegationExpirationTooSoonError as Jn, confidentialTotalSupplyContract as Jr, tokenMetadataQueryOptions as Jt, ApproveUnderlyingParams as K, DelegationCooldownError as Kn, symbolContract as Kr, TokenMetadata as Kt, wrapMutationOptions as L, ERC20ReadFailedError as Ln, ERC7984_WRAPPER_INTERFACE_ID as Lr, DefaultRegistryAddresses as Lt, encryptMutationOptions as M, NotEntitledError as Mn, isHandleDelegatedContract as Mr, pendingUnshieldQueryOptions as Mt, FinalizeUnwrapParams as N, ConfigurationError as Nn, revokeDelegationContract as Nr, UnderlyingAllowanceQueryConfig as Nt, grantPermitMutationOptions as O, SignerRequiredError as On, getTokenPairsSliceContract as Or, Token as Ot, finalizeUnwrapMutationOptions as P, RelayerRequestFailedError as Pn, transferAndCallContract as Pr, underlyingAllowanceQueryOptions as Pt, ConfidentialTransferFromParams as Q, DelegationNotPropagatedError as Qn, inferredTotalSupplyContract as Qr, invalidateAfterApproveUnderlying as Qt, UnwrapParams as R, InsufficientAllowanceError as Rn, isConfidentialTokenContract as Rr, ListPairsOptions as Rt, revokePermitsMutationOptions as S, UnshieldAlreadyFinalizedError as Sn, TokenWrapperPairWithMetadata as Sr, confidentialBalancesQueryOptions as St, RegisterPermitParams as T, SigningFailedError as Tn, getTokenPairContract as Tr, WrappedToken as Tt, unshieldAllMutationOptions as U, EncryptionFailedError as Un, balanceOfContract as Ur, IsConfidentialQueryConfig as Ut, resumeUnshieldMutationOptions as V, DecryptionFailedError as Vn, allowanceContract as Vr, TotalSupplyQueryConfig as Vt, UnshieldParams as W, AclPausedError as Wn, decimalsContract as Wr, isConfidentialQueryOptions as Wt, ConfidentialTransferFromAndCallParams as X, DelegationExpiryUnchangedError as Xn, confidentialTransferFromContract as Xr, QueryFilterLike as Xt, confidentialSetOperatorMutationOptions as Y, DelegationExpiredError as Yn, confidentialTransferContract as Yr, QueryClientLike as Yt, confidentialTransferFromAndCallMutationOptions as Z, DelegationNotFoundError as Zn, finalizeUnwrapContract as Zr, QueryLike as Zt, DecryptBalanceAsParams as _, DelegationStatus as _n, SerializedPermitEip712 as _r, tokenPairQueryOptions as _t, ZamaSDK as a, unwrapRequesterContract as ai, invalidateAfterWrap as an, RevokedKmsContextError as ar, shieldMutationOptions as at, delegateDecryptionMutationOptions as b, matchZamaError as bn, PaginatedResult as br, tokenPairsSliceQueryOptions as bt, BatchDecryptItem as c, invalidateWalletLifecycleQueries as cn, ChainMismatchError as cr, ListPairsQueryConfig as ct, DelegationStatusQueryConfig as d, MutationFactoryOptions as dn, isRetryable as dr, TokenPairsSliceQueryConfig as dt, rateContract as ei, invalidateAfterShield as en, InvalidTransportKeyPairError as er, ConfidentialTransferAndCallParams as et, delegationStatusQueryOptions as f, QueryFactoryOptions as fn, retryAfterSeconds as fr, WrappersRegistryQueryConfig as ft, batchDecryptBalancesAsMutationOptions as g, Delegations as gn, SerializedPermit as gr, tokenAddressQueryOptions as gt, BatchDecryptBalancesAsParams as h, hashFn as hn, PreparedPermit as hr, listPairsQueryOptions as ht, decryptValuesQueryOptions as i, unwrapFromBalanceContract as ii, invalidateAfterUnwrap as in, PreparedPermitExpiredError as ir, ShieldParams as it, delegatedDecryptValuesMutationOptions as j, RpcRateLimitError as jn, getDelegationExpiryContract as jr, PendingUnshieldQueryConfig as jt, decryptPublicValuesMutationOptions as k, WalletAccountNotReadyError as kn, isConfidentialTokenValidContract as kr, ConfidentialIsOperatorQueryConfig as kt, BatchDecryptResult as l, zamaQueryKeys as ln, ZamaError as lr, TokenAddressQueryConfig as lt, revokeDelegationMutationOptions as m, filterQueryOptions as mn, PreparePermitRequest as mr, isConfidentialTokenValidQueryOptions as mt, DecryptResult as n, underlyingContract as ni, invalidateAfterUnshield as nn, NoCiphertextError as nr, ConfidentialTransferParams as nt, ZamaSDKOptions as o, wrapContract as oi, invalidateBalanceQueries as on, TransportKeyPairChangedError as or, ConfidentialTokenAddressQueryConfig as ot, RevokeDelegationParams as p, StrippedQueryOptionKeys as pn, Permission as pr, confidentialTokenAddressQueryOptions as pt, approveUnderlyingMutationOptions as q, DelegationDelegateEqualsContractError as qn, confidentialBalanceOfContract as qr, TokenMetadataQueryConfig as qt, EncryptedInput as r, unwrapContract as ri, invalidateAfterUnshieldSettled as rn, PreparedPermitChainMismatchError as rr, confidentialTransferMutationOptions as rt, Offline as s, createConfig as si, invalidateWagmiBalanceQueries as sn, TransportKeyPairExpiredError as sr, IsConfidentialTokenValidQueryConfig as st, Decryption as t, setOperatorContract as ti, invalidateAfterTransfer as tn, KeyWrappingError as tr, confidentialTransferAndCallMutationOptions as tt, DelegatedDecryptOptions as u, SignerQueryContext as un, ZamaErrorCode as ur, TokenPairQueryConfig as ut, decryptBalanceAsMutationOptions as v, Permits as vn, SerializedTransportKeyPair as vr, tokenPairsLengthQueryOptions as vt, hasPermitQueryOptions as w, SigningErrorMetadata as wn, getTokenAddressContract as wr, confidentialBalanceQueryOptions as wt, clearCredentialsMutationOptions as x, UnshieldAlreadyFinalizedDetails as xn, TokenWrapperPair as xr, ConfidentialBalancesQueryConfig as xt, DelegateDecryptionParams as y, ErrorForCode as yn, ChecksummedAddress as yr, tokenPairsQueryOptions as yt, unwrapMutationOptions as z, InsufficientConfidentialBalanceError as zn, isConfidentialWrapperContract as zr, WrappersRegistry as zt };
|
|
22572
|
+
//# sourceMappingURL=index-CnIEp8zv.d.ts.map
|