@zama-fhe/sdk 3.8.0-beta.20 → 3.8.0-beta.21
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/alignment.cjs +1 -1
- package/dist/cjs/alignment.cjs.map +1 -1
- package/dist/cjs/base-signer.cjs +1 -1
- package/dist/cjs/base-signer.cjs.map +1 -1
- package/dist/cjs/ethers/index.cjs +1 -1
- package/dist/cjs/ethers/index.cjs.map +1 -1
- package/dist/cjs/fhevm-relayer.cjs +2 -2
- package/dist/cjs/fhevm-relayer.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/log-decoding.cjs +2 -0
- package/dist/cjs/log-decoding.cjs.map +1 -0
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/query-keys.cjs +2 -0
- package/dist/cjs/query-keys.cjs.map +1 -0
- package/dist/cjs/relayer.cjs +1 -1
- package/dist/cjs/relayer.cjs.map +1 -1
- package/dist/cjs/telemetry.cjs +1 -1
- package/dist/cjs/telemetry.cjs.map +1 -1
- package/dist/cjs/token.cjs +1 -1
- package/dist/cjs/token.cjs.map +1 -1
- package/dist/cjs/vaults/index.cjs +1 -1
- package/dist/cjs/vaults/index.cjs.map +1 -1
- package/dist/cjs/viem/index.cjs +1 -1
- package/dist/cjs/viem/index.cjs.map +1 -1
- package/dist/cjs/wrappers-registry.cjs +2 -0
- package/dist/cjs/wrappers-registry.cjs.map +1 -0
- package/dist/esm/alignment-o-YIndFR.js +2 -0
- package/dist/esm/alignment-o-YIndFR.js.map +1 -0
- package/dist/esm/{base-signer-C4P_Y-TS.d.ts → base-signer-nenGJU9U.d.ts} +1 -1
- package/dist/esm/base-signer-p5iz9eeb.js +2 -0
- package/dist/esm/base-signer-p5iz9eeb.js.map +1 -0
- package/dist/esm/cleartext/index.d.ts +2 -2
- package/dist/esm/cleartext/index.js +1 -1
- package/dist/esm/{cleartext-D587CgVj.d.ts → cleartext-BLMLdKFh.d.ts} +1 -1
- package/dist/esm/{cleartext-BrJewisr.js → cleartext-C1Y5zc1Y.js} +2 -2
- package/dist/esm/{cleartext-BrJewisr.js.map → cleartext-C1Y5zc1Y.js.map} +1 -1
- package/dist/esm/{index-TuEeFx9Z.d.ts → decryption-Cp8calaa.d.ts} +1110 -1575
- package/dist/esm/{encrypt-worker-client-Bjab5Grh.d.ts → encrypt-worker-client-CkEIA0Tp.d.ts} +1 -1
- package/dist/esm/{encryption-DDP0UpGa.js → encryption-BT886Jlj.js} +2 -2
- package/dist/esm/{encryption-DDP0UpGa.js.map → encryption-BT886Jlj.js.map} +1 -1
- package/dist/esm/ethers/index.d.ts +12 -4
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/ethers/index.js.map +1 -1
- package/dist/esm/{fatal-batch-BqKg7m3V.js → fatal-batch-BYeHrf0V.js} +2 -2
- package/dist/esm/{fatal-batch-BqKg7m3V.js.map → fatal-batch-BYeHrf0V.js.map} +1 -1
- package/dist/esm/{fhevm-relayer-B-Ve8Yyz.js → fhevm-relayer-BEzN0aev.js} +2 -2
- package/dist/esm/{fhevm-relayer-B-Ve8Yyz.js.map → fhevm-relayer-BEzN0aev.js.map} +1 -1
- package/dist/esm/{index-Dae8rZWN.d.ts → index-CI6f4jxt.d.ts} +5 -5
- package/dist/esm/{index-yCC7GnOx.d.ts → index-ClNBSbRy.d.ts} +2 -2
- package/dist/esm/index.d.ts +8 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/index.d.ts +3 -3
- package/dist/esm/internal/index.js +1 -1
- package/dist/esm/log-decoding-ZthqwHOv.js +2 -0
- package/dist/esm/log-decoding-ZthqwHOv.js.map +1 -0
- package/dist/esm/node/index.d.ts +3 -3
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/query/index.d.ts +5 -5
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/query-keys-CSPxPLBB.js +2 -0
- package/dist/esm/query-keys-CSPxPLBB.js.map +1 -0
- package/dist/esm/{relayer-CqdiNLZH.js → relayer-nWfQAlo7.js} +2 -2
- package/dist/esm/{relayer-CqdiNLZH.js.map → relayer-nWfQAlo7.js.map} +1 -1
- package/dist/esm/{signing-BIlZhi5G.js → signing-CVEOw21I.js} +2 -2
- package/dist/esm/{signing-BIlZhi5G.js.map → signing-CVEOw21I.js.map} +1 -1
- package/dist/esm/telemetry-YFH36F_7.js +2 -0
- package/dist/esm/telemetry-YFH36F_7.js.map +1 -0
- package/dist/esm/token-AXsOIUDB.js +2 -0
- package/dist/esm/{token-CxDfm7V-.js.map → token-AXsOIUDB.js.map} +1 -1
- package/dist/esm/{types-Bi-kDUxb.d.ts → types-D253qkvB.d.ts} +1 -1
- package/dist/esm/{types-D1qhoqkF.d.ts → types-DH06Ap0n.d.ts} +1 -1
- package/dist/esm/{types-DbnDm2O9.d.ts → types-Ubeo72FV.d.ts} +13 -1
- package/dist/esm/{validation-CL7MJT6k.js → validation-CZfDLOUh.js} +2 -2
- package/dist/esm/{validation-CL7MJT6k.js.map → validation-CZfDLOUh.js.map} +1 -1
- package/dist/esm/vaults/index.d.ts +262 -15600
- package/dist/esm/vaults/index.js +1 -1
- package/dist/esm/vaults/index.js.map +1 -1
- package/dist/esm/viem/index.d.ts +12 -4
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/viem/index.js.map +1 -1
- package/dist/esm/web/index.d.ts +2 -2
- package/dist/esm/web/index.js +1 -1
- package/dist/esm/wrappers-registry-Cm3JJeqx.js +2 -0
- package/dist/esm/wrappers-registry-Cm3JJeqx.js.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/applied-runtime.cjs +0 -2
- package/dist/cjs/applied-runtime.cjs.map +0 -1
- package/dist/cjs/invalidation.cjs +0 -2
- package/dist/cjs/invalidation.cjs.map +0 -1
- package/dist/cjs/primitives.cjs +0 -2
- package/dist/cjs/primitives.cjs.map +0 -1
- package/dist/cjs/wrapped-token.cjs +0 -2
- package/dist/cjs/wrapped-token.cjs.map +0 -1
- package/dist/esm/alignment-CYa0d0Ud.js +0 -2
- package/dist/esm/alignment-CYa0d0Ud.js.map +0 -1
- package/dist/esm/applied-runtime-3fzqBC2V.js +0 -2
- package/dist/esm/applied-runtime-3fzqBC2V.js.map +0 -1
- package/dist/esm/base-signer-DvCCKQfk.js +0 -2
- package/dist/esm/base-signer-DvCCKQfk.js.map +0 -1
- package/dist/esm/invalidation-CzspPBR7.js +0 -2
- package/dist/esm/invalidation-CzspPBR7.js.map +0 -1
- package/dist/esm/primitives-Cym-3HKa.js +0 -2
- package/dist/esm/primitives-Cym-3HKa.js.map +0 -1
- package/dist/esm/telemetry-CmBkkrXK.js +0 -2
- package/dist/esm/telemetry-CmBkkrXK.js.map +0 -1
- package/dist/esm/token-CxDfm7V-.js +0 -2
- package/dist/esm/wrapped-token-BWMNyFj2.js +0 -2
- package/dist/esm/wrapped-token-BWMNyFj2.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as WrapOptions, D as GenericSigner, Et as UnshieldCallbacks, O as WalletAccount, S as TransactionKind, St as UnwrapResult, Tt as TransferCallbacks, _ as PrepareTransactionRequest, bt as TransferOptions, c as GenericStorage, cn as EncryptResult, en as TransactionReceipt, g as PrepareOptions, gn as RelayerSDK, hn as RelayerRequestOptions, i as ZamaConfig, l as GenericProvider, ln as EncryptedValue, nn as ClearValue, rn as DecryptPublicValuesResult, sn as EncryptParams, tn as TransactionResult, v as PreparedFor, vt as ShieldOptions, xt as UnshieldOptions } from "./types-Ubeo72FV.js";
|
|
2
2
|
import { Address, Hex } from "viem";
|
|
3
3
|
import "zod/mini";
|
|
4
4
|
import { MutationFunctionContext, QueryKey, QueryObserverOptions, skipToken } from "@tanstack/query-core";
|
|
@@ -23233,14 +23233,12 @@ declare const ZamaErrorCode: {
|
|
|
23233
23233
|
readonly PreparedPermitExpired: "PREPARED_PERMIT_EXPIRED";
|
|
23234
23234
|
/** The unwrap request was already finalized on-chain; there is nothing left to resume. */
|
|
23235
23235
|
readonly UnshieldAlreadyFinalized: "UNSHIELD_ALREADY_FINALIZED";
|
|
23236
|
-
/**
|
|
23237
|
-
readonly UnlistedConfidentialToken: "UNLISTED_CONFIDENTIAL_TOKEN";
|
|
23238
|
-
/** A batcher one leg of a group submission would join is paused. */
|
|
23236
|
+
/** A batcher a vault join needs is paused. */
|
|
23239
23237
|
readonly VaultBatcherPaused: "VAULT_BATCHER_PAUSED";
|
|
23240
|
-
/** A batch to be finalized is not
|
|
23238
|
+
/** A batch to be finalized is not dispatched. */
|
|
23241
23239
|
readonly VaultBatchNotDispatched: "VAULT_BATCH_NOT_DISPATCHED";
|
|
23242
|
-
/** A
|
|
23243
|
-
readonly
|
|
23240
|
+
/** A vault join was mined, but its receipt does not confirm every leg. */
|
|
23241
|
+
readonly VaultJoinUnconfirmed: "VAULT_JOIN_UNCONFIRMED";
|
|
23244
23242
|
};
|
|
23245
23243
|
/** Union of all {@link ZamaErrorCode} string values. */
|
|
23246
23244
|
type ZamaErrorCode = (typeof ZamaErrorCode)[keyof typeof ZamaErrorCode];
|
|
@@ -23724,518 +23722,531 @@ declare class UnshieldAlreadyFinalizedError extends ZamaError {
|
|
|
23724
23722
|
readonly unwrapRequestId: EncryptedValue;
|
|
23725
23723
|
constructor(message: string, details: UnshieldAlreadyFinalizedDetails, options?: ErrorOptions);
|
|
23726
23724
|
}
|
|
23725
|
+
/** Whether a join deposits the confidential asset or redeems a vault's confidential shares. */
|
|
23726
|
+
type JoinDirection = "deposit" | "redeem";
|
|
23727
|
+
/** A batch's state, named as the batcher contract names it. */
|
|
23728
|
+
type BatchState = "pending" | "dispatched" | "finalized" | "canceled";
|
|
23729
|
+
/** One EVM call, encoded. */
|
|
23730
|
+
interface Call {
|
|
23731
|
+
/** The contract called. */
|
|
23732
|
+
readonly to: Address;
|
|
23733
|
+
/** The encoded calldata. */
|
|
23734
|
+
readonly data: Hex;
|
|
23735
|
+
/** Vault calls never carry value. */
|
|
23736
|
+
readonly value: 0n;
|
|
23737
|
+
}
|
|
23738
|
+
/** One vault's part of a join. */
|
|
23739
|
+
interface VaultLeg {
|
|
23740
|
+
/** The vault this leg joins. */
|
|
23741
|
+
readonly vaultId: string;
|
|
23742
|
+
/** The vault's active batcher when the join was prepared. */
|
|
23743
|
+
readonly batcher: Address;
|
|
23744
|
+
/** The confidential token the leg spends: the asset for a deposit, the vault's share for a redeem. */
|
|
23745
|
+
readonly token: Address;
|
|
23746
|
+
/** The chosen vault's amount, zero for every other leg. */
|
|
23747
|
+
readonly amount: bigint;
|
|
23748
|
+
}
|
|
23749
|
+
/** An ERC-7984 operator approval a join relies on, sent to the token it is on. */
|
|
23750
|
+
interface OperatorApprovalCall extends Call {
|
|
23751
|
+
/** Tells an operator approval from a join without decoding the calldata. */
|
|
23752
|
+
readonly kind: "operatorApproval";
|
|
23753
|
+
/** The vault whose token the approval is on. */
|
|
23754
|
+
readonly vaultId: string;
|
|
23755
|
+
/** The router. */
|
|
23756
|
+
readonly operator: Address;
|
|
23757
|
+
/** When the approval expires, in chain seconds. */
|
|
23758
|
+
readonly until: bigint;
|
|
23759
|
+
}
|
|
23760
|
+
/** A join call. */
|
|
23761
|
+
interface JoinCall extends Call {
|
|
23762
|
+
/** Tells a join from an operator approval without decoding the calldata. */
|
|
23763
|
+
readonly kind: "join";
|
|
23764
|
+
/** The leg this call funds; for a router call, the chosen vault's leg. */
|
|
23765
|
+
readonly leg: VaultLeg;
|
|
23766
|
+
}
|
|
23767
|
+
/** A call of a prepared join. */
|
|
23768
|
+
type VaultCall = OperatorApprovalCall | JoinCall;
|
|
23727
23769
|
/**
|
|
23728
|
-
*
|
|
23729
|
-
*
|
|
23730
|
-
|
|
23731
|
-
|
|
23732
|
-
/** Open: accepts joins and quits. Always the batcher's `currentBatchId`. */
|
|
23733
|
-
readonly Pending: 0;
|
|
23734
|
-
/** Closed; the aggregate amount is being decrypted. Only `finalize` applies, which a keeper normally sends. */
|
|
23735
|
-
readonly Dispatched: 1;
|
|
23736
|
-
/** Settled with an exchange rate — the only state in which `claim` succeeds. */
|
|
23737
|
-
readonly Finalized: 2;
|
|
23738
|
-
/** The route failed or the callback deadline passed; `quit` refunds the original deposit. */
|
|
23739
|
-
readonly Canceled: 3;
|
|
23740
|
-
};
|
|
23741
|
-
/** Union of all {@link BatchState} values. */
|
|
23742
|
-
type BatchState = (typeof BatchState)[keyof typeof BatchState];
|
|
23743
|
-
/**
|
|
23744
|
-
* A batch's state with the timestamps that state needs, so a UI can switch on
|
|
23745
|
-
* `state` and handle every case. Timestamps are Unix seconds on chain. The
|
|
23746
|
-
* `secondsUntil*` fields are measured against the block timestamp at read
|
|
23747
|
-
* time and stop at `0`; tick a live countdown from the `*At` timestamps.
|
|
23770
|
+
* How a join reaches the batchers.
|
|
23771
|
+
*
|
|
23772
|
+
* - `"router"`: one call through the router.
|
|
23773
|
+
* - `"direct"`: one call per leg, straight to each batcher, with no operator approval.
|
|
23748
23774
|
*/
|
|
23749
|
-
type
|
|
23750
|
-
|
|
23751
|
-
|
|
23752
|
-
|
|
23753
|
-
|
|
23754
|
-
|
|
23755
|
-
|
|
23756
|
-
|
|
23757
|
-
|
|
23758
|
-
|
|
23759
|
-
|
|
23760
|
-
|
|
23761
|
-
|
|
23762
|
-
/**
|
|
23763
|
-
|
|
23764
|
-
|
|
23765
|
-
|
|
23766
|
-
|
|
23767
|
-
|
|
23768
|
-
callbackDeadlineAt: bigint;
|
|
23769
|
-
/** Seconds until `callbackDeadlineAt`; `0` once reached. */
|
|
23770
|
-
secondsUntilCallbackDeadline: bigint;
|
|
23771
|
-
} | {
|
|
23772
|
-
state: typeof BatchState.Finalized;
|
|
23773
|
-
createdAt: bigint;
|
|
23774
|
-
dispatchableAt: bigint;
|
|
23775
|
-
dispatchedAt: bigint;
|
|
23776
|
-
} | {
|
|
23777
|
-
state: typeof BatchState.Canceled;
|
|
23778
|
-
createdAt: bigint;
|
|
23779
|
-
dispatchableAt: bigint;
|
|
23780
|
-
dispatchedAt: bigint;
|
|
23781
|
-
};
|
|
23782
|
-
/** Addresses that make up one confidential vault. */
|
|
23783
|
-
interface VaultAddresses {
|
|
23775
|
+
type JoinRoute = "direct" | "router";
|
|
23776
|
+
/** A join built but not sent. */
|
|
23777
|
+
interface PreparedJoin {
|
|
23778
|
+
/** Whether it deposits or redeems. */
|
|
23779
|
+
readonly direction: JoinDirection;
|
|
23780
|
+
/** The chain to send the calls on. */
|
|
23781
|
+
readonly chainId: number;
|
|
23782
|
+
/** The group joined, or `undefined` for a vault joined on its own. */
|
|
23783
|
+
readonly groupId: string | undefined;
|
|
23784
|
+
/** The vault that receives the amount. */
|
|
23785
|
+
readonly vaultId: string;
|
|
23786
|
+
/** The account that must send the calls: their encryption proofs are bound to it. */
|
|
23787
|
+
readonly account: Address;
|
|
23788
|
+
/** The amount, in the asset for a deposit and in shares for a redeem. */
|
|
23789
|
+
readonly amount: bigint;
|
|
23790
|
+
/** How the calls reach the batchers. */
|
|
23791
|
+
readonly route: JoinRoute;
|
|
23792
|
+
/** Every vault joined, in group order, the zero legs included. */
|
|
23793
|
+
readonly legs: readonly [VaultLeg, ...VaultLeg[]];
|
|
23784
23794
|
/**
|
|
23785
|
-
*
|
|
23786
|
-
*
|
|
23787
|
-
* skip that read: it is verified against what the batchers report.
|
|
23795
|
+
* Every call in send order: the operator approvals the account lacks, in leg
|
|
23796
|
+
* order, then the joins.
|
|
23788
23797
|
*/
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
|
|
23798
|
+
readonly calls: readonly [VaultCall, ...VaultCall[]];
|
|
23799
|
+
}
|
|
23800
|
+
/** What `prepareDeposit` and `prepareRedeem` take for a vault on its own. */
|
|
23801
|
+
interface JoinInput {
|
|
23802
|
+
/** The account that will send the calls. */
|
|
23803
|
+
readonly account: Address;
|
|
23804
|
+
/** Plaintext, in the asset for a deposit and in shares for a redeem. */
|
|
23805
|
+
readonly amount: bigint;
|
|
23794
23806
|
}
|
|
23795
|
-
/**
|
|
23807
|
+
/** What `prepareDeposit` and `prepareRedeem` take for a group. */
|
|
23808
|
+
interface GroupJoinInput<TVaultId extends string = string> extends JoinInput {
|
|
23809
|
+
/** The vault of the group the amount goes to. */
|
|
23810
|
+
readonly vaultId: TVaultId;
|
|
23811
|
+
}
|
|
23812
|
+
/** Options for `prepareDeposit` and `prepareRedeem`. */
|
|
23796
23813
|
interface JoinOptions {
|
|
23797
|
-
/**
|
|
23798
|
-
|
|
23799
|
-
* whose balance the connected signer cannot decrypt, such as smart wallets.
|
|
23800
|
-
*/
|
|
23801
|
-
skipBalanceCheck?: boolean;
|
|
23802
|
-
/**
|
|
23803
|
-
* Called with the join's transaction hash once the wallet has signed and
|
|
23804
|
-
* sent it, before the SDK waits for the receipt — the moment a UI moves
|
|
23805
|
-
* from "confirm in your wallet" to "waiting for the transaction".
|
|
23806
|
-
*/
|
|
23807
|
-
onJoinSubmitted?: (txHash: Hex) => void;
|
|
23814
|
+
/** Skip the balance check, which decrypts as the signer. A paused batcher is always checked. */
|
|
23815
|
+
readonly skipBalanceCheck?: boolean;
|
|
23808
23816
|
}
|
|
23809
|
-
/** Options for
|
|
23810
|
-
interface
|
|
23811
|
-
/**
|
|
23812
|
-
|
|
23813
|
-
*
|
|
23814
|
-
* Set this to join on behalf of another account — but note that the
|
|
23815
|
-
* beneficiary, not the caller, then owns the position: only they can
|
|
23816
|
-
* {@link VaultBatcher.quit} it, and {@link VaultBatcher.claim} pays out to
|
|
23817
|
-
* them.
|
|
23818
|
-
*/
|
|
23819
|
-
beneficiary?: Address;
|
|
23820
|
-
/**
|
|
23821
|
-
* Unix timestamp until which the batcher's operator grant on the joined
|
|
23822
|
-
* token is valid. Only used for a join with another `beneficiary`, the one
|
|
23823
|
-
* case that needs a grant, and only when none is active. Defaults to
|
|
23824
|
-
* `Token.setOperator`'s own default (now + 1 hour).
|
|
23825
|
-
*/
|
|
23826
|
-
operatorUntil?: number;
|
|
23817
|
+
/** Options for `prepareDeposit` and `prepareRedeem` into a group. */
|
|
23818
|
+
interface GroupJoinOptions extends JoinOptions {
|
|
23819
|
+
/** Defaults to `"router"`. */
|
|
23820
|
+
readonly route?: JoinRoute;
|
|
23827
23821
|
}
|
|
23828
|
-
/**
|
|
23829
|
-
interface
|
|
23830
|
-
/** The
|
|
23831
|
-
|
|
23832
|
-
/** The
|
|
23833
|
-
|
|
23834
|
-
/**
|
|
23835
|
-
|
|
23836
|
-
|
|
23837
|
-
|
|
23838
|
-
|
|
23839
|
-
|
|
23822
|
+
/** A batch on one batcher. */
|
|
23823
|
+
interface BatchRef {
|
|
23824
|
+
/** The chain the batcher is on. */
|
|
23825
|
+
readonly chainId: number;
|
|
23826
|
+
/** The batcher the batch is on. */
|
|
23827
|
+
readonly batcher: Address;
|
|
23828
|
+
/** The batch's id on that batcher. */
|
|
23829
|
+
readonly batchId: bigint;
|
|
23830
|
+
}
|
|
23831
|
+
/** A batcher on one chain. */
|
|
23832
|
+
type BatcherRef = Pick<BatchRef, "chainId" | "batcher">;
|
|
23833
|
+
/** Options for `deposit` and `redeem`. */
|
|
23834
|
+
interface SendJoinOptions {
|
|
23835
|
+
/** Skip the balance check. A paused batcher is always checked. */
|
|
23836
|
+
readonly skipBalanceCheck?: boolean;
|
|
23837
|
+
/** Called with the join's transaction hash once the wallet has sent it, before the SDK waits for the receipt. */
|
|
23838
|
+
readonly onJoinSubmitted?: (txHash: Hex) => void;
|
|
23839
|
+
}
|
|
23840
|
+
/** A settlement built but not sent. */
|
|
23841
|
+
interface PreparedFinalize extends BatchRef {
|
|
23842
|
+
/** The publicly decrypted amount the batch's unwrap released. */
|
|
23843
|
+
readonly unwrapAmountCleartext: bigint;
|
|
23844
|
+
/** The proof of that decryption. */
|
|
23845
|
+
readonly decryptionProof: Hex;
|
|
23846
|
+
/** The `dispatchBatchCallback` call. */
|
|
23847
|
+
readonly call: Call;
|
|
23848
|
+
}
|
|
23849
|
+
/** An operation that can be sent for a batch. */
|
|
23850
|
+
type BatchAction = "claim" | "quit" | "dispatch" | "finalize";
|
|
23851
|
+
interface BatchBase extends BatchRef {
|
|
23852
|
+
/** The time the batch opened, in chain seconds. */
|
|
23853
|
+
readonly createdAt: bigint;
|
|
23854
|
+
/** The time from which anyone may dispatch it, in chain seconds, fixed when it opened. */
|
|
23855
|
+
readonly dispatchableAt: bigint;
|
|
23856
|
+
/** Whether the batcher is paused. */
|
|
23857
|
+
readonly paused: boolean;
|
|
23858
|
+
/** The account's encrypted deposit, or `null` when no account was given. */
|
|
23859
|
+
readonly deposit: EncryptedValue | null;
|
|
23860
|
+
/** What can be sent at `observedAt`. */
|
|
23861
|
+
readonly actions: readonly BatchAction[];
|
|
23862
|
+
/** The block timestamp the read was made at. */
|
|
23863
|
+
readonly observedAt: bigint;
|
|
23864
|
+
/** The next chain time at which `actions` can change on its own, or `null`. */
|
|
23865
|
+
readonly nextChangeAt: bigint | null;
|
|
23866
|
+
}
|
|
23867
|
+
interface DispatchedTimes {
|
|
23868
|
+
/** When it was dispatched, in chain seconds. */
|
|
23869
|
+
readonly dispatchedAt: bigint;
|
|
23870
|
+
/** The time after which the batch can no longer settle, in chain seconds. */
|
|
23871
|
+
readonly cancelsAt: bigint;
|
|
23872
|
+
}
|
|
23873
|
+
/** One batch as read from chain. */
|
|
23874
|
+
type Batch = (BatchBase & {
|
|
23875
|
+
readonly state: "pending";
|
|
23876
|
+
}) | (BatchBase & DispatchedTimes & {
|
|
23877
|
+
readonly state: "dispatched" | "canceled";
|
|
23878
|
+
}) | (BatchBase & DispatchedTimes & {
|
|
23879
|
+
readonly state: "finalized";
|
|
23880
|
+
/** The rate as a fixed-point number: `rate / 10 ** decimals`. */
|
|
23881
|
+
readonly exchangeRate: {
|
|
23882
|
+
readonly rate: bigint;
|
|
23883
|
+
readonly decimals: number;
|
|
23884
|
+
};
|
|
23885
|
+
});
|
|
23886
|
+
/** The open batch of one vault's active batcher. */
|
|
23887
|
+
interface OpenBatch extends BatchRef {
|
|
23888
|
+
/** The vault whose open batch this is. */
|
|
23889
|
+
readonly vaultId: string;
|
|
23890
|
+
/** The time from which anyone may dispatch the batch, in chain seconds. */
|
|
23891
|
+
readonly dispatchableAt: bigint;
|
|
23892
|
+
/** Whether the batcher is paused. */
|
|
23893
|
+
readonly paused: boolean;
|
|
23894
|
+
/** The block timestamp the read was made at. */
|
|
23895
|
+
readonly observedAt: bigint;
|
|
23896
|
+
}
|
|
23897
|
+
/** What `deposit` and `redeem` return. */
|
|
23898
|
+
interface JoinOutcome {
|
|
23899
|
+
/** The batch each leg landed in, in group order. */
|
|
23900
|
+
readonly batches: readonly (BatchRef & {
|
|
23901
|
+
readonly vaultId: string;
|
|
23902
|
+
})[];
|
|
23903
|
+
/** Every transaction sent, operator approvals first. */
|
|
23904
|
+
readonly txHashes: readonly Hex[];
|
|
23905
|
+
}
|
|
23906
|
+
/** What a {@link VaultBatcherPausedError} carries. */
|
|
23907
|
+
interface VaultBatcherPausedDetails {
|
|
23908
|
+
/** The batcher that reported `paused()`. */
|
|
23909
|
+
readonly batcher: Address;
|
|
23910
|
+
/** The vault whose leg needs the batcher. */
|
|
23911
|
+
readonly vaultId: string;
|
|
23912
|
+
}
|
|
23913
|
+
/** A batcher that a join needs is paused. */
|
|
23914
|
+
declare class VaultBatcherPausedError extends ZamaError {
|
|
23915
|
+
/** The batcher that reported `paused()`. */
|
|
23916
|
+
readonly batcher: Address;
|
|
23917
|
+
/** The vault whose leg needs the batcher. */
|
|
23918
|
+
readonly vaultId: string;
|
|
23919
|
+
constructor(message: string, details: VaultBatcherPausedDetails, options?: ErrorOptions);
|
|
23920
|
+
}
|
|
23921
|
+
/** What a {@link VaultBatchNotDispatchedError} carries. */
|
|
23922
|
+
interface VaultBatchNotDispatchedDetails {
|
|
23923
|
+
/** The batcher the batch belongs to. */
|
|
23924
|
+
readonly batcher: Address;
|
|
23925
|
+
/** The batch that was to be finalized. */
|
|
23926
|
+
readonly batchId: bigint;
|
|
23927
|
+
/** The state the batch is in instead. */
|
|
23928
|
+
readonly state: BatchState;
|
|
23929
|
+
}
|
|
23930
|
+
/** The batch to finalize is not dispatched. */
|
|
23931
|
+
declare class VaultBatchNotDispatchedError extends ZamaError {
|
|
23932
|
+
/** The batcher the batch belongs to. */
|
|
23933
|
+
readonly batcher: Address;
|
|
23934
|
+
/** The batch that was to be finalized. */
|
|
23935
|
+
readonly batchId: bigint;
|
|
23936
|
+
/** The state the batch is in instead. */
|
|
23937
|
+
readonly state: BatchState;
|
|
23938
|
+
constructor(message: string, details: VaultBatchNotDispatchedDetails, options?: ErrorOptions);
|
|
23939
|
+
}
|
|
23940
|
+
/** What a {@link VaultJoinUnconfirmedError} carries. */
|
|
23941
|
+
interface VaultJoinUnconfirmedDetails {
|
|
23942
|
+
/** The mined join transaction. */
|
|
23943
|
+
readonly txHash: Hex;
|
|
23944
|
+
/** Its receipt, to inspect the logs. */
|
|
23945
|
+
readonly receipt: TransactionReceipt;
|
|
23946
|
+
/** The vaults whose `Joined` log the SDK could not match. Not a list of legs that did not join. */
|
|
23947
|
+
readonly unconfirmedVaultIds: readonly string[];
|
|
23840
23948
|
}
|
|
23841
23949
|
/**
|
|
23842
|
-
*
|
|
23843
|
-
* `QueryObserverOptions` with `queryKey` and `queryFn` required and the
|
|
23844
|
-
* cache-internal keys (`queryHash`, `queryKeyHashFn`, `throwOnError`) removed.
|
|
23950
|
+
* A join was mined, but the SDK could not match a `Joined` log to every leg.
|
|
23845
23951
|
*/
|
|
23846
|
-
|
|
23847
|
-
|
|
23848
|
-
|
|
23849
|
-
/**
|
|
23850
|
-
|
|
23851
|
-
/**
|
|
23852
|
-
|
|
23853
|
-
|
|
23854
|
-
mutationFn: (variables: TVariables) => Promise<TData>;
|
|
23855
|
-
/** Optional callback invoked after the mutation succeeds. */
|
|
23856
|
-
onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => void;
|
|
23952
|
+
declare class VaultJoinUnconfirmedError extends ZamaError {
|
|
23953
|
+
/** The mined join transaction. */
|
|
23954
|
+
readonly txHash: Hex;
|
|
23955
|
+
/** Its receipt, to inspect the logs. */
|
|
23956
|
+
readonly receipt: TransactionReceipt;
|
|
23957
|
+
/** The vaults whose `Joined` log the SDK could not match. Not a list of legs that did not join. */
|
|
23958
|
+
readonly unconfirmedVaultIds: readonly string[];
|
|
23959
|
+
constructor(message: string, details: VaultJoinUnconfirmedDetails, options?: ErrorOptions);
|
|
23857
23960
|
}
|
|
23858
23961
|
/**
|
|
23859
|
-
*
|
|
23962
|
+
* Maps each {@link ZamaErrorCode} to the error class thrown with that code, so
|
|
23963
|
+
* {@link matchZamaError} handlers receive the matched subtype instead of the base
|
|
23964
|
+
* `ZamaError`.
|
|
23965
|
+
*/
|
|
23966
|
+
interface ErrorForCode {
|
|
23967
|
+
/** Thrown for {@link ZamaErrorCode.SigningRejected}. */
|
|
23968
|
+
[ZamaErrorCode.SigningRejected]: SigningRejectedError;
|
|
23969
|
+
/** Thrown for {@link ZamaErrorCode.SigningFailed}. */
|
|
23970
|
+
[ZamaErrorCode.SigningFailed]: SigningFailedError;
|
|
23971
|
+
/** Thrown for {@link ZamaErrorCode.EncryptionFailed}. */
|
|
23972
|
+
[ZamaErrorCode.EncryptionFailed]: EncryptionFailedError;
|
|
23973
|
+
/** Thrown for {@link ZamaErrorCode.DecryptionFailed}. */
|
|
23974
|
+
[ZamaErrorCode.DecryptionFailed]: DecryptionFailedError;
|
|
23975
|
+
/** Thrown for {@link ZamaErrorCode.EncryptOffloadUnavailable}. */
|
|
23976
|
+
[ZamaErrorCode.EncryptOffloadUnavailable]: EncryptOffloadUnavailableError;
|
|
23977
|
+
/** Thrown for {@link ZamaErrorCode.TransactionReverted}. */
|
|
23978
|
+
[ZamaErrorCode.TransactionReverted]: TransactionRevertedError;
|
|
23979
|
+
/** Thrown for {@link ZamaErrorCode.HcuBlockLimitExceeded}. */
|
|
23980
|
+
[ZamaErrorCode.HcuBlockLimitExceeded]: HcuBlockLimitExceededError;
|
|
23981
|
+
/** Thrown for {@link ZamaErrorCode.HcuTransactionLimitExceeded}. */
|
|
23982
|
+
[ZamaErrorCode.HcuTransactionLimitExceeded]: HcuTransactionLimitExceededError;
|
|
23983
|
+
/** Thrown for {@link ZamaErrorCode.TransportKeyPairExpired}. */
|
|
23984
|
+
[ZamaErrorCode.TransportKeyPairExpired]: TransportKeyPairExpiredError;
|
|
23985
|
+
/** Thrown for {@link ZamaErrorCode.InvalidTransportKeyPair}. */
|
|
23986
|
+
[ZamaErrorCode.InvalidTransportKeyPair]: InvalidTransportKeyPairError;
|
|
23987
|
+
/** Thrown for {@link ZamaErrorCode.RevokedKmsContext}. */
|
|
23988
|
+
[ZamaErrorCode.RevokedKmsContext]: RevokedKmsContextError;
|
|
23989
|
+
/** Thrown for {@link ZamaErrorCode.NoCiphertext}. */
|
|
23990
|
+
[ZamaErrorCode.NoCiphertext]: NoCiphertextError;
|
|
23991
|
+
/** Thrown for {@link ZamaErrorCode.RelayerRequestFailed}. */
|
|
23992
|
+
[ZamaErrorCode.RelayerRequestFailed]: RelayerRequestFailedError;
|
|
23993
|
+
/** Thrown for {@link ZamaErrorCode.NotEntitled}. */
|
|
23994
|
+
[ZamaErrorCode.NotEntitled]: NotEntitledError;
|
|
23995
|
+
/** Thrown for {@link ZamaErrorCode.RpcRateLimited}. */
|
|
23996
|
+
[ZamaErrorCode.RpcRateLimited]: RpcRateLimitError;
|
|
23997
|
+
/** Thrown for {@link ZamaErrorCode.Configuration}. */
|
|
23998
|
+
[ZamaErrorCode.Configuration]: ConfigurationError;
|
|
23999
|
+
/** Thrown for {@link ZamaErrorCode.DelegationSelfNotAllowed}. */
|
|
24000
|
+
[ZamaErrorCode.DelegationSelfNotAllowed]: DelegationSelfNotAllowedError;
|
|
24001
|
+
/** Thrown for {@link ZamaErrorCode.DelegationCooldown}. */
|
|
24002
|
+
[ZamaErrorCode.DelegationCooldown]: DelegationCooldownError;
|
|
24003
|
+
/** Thrown for {@link ZamaErrorCode.DelegationNotFound}. */
|
|
24004
|
+
[ZamaErrorCode.DelegationNotFound]: DelegationNotFoundError;
|
|
24005
|
+
/** Thrown for {@link ZamaErrorCode.DelegationExpired}. */
|
|
24006
|
+
[ZamaErrorCode.DelegationExpired]: DelegationExpiredError;
|
|
24007
|
+
/** Thrown for {@link ZamaErrorCode.InsufficientConfidentialBalance}. */
|
|
24008
|
+
[ZamaErrorCode.InsufficientConfidentialBalance]: InsufficientConfidentialBalanceError;
|
|
24009
|
+
/** Thrown for {@link ZamaErrorCode.InsufficientERC20Balance}. */
|
|
24010
|
+
[ZamaErrorCode.InsufficientERC20Balance]: InsufficientERC20BalanceError;
|
|
24011
|
+
/** Thrown for {@link ZamaErrorCode.InsufficientAllowance}. */
|
|
24012
|
+
[ZamaErrorCode.InsufficientAllowance]: InsufficientAllowanceError;
|
|
24013
|
+
/** Thrown for {@link ZamaErrorCode.BalanceCheckUnavailable}. */
|
|
24014
|
+
[ZamaErrorCode.BalanceCheckUnavailable]: BalanceCheckUnavailableError;
|
|
24015
|
+
/** Thrown for {@link ZamaErrorCode.ERC20ReadFailed}. */
|
|
24016
|
+
[ZamaErrorCode.ERC20ReadFailed]: ERC20ReadFailedError;
|
|
24017
|
+
/** Thrown for {@link ZamaErrorCode.DelegationExpiryUnchanged}. */
|
|
24018
|
+
[ZamaErrorCode.DelegationExpiryUnchanged]: DelegationExpiryUnchangedError;
|
|
24019
|
+
/** Thrown for {@link ZamaErrorCode.DelegationDelegateEqualsContract}. */
|
|
24020
|
+
[ZamaErrorCode.DelegationDelegateEqualsContract]: DelegationDelegateEqualsContractError;
|
|
24021
|
+
/** Thrown for {@link ZamaErrorCode.DelegationDelegateCannotBeWildcard}. */
|
|
24022
|
+
[ZamaErrorCode.DelegationDelegateCannotBeWildcard]: DelegationDelegateCannotBeWildcardError;
|
|
24023
|
+
/** Thrown for {@link ZamaErrorCode.DelegationContractIsSelf}. */
|
|
24024
|
+
[ZamaErrorCode.DelegationContractIsSelf]: DelegationContractIsSelfError;
|
|
24025
|
+
/** Thrown for {@link ZamaErrorCode.AclPaused}. */
|
|
24026
|
+
[ZamaErrorCode.AclPaused]: AclPausedError;
|
|
24027
|
+
/** Thrown for {@link ZamaErrorCode.DelegationExpirationTooSoon}. */
|
|
24028
|
+
[ZamaErrorCode.DelegationExpirationTooSoon]: DelegationExpirationTooSoonError;
|
|
24029
|
+
/** Thrown for {@link ZamaErrorCode.DelegationNotPropagated}. */
|
|
24030
|
+
[ZamaErrorCode.DelegationNotPropagated]: DelegationNotPropagatedError;
|
|
24031
|
+
/** Thrown for {@link ZamaErrorCode.ChainMismatch}. */
|
|
24032
|
+
[ZamaErrorCode.ChainMismatch]: ChainMismatchError;
|
|
24033
|
+
/** Thrown for {@link ZamaErrorCode.SignerNotConfigured}. */
|
|
24034
|
+
[ZamaErrorCode.SignerNotConfigured]: SignerNotConfiguredError;
|
|
24035
|
+
/** Thrown for {@link ZamaErrorCode.WalletNotConnected}. */
|
|
24036
|
+
[ZamaErrorCode.WalletNotConnected]: WalletNotConnectedError;
|
|
24037
|
+
/** Thrown for {@link ZamaErrorCode.WalletAccountNotReady}. */
|
|
24038
|
+
[ZamaErrorCode.WalletAccountNotReady]: WalletAccountNotReadyError;
|
|
24039
|
+
/** Thrown for {@link ZamaErrorCode.KeyWrappingFailed}. */
|
|
24040
|
+
[ZamaErrorCode.KeyWrappingFailed]: KeyWrappingError;
|
|
24041
|
+
/** Thrown for {@link ZamaErrorCode.TransportKeyPairChanged}. */
|
|
24042
|
+
[ZamaErrorCode.TransportKeyPairChanged]: TransportKeyPairChangedError;
|
|
24043
|
+
/** Thrown for {@link ZamaErrorCode.PreparedPermitChainMismatch}. */
|
|
24044
|
+
[ZamaErrorCode.PreparedPermitChainMismatch]: PreparedPermitChainMismatchError;
|
|
24045
|
+
/** Thrown for {@link ZamaErrorCode.PreparedPermitExpired}. */
|
|
24046
|
+
[ZamaErrorCode.PreparedPermitExpired]: PreparedPermitExpiredError;
|
|
24047
|
+
/** Thrown for {@link ZamaErrorCode.UnshieldAlreadyFinalized}. */
|
|
24048
|
+
[ZamaErrorCode.UnshieldAlreadyFinalized]: UnshieldAlreadyFinalizedError;
|
|
24049
|
+
/** Thrown for {@link ZamaErrorCode.VaultBatcherPaused}. */
|
|
24050
|
+
[ZamaErrorCode.VaultBatcherPaused]: VaultBatcherPausedError;
|
|
24051
|
+
/** Thrown for {@link ZamaErrorCode.VaultBatchNotDispatched}. */
|
|
24052
|
+
[ZamaErrorCode.VaultBatchNotDispatched]: VaultBatchNotDispatchedError;
|
|
24053
|
+
/** Thrown for {@link ZamaErrorCode.VaultJoinUnconfirmed}. */
|
|
24054
|
+
[ZamaErrorCode.VaultJoinUnconfirmed]: VaultJoinUnconfirmedError;
|
|
24055
|
+
}
|
|
24056
|
+
/**
|
|
24057
|
+
* Pattern-match on a {@link ZamaError} by its error code. Each handler receives the
|
|
24058
|
+
* error class for its code, so subclass fields are available without a cast.
|
|
24059
|
+
* Falls through to the `_` wildcard handler if no specific handler matches.
|
|
24060
|
+
* Returns `undefined` if the error is not a `ZamaError` and no `_` handler is provided.
|
|
23860
24061
|
*
|
|
23861
24062
|
* @example
|
|
23862
24063
|
* ```ts
|
|
23863
|
-
*
|
|
23864
|
-
*
|
|
24064
|
+
* matchZamaError(error, {
|
|
24065
|
+
* SIGNING_REJECTED: () => toast("Please approve in wallet"),
|
|
24066
|
+
* INSUFFICIENT_CONFIDENTIAL_BALANCE: (e) => toast(`Need ${e.requested}, have ${e.available}`),
|
|
24067
|
+
* RELAYER_REQUEST_FAILED: (e) => toast(`Relayer failed (${e.statusCode})`),
|
|
24068
|
+
* _: () => toast("Unknown error"),
|
|
23865
24069
|
* });
|
|
23866
24070
|
* ```
|
|
23867
24071
|
*/
|
|
23868
|
-
declare
|
|
23869
|
-
|
|
23870
|
-
|
|
23871
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.confidentialBalance", {
|
|
23872
|
-
readonly tokenAddress: `0x${string}`;
|
|
23873
|
-
}];
|
|
23874
|
-
readonly owner: (tokenAddress: Address, owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalance", {
|
|
23875
|
-
readonly owner?: `0x${string}` | undefined;
|
|
23876
|
-
readonly walletAddress: `0x${string}`;
|
|
23877
|
-
readonly walletChainId: number;
|
|
23878
|
-
readonly tokenAddress: `0x${string}`;
|
|
23879
|
-
} | {
|
|
23880
|
-
readonly owner?: `0x${string}` | undefined;
|
|
23881
|
-
readonly walletAddress?: undefined;
|
|
23882
|
-
readonly walletChainId?: undefined;
|
|
23883
|
-
readonly tokenAddress: `0x${string}`;
|
|
23884
|
-
}];
|
|
23885
|
-
};
|
|
23886
|
-
readonly confidentialBalances: {
|
|
23887
|
-
readonly all: readonly ["zama.confidentialBalances"];
|
|
23888
|
-
readonly tokens: (tokenAddresses: Address[], owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalances", {
|
|
23889
|
-
readonly owner?: `0x${string}` | undefined;
|
|
23890
|
-
readonly walletAddress: `0x${string}`;
|
|
23891
|
-
readonly walletChainId: number;
|
|
23892
|
-
readonly tokenAddresses: `0x${string}`[];
|
|
23893
|
-
} | {
|
|
23894
|
-
readonly owner?: `0x${string}` | undefined;
|
|
23895
|
-
readonly walletAddress?: undefined;
|
|
23896
|
-
readonly walletChainId?: undefined;
|
|
23897
|
-
readonly tokenAddresses: `0x${string}`[];
|
|
23898
|
-
}];
|
|
23899
|
-
};
|
|
23900
|
-
readonly tokenMetadata: {
|
|
23901
|
-
readonly all: readonly ["zama.tokenMetadata"];
|
|
23902
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.tokenMetadata", {
|
|
23903
|
-
readonly tokenAddress: `0x${string}`;
|
|
23904
|
-
}];
|
|
23905
|
-
};
|
|
23906
|
-
readonly isConfidential: {
|
|
23907
|
-
readonly all: readonly ["zama.isConfidential"];
|
|
23908
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.isConfidential", {
|
|
23909
|
-
readonly tokenAddress: `0x${string}`;
|
|
23910
|
-
}];
|
|
23911
|
-
};
|
|
23912
|
-
readonly isWrapper: {
|
|
23913
|
-
readonly all: readonly ["zama.isWrapper"];
|
|
23914
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.isWrapper", {
|
|
23915
|
-
readonly tokenAddress: `0x${string}`;
|
|
23916
|
-
}];
|
|
23917
|
-
};
|
|
23918
|
-
readonly wrapperDiscovery: {
|
|
23919
|
-
readonly all: readonly ["zama.wrapperDiscovery"];
|
|
23920
|
-
readonly token: (tokenAddress?: Address, erc20Address?: Address, registryAddress?: Address) => readonly ["zama.wrapperDiscovery", {
|
|
23921
|
-
readonly registryAddress?: `0x${string}` | undefined;
|
|
23922
|
-
readonly erc20Address?: `0x${string}` | undefined;
|
|
23923
|
-
readonly tokenAddress?: `0x${string}` | undefined;
|
|
23924
|
-
}];
|
|
23925
|
-
};
|
|
23926
|
-
readonly underlyingAllowance: {
|
|
23927
|
-
readonly all: readonly ["zama.underlyingAllowance"];
|
|
23928
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.underlyingAllowance", {
|
|
23929
|
-
readonly tokenAddress: `0x${string}`;
|
|
23930
|
-
}];
|
|
23931
|
-
readonly scope: (tokenAddress: Address, owner?: Address) => readonly ["zama.underlyingAllowance", {
|
|
23932
|
-
readonly owner?: `0x${string}` | undefined;
|
|
23933
|
-
readonly tokenAddress: `0x${string}`;
|
|
23934
|
-
}];
|
|
23935
|
-
};
|
|
23936
|
-
readonly confidentialIsOperator: {
|
|
23937
|
-
readonly all: readonly ["zama.confidentialIsOperator"];
|
|
23938
|
-
readonly token: (tokenAddress?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
23939
|
-
tokenAddress: `0x${string}`;
|
|
23940
|
-
} | {
|
|
23941
|
-
tokenAddress?: undefined;
|
|
23942
|
-
}];
|
|
23943
|
-
readonly scope: (tokenAddress?: Address, holder?: Address, spender?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
23944
|
-
readonly spender?: `0x${string}` | undefined;
|
|
23945
|
-
readonly holder?: `0x${string}` | undefined;
|
|
23946
|
-
readonly tokenAddress?: `0x${string}` | undefined;
|
|
23947
|
-
}];
|
|
23948
|
-
};
|
|
23949
|
-
readonly totalSupply: {
|
|
23950
|
-
readonly all: readonly ["zama.totalSupply"];
|
|
23951
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.totalSupply", {
|
|
23952
|
-
readonly tokenAddress: `0x${string}`;
|
|
23953
|
-
}];
|
|
23954
|
-
};
|
|
23955
|
-
readonly pendingUnshield: {
|
|
23956
|
-
readonly all: readonly ["zama.pendingUnshield"];
|
|
23957
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.pendingUnshield", {
|
|
23958
|
-
readonly tokenAddress: `0x${string}`;
|
|
23959
|
-
}];
|
|
23960
|
-
};
|
|
23961
|
-
readonly hasPermit: {
|
|
23962
|
-
readonly all: readonly ["zama.hasPermit"];
|
|
23963
|
-
readonly scope: (contractAddresses: Address[], walletAccount?: WalletAccount) => readonly ["zama.hasPermit", {
|
|
23964
|
-
readonly contractAddresses: `0x${string}`[];
|
|
23965
|
-
readonly walletAddress: `0x${string}`;
|
|
23966
|
-
readonly walletChainId: number;
|
|
23967
|
-
} | {
|
|
23968
|
-
readonly contractAddresses: `0x${string}`[];
|
|
23969
|
-
readonly walletAddress?: undefined;
|
|
23970
|
-
readonly walletChainId?: undefined;
|
|
23971
|
-
}];
|
|
23972
|
-
};
|
|
23973
|
-
readonly delegationStatus: {
|
|
23974
|
-
readonly all: readonly ["zama.delegationStatus"];
|
|
23975
|
-
readonly contract: (contractAddress?: Address) => readonly ["zama.delegationStatus", {
|
|
23976
|
-
contractAddress: `0x${string}`;
|
|
23977
|
-
} | {
|
|
23978
|
-
contractAddress?: undefined;
|
|
23979
|
-
}];
|
|
23980
|
-
readonly scope: (contractAddress?: Address, delegator?: Address, delegate?: Address) => readonly ["zama.delegationStatus", {
|
|
23981
|
-
readonly delegateAddress?: `0x${string}` | undefined;
|
|
23982
|
-
readonly delegatorAddress?: `0x${string}` | undefined;
|
|
23983
|
-
readonly contractAddress?: `0x${string}` | undefined;
|
|
23984
|
-
}];
|
|
23985
|
-
};
|
|
23986
|
-
readonly decryption: {
|
|
23987
|
-
readonly all: readonly ["zama.decryption"];
|
|
23988
|
-
readonly encryptedValue: (encryptedValue: string, contractAddress?: Address) => readonly ["zama.decryption", {
|
|
23989
|
-
readonly contractAddress?: `0x${string}` | undefined;
|
|
23990
|
-
readonly encryptedValue: string;
|
|
23991
|
-
}];
|
|
23992
|
-
readonly encryptedInputs: (encryptedInputs: readonly {
|
|
23993
|
-
encryptedValue: string;
|
|
23994
|
-
contractAddress: Address;
|
|
23995
|
-
}[], walletAccount?: WalletAccount) => readonly ["zama.decryption", {
|
|
23996
|
-
readonly encryptedInputs: {
|
|
23997
|
-
encryptedValue: Hex;
|
|
23998
|
-
contractAddress: `0x${string}`;
|
|
23999
|
-
}[];
|
|
24000
|
-
readonly walletAddress: `0x${string}`;
|
|
24001
|
-
readonly walletChainId: number;
|
|
24002
|
-
} | {
|
|
24003
|
-
readonly encryptedInputs: {
|
|
24004
|
-
encryptedValue: Hex;
|
|
24005
|
-
contractAddress: `0x${string}`;
|
|
24006
|
-
}[];
|
|
24007
|
-
readonly walletAddress?: undefined;
|
|
24008
|
-
readonly walletChainId?: undefined;
|
|
24009
|
-
}];
|
|
24010
|
-
};
|
|
24011
|
-
readonly wrappersRegistry: {
|
|
24012
|
-
readonly all: readonly ["zama.wrappersRegistry"];
|
|
24013
|
-
readonly chainId: (walletChainId?: number) => readonly ["zama.wrappersRegistry", {
|
|
24014
|
-
readonly walletChainId?: number | undefined;
|
|
24015
|
-
readonly type: "chainId";
|
|
24016
|
-
}];
|
|
24017
|
-
readonly tokenPairs: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
24018
|
-
readonly type: "tokenPairs";
|
|
24019
|
-
readonly registryAddress: `0x${string}`;
|
|
24020
|
-
}];
|
|
24021
|
-
readonly confidentialTokenAddress: (registryAddress: Address, tokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
24022
|
-
readonly type: "confidentialTokenAddress";
|
|
24023
|
-
readonly registryAddress: `0x${string}`;
|
|
24024
|
-
readonly tokenAddress: `0x${string}`;
|
|
24025
|
-
}];
|
|
24026
|
-
readonly tokenAddress: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
24027
|
-
readonly type: "tokenAddress";
|
|
24028
|
-
readonly registryAddress: `0x${string}`;
|
|
24029
|
-
readonly confidentialTokenAddress: `0x${string}`;
|
|
24030
|
-
}];
|
|
24031
|
-
readonly tokenPairsLength: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
24032
|
-
readonly type: "tokenPairsLength";
|
|
24033
|
-
readonly registryAddress: `0x${string}`;
|
|
24034
|
-
}];
|
|
24035
|
-
readonly tokenPairsSlice: (registryAddress: Address, fromIndex: string, toIndex: string) => readonly ["zama.wrappersRegistry", {
|
|
24036
|
-
readonly type: "tokenPairsSlice";
|
|
24037
|
-
readonly registryAddress: `0x${string}`;
|
|
24038
|
-
readonly fromIndex: string;
|
|
24039
|
-
readonly toIndex: string;
|
|
24040
|
-
}];
|
|
24041
|
-
readonly tokenPair: (registryAddress: Address, index: string) => readonly ["zama.wrappersRegistry", {
|
|
24042
|
-
readonly type: "tokenPair";
|
|
24043
|
-
readonly registryAddress: `0x${string}`;
|
|
24044
|
-
readonly index: string;
|
|
24045
|
-
}];
|
|
24046
|
-
readonly isConfidentialTokenValid: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
24047
|
-
readonly type: "isConfidentialTokenValid";
|
|
24048
|
-
readonly registryAddress: `0x${string}`;
|
|
24049
|
-
readonly confidentialTokenAddress: `0x${string}`;
|
|
24050
|
-
}];
|
|
24051
|
-
readonly listPairs: (registryAddress: Address, page: number, pageSize: number, metadata: boolean) => readonly ["zama.wrappersRegistry", {
|
|
24052
|
-
readonly type: "listPairs";
|
|
24053
|
-
readonly registryAddress: `0x${string}`;
|
|
24054
|
-
readonly page: number;
|
|
24055
|
-
readonly pageSize: number;
|
|
24056
|
-
readonly metadata: boolean;
|
|
24057
|
-
}];
|
|
24058
|
-
};
|
|
24059
|
-
};
|
|
24060
|
-
/** Connected-wallet context threaded into query factories to scope cache keys and gate signer-dependent queries. */
|
|
24061
|
-
interface SignerQueryContext {
|
|
24062
|
-
/** Connected wallet account; queries that need a signer stay disabled until it is set. */
|
|
24063
|
-
walletAccount?: WalletAccount;
|
|
24064
|
-
}
|
|
24065
|
-
/** A single encrypted value to decrypt, paired with the contract that owns it. */
|
|
24066
|
-
interface EncryptedInput {
|
|
24067
|
-
/** Encrypted handle to decrypt. */
|
|
24068
|
-
encryptedValue: EncryptedValue;
|
|
24069
|
-
/** Address of the contract the encrypted value belongs to. */
|
|
24070
|
-
contractAddress: Address;
|
|
24071
|
-
}
|
|
24072
|
-
/** Decrypted clear values keyed by encrypted handle. */
|
|
24073
|
-
type DecryptResult = Readonly<Record<EncryptedValue, ClearValue>>;
|
|
24074
|
-
/** Builds TanStack Query options for decrypting a batch of encrypted handles into their clear values. */
|
|
24075
|
-
declare function decryptValuesQueryOptions(sdk: ZamaSDK, encryptedInputs: EncryptedInput[], signerContext?: SignerQueryContext): QueryFactoryOptions<DecryptResult, Error, DecryptResult, ReturnType<typeof zamaQueryKeys.decryption.encryptedInputs>>;
|
|
24076
|
-
/** Options shared by the delegated-decrypt entry points. */
|
|
24077
|
-
interface DelegatedDecryptOptions {
|
|
24078
|
-
/**
|
|
24079
|
-
* Ride out the gateway propagation window: when a just-granted delegation
|
|
24080
|
-
* has not yet synced, the delegated decrypt is retried (bounded, ~30s) until
|
|
24081
|
-
* it lands instead of throwing {@link DelegationNotPropagatedError}. Defaults
|
|
24082
|
-
* to `true`. Pass `false` to fail fast on the first not-propagated response.
|
|
24083
|
-
*/
|
|
24084
|
-
waitForPropagation?: boolean;
|
|
24085
|
-
}
|
|
24086
|
-
/** Per-handle outcome of a batch decrypt: the decrypted value, or a per-item error. */
|
|
24087
|
-
interface BatchDecryptItem {
|
|
24088
|
-
/** The encrypted value (handle) being decrypted. */
|
|
24089
|
-
encryptedValue: EncryptedValue;
|
|
24090
|
-
/** Address of the contract the handle belongs to. */
|
|
24091
|
-
contractAddress: Address;
|
|
24092
|
-
/** Decrypted clear value; set when this item succeeded. */
|
|
24093
|
-
value?: ClearValue;
|
|
24094
|
-
/** Error for this item; set when this item failed. */
|
|
24095
|
-
error?: ZamaError;
|
|
24096
|
-
}
|
|
24097
|
-
/** Result of a batch decrypt: one entry per requested handle, in input order. */
|
|
24098
|
-
interface BatchDecryptResult {
|
|
24099
|
-
/** Per-handle outcomes. */
|
|
24100
|
-
items: BatchDecryptItem[];
|
|
24101
|
-
}
|
|
24072
|
+
declare function matchZamaError<R>(error: unknown, handlers: { [K in ZamaErrorCode]?: (error: ErrorForCode[K]) => R; } & {
|
|
24073
|
+
_?: (error: unknown) => R;
|
|
24074
|
+
}): R | undefined;
|
|
24102
24075
|
/**
|
|
24103
|
-
* Public namespace for
|
|
24104
|
-
*
|
|
24105
|
-
* Exposed as `sdk.decryption`. Prefer these methods over the low-level
|
|
24106
|
-
* `sdk.relayer.decryptValues` / `decryptPublicValues`: they
|
|
24107
|
-
* assemble the credential bundle (transport key pair, EIP-712 permit) for you,
|
|
24108
|
-
* cache results, and wrap relayer errors. Reach for `sdk.relayer.*` only when
|
|
24109
|
-
* you must control credential assembly by hand.
|
|
24076
|
+
* Public namespace for permit and transport-key-pair management.
|
|
24110
24077
|
*
|
|
24111
|
-
* Owns the SDK-level guards (
|
|
24112
|
-
*
|
|
24113
|
-
*
|
|
24114
|
-
* actual work to the internal {@link DecryptionService} or the relayer directly for
|
|
24115
|
-
* `decryptPublicValues`.
|
|
24078
|
+
* Exposed as `sdk.permits`. Owns the SDK-level guards (chain alignment, empty-array
|
|
24079
|
+
* short-circuit, decrypt-cache invalidation) and delegates the actual work to the
|
|
24080
|
+
* internal {@link CredentialService}.
|
|
24116
24081
|
*
|
|
24117
|
-
*
|
|
24118
|
-
*
|
|
24119
|
-
*
|
|
24082
|
+
* The namespace is named `permits` because the user-facing concept is the signed-permit
|
|
24083
|
+
* store. The transport key pair is invisible plumbing — there is no `getTransportKeyPair()`
|
|
24084
|
+
* surfaced; the key pair exists to sign permits and is created automatically when needed.
|
|
24085
|
+
* {@link clear} wipes both the permit store and the transport key pair (permits
|
|
24086
|
+
* cascade-delete with the key pair).
|
|
24120
24087
|
*
|
|
24121
|
-
*
|
|
24122
|
-
*
|
|
24123
|
-
*
|
|
24088
|
+
* When `transportKeyPairScope` is configured (opt-in shared-tenant scope for B2B2C/WaaS
|
|
24089
|
+
* operators), {@link clear} and {@link revokePermits} stay signer-level only — they never
|
|
24090
|
+
* touch the shared key pair. {@link revokeTransportKeyPair} is the distinct,
|
|
24091
|
+
* operator-level operation for that.
|
|
24124
24092
|
*/
|
|
24125
|
-
declare class
|
|
24093
|
+
declare class Permits {
|
|
24126
24094
|
#private;
|
|
24127
24095
|
/**
|
|
24128
|
-
*
|
|
24129
|
-
*
|
|
24130
|
-
*
|
|
24131
|
-
* Zero encrypted values are mapped to `0n` without hitting the relayer.
|
|
24132
|
-
* Events (`DecryptStart/End/Error`) are emitted uniformly.
|
|
24133
|
-
* Relayer errors are wrapped into typed SDK errors.
|
|
24096
|
+
* Sign and store an EIP-712 permit authorizing direct decryption for the
|
|
24097
|
+
* given contract addresses.
|
|
24134
24098
|
*
|
|
24135
|
-
*
|
|
24136
|
-
*
|
|
24137
|
-
*
|
|
24138
|
-
*
|
|
24139
|
-
*
|
|
24099
|
+
* Idempotent: if a permit covering the requested set already exists, no
|
|
24100
|
+
* wallet prompt occurs. Otherwise the SDK chunks the uncovered subset into
|
|
24101
|
+
* groups of ≤10 contracts and prompts once per chunk; partial mid-flight
|
|
24102
|
+
* rejection is preserved (already-signed chunks are persisted before the
|
|
24103
|
+
* next prompt).
|
|
24140
24104
|
*
|
|
24141
|
-
* @
|
|
24142
|
-
*
|
|
24143
|
-
*
|
|
24144
|
-
* { encryptedValue: balance, contractAddress: cUSDT },
|
|
24145
|
-
* ]);
|
|
24146
|
-
* console.log(values[balance]); // 1000n
|
|
24147
|
-
* ```
|
|
24105
|
+
* @param contracts - Contract addresses to authorize.
|
|
24106
|
+
* @throws if `transportKeyPairDerivationSecret` is configured and the keypair fails to wrap or
|
|
24107
|
+
* unwrap. {@link KeyWrappingError}
|
|
24148
24108
|
*/
|
|
24149
|
-
|
|
24109
|
+
grantPermit(contracts: Address[]): Promise<void>;
|
|
24150
24110
|
/**
|
|
24151
|
-
*
|
|
24152
|
-
*
|
|
24153
|
-
* Mirrors {@link decryptValues} with delegated credentials — same caching and
|
|
24154
|
-
* zero-value short-circuit. Before reading from cache or calling the relayer,
|
|
24155
|
-
* every non-zero encrypted value's contract must have an active delegation from the
|
|
24156
|
-
* delegator to the connected signer; missing or expired delegations fail fast.
|
|
24111
|
+
* Sign and store an EIP-712 delegation permit authorizing decryption on
|
|
24112
|
+
* behalf of `delegator`. Same idempotence/chunking semantics as {@link grantPermit}.
|
|
24157
24113
|
*
|
|
24158
|
-
* @param
|
|
24159
|
-
* @param
|
|
24160
|
-
* @
|
|
24161
|
-
*
|
|
24162
|
-
|
|
24163
|
-
|
|
24164
|
-
|
|
24165
|
-
*
|
|
24166
|
-
*
|
|
24167
|
-
*
|
|
24114
|
+
* @param delegator - The address that delegated decryption rights to the connected signer.
|
|
24115
|
+
* @param contracts - Contract addresses to authorize.
|
|
24116
|
+
* @throws if `transportKeyPairDerivationSecret` is configured and the keypair fails to wrap or
|
|
24117
|
+
* unwrap. {@link KeyWrappingError}
|
|
24118
|
+
*/
|
|
24119
|
+
grantDelegationPermit(delegator: Address, contracts: Address[]): Promise<void>;
|
|
24120
|
+
/**
|
|
24121
|
+
* Pure store lookup: is there a permit covering `contracts`?
|
|
24122
|
+
* No wallet prompt, no transport key pair generation. Returns `false` when no signer
|
|
24123
|
+
* is configured, or when `transportKeyPairDerivationSecret` is configured and the stored keypair
|
|
24124
|
+
* fails to unwrap. Does not swallow other errors (e.g. a failing storage backend), which
|
|
24125
|
+
* propagate normally.
|
|
24126
|
+
*/
|
|
24127
|
+
hasPermit(contracts: Address[]): Promise<boolean>;
|
|
24128
|
+
/**
|
|
24129
|
+
* Pure store lookup for a delegation permit. Never throws when the stored keypair
|
|
24130
|
+
* fails to unwrap, reporting no permit instead; other errors still propagate.
|
|
24168
24131
|
*
|
|
24169
|
-
* @
|
|
24170
|
-
*
|
|
24171
|
-
*
|
|
24172
|
-
* { encryptedValue: balance, contractAddress: tokenAddr },
|
|
24173
|
-
* ], delegatorAddr);
|
|
24174
|
-
* console.log(values[balance]); // 1000n
|
|
24175
|
-
* ```
|
|
24132
|
+
* @param delegator - The address that delegated decryption rights to the connected signer.
|
|
24133
|
+
* @param contracts - Contract addresses to check.
|
|
24134
|
+
* @returns `true` if cached delegation permits cover all requested contracts.
|
|
24176
24135
|
*/
|
|
24177
|
-
|
|
24136
|
+
hasDelegationPermit(delegator: Address, contracts: Address[]): Promise<boolean>;
|
|
24178
24137
|
/**
|
|
24179
|
-
*
|
|
24138
|
+
* Best-effort transport-key-pair prefetch for the connected signer.
|
|
24180
24139
|
*
|
|
24181
|
-
*
|
|
24182
|
-
*
|
|
24183
|
-
* can submit on-chain finalization transactions (e.g. `finalizeUnwrap`).
|
|
24140
|
+
* Optional latency optimization: decrypt and permit flows remain correct
|
|
24141
|
+
* without it because they lazily create the transport key pair when needed.
|
|
24184
24142
|
*
|
|
24185
|
-
*
|
|
24186
|
-
*
|
|
24187
|
-
*
|
|
24143
|
+
* Silent no-op when no signer is configured or no wallet account is
|
|
24144
|
+
* available. The transport key pair is generated through the relayer dispatcher's
|
|
24145
|
+
* currently active chain — see {@link LifecycleService}, which calls
|
|
24146
|
+
* `switchChain` before fanning the wallet-account change out to listeners,
|
|
24147
|
+
* so any downstream caller (including React adapters) observes the
|
|
24148
|
+
* dispatcher on the wallet chain by the time it invokes warmup.
|
|
24188
24149
|
*
|
|
24189
|
-
*
|
|
24190
|
-
*
|
|
24191
|
-
*
|
|
24192
|
-
*
|
|
24193
|
-
*
|
|
24150
|
+
* Not for pre-warming a shared `transportKeyPairScope`: this call's wallet-account
|
|
24151
|
+
* precondition doesn't conceptually apply to a scope-wide key, and would silently
|
|
24152
|
+
* no-op precisely when an operator is most likely to be calling it (no end-user
|
|
24153
|
+
* connected yet). Use {@link warmTransportKeyPairScope} instead.
|
|
24154
|
+
*
|
|
24155
|
+
* @throws if `transportKeyPairDerivationSecret` is configured and the keypair fails to wrap or
|
|
24156
|
+
* unwrap. {@link KeyWrappingError}
|
|
24194
24157
|
*/
|
|
24195
|
-
|
|
24158
|
+
warmTransportKeyPair(): Promise<void>;
|
|
24196
24159
|
/**
|
|
24197
|
-
*
|
|
24160
|
+
* Single-permit form of {@link batchRegisterPermits}.
|
|
24198
24161
|
*
|
|
24199
|
-
*
|
|
24200
|
-
*
|
|
24201
|
-
*
|
|
24202
|
-
|
|
24162
|
+
* @param prepared - The payload `sdk.offline.preparePermit` returned.
|
|
24163
|
+
* @param signature - The 65-byte `eth_signTypedData_v4` signature over `prepared.eip712`.
|
|
24164
|
+
* @throws everything {@link batchRegisterPermits} throws, for this one permit.
|
|
24165
|
+
*/
|
|
24166
|
+
registerPermit(prepared: PreparedPermit, signature: Hex): Promise<void>;
|
|
24167
|
+
/**
|
|
24168
|
+
* Offline permit flow, phase 2: verify and persist the signatures an
|
|
24169
|
+
* out-of-process signer produced for `sdk.offline.batchPreparePermits`
|
|
24170
|
+
* payloads. Every permit is verified before any is persisted, so a permit
|
|
24171
|
+
* that fails verification leaves the store untouched. Persisting is
|
|
24172
|
+
* best-effort: a failed store write is logged, not thrown.
|
|
24173
|
+
*
|
|
24174
|
+
* No wallet account required: each permit is scoped by `prepared.signerAddress`
|
|
24175
|
+
* (and `prepared.delegatorAddress`, if present), not a connected signer.
|
|
24176
|
+
*
|
|
24177
|
+
* Stops at the first permit that fails verification. With more than one
|
|
24178
|
+
* permit, the error message is prefixed with that permit's position
|
|
24179
|
+
* (`permits[i]: …`).
|
|
24180
|
+
*
|
|
24181
|
+
* @param permits - Each `sdk.offline.batchPreparePermits` payload paired with the
|
|
24182
|
+
* 65-byte `eth_signTypedData_v4` signature over its `eip712`.
|
|
24183
|
+
* @throws if `permits` is empty, or a `prepared` doesn't match the `PreparedPermit`
|
|
24184
|
+
* shape (e.g. it crossed a process boundary and was corrupted). {@link ConfigurationError}
|
|
24185
|
+
* @throws if the chain embedded in `prepared.eip712` doesn't match the active chain. {@link PreparedPermitChainMismatchError}
|
|
24186
|
+
* @throws if the permit's validity window has already elapsed. {@link PreparedPermitExpiredError}
|
|
24187
|
+
* @throws if the transport key pair changed since prepare. {@link TransportKeyPairChangedError}
|
|
24188
|
+
* @throws if the signature is invalid or malformed. {@link SigningFailedError}
|
|
24189
|
+
*/
|
|
24190
|
+
batchRegisterPermits(permits: readonly SignedPreparedPermit[]): Promise<void>;
|
|
24191
|
+
/**
|
|
24192
|
+
* Wipe FHE permits for the current signer.
|
|
24193
|
+
*
|
|
24194
|
+
* - With no argument: every permit referencing this signer is removed across
|
|
24195
|
+
* all chains and delegators. The transport key pair survives — use {@link clear} to
|
|
24196
|
+
* also wipe the transport key pair.
|
|
24197
|
+
* - With a contract list: every signed permit in the direct-decrypt scope
|
|
24198
|
+
* (current chain) whose immutable payload touches any listed address is
|
|
24199
|
+
* removed. Delegation permits are not touched in this mode.
|
|
24203
24200
|
*
|
|
24204
|
-
* @param encryptedInputs - FHE encrypted values paired with their contract addresses.
|
|
24205
|
-
* @param delegatorAddress - The address that granted delegation rights.
|
|
24206
|
-
* @param accountAddress - The account on whose behalf decryption is performed. Defaults to `delegatorAddress`.
|
|
24207
|
-
* @param maxConcurrency - Maximum parallel decrypt calls during per-entry fallback.
|
|
24208
|
-
* @param waitForPropagation - Ride out the gateway propagation window on the
|
|
24209
|
-
* initial batch attempt (default `true`). See {@link DelegatedDecryptOptions.waitForPropagation}.
|
|
24210
|
-
* @returns Per-entry results, each with a value or an error.
|
|
24211
24201
|
* @throws if no signer is configured. {@link SignerNotConfiguredError}
|
|
24212
|
-
|
|
24213
|
-
|
|
24214
|
-
|
|
24215
|
-
*
|
|
24202
|
+
*/
|
|
24203
|
+
revokePermits(contracts?: Address[]): Promise<void>;
|
|
24204
|
+
/**
|
|
24205
|
+
* Wipe the transport key pair for the current signer and cascade-delete every permit
|
|
24206
|
+
* (across chains and delegators) referencing it.
|
|
24216
24207
|
*
|
|
24217
|
-
* @
|
|
24218
|
-
* ```ts
|
|
24219
|
-
* const result = await sdk.decryption.delegatedBatchDecryptValues({
|
|
24220
|
-
* encryptedInputs: [
|
|
24221
|
-
* { encryptedValue: encryptedValue1, contractAddress: tokenA },
|
|
24222
|
-
* { encryptedValue: encryptedValue2, contractAddress: tokenB },
|
|
24223
|
-
* ],
|
|
24224
|
-
* delegatorAddress: "0xDelegator",
|
|
24225
|
-
* maxConcurrency: 5,
|
|
24226
|
-
* });
|
|
24227
|
-
* for (const item of result.items) {
|
|
24228
|
-
* if (item.error) console.error(item.encryptedValue, item.error);
|
|
24229
|
-
* else console.log(item.encryptedValue, item.value);
|
|
24230
|
-
* }
|
|
24231
|
-
* ```
|
|
24208
|
+
* @throws if no signer is configured. {@link SignerNotConfiguredError}
|
|
24232
24209
|
*/
|
|
24233
|
-
|
|
24234
|
-
|
|
24235
|
-
|
|
24236
|
-
|
|
24237
|
-
|
|
24238
|
-
|
|
24210
|
+
clear(): Promise<void>;
|
|
24211
|
+
/**
|
|
24212
|
+
* Revoke the shared transport key pair for `transportKeyPairScope`. Storage-only,
|
|
24213
|
+
* operator-level action: no wallet account or signer needs to be connected.
|
|
24214
|
+
*
|
|
24215
|
+
* Deletes the shared key pair; every permit in the scope embeds its public key, so
|
|
24216
|
+
* they're all treated as stale on next access. Signer-level {@link clear} never does
|
|
24217
|
+
* this — it only ever wipes the calling signer's own permits.
|
|
24218
|
+
*
|
|
24219
|
+
* Not best-effort, unlike most credential-store writes: a storage failure rejects
|
|
24220
|
+
* instead of being logged and swallowed. This is the primitive an operator reaches
|
|
24221
|
+
* for on suspected key compromise — a resolved promise must mean the key pair is
|
|
24222
|
+
* actually gone.
|
|
24223
|
+
*
|
|
24224
|
+
* Stops the SDK from reissuing or reusing the deleted key — does not revoke any
|
|
24225
|
+
* permit already issued under it. A permit is a self-contained, bearer-style EIP-712
|
|
24226
|
+
* signature the relayer accepts independently of this SDK; one exfiltrated alongside
|
|
24227
|
+
* the key remains usable until its own `permitTTL` expiry regardless of this call.
|
|
24228
|
+
*
|
|
24229
|
+
* @param scopeId - Must match the configured `transportKeyPairScope`, as a guard
|
|
24230
|
+
* against revoking the wrong scope by mistake.
|
|
24231
|
+
* @throws if no scope is configured, or `scopeId` doesn't match it. {@link ConfigurationError}
|
|
24232
|
+
* @throws if the underlying storage delete fails.
|
|
24233
|
+
*/
|
|
24234
|
+
revokeTransportKeyPair(scopeId: string): Promise<void>;
|
|
24235
|
+
/**
|
|
24236
|
+
* Warm the shared transport key pair for `transportKeyPairScope` — the pre-warm
|
|
24237
|
+
* counterpart to {@link revokeTransportKeyPair}. Storage-only, operator-level action:
|
|
24238
|
+
* no wallet account or signer needs to be connected. Prefer this over
|
|
24239
|
+
* {@link warmTransportKeyPair} for a scoped key pair: unlike that method, this never
|
|
24240
|
+
* silently no-ops for lack of a connected wallet, because a scope-wide key was never
|
|
24241
|
+
* tied to one in the first place.
|
|
24242
|
+
*
|
|
24243
|
+
* @param scopeId - Must match the configured `transportKeyPairScope`, as a guard
|
|
24244
|
+
* against warming the wrong scope by mistake.
|
|
24245
|
+
* @throws if no scope is configured, or `scopeId` doesn't match it. {@link ConfigurationError}
|
|
24246
|
+
* @throws if `transportKeyPairDerivationSecret` is configured and the keypair fails to wrap or
|
|
24247
|
+
* unwrap. {@link KeyWrappingError}
|
|
24248
|
+
*/
|
|
24249
|
+
warmTransportKeyPairScope(scopeId: string): Promise<void>;
|
|
24239
24250
|
}
|
|
24240
24251
|
/** Delegation activity and expiry, resolved from the active contract or wildcard grant. */
|
|
24241
24252
|
interface DelegationStatus {
|
|
@@ -24422,181 +24433,301 @@ declare class Offline {
|
|
|
24422
24433
|
*/
|
|
24423
24434
|
batchPreparePermits(request: PreparePermitRequest): Promise<PreparedPermit[]>;
|
|
24424
24435
|
}
|
|
24436
|
+
/** Options for {@link Token.batchDecryptBalancesAs}. */
|
|
24437
|
+
interface BatchDecryptAsOptions {
|
|
24438
|
+
/** The address of the account that delegated decryption rights. */
|
|
24439
|
+
delegatorAddress: Address;
|
|
24440
|
+
/** Pre-fetched encrypted values. When omitted, they are fetched from the chain. */
|
|
24441
|
+
encryptedValues?: EncryptedValue[];
|
|
24442
|
+
/**
|
|
24443
|
+
* The account whose on-chain balance to read. Defaults to the delegator
|
|
24444
|
+
* address, which is the common case (the delegator grants permission to
|
|
24445
|
+
* decrypt their own balance). Only set this when the account differs
|
|
24446
|
+
* from the delegator.
|
|
24447
|
+
*
|
|
24448
|
+
* Matches the `account` parameter of `confidentialBalanceOf(account)` on-chain.
|
|
24449
|
+
*/
|
|
24450
|
+
accountAddress?: Address;
|
|
24451
|
+
/** Maximum number of concurrent decrypt calls. Default: 10. */
|
|
24452
|
+
maxConcurrency?: number;
|
|
24453
|
+
/** Called when decryption fails for a single token. Return a fallback bigint. */
|
|
24454
|
+
onError?: (error: Error, address: Address) => bigint;
|
|
24455
|
+
}
|
|
24456
|
+
/** Result of {@link Token.batchBalancesOf}. */
|
|
24457
|
+
interface BatchBalancesResult {
|
|
24458
|
+
/** Successfully decrypted balances, keyed by token address. */
|
|
24459
|
+
results: Map<Address, bigint>;
|
|
24460
|
+
/** Per-token errors for tokens that failed to decrypt. */
|
|
24461
|
+
errors: Map<Address, ZamaError>;
|
|
24462
|
+
}
|
|
24425
24463
|
/**
|
|
24426
|
-
*
|
|
24427
|
-
*
|
|
24428
|
-
*
|
|
24429
|
-
* short-circuit, decrypt-cache invalidation) and delegates the actual work to the
|
|
24430
|
-
* internal {@link CredentialService}.
|
|
24464
|
+
* High-level interface for an ERC-7984 confidential token.
|
|
24465
|
+
* Hides FHE complexity (encryption, decryption, EIP-712 signing) behind
|
|
24466
|
+
* familiar ERC-20-like methods.
|
|
24431
24467
|
*
|
|
24432
|
-
*
|
|
24433
|
-
*
|
|
24434
|
-
* surfaced; the key pair exists to sign permits and is created automatically when needed.
|
|
24435
|
-
* {@link clear} wipes both the permit store and the transport key pair (permits
|
|
24436
|
-
* cascade-delete with the key pair).
|
|
24468
|
+
* For ERC-7984 wrappers (shield/unshield), use {@link WrappedToken} instead —
|
|
24469
|
+
* it extends `Token` with wrapper-specific operations.
|
|
24437
24470
|
*
|
|
24438
|
-
*
|
|
24439
|
-
*
|
|
24440
|
-
*
|
|
24441
|
-
* operator-level operation for that.
|
|
24471
|
+
* Decryption, credentials, caching, and event emission are handled by the
|
|
24472
|
+
* owning {@link ZamaSDK} — this class only exposes token-scoped helpers
|
|
24473
|
+
* that delegate to `sdk.decryption.decryptValues` and `sdk.permits.grantPermit`.
|
|
24442
24474
|
*/
|
|
24443
|
-
declare class
|
|
24475
|
+
declare class Token {
|
|
24444
24476
|
#private;
|
|
24477
|
+
/** The SDK instance this token operates through. */
|
|
24478
|
+
readonly sdk: ZamaSDK;
|
|
24479
|
+
/** Checksummed address of the confidential token contract. */
|
|
24480
|
+
readonly address: Address;
|
|
24481
|
+
constructor(sdk: ZamaSDK, address: Address);
|
|
24482
|
+
/** Read the token name from the contract. */
|
|
24483
|
+
name(): Promise<string>;
|
|
24484
|
+
/** Read the token symbol from the contract. */
|
|
24485
|
+
symbol(): Promise<string>;
|
|
24486
|
+
/** Read the token decimals from the contract. */
|
|
24487
|
+
decimals(): Promise<number>;
|
|
24445
24488
|
/**
|
|
24446
|
-
*
|
|
24447
|
-
* given contract addresses.
|
|
24489
|
+
* ERC-165 check for {@link ERC7984_INTERFACE_ID} support.
|
|
24448
24490
|
*
|
|
24449
|
-
*
|
|
24450
|
-
* wallet prompt occurs. Otherwise the SDK chunks the uncovered subset into
|
|
24451
|
-
* groups of ≤10 contracts and prompts once per chunk; partial mid-flight
|
|
24452
|
-
* rejection is preserved (already-signed chunks are persisted before the
|
|
24453
|
-
* next prompt).
|
|
24454
|
-
*
|
|
24455
|
-
* @param contracts - Contract addresses to authorize.
|
|
24456
|
-
* @throws if `transportKeyPairDerivationSecret` is configured and the keypair fails to wrap or
|
|
24457
|
-
* unwrap. {@link KeyWrappingError}
|
|
24491
|
+
* @returns `true` if the contract implements the ERC-7984 confidential token interface.
|
|
24458
24492
|
*/
|
|
24459
|
-
|
|
24493
|
+
isConfidential(): Promise<boolean>;
|
|
24460
24494
|
/**
|
|
24461
|
-
*
|
|
24462
|
-
* behalf of `delegator`. Same idempotence/chunking semantics as {@link grantPermit}.
|
|
24495
|
+
* ERC-165 check for IERC7984ERC20Wrapper support.
|
|
24463
24496
|
*
|
|
24464
|
-
* @
|
|
24465
|
-
*
|
|
24466
|
-
* @throws if `transportKeyPairDerivationSecret` is configured and the keypair fails to wrap or
|
|
24467
|
-
* unwrap. {@link KeyWrappingError}
|
|
24497
|
+
* @returns `true` if the contract implements the ERC-7984 wrapper interface
|
|
24498
|
+
* ({@link ERC7984_WRAPPER_INTERFACE_ID}, `0x1f1c62b2`).
|
|
24468
24499
|
*/
|
|
24469
|
-
|
|
24500
|
+
isWrapper(): Promise<boolean>;
|
|
24470
24501
|
/**
|
|
24471
|
-
*
|
|
24472
|
-
*
|
|
24473
|
-
*
|
|
24474
|
-
*
|
|
24475
|
-
*
|
|
24502
|
+
* Decrypt and return the plaintext balance for the given owner.
|
|
24503
|
+
* Acquires FHE credentials via a wallet signature if none are cached.
|
|
24504
|
+
*
|
|
24505
|
+
* @param owner - Balance owner address.
|
|
24506
|
+
* @returns The decrypted plaintext balance as a bigint.
|
|
24507
|
+
* @throws if FHE decryption fails. {@link DecryptionFailedError}
|
|
24508
|
+
*
|
|
24509
|
+
* @example
|
|
24510
|
+
* ```ts
|
|
24511
|
+
* const balance = await token.balanceOf("0xOwner");
|
|
24512
|
+
* ```
|
|
24476
24513
|
*/
|
|
24477
|
-
|
|
24514
|
+
balanceOf(owner: Address): Promise<bigint>;
|
|
24478
24515
|
/**
|
|
24479
|
-
*
|
|
24480
|
-
* fails to unwrap, reporting no permit instead; other errors still propagate.
|
|
24516
|
+
* Return the raw encrypted balance without decrypting.
|
|
24481
24517
|
*
|
|
24482
|
-
* @param
|
|
24483
|
-
* @
|
|
24484
|
-
*
|
|
24518
|
+
* @param owner - Balance owner address.
|
|
24519
|
+
* @returns The encrypted balance as a hex string.
|
|
24520
|
+
*
|
|
24521
|
+
* @example
|
|
24522
|
+
* ```ts
|
|
24523
|
+
* const encryptedValue = await token.confidentialBalanceOf("0xOwner");
|
|
24524
|
+
* ```
|
|
24485
24525
|
*/
|
|
24486
|
-
|
|
24526
|
+
confidentialBalanceOf(owner: Address): Promise<EncryptedValue>;
|
|
24487
24527
|
/**
|
|
24488
|
-
*
|
|
24489
|
-
*
|
|
24490
|
-
*
|
|
24491
|
-
* without it because they lazily create the transport key pair when needed.
|
|
24528
|
+
* Decrypt the balance of a delegator using delegated decryption credentials.
|
|
24529
|
+
* The connected signer acts as the delegatee who has been granted permission
|
|
24530
|
+
* by the delegator to decrypt their balance.
|
|
24492
24531
|
*
|
|
24493
|
-
*
|
|
24494
|
-
*
|
|
24495
|
-
*
|
|
24496
|
-
*
|
|
24497
|
-
* so any downstream caller (including React adapters) observes the
|
|
24498
|
-
* dispatcher on the wallet chain by the time it invokes warmup.
|
|
24532
|
+
* Clear values are cached in storage keyed by `(account, token, encryptedValue)`.
|
|
24533
|
+
* Because every on-chain balance change produces a new encrypted value,
|
|
24534
|
+
* stale cache entries are never served. Cache write failures are silently
|
|
24535
|
+
* ignored — they do not affect the returned value.
|
|
24499
24536
|
*
|
|
24500
|
-
*
|
|
24501
|
-
*
|
|
24502
|
-
*
|
|
24503
|
-
*
|
|
24537
|
+
* @param delegatorAddress - The address of the account that delegated decryption rights.
|
|
24538
|
+
* @param accountAddress - The account whose on-chain balance to read. Defaults
|
|
24539
|
+
* to the delegator address.
|
|
24540
|
+
* @returns The decrypted plaintext balance as a bigint.
|
|
24541
|
+
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
24542
|
+
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
24543
|
+
* @throws if delegated decryption fails. {@link DecryptionFailedError}
|
|
24504
24544
|
*
|
|
24505
|
-
* @
|
|
24506
|
-
*
|
|
24545
|
+
* @example
|
|
24546
|
+
* ```ts
|
|
24547
|
+
* const balance = await token.decryptBalanceAs({
|
|
24548
|
+
* delegatorAddress: "0xDelegator",
|
|
24549
|
+
* });
|
|
24550
|
+
* ```
|
|
24507
24551
|
*/
|
|
24508
|
-
|
|
24552
|
+
decryptBalanceAs({ delegatorAddress, accountAddress }: {
|
|
24553
|
+
delegatorAddress: Address;
|
|
24554
|
+
accountAddress?: Address;
|
|
24555
|
+
}): Promise<bigint>;
|
|
24509
24556
|
/**
|
|
24510
|
-
*
|
|
24557
|
+
* Decrypt confidential balances for multiple tokens in parallel, returning
|
|
24558
|
+
* successes and per-token errors separately. Pre-authorizes all token
|
|
24559
|
+
* addresses in a single wallet signature, then delegates each decrypt to
|
|
24560
|
+
* `sdk.decryption.decryptValues`.
|
|
24511
24561
|
*
|
|
24512
|
-
*
|
|
24513
|
-
*
|
|
24514
|
-
* @
|
|
24562
|
+
* Tokens that fail to decrypt land in `errors`; the batch keeps going.
|
|
24563
|
+
*
|
|
24564
|
+
* @param tokens - Array of {@link Token} instances bound to the same SDK.
|
|
24565
|
+
* @param owner - Balance owner address.
|
|
24566
|
+
* @returns `{ results, errors }` partitioning the per-token outcomes.
|
|
24567
|
+
* @throws A failure that affects the whole session (rejected signature,
|
|
24568
|
+
* misconfiguration, RPC rate limit, key unwrapping failure, revoked KMS
|
|
24569
|
+
* context) rejects the call instead of landing in `errors`.
|
|
24570
|
+
*
|
|
24571
|
+
* @example
|
|
24572
|
+
* ```ts
|
|
24573
|
+
* const { results, errors } = await Token.batchBalancesOf(tokens, owner);
|
|
24574
|
+
* ```
|
|
24515
24575
|
*/
|
|
24516
|
-
|
|
24576
|
+
static batchBalancesOf(tokens: Token[], owner: Address): Promise<BatchBalancesResult>;
|
|
24517
24577
|
/**
|
|
24518
|
-
*
|
|
24519
|
-
*
|
|
24520
|
-
* payloads. Every permit is verified before any is persisted, so a permit
|
|
24521
|
-
* that fails verification leaves the store untouched. Persisting is
|
|
24522
|
-
* best-effort: a failed store write is logged, not thrown.
|
|
24578
|
+
* Batch decrypt confidential balances as a delegate across multiple tokens.
|
|
24579
|
+
* Mirrors {@link batchBalancesOf} but uses delegated credentials.
|
|
24523
24580
|
*
|
|
24524
|
-
*
|
|
24525
|
-
*
|
|
24581
|
+
* **Error handling:** If a per-token decryption fails and no `onError` callback
|
|
24582
|
+
* is provided, errors are collected and thrown as an aggregated
|
|
24583
|
+
* `DecryptionFailedError`. When the relayer returns no value for an encrypted value,
|
|
24584
|
+
* a `DecryptionFailedError` is thrown for that token (never silently returns `0n`).
|
|
24585
|
+
* Pass `onError: () => 0n` to opt into the silent zero behavior.
|
|
24526
24586
|
*
|
|
24527
|
-
*
|
|
24528
|
-
*
|
|
24529
|
-
*
|
|
24587
|
+
* @param tokens - Array of Token instances to decrypt balances for.
|
|
24588
|
+
* @param options - Delegated decryption configuration.
|
|
24589
|
+
* @returns A Map from token address to decrypted balance.
|
|
24590
|
+
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
24591
|
+
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
24592
|
+
* @throws if any decryption fails and no `onError` is provided. {@link DecryptionFailedError}
|
|
24593
|
+
* @throws A failure that affects the whole session (rejected signature, RPC
|
|
24594
|
+
* rate limit, revoked KMS context) rejects the call even when `onError` is
|
|
24595
|
+
* provided.
|
|
24530
24596
|
*
|
|
24531
|
-
* @
|
|
24532
|
-
*
|
|
24533
|
-
*
|
|
24534
|
-
*
|
|
24535
|
-
*
|
|
24536
|
-
*
|
|
24537
|
-
*
|
|
24538
|
-
* @throws if the signature is invalid or malformed. {@link SigningFailedError}
|
|
24597
|
+
* @example
|
|
24598
|
+
* ```ts
|
|
24599
|
+
* const balances = await Token.batchDecryptBalancesAs(tokens, {
|
|
24600
|
+
* delegatorAddress: "0xDelegator",
|
|
24601
|
+
* onError: (err, addr) => { console.error(addr, err); return 0n; },
|
|
24602
|
+
* });
|
|
24603
|
+
* ```
|
|
24539
24604
|
*/
|
|
24540
|
-
|
|
24605
|
+
static batchDecryptBalancesAs(tokens: Token[], options: BatchDecryptAsOptions): Promise<Map<Address, bigint>>;
|
|
24606
|
+
private static readBalanceHandlesBatch;
|
|
24541
24607
|
/**
|
|
24542
|
-
*
|
|
24608
|
+
* Confidential transfer. Encrypts the amount via FHE, then calls the contract.
|
|
24543
24609
|
*
|
|
24544
|
-
*
|
|
24545
|
-
*
|
|
24546
|
-
*
|
|
24547
|
-
*
|
|
24548
|
-
* (current chain) whose immutable payload touches any listed address is
|
|
24549
|
-
* removed. Delegation permits are not touched in this mode.
|
|
24610
|
+
* By default, the SDK validates the confidential balance before submitting.
|
|
24611
|
+
* If a cached plaintext balance exists it is used; otherwise, if credentials
|
|
24612
|
+
* are cached, it decrypts on the fly. Set `skipBalanceCheck: true` to bypass
|
|
24613
|
+
* this validation (e.g. for smart wallets).
|
|
24550
24614
|
*
|
|
24551
|
-
* @
|
|
24615
|
+
* @param to - Recipient address.
|
|
24616
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
24617
|
+
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
24618
|
+
* @returns The transaction hash and mined receipt.
|
|
24619
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
24620
|
+
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
24621
|
+
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
24622
|
+
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
24623
|
+
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
24624
|
+
*
|
|
24625
|
+
* @example
|
|
24626
|
+
* ```ts
|
|
24627
|
+
* const txHash = await token.confidentialTransfer("0xRecipient", 1000n);
|
|
24628
|
+
* ```
|
|
24552
24629
|
*/
|
|
24553
|
-
|
|
24630
|
+
confidentialTransfer(to: Address, amount: bigint, options?: TransferOptions): Promise<TransactionResult>;
|
|
24554
24631
|
/**
|
|
24555
|
-
*
|
|
24556
|
-
*
|
|
24632
|
+
* Operator encrypted transfer on behalf of another address.
|
|
24633
|
+
* The caller must be an approved operator for `from`.
|
|
24557
24634
|
*
|
|
24558
|
-
* @
|
|
24635
|
+
* @param from - The address to transfer from (caller must be an approved operator).
|
|
24636
|
+
* @param to - Recipient address.
|
|
24637
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
24638
|
+
* @returns The transaction hash and mined receipt.
|
|
24639
|
+
*
|
|
24640
|
+
* @example
|
|
24641
|
+
* ```ts
|
|
24642
|
+
* const txHash = await token.confidentialTransferFrom("0xFrom", "0xTo", 500n);
|
|
24643
|
+
* ```
|
|
24559
24644
|
*/
|
|
24560
|
-
|
|
24645
|
+
confidentialTransferFrom(from: Address, to: Address, amount: bigint, callbacks?: TransferCallbacks): Promise<TransactionResult>;
|
|
24561
24646
|
/**
|
|
24562
|
-
*
|
|
24563
|
-
*
|
|
24647
|
+
* ERC-7984 `confidentialTransferAndCall`: encrypted transfer that also invokes
|
|
24648
|
+
* the recipient's receiver hook (`onConfidentialTransferReceived`) in a single
|
|
24649
|
+
* transaction. The caller crafts the opaque `data` payload — the SDK does not
|
|
24650
|
+
* encode, validate, or interpret it.
|
|
24564
24651
|
*
|
|
24565
|
-
*
|
|
24566
|
-
* they're all treated as stale on next access. Signer-level {@link clear} never does
|
|
24567
|
-
* this — it only ever wipes the calling signer's own permits.
|
|
24652
|
+
* Balance validation follows the same rules as {@link Token.confidentialTransfer}.
|
|
24568
24653
|
*
|
|
24569
|
-
*
|
|
24570
|
-
*
|
|
24571
|
-
*
|
|
24572
|
-
*
|
|
24654
|
+
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
24655
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
24656
|
+
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
24657
|
+
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
24658
|
+
* @returns The transaction hash and mined receipt.
|
|
24573
24659
|
*
|
|
24574
|
-
*
|
|
24575
|
-
*
|
|
24576
|
-
*
|
|
24577
|
-
*
|
|
24660
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
24661
|
+
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
24662
|
+
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
24663
|
+
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
24664
|
+
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
24578
24665
|
*
|
|
24579
|
-
* @
|
|
24580
|
-
*
|
|
24581
|
-
*
|
|
24582
|
-
*
|
|
24666
|
+
* @example
|
|
24667
|
+
* ```ts
|
|
24668
|
+
* const txHash = await token.confidentialTransferAndCall(
|
|
24669
|
+
* "0xRecipient",
|
|
24670
|
+
* 1000n,
|
|
24671
|
+
* "0xabcd", // caller-encoded payload forwarded to the receiver hook
|
|
24672
|
+
* );
|
|
24673
|
+
* ```
|
|
24583
24674
|
*/
|
|
24584
|
-
|
|
24675
|
+
confidentialTransferAndCall(to: Address, amount: bigint, data: Hex, options?: TransferOptions): Promise<TransactionResult>;
|
|
24585
24676
|
/**
|
|
24586
|
-
*
|
|
24587
|
-
*
|
|
24588
|
-
*
|
|
24589
|
-
*
|
|
24590
|
-
*
|
|
24591
|
-
*
|
|
24592
|
-
*
|
|
24593
|
-
* @param
|
|
24594
|
-
*
|
|
24595
|
-
* @
|
|
24596
|
-
* @
|
|
24597
|
-
*
|
|
24677
|
+
* ERC-7984 `confidentialTransferFromAndCall`: operator-initiated encrypted
|
|
24678
|
+
* transfer that also invokes the recipient's receiver hook in a single
|
|
24679
|
+
* transaction. The caller must be an approved operator for `from` and crafts
|
|
24680
|
+
* the opaque `data` payload — the SDK does not encode or interpret it.
|
|
24681
|
+
*
|
|
24682
|
+
* @param from - The address to transfer from (caller must be an approved operator).
|
|
24683
|
+
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
24684
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
24685
|
+
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
24686
|
+
* @param callbacks - Optional progress callbacks.
|
|
24687
|
+
* @returns The transaction hash and mined receipt.
|
|
24688
|
+
*
|
|
24689
|
+
* @example
|
|
24690
|
+
* ```ts
|
|
24691
|
+
* const txHash = await token.confidentialTransferFromAndCall(
|
|
24692
|
+
* "0xFrom",
|
|
24693
|
+
* "0xRecipient",
|
|
24694
|
+
* 500n,
|
|
24695
|
+
* "0xabcd",
|
|
24696
|
+
* );
|
|
24697
|
+
* ```
|
|
24598
24698
|
*/
|
|
24599
|
-
|
|
24699
|
+
confidentialTransferFromAndCall(from: Address, to: Address, amount: bigint, data: Hex, callbacks?: TransferCallbacks): Promise<TransactionResult>;
|
|
24700
|
+
/**
|
|
24701
|
+
* Set operator approval for the confidential token.
|
|
24702
|
+
* Defaults to 1 hour from now if `until` is not specified.
|
|
24703
|
+
*
|
|
24704
|
+
* @param operator - The address to set as an operator.
|
|
24705
|
+
* @param until - Optional Unix timestamp for approval expiry. Defaults to now + 1 hour.
|
|
24706
|
+
* @returns The transaction hash and mined receipt.
|
|
24707
|
+
*
|
|
24708
|
+
* @example
|
|
24709
|
+
* ```ts
|
|
24710
|
+
* const txHash = await token.setOperator("0xOperator");
|
|
24711
|
+
* ```
|
|
24712
|
+
*/
|
|
24713
|
+
setOperator(operator: Address, until?: number): Promise<TransactionResult>;
|
|
24714
|
+
/**
|
|
24715
|
+
* Check if a spender is an approved operator for a given holder.
|
|
24716
|
+
*
|
|
24717
|
+
* @param holder - The token holder address.
|
|
24718
|
+
* @param spender - The address to check operator approval for.
|
|
24719
|
+
* @returns `true` if the spender is an approved operator for the holder.
|
|
24720
|
+
*
|
|
24721
|
+
* @example
|
|
24722
|
+
* ```ts
|
|
24723
|
+
* if (await token.isOperator("0xHolder", "0xSpender")) {
|
|
24724
|
+
* // spender can call transferFrom on behalf of holder
|
|
24725
|
+
* }
|
|
24726
|
+
* ```
|
|
24727
|
+
*/
|
|
24728
|
+
isOperator(holder: Address, spender: Address): Promise<boolean>;
|
|
24729
|
+
/** Verify all tokens share the same SDK instance and return it. */
|
|
24730
|
+
private static assertSameSdk;
|
|
24600
24731
|
}
|
|
24601
24732
|
/**
|
|
24602
24733
|
* Confidential ERC-20 wrapper (ERC-7984 ERC20Wrapper).
|
|
@@ -25180,999 +25311,403 @@ declare class ZamaSDK {
|
|
|
25180
25311
|
*/
|
|
25181
25312
|
[Symbol.dispose](): void;
|
|
25182
25313
|
}
|
|
25183
|
-
/**
|
|
25184
|
-
|
|
25185
|
-
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
|
|
25190
|
-
|
|
25191
|
-
|
|
25192
|
-
|
|
25193
|
-
|
|
25194
|
-
|
|
25195
|
-
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
maxConcurrency?: number;
|
|
25200
|
-
/** Called when decryption fails for a single token. Return a fallback bigint. */
|
|
25201
|
-
onError?: (error: Error, address: Address) => bigint;
|
|
25202
|
-
}
|
|
25203
|
-
/** Result of {@link Token.batchBalancesOf}. */
|
|
25204
|
-
interface BatchBalancesResult {
|
|
25205
|
-
/** Successfully decrypted balances, keyed by token address. */
|
|
25206
|
-
results: Map<Address, bigint>;
|
|
25207
|
-
/** Per-token errors for tokens that failed to decrypt. */
|
|
25208
|
-
errors: Map<Address, ZamaError>;
|
|
25314
|
+
/**
|
|
25315
|
+
* TanStack Query options object returned by the SDK's `*QueryOptions` factories:
|
|
25316
|
+
* `QueryObserverOptions` with `queryKey` and `queryFn` required and the
|
|
25317
|
+
* cache-internal keys (`queryHash`, `queryKeyHashFn`, `throwOnError`) removed.
|
|
25318
|
+
*/
|
|
25319
|
+
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"> & {
|
|
25320
|
+
queryFn: Exclude<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>["queryFn"], typeof skipToken | undefined>;
|
|
25321
|
+
};
|
|
25322
|
+
/** TanStack Query mutation options object returned by the SDK's `*MutationOptions` factories. */
|
|
25323
|
+
interface MutationFactoryOptions<TMutationKey extends readonly unknown[], TVariables, TData, TOnMutateResult = unknown> {
|
|
25324
|
+
/** Cache key identifying the mutation. */
|
|
25325
|
+
mutationKey: TMutationKey;
|
|
25326
|
+
/** Runs the mutation for the given variables. */
|
|
25327
|
+
mutationFn: (variables: TVariables) => Promise<TData>;
|
|
25328
|
+
/** Optional callback invoked after the mutation succeeds. */
|
|
25329
|
+
onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => void;
|
|
25209
25330
|
}
|
|
25210
25331
|
/**
|
|
25211
|
-
*
|
|
25212
|
-
* Hides FHE complexity (encryption, decryption, EIP-712 signing) behind
|
|
25213
|
-
* familiar ERC-20-like methods.
|
|
25214
|
-
*
|
|
25215
|
-
* For ERC-7984 wrappers (shield/unshield), use {@link WrappedToken} instead —
|
|
25216
|
-
* it extends `Token` with wrapper-specific operations.
|
|
25332
|
+
* Canonical query-key namespace for `@zama-fhe/sdk/query`.
|
|
25217
25333
|
*
|
|
25218
|
-
*
|
|
25219
|
-
*
|
|
25220
|
-
*
|
|
25334
|
+
* @example
|
|
25335
|
+
* ```ts
|
|
25336
|
+
* queryClient.invalidateQueries({
|
|
25337
|
+
* queryKey: zamaQueryKeys.confidentialBalance.token("0xToken"),
|
|
25338
|
+
* });
|
|
25339
|
+
* ```
|
|
25221
25340
|
*/
|
|
25222
|
-
declare
|
|
25223
|
-
|
|
25224
|
-
|
|
25225
|
-
|
|
25226
|
-
|
|
25227
|
-
|
|
25228
|
-
|
|
25229
|
-
|
|
25230
|
-
|
|
25231
|
-
|
|
25232
|
-
|
|
25233
|
-
|
|
25234
|
-
|
|
25235
|
-
|
|
25236
|
-
|
|
25237
|
-
|
|
25238
|
-
|
|
25239
|
-
|
|
25240
|
-
|
|
25241
|
-
|
|
25242
|
-
|
|
25243
|
-
|
|
25244
|
-
|
|
25245
|
-
|
|
25246
|
-
|
|
25247
|
-
|
|
25248
|
-
|
|
25249
|
-
|
|
25250
|
-
|
|
25251
|
-
|
|
25252
|
-
|
|
25253
|
-
|
|
25254
|
-
|
|
25255
|
-
|
|
25256
|
-
|
|
25257
|
-
|
|
25258
|
-
|
|
25259
|
-
|
|
25260
|
-
|
|
25261
|
-
|
|
25262
|
-
|
|
25263
|
-
|
|
25264
|
-
|
|
25265
|
-
|
|
25266
|
-
|
|
25267
|
-
|
|
25268
|
-
|
|
25269
|
-
|
|
25270
|
-
|
|
25271
|
-
|
|
25272
|
-
|
|
25273
|
-
|
|
25274
|
-
|
|
25275
|
-
|
|
25276
|
-
|
|
25277
|
-
|
|
25278
|
-
|
|
25279
|
-
|
|
25280
|
-
|
|
25281
|
-
|
|
25282
|
-
|
|
25283
|
-
|
|
25284
|
-
|
|
25285
|
-
|
|
25286
|
-
|
|
25287
|
-
|
|
25288
|
-
|
|
25289
|
-
|
|
25290
|
-
|
|
25291
|
-
|
|
25292
|
-
|
|
25293
|
-
|
|
25294
|
-
|
|
25295
|
-
|
|
25296
|
-
|
|
25297
|
-
|
|
25298
|
-
|
|
25299
|
-
|
|
25300
|
-
|
|
25301
|
-
|
|
25302
|
-
}
|
|
25303
|
-
|
|
25304
|
-
|
|
25305
|
-
|
|
25306
|
-
|
|
25307
|
-
|
|
25308
|
-
|
|
25309
|
-
|
|
25310
|
-
|
|
25311
|
-
|
|
25312
|
-
|
|
25313
|
-
|
|
25314
|
-
|
|
25315
|
-
|
|
25316
|
-
|
|
25317
|
-
|
|
25318
|
-
|
|
25319
|
-
|
|
25320
|
-
|
|
25321
|
-
|
|
25322
|
-
|
|
25323
|
-
|
|
25324
|
-
|
|
25325
|
-
|
|
25326
|
-
|
|
25327
|
-
|
|
25328
|
-
|
|
25329
|
-
|
|
25330
|
-
|
|
25331
|
-
|
|
25332
|
-
|
|
25333
|
-
|
|
25334
|
-
|
|
25335
|
-
|
|
25336
|
-
|
|
25337
|
-
|
|
25338
|
-
|
|
25339
|
-
|
|
25340
|
-
|
|
25341
|
-
|
|
25342
|
-
|
|
25343
|
-
|
|
25344
|
-
|
|
25345
|
-
|
|
25346
|
-
|
|
25347
|
-
|
|
25348
|
-
|
|
25349
|
-
|
|
25350
|
-
|
|
25351
|
-
|
|
25352
|
-
|
|
25353
|
-
|
|
25354
|
-
|
|
25355
|
-
|
|
25356
|
-
|
|
25357
|
-
|
|
25358
|
-
|
|
25359
|
-
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
|
|
25364
|
-
|
|
25365
|
-
|
|
25366
|
-
|
|
25367
|
-
|
|
25368
|
-
|
|
25369
|
-
|
|
25370
|
-
|
|
25371
|
-
|
|
25372
|
-
|
|
25373
|
-
|
|
25374
|
-
|
|
25375
|
-
|
|
25376
|
-
|
|
25377
|
-
|
|
25378
|
-
|
|
25379
|
-
|
|
25380
|
-
|
|
25381
|
-
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
|
|
25387
|
-
|
|
25388
|
-
|
|
25389
|
-
|
|
25390
|
-
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
|
|
25394
|
-
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25399
|
-
|
|
25400
|
-
|
|
25401
|
-
|
|
25402
|
-
|
|
25403
|
-
|
|
25404
|
-
|
|
25405
|
-
|
|
25406
|
-
|
|
25407
|
-
|
|
25408
|
-
|
|
25409
|
-
|
|
25410
|
-
|
|
25411
|
-
|
|
25412
|
-
|
|
25413
|
-
|
|
25414
|
-
|
|
25415
|
-
|
|
25416
|
-
|
|
25417
|
-
|
|
25418
|
-
|
|
25419
|
-
|
|
25420
|
-
|
|
25421
|
-
|
|
25422
|
-
|
|
25423
|
-
/**
|
|
25424
|
-
|
|
25425
|
-
* transfer that also invokes the recipient's receiver hook in a single
|
|
25426
|
-
* transaction. The caller must be an approved operator for `from` and crafts
|
|
25427
|
-
* the opaque `data` payload — the SDK does not encode or interpret it.
|
|
25428
|
-
*
|
|
25429
|
-
* @param from - The address to transfer from (caller must be an approved operator).
|
|
25430
|
-
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
25431
|
-
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
25432
|
-
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
25433
|
-
* @param callbacks - Optional progress callbacks.
|
|
25434
|
-
* @returns The transaction hash and mined receipt.
|
|
25435
|
-
*
|
|
25436
|
-
* @example
|
|
25437
|
-
* ```ts
|
|
25438
|
-
* const txHash = await token.confidentialTransferFromAndCall(
|
|
25439
|
-
* "0xFrom",
|
|
25440
|
-
* "0xRecipient",
|
|
25441
|
-
* 500n,
|
|
25442
|
-
* "0xabcd",
|
|
25443
|
-
* );
|
|
25444
|
-
* ```
|
|
25445
|
-
*/
|
|
25446
|
-
confidentialTransferFromAndCall(from: Address, to: Address, amount: bigint, data: Hex, callbacks?: TransferCallbacks): Promise<TransactionResult>;
|
|
25447
|
-
/**
|
|
25448
|
-
* Set operator approval for the confidential token.
|
|
25449
|
-
* Defaults to 1 hour from now if `until` is not specified.
|
|
25450
|
-
*
|
|
25451
|
-
* @param operator - The address to set as an operator.
|
|
25452
|
-
* @param until - Optional Unix timestamp for approval expiry. Defaults to now + 1 hour.
|
|
25453
|
-
* @returns The transaction hash and mined receipt.
|
|
25454
|
-
*
|
|
25455
|
-
* @example
|
|
25456
|
-
* ```ts
|
|
25457
|
-
* const txHash = await token.setOperator("0xOperator");
|
|
25458
|
-
* ```
|
|
25459
|
-
*/
|
|
25460
|
-
setOperator(operator: Address, until?: number): Promise<TransactionResult>;
|
|
25461
|
-
/**
|
|
25462
|
-
* Check if a spender is an approved operator for a given holder.
|
|
25463
|
-
*
|
|
25464
|
-
* @param holder - The token holder address.
|
|
25465
|
-
* @param spender - The address to check operator approval for.
|
|
25466
|
-
* @returns `true` if the spender is an approved operator for the holder.
|
|
25467
|
-
*
|
|
25468
|
-
* @example
|
|
25469
|
-
* ```ts
|
|
25470
|
-
* if (await token.isOperator("0xHolder", "0xSpender")) {
|
|
25471
|
-
* // spender can call transferFrom on behalf of holder
|
|
25472
|
-
* }
|
|
25473
|
-
* ```
|
|
25474
|
-
*/
|
|
25475
|
-
isOperator(holder: Address, spender: Address): Promise<boolean>;
|
|
25476
|
-
/** Verify all tokens share the same SDK instance and return it. */
|
|
25477
|
-
private static assertSameSdk;
|
|
25341
|
+
declare const zamaQueryKeys: {
|
|
25342
|
+
readonly confidentialBalance: {
|
|
25343
|
+
readonly all: readonly ["zama.confidentialBalance"];
|
|
25344
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.confidentialBalance", {
|
|
25345
|
+
readonly tokenAddress: `0x${string}`;
|
|
25346
|
+
}];
|
|
25347
|
+
readonly owner: (tokenAddress: Address, owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalance", {
|
|
25348
|
+
readonly owner?: `0x${string}` | undefined;
|
|
25349
|
+
readonly walletAddress: `0x${string}`;
|
|
25350
|
+
readonly walletChainId: number;
|
|
25351
|
+
readonly tokenAddress: `0x${string}`;
|
|
25352
|
+
} | {
|
|
25353
|
+
readonly owner?: `0x${string}` | undefined;
|
|
25354
|
+
readonly walletAddress?: undefined;
|
|
25355
|
+
readonly walletChainId?: undefined;
|
|
25356
|
+
readonly tokenAddress: `0x${string}`;
|
|
25357
|
+
}];
|
|
25358
|
+
};
|
|
25359
|
+
readonly confidentialBalances: {
|
|
25360
|
+
readonly all: readonly ["zama.confidentialBalances"];
|
|
25361
|
+
readonly tokens: (tokenAddresses: Address[], owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalances", {
|
|
25362
|
+
readonly owner?: `0x${string}` | undefined;
|
|
25363
|
+
readonly walletAddress: `0x${string}`;
|
|
25364
|
+
readonly walletChainId: number;
|
|
25365
|
+
readonly tokenAddresses: `0x${string}`[];
|
|
25366
|
+
} | {
|
|
25367
|
+
readonly owner?: `0x${string}` | undefined;
|
|
25368
|
+
readonly walletAddress?: undefined;
|
|
25369
|
+
readonly walletChainId?: undefined;
|
|
25370
|
+
readonly tokenAddresses: `0x${string}`[];
|
|
25371
|
+
}];
|
|
25372
|
+
};
|
|
25373
|
+
readonly tokenMetadata: {
|
|
25374
|
+
readonly all: readonly ["zama.tokenMetadata"];
|
|
25375
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.tokenMetadata", {
|
|
25376
|
+
readonly tokenAddress: `0x${string}`;
|
|
25377
|
+
}];
|
|
25378
|
+
};
|
|
25379
|
+
readonly isConfidential: {
|
|
25380
|
+
readonly all: readonly ["zama.isConfidential"];
|
|
25381
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.isConfidential", {
|
|
25382
|
+
readonly tokenAddress: `0x${string}`;
|
|
25383
|
+
}];
|
|
25384
|
+
};
|
|
25385
|
+
readonly isWrapper: {
|
|
25386
|
+
readonly all: readonly ["zama.isWrapper"];
|
|
25387
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.isWrapper", {
|
|
25388
|
+
readonly tokenAddress: `0x${string}`;
|
|
25389
|
+
}];
|
|
25390
|
+
};
|
|
25391
|
+
readonly wrapperDiscovery: {
|
|
25392
|
+
readonly all: readonly ["zama.wrapperDiscovery"];
|
|
25393
|
+
readonly token: (tokenAddress?: Address, erc20Address?: Address, registryAddress?: Address) => readonly ["zama.wrapperDiscovery", {
|
|
25394
|
+
readonly registryAddress?: `0x${string}` | undefined;
|
|
25395
|
+
readonly erc20Address?: `0x${string}` | undefined;
|
|
25396
|
+
readonly tokenAddress?: `0x${string}` | undefined;
|
|
25397
|
+
}];
|
|
25398
|
+
};
|
|
25399
|
+
readonly underlyingAllowance: {
|
|
25400
|
+
readonly all: readonly ["zama.underlyingAllowance"];
|
|
25401
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.underlyingAllowance", {
|
|
25402
|
+
readonly tokenAddress: `0x${string}`;
|
|
25403
|
+
}];
|
|
25404
|
+
readonly scope: (tokenAddress: Address, owner?: Address) => readonly ["zama.underlyingAllowance", {
|
|
25405
|
+
readonly owner?: `0x${string}` | undefined;
|
|
25406
|
+
readonly tokenAddress: `0x${string}`;
|
|
25407
|
+
}];
|
|
25408
|
+
};
|
|
25409
|
+
readonly confidentialIsOperator: {
|
|
25410
|
+
readonly all: readonly ["zama.confidentialIsOperator"];
|
|
25411
|
+
readonly token: (tokenAddress?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
25412
|
+
tokenAddress: `0x${string}`;
|
|
25413
|
+
} | {
|
|
25414
|
+
tokenAddress?: undefined;
|
|
25415
|
+
}];
|
|
25416
|
+
readonly scope: (tokenAddress?: Address, holder?: Address, spender?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
25417
|
+
readonly spender?: `0x${string}` | undefined;
|
|
25418
|
+
readonly holder?: `0x${string}` | undefined;
|
|
25419
|
+
readonly tokenAddress?: `0x${string}` | undefined;
|
|
25420
|
+
}];
|
|
25421
|
+
};
|
|
25422
|
+
readonly totalSupply: {
|
|
25423
|
+
readonly all: readonly ["zama.totalSupply"];
|
|
25424
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.totalSupply", {
|
|
25425
|
+
readonly tokenAddress: `0x${string}`;
|
|
25426
|
+
}];
|
|
25427
|
+
};
|
|
25428
|
+
readonly pendingUnshield: {
|
|
25429
|
+
readonly all: readonly ["zama.pendingUnshield"];
|
|
25430
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.pendingUnshield", {
|
|
25431
|
+
readonly tokenAddress: `0x${string}`;
|
|
25432
|
+
}];
|
|
25433
|
+
};
|
|
25434
|
+
readonly hasPermit: {
|
|
25435
|
+
readonly all: readonly ["zama.hasPermit"];
|
|
25436
|
+
readonly scope: (contractAddresses: Address[], walletAccount?: WalletAccount) => readonly ["zama.hasPermit", {
|
|
25437
|
+
readonly contractAddresses: `0x${string}`[];
|
|
25438
|
+
readonly walletAddress: `0x${string}`;
|
|
25439
|
+
readonly walletChainId: number;
|
|
25440
|
+
} | {
|
|
25441
|
+
readonly contractAddresses: `0x${string}`[];
|
|
25442
|
+
readonly walletAddress?: undefined;
|
|
25443
|
+
readonly walletChainId?: undefined;
|
|
25444
|
+
}];
|
|
25445
|
+
};
|
|
25446
|
+
readonly delegationStatus: {
|
|
25447
|
+
readonly all: readonly ["zama.delegationStatus"];
|
|
25448
|
+
readonly contract: (contractAddress?: Address) => readonly ["zama.delegationStatus", {
|
|
25449
|
+
contractAddress: `0x${string}`;
|
|
25450
|
+
} | {
|
|
25451
|
+
contractAddress?: undefined;
|
|
25452
|
+
}];
|
|
25453
|
+
readonly scope: (contractAddress?: Address, delegator?: Address, delegate?: Address) => readonly ["zama.delegationStatus", {
|
|
25454
|
+
readonly delegateAddress?: `0x${string}` | undefined;
|
|
25455
|
+
readonly delegatorAddress?: `0x${string}` | undefined;
|
|
25456
|
+
readonly contractAddress?: `0x${string}` | undefined;
|
|
25457
|
+
}];
|
|
25458
|
+
};
|
|
25459
|
+
readonly decryption: {
|
|
25460
|
+
readonly all: readonly ["zama.decryption"];
|
|
25461
|
+
readonly encryptedValue: (encryptedValue: string, contractAddress?: Address) => readonly ["zama.decryption", {
|
|
25462
|
+
readonly contractAddress?: `0x${string}` | undefined;
|
|
25463
|
+
readonly encryptedValue: string;
|
|
25464
|
+
}];
|
|
25465
|
+
readonly encryptedInputs: (encryptedInputs: readonly {
|
|
25466
|
+
encryptedValue: string;
|
|
25467
|
+
contractAddress: Address;
|
|
25468
|
+
}[], walletAccount?: WalletAccount) => readonly ["zama.decryption", {
|
|
25469
|
+
readonly encryptedInputs: {
|
|
25470
|
+
encryptedValue: Hex;
|
|
25471
|
+
contractAddress: `0x${string}`;
|
|
25472
|
+
}[];
|
|
25473
|
+
readonly walletAddress: `0x${string}`;
|
|
25474
|
+
readonly walletChainId: number;
|
|
25475
|
+
} | {
|
|
25476
|
+
readonly encryptedInputs: {
|
|
25477
|
+
encryptedValue: Hex;
|
|
25478
|
+
contractAddress: `0x${string}`;
|
|
25479
|
+
}[];
|
|
25480
|
+
readonly walletAddress?: undefined;
|
|
25481
|
+
readonly walletChainId?: undefined;
|
|
25482
|
+
}];
|
|
25483
|
+
};
|
|
25484
|
+
readonly wrappersRegistry: {
|
|
25485
|
+
readonly all: readonly ["zama.wrappersRegistry"];
|
|
25486
|
+
readonly chainId: (walletChainId?: number) => readonly ["zama.wrappersRegistry", {
|
|
25487
|
+
readonly walletChainId?: number | undefined;
|
|
25488
|
+
readonly type: "chainId";
|
|
25489
|
+
}];
|
|
25490
|
+
readonly tokenPairs: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
25491
|
+
readonly type: "tokenPairs";
|
|
25492
|
+
readonly registryAddress: `0x${string}`;
|
|
25493
|
+
}];
|
|
25494
|
+
readonly confidentialTokenAddress: (registryAddress: Address, tokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
25495
|
+
readonly type: "confidentialTokenAddress";
|
|
25496
|
+
readonly registryAddress: `0x${string}`;
|
|
25497
|
+
readonly tokenAddress: `0x${string}`;
|
|
25498
|
+
}];
|
|
25499
|
+
readonly tokenAddress: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
25500
|
+
readonly type: "tokenAddress";
|
|
25501
|
+
readonly registryAddress: `0x${string}`;
|
|
25502
|
+
readonly confidentialTokenAddress: `0x${string}`;
|
|
25503
|
+
}];
|
|
25504
|
+
readonly tokenPairsLength: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
25505
|
+
readonly type: "tokenPairsLength";
|
|
25506
|
+
readonly registryAddress: `0x${string}`;
|
|
25507
|
+
}];
|
|
25508
|
+
readonly tokenPairsSlice: (registryAddress: Address, fromIndex: string, toIndex: string) => readonly ["zama.wrappersRegistry", {
|
|
25509
|
+
readonly type: "tokenPairsSlice";
|
|
25510
|
+
readonly registryAddress: `0x${string}`;
|
|
25511
|
+
readonly fromIndex: string;
|
|
25512
|
+
readonly toIndex: string;
|
|
25513
|
+
}];
|
|
25514
|
+
readonly tokenPair: (registryAddress: Address, index: string) => readonly ["zama.wrappersRegistry", {
|
|
25515
|
+
readonly type: "tokenPair";
|
|
25516
|
+
readonly registryAddress: `0x${string}`;
|
|
25517
|
+
readonly index: string;
|
|
25518
|
+
}];
|
|
25519
|
+
readonly isConfidentialTokenValid: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
25520
|
+
readonly type: "isConfidentialTokenValid";
|
|
25521
|
+
readonly registryAddress: `0x${string}`;
|
|
25522
|
+
readonly confidentialTokenAddress: `0x${string}`;
|
|
25523
|
+
}];
|
|
25524
|
+
readonly listPairs: (registryAddress: Address, page: number, pageSize: number, metadata: boolean) => readonly ["zama.wrappersRegistry", {
|
|
25525
|
+
readonly type: "listPairs";
|
|
25526
|
+
readonly registryAddress: `0x${string}`;
|
|
25527
|
+
readonly page: number;
|
|
25528
|
+
readonly pageSize: number;
|
|
25529
|
+
readonly metadata: boolean;
|
|
25530
|
+
}];
|
|
25531
|
+
};
|
|
25532
|
+
};
|
|
25533
|
+
/** Connected-wallet context threaded into query factories to scope cache keys and gate signer-dependent queries. */
|
|
25534
|
+
interface SignerQueryContext {
|
|
25535
|
+
/** Connected wallet account; queries that need a signer stay disabled until it is set. */
|
|
25536
|
+
walletAccount?: WalletAccount;
|
|
25537
|
+
}
|
|
25538
|
+
/** A single encrypted value to decrypt, paired with the contract that owns it. */
|
|
25539
|
+
interface EncryptedInput {
|
|
25540
|
+
/** Encrypted handle to decrypt. */
|
|
25541
|
+
encryptedValue: EncryptedValue;
|
|
25542
|
+
/** Address of the contract the encrypted value belongs to. */
|
|
25543
|
+
contractAddress: Address;
|
|
25478
25544
|
}
|
|
25479
|
-
/**
|
|
25480
|
-
|
|
25545
|
+
/** Decrypted clear values keyed by encrypted handle. */
|
|
25546
|
+
type DecryptResult = Readonly<Record<EncryptedValue, ClearValue>>;
|
|
25547
|
+
/** Builds TanStack Query options for decrypting a batch of encrypted handles into their clear values. */
|
|
25548
|
+
declare function decryptValuesQueryOptions(sdk: ZamaSDK, encryptedInputs: EncryptedInput[], signerContext?: SignerQueryContext): QueryFactoryOptions<DecryptResult, Error, DecryptResult, ReturnType<typeof zamaQueryKeys.decryption.encryptedInputs>>;
|
|
25549
|
+
/** Options shared by the delegated-decrypt entry points. */
|
|
25550
|
+
interface DelegatedDecryptOptions {
|
|
25481
25551
|
/**
|
|
25482
|
-
*
|
|
25483
|
-
*
|
|
25484
|
-
*
|
|
25485
|
-
*
|
|
25552
|
+
* Ride out the gateway propagation window: when a just-granted delegation
|
|
25553
|
+
* has not yet synced, the delegated decrypt is retried (bounded, ~30s) until
|
|
25554
|
+
* it lands instead of throwing {@link DelegationNotPropagatedError}. Defaults
|
|
25555
|
+
* to `true`. Pass `false` to fail fast on the first not-propagated response.
|
|
25486
25556
|
*/
|
|
25487
|
-
|
|
25557
|
+
waitForPropagation?: boolean;
|
|
25488
25558
|
}
|
|
25489
|
-
/**
|
|
25490
|
-
interface
|
|
25491
|
-
/** The
|
|
25492
|
-
|
|
25493
|
-
/**
|
|
25494
|
-
|
|
25495
|
-
/**
|
|
25496
|
-
|
|
25497
|
-
/**
|
|
25498
|
-
|
|
25559
|
+
/** Per-handle outcome of a batch decrypt: the decrypted value, or a per-item error. */
|
|
25560
|
+
interface BatchDecryptItem {
|
|
25561
|
+
/** The encrypted value (handle) being decrypted. */
|
|
25562
|
+
encryptedValue: EncryptedValue;
|
|
25563
|
+
/** Address of the contract the handle belongs to. */
|
|
25564
|
+
contractAddress: Address;
|
|
25565
|
+
/** Decrypted clear value; set when this item succeeded. */
|
|
25566
|
+
value?: ClearValue;
|
|
25567
|
+
/** Error for this item; set when this item failed. */
|
|
25568
|
+
error?: ZamaError;
|
|
25499
25569
|
}
|
|
25500
|
-
/**
|
|
25501
|
-
|
|
25502
|
-
|
|
25503
|
-
|
|
25504
|
-
* per direction, so construct one instance for deposits and one for redeems.
|
|
25505
|
-
*
|
|
25506
|
-
* The lifecycle is `join` → `dispatchBatch` → `claim`. Finalization between
|
|
25507
|
-
* the last two is normally driven by a keeper, an off-chain service that
|
|
25508
|
-
* sends each dispatched batch's callback, so a batch is claimable only once it
|
|
25509
|
-
* reaches {@link BatchState.Finalized}, which can be well after dispatch;
|
|
25510
|
-
* {@link finalize} settles a batch the keeper has not.
|
|
25511
|
-
*/
|
|
25512
|
-
declare class VaultBatcher {
|
|
25513
|
-
#private;
|
|
25514
|
-
/** The SDK instance this batcher reads and writes through. */
|
|
25515
|
-
readonly sdk: ZamaSDK;
|
|
25516
|
-
/** Checksummed address of the batcher contract. */
|
|
25517
|
-
readonly address: Address;
|
|
25518
|
-
/** The chain reads go to; `undefined` for the provider's current chain. */
|
|
25519
|
-
readonly chainId: number | undefined;
|
|
25520
|
-
constructor(sdk: ZamaSDK, address: Address, options?: VaultBatcherOptions);
|
|
25521
|
-
/**
|
|
25522
|
-
* The underlying ERC-4626 vault. Share price (`convertToShares`,
|
|
25523
|
-
* `convertToAssets`, `totalAssets`) is read from it directly, not from the
|
|
25524
|
-
* batcher. Resolved once and cached.
|
|
25525
|
-
*/
|
|
25526
|
-
vault(): Promise<Address>;
|
|
25527
|
-
/**
|
|
25528
|
-
* The confidential token this batcher accepts as input (e.g. shares for a
|
|
25529
|
-
* redeem batcher). Resolved once and cached.
|
|
25530
|
-
*/
|
|
25531
|
-
fromToken(): Promise<Address>;
|
|
25532
|
-
/**
|
|
25533
|
-
* The confidential token this batcher pays out (e.g. shares for a
|
|
25534
|
-
* deposit batcher). Resolved once and cached.
|
|
25535
|
-
*/
|
|
25536
|
-
toToken(): Promise<Address>;
|
|
25537
|
-
/** The id of the currently open (not-yet-dispatched) batch. */
|
|
25538
|
-
currentBatchId(): Promise<bigint>;
|
|
25539
|
-
/**
|
|
25540
|
-
* A batch's lifecycle state. See {@link BatchState} for which operation each
|
|
25541
|
-
* state allows.
|
|
25542
|
-
*
|
|
25543
|
-
* @throws Reverts on chain with `BatchNonexistent` for an id above
|
|
25544
|
-
* {@link currentBatchId} — batch ids start at 1.
|
|
25545
|
-
* @throws if the contract returns a state the SDK does not know. {@link ConfigurationError}
|
|
25546
|
-
*/
|
|
25547
|
-
batchState(batchId: bigint): Promise<BatchState>;
|
|
25548
|
-
/** Whether the batcher is paused. While paused, `join` and `dispatchBatch` revert; `quit` and `claim` still work. */
|
|
25549
|
-
paused(): Promise<boolean>;
|
|
25550
|
-
/**
|
|
25551
|
-
* The policy for batches opened from now on. Dispatch of an existing batch
|
|
25552
|
-
* is gated on {@link batchMinBatchAge} instead.
|
|
25553
|
-
*/
|
|
25554
|
-
minBatchAge(): Promise<bigint>;
|
|
25555
|
-
/** The minimum age in seconds pinned to `batchId` when it opened — the value dispatch enforces. */
|
|
25556
|
-
batchMinBatchAge(batchId: bigint): Promise<bigint>;
|
|
25557
|
-
/**
|
|
25558
|
-
* How long a dispatched batch may wait for its decryption callback before it
|
|
25559
|
-
* is canceled — seconds, not a timestamp, despite the name. Applies to
|
|
25560
|
-
* batches opened from now on; for an existing batch use
|
|
25561
|
-
* {@link batchCallbackDeadline}.
|
|
25562
|
-
*/
|
|
25563
|
-
callbackDeadline(): Promise<bigint>;
|
|
25564
|
-
/**
|
|
25565
|
-
* The callback deadline pinned to `batchId` when it opened. Add it to
|
|
25566
|
-
* {@link batchDispatchedAt} for the timestamp that batch must finalize by.
|
|
25567
|
-
*/
|
|
25568
|
-
batchCallbackDeadline(batchId: bigint): Promise<bigint>;
|
|
25569
|
-
/** The Unix timestamp (seconds) at which a batch was opened. */
|
|
25570
|
-
batchCreatedAt(batchId: bigint): Promise<bigint>;
|
|
25571
|
-
/** The Unix timestamp (seconds) at which a batch was dispatched, or `0` if it hasn't been yet. */
|
|
25572
|
-
batchDispatchedAt(batchId: bigint): Promise<bigint>;
|
|
25573
|
-
/**
|
|
25574
|
-
* A finalized batch's exchange rate, scaled by
|
|
25575
|
-
* {@link exchangeRateDecimals}; `0` until the batch finalizes. A claim pays
|
|
25576
|
-
* out `deposit * exchangeRate / 10 ** exchangeRateDecimals`, rounded down.
|
|
25577
|
-
*/
|
|
25578
|
-
exchangeRate(batchId: bigint): Promise<bigint>;
|
|
25579
|
-
/** The number of decimals {@link exchangeRate} is scaled by. */
|
|
25580
|
-
exchangeRateDecimals(): Promise<number>;
|
|
25581
|
-
/**
|
|
25582
|
-
* Seconds until `batchId` becomes eligible for dispatch, `0` once it already
|
|
25583
|
-
* is — the earliest possible moment, not a promise anyone will dispatch
|
|
25584
|
-
* then. `null` once the batch has left {@link BatchState.Pending} and can
|
|
25585
|
-
* never be dispatched again.
|
|
25586
|
-
*
|
|
25587
|
-
* Measured against the chain's block timestamp and the batch's own pinned
|
|
25588
|
-
* minimum age, so neither local clock drift nor a mid-flight policy change
|
|
25589
|
-
* desyncs the countdown.
|
|
25590
|
-
*/
|
|
25591
|
-
timeUntilDispatchable(batchId: bigint): Promise<bigint | null>;
|
|
25592
|
-
/**
|
|
25593
|
-
* Seconds until a dispatched batch reaches its callback deadline, `0` once
|
|
25594
|
-
* it has. From then on {@link finalize} cancels the batch instead of
|
|
25595
|
-
* settling it, except on an asynchronous redeem batcher that has already
|
|
25596
|
-
* placed the redemption request. `null` outside {@link BatchState.Dispatched}, where there is
|
|
25597
|
-
* nothing to finalize.
|
|
25598
|
-
*
|
|
25599
|
-
* Measured against the chain's block timestamp and the batch's own pinned
|
|
25600
|
-
* deadline, like {@link timeUntilDispatchable}.
|
|
25601
|
-
*/
|
|
25602
|
-
timeUntilCallbackDeadline(batchId: bigint): Promise<bigint | null>;
|
|
25603
|
-
/**
|
|
25604
|
-
* A batch's state with the timestamps that state needs: when it becomes
|
|
25605
|
-
* dispatchable while `Pending`, when its callback deadline passes while
|
|
25606
|
-
* `Dispatched`. Switch on `state` to decide what to show and offer; see
|
|
25607
|
-
* {@link BatchState}.
|
|
25608
|
-
*/
|
|
25609
|
-
batchStatus(batchId: bigint): Promise<BatchStatus>;
|
|
25610
|
-
/** The encrypted aggregate amount joined into a batch, without decrypting it. */
|
|
25611
|
-
confidentialTotalDeposits(batchId: bigint): Promise<EncryptedValue>;
|
|
25612
|
-
/** The encrypted amount `account` joined into a batch, without decrypting it. */
|
|
25613
|
-
confidentialDepositOf(batchId: bigint, account: Address): Promise<EncryptedValue>;
|
|
25614
|
-
/**
|
|
25615
|
-
* The unwrap request on `fromToken` that a dispatched batch settles against
|
|
25616
|
-
* once its amount is publicly decrypted. Zero until the batch is dispatched.
|
|
25617
|
-
*/
|
|
25618
|
-
unwrapRequestId(batchId: bigint): Promise<EncryptedValue>;
|
|
25619
|
-
/**
|
|
25620
|
-
* Decrypt and return the plaintext amount `account` joined into a batch.
|
|
25621
|
-
* Acquires FHE credentials via a wallet signature if none are cached.
|
|
25622
|
-
*/
|
|
25623
|
-
depositOf(batchId: bigint, account: Address): Promise<bigint>;
|
|
25624
|
-
/**
|
|
25625
|
-
* Join the currently open batch with a plaintext amount, encrypted via FHE
|
|
25626
|
-
* automatically. Once someone calls {@link dispatchBatch} and the batch
|
|
25627
|
-
* is finalized, call {@link claim} to receive the output.
|
|
25628
|
-
*
|
|
25629
|
-
* @param amount - The plaintext amount to contribute; encrypted before submission.
|
|
25630
|
-
* @param beneficiary - Recipient of the batch's eventual output. Defaults to the connected wallet account.
|
|
25631
|
-
*
|
|
25632
|
-
* @remarks
|
|
25633
|
-
* A join that credits the caller sends the amount to the batcher with
|
|
25634
|
-
* `confidentialTransferAndCall`, so it needs no operator grant. A join for
|
|
25635
|
-
* another `beneficiary` calls the batcher's `join`, which pulls the amount
|
|
25636
|
-
* and so needs an active ERC-7984 operator grant from the caller.
|
|
25637
|
-
*
|
|
25638
|
-
* A join with too little balance still succeeds on chain and credits
|
|
25639
|
-
* nothing, so the amount is checked against the caller's confidential
|
|
25640
|
-
* balance first; `confidentialJoinedAmount` is the authoritative record of
|
|
25641
|
-
* what actually landed.
|
|
25642
|
-
*
|
|
25643
|
-
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
25644
|
-
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
25645
|
-
*/
|
|
25646
|
-
join(amount: bigint, beneficiary?: Address, options?: JoinOptions): Promise<JoinResult>;
|
|
25647
|
-
/**
|
|
25648
|
-
* Withdraw the caller's own deposit from a batch, returning it to their
|
|
25649
|
-
* confidential balance on `fromToken`.
|
|
25650
|
-
*
|
|
25651
|
-
* Legal in two states: {@link BatchState.Pending} (undo a join before
|
|
25652
|
-
* dispatch) and {@link BatchState.Canceled} (take the deposit back after a
|
|
25653
|
-
* batch failed to finalize).
|
|
25654
|
-
*
|
|
25655
|
-
* Refunds the caller only. To refund someone else's deposit in a canceled
|
|
25656
|
-
* batch, use {@link recover}.
|
|
25657
|
-
*/
|
|
25658
|
-
quit(batchId: bigint): Promise<TransactionResult>;
|
|
25659
|
-
/**
|
|
25660
|
-
* Refund `account`'s deposit in a canceled batch on their behalf.
|
|
25661
|
-
* Permissionless — anyone can call this, and the refund always goes to
|
|
25662
|
-
* `account`, never to the caller.
|
|
25663
|
-
*
|
|
25664
|
-
* Only legal once the batch reaches {@link BatchState.Canceled}; before that,
|
|
25665
|
-
* a participant undoes their own join with {@link quit}.
|
|
25666
|
-
*
|
|
25667
|
-
* @param account - The depositor to refund. Defaults to the connected wallet account.
|
|
25668
|
-
*/
|
|
25669
|
-
recover(batchId: bigint, account?: Address): Promise<TransactionResult>;
|
|
25670
|
-
/**
|
|
25671
|
-
* Claim a finalized batch's output for `account`. Permissionless — anyone
|
|
25672
|
-
* can call this on another account's behalf, and the output always goes to
|
|
25673
|
-
* `account`, never to the caller. The amount is not returned; read it as a
|
|
25674
|
-
* balance on the batcher's {@link toToken}.
|
|
25675
|
-
*
|
|
25676
|
-
* Only legal once the batch reaches {@link BatchState.Finalized}; on a
|
|
25677
|
-
* canceled batch use {@link quit} or {@link recover} instead.
|
|
25678
|
-
*
|
|
25679
|
-
* @param account - The account to claim for. Defaults to the connected wallet account.
|
|
25680
|
-
*/
|
|
25681
|
-
claim(batchId: bigint, account?: Address): Promise<TransactionResult>;
|
|
25682
|
-
/**
|
|
25683
|
-
* Close the current batch once it has reached its pinned minimum age and
|
|
25684
|
-
* kick off decryption of its aggregate amount. Permissionless — any
|
|
25685
|
-
* account with a configured signer can call this, not just participants.
|
|
25686
|
-
* Reverts while the batcher is {@link paused}.
|
|
25687
|
-
*/
|
|
25688
|
-
dispatchBatch(): Promise<TransactionResult>;
|
|
25689
|
-
/**
|
|
25690
|
-
* Settle a dispatched batch yourself: publicly decrypt the aggregate amount
|
|
25691
|
-
* its unwrap request released and hand the cleartext and proof to the
|
|
25692
|
-
* batcher, which executes the route. Permissionless, like
|
|
25693
|
-
* {@link dispatchBatch}. A keeper normally does this, so reach for it
|
|
25694
|
-
* when a batch has sat in {@link BatchState.Dispatched} longer than
|
|
25695
|
-
* expected. Past the batch's callback deadline the same call cancels the
|
|
25696
|
-
* batch instead of settling it, except on an asynchronous redeem batcher
|
|
25697
|
-
* that has already placed the redemption request, which keeps settling.
|
|
25698
|
-
* {@link timeUntilCallbackDeadline} says whether the deadline has passed.
|
|
25699
|
-
*
|
|
25700
|
-
* @throws if no signer is configured. {@link SignerNotConfiguredError}
|
|
25701
|
-
* @throws if the batch is not {@link BatchState.Dispatched}, for example because a keeper already finalized it. {@link VaultBatchNotDispatchedError}
|
|
25702
|
-
* @throws if the public decryption returns no cleartext for the amount. {@link DecryptionFailedError}
|
|
25703
|
-
*/
|
|
25704
|
-
finalize(batchId: bigint): Promise<TransactionResult>;
|
|
25705
|
-
/**
|
|
25706
|
-
* Build the settlement {@link finalize} sends without sending it: the
|
|
25707
|
-
* `dispatchBatchCallback` call with the publicly decrypted amount and its
|
|
25708
|
-
* proof, for a host that signs and sends through its own pipeline. Needs no
|
|
25709
|
-
* signer.
|
|
25710
|
-
*
|
|
25711
|
-
* @throws if the batch is not {@link BatchState.Dispatched}, for example because a keeper already finalized it. {@link VaultBatchNotDispatchedError}
|
|
25712
|
-
* @throws if the batcher is pinned to a chain the provider is not on, since decryption runs on the provider's chain. {@link ConfigurationError}
|
|
25713
|
-
* @throws if the public decryption returns no cleartext for the amount. {@link DecryptionFailedError}
|
|
25714
|
-
*/
|
|
25715
|
-
prepareFinalize(batchId: bigint): Promise<PreparedFinalize>;
|
|
25570
|
+
/** Result of a batch decrypt: one entry per requested handle, in input order. */
|
|
25571
|
+
interface BatchDecryptResult {
|
|
25572
|
+
/** Per-handle outcomes. */
|
|
25573
|
+
items: BatchDecryptItem[];
|
|
25716
25574
|
}
|
|
25717
25575
|
/**
|
|
25718
|
-
*
|
|
25576
|
+
* Public namespace for FHE decryption — the canonical way to decrypt.
|
|
25719
25577
|
*
|
|
25720
|
-
*
|
|
25721
|
-
*
|
|
25722
|
-
*
|
|
25578
|
+
* Exposed as `sdk.decryption`. Prefer these methods over the low-level
|
|
25579
|
+
* `sdk.relayer.decryptValues` / `decryptPublicValues`: they
|
|
25580
|
+
* assemble the credential bundle (transport key pair, EIP-712 permit) for you,
|
|
25581
|
+
* cache results, and wrap relayer errors. Reach for `sdk.relayer.*` only when
|
|
25582
|
+
* you must control credential assembly by hand.
|
|
25723
25583
|
*
|
|
25724
|
-
*
|
|
25725
|
-
*
|
|
25726
|
-
*
|
|
25727
|
-
|
|
25728
|
-
|
|
25729
|
-
|
|
25730
|
-
*
|
|
25731
|
-
*
|
|
25584
|
+
* Owns the SDK-level guards (signer requirement on
|
|
25585
|
+
* `decryptValues` and `delegatedDecryptValues`, empty-array
|
|
25586
|
+
* short-circuit on `decryptPublicValues`, relayer error wrapping) and delegates the
|
|
25587
|
+
* actual work to the internal {@link DecryptionService} or the relayer directly for
|
|
25588
|
+
* `decryptPublicValues`.
|
|
25589
|
+
*
|
|
25590
|
+
* **Mixed signer requirement:** `decryptValues` and
|
|
25591
|
+
* `delegatedDecryptValues` need a configured signer; `decryptPublicValues`
|
|
25592
|
+
* does not. Each method documents its requirement in its JSDoc.
|
|
25732
25593
|
*
|
|
25733
|
-
*
|
|
25734
|
-
*
|
|
25594
|
+
* **Request chunking:** decrypt requests are split internally to stay under
|
|
25595
|
+
* the relayer's 2048-cleartext-bit per-request budget — callers never need to
|
|
25596
|
+
* size batches themselves.
|
|
25735
25597
|
*/
|
|
25736
|
-
declare class
|
|
25598
|
+
declare class Decryption {
|
|
25737
25599
|
#private;
|
|
25738
|
-
/** The SDK instance this vault reads and writes through. */
|
|
25739
|
-
readonly sdk: ZamaSDK;
|
|
25740
|
-
/** Joined by deposits of the underlying asset. */
|
|
25741
|
-
readonly depositBatcher: VaultBatcher;
|
|
25742
|
-
/** Joined by share redemptions. */
|
|
25743
|
-
readonly redeemBatcher: VaultBatcher;
|
|
25744
|
-
/** The chain both batchers are on; `undefined` for the provider's current chain. */
|
|
25745
|
-
readonly chainId: number | undefined;
|
|
25746
|
-
constructor(sdk: ZamaSDK, addresses: VaultAddresses, options?: VaultBatcherOptions);
|
|
25747
|
-
/**
|
|
25748
|
-
* The underlying ERC-4626 vault contract, read from both batchers rather
|
|
25749
|
-
* than trusted from configuration. Resolved once and cached.
|
|
25750
|
-
*
|
|
25751
|
-
* @throws if the batchers report different vaults, or either disagrees with
|
|
25752
|
-
* an `addresses.vault` passed to the constructor — a mismatched pair would
|
|
25753
|
-
* settle deposits and redemptions against different vaults.
|
|
25754
|
-
* {@link ConfigurationError}
|
|
25755
|
-
*/
|
|
25756
|
-
vaultAddress(): Promise<Address>;
|
|
25757
25600
|
/**
|
|
25758
|
-
*
|
|
25759
|
-
*
|
|
25760
|
-
*/
|
|
25761
|
-
cAsset(): Promise<WrappedToken>;
|
|
25762
|
-
/**
|
|
25763
|
-
* The confidential share token this vault issues. Resolved once and cached.
|
|
25764
|
-
*
|
|
25765
|
-
* Read from the redeem batcher, which is the contract that actually pulls
|
|
25766
|
-
* these shares and so decides which token a redemption must grant on.
|
|
25767
|
-
*/
|
|
25768
|
-
cShare(): Promise<WrappedToken>;
|
|
25769
|
-
/**
|
|
25770
|
-
* Deposit a plaintext amount of the underlying confidential asset,
|
|
25771
|
-
* joining the current deposit batch. The amount is sent to the batcher, so
|
|
25772
|
-
* no operator grant is needed, except for another `beneficiary`: then the
|
|
25773
|
-
* batcher pulls it and is granted an ERC-7984 operator approval on the
|
|
25774
|
-
* deposit token first, unless one is already active.
|
|
25601
|
+
* Decrypt one or more FHE encrypted values. Results are cached — repeated calls
|
|
25602
|
+
* for the same encrypted value skip the relayer round-trip.
|
|
25775
25603
|
*
|
|
25776
|
-
*
|
|
25777
|
-
*
|
|
25778
|
-
*
|
|
25779
|
-
*/
|
|
25780
|
-
deposit(amount: bigint, options?: VaultJoinOptions): Promise<JoinResult>;
|
|
25781
|
-
/**
|
|
25782
|
-
* Join the current redeem batch, which the vault later settles into the
|
|
25783
|
-
* underlying asset at the batch's exchange rate. The shares are sent to the
|
|
25784
|
-
* batcher, so no operator grant is needed, except for another
|
|
25785
|
-
* `beneficiary`: then the batcher pulls them and is granted an ERC-7984
|
|
25786
|
-
* operator approval on the share token first, unless one is already active.
|
|
25604
|
+
* Zero encrypted values are mapped to `0n` without hitting the relayer.
|
|
25605
|
+
* Events (`DecryptStart/End/Error`) are emitted uniformly.
|
|
25606
|
+
* Relayer errors are wrapped into typed SDK errors.
|
|
25787
25607
|
*
|
|
25788
|
-
* @param
|
|
25789
|
-
*
|
|
25790
|
-
* @
|
|
25791
|
-
*
|
|
25792
|
-
|
|
25793
|
-
|
|
25794
|
-
|
|
25795
|
-
|
|
25796
|
-
|
|
25797
|
-
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
|
|
25801
|
-
* @example
|
|
25802
|
-
* ```ts
|
|
25803
|
-
* import { createVault } from "@zama-fhe/sdk/vaults";
|
|
25804
|
-
*
|
|
25805
|
-
* const vault = createVault(sdk, {
|
|
25806
|
-
* depositBatcher: "0xDepositBatcher",
|
|
25807
|
-
* redeemBatcher: "0xRedeemBatcher",
|
|
25808
|
-
* });
|
|
25809
|
-
* const { batchId } = await vault.deposit(1_000_000n);
|
|
25810
|
-
* // …once the batch is dispatched and reaches BatchState.Finalized:
|
|
25811
|
-
* await vault.depositBatcher.claim(batchId);
|
|
25812
|
-
* ```
|
|
25813
|
-
*/
|
|
25814
|
-
declare function createVault(sdk: ZamaSDK, addresses: VaultAddresses, options?: VaultBatcherOptions): Vault;
|
|
25815
|
-
/** Whether a submission joins deposit or redeem batchers. */
|
|
25816
|
-
type Direction = "deposit" | "redeem";
|
|
25817
|
-
/** One vault of a group. */
|
|
25818
|
-
interface VaultMemberConfig extends VaultAddresses {
|
|
25819
|
-
/** What callers pass to `deposit` and `redeem` to pick this vault. */
|
|
25820
|
-
readonly id: string;
|
|
25821
|
-
/**
|
|
25822
|
-
* The vault's confidential share token. Optional: read from the redeem
|
|
25823
|
-
* batcher when absent, and checked against it when given.
|
|
25824
|
-
*/
|
|
25825
|
-
readonly cShare?: Address;
|
|
25826
|
-
}
|
|
25827
|
-
/** What {@link createVaultGroup} takes. */
|
|
25828
|
-
interface VaultGroupConfig {
|
|
25829
|
-
/** Names the group in error messages. */
|
|
25830
|
-
readonly id: string;
|
|
25831
|
-
/** The confidential wrapper of the asset every member takes deposits in. */
|
|
25832
|
-
readonly cAsset: Address;
|
|
25833
|
-
/**
|
|
25834
|
-
* The router that fans a submission out across the members. Optional for a
|
|
25835
|
-
* group of one, which joins its only batcher directly, and for a host that
|
|
25836
|
-
* only ever prepares `"legs"` deliveries.
|
|
25837
|
-
*/
|
|
25838
|
-
readonly router?: Address;
|
|
25839
|
-
/**
|
|
25840
|
-
* Submit through a `router` other than the configured chain's
|
|
25841
|
-
* `vaultRouterAddress`. Off by default; set it only for a router you
|
|
25842
|
-
* deployed yourself.
|
|
25843
|
-
*/
|
|
25844
|
-
readonly allowCustomRouter?: boolean;
|
|
25845
|
-
/** The members, in the order their legs are submitted. */
|
|
25846
|
-
readonly vaults: readonly VaultMemberConfig[];
|
|
25847
|
-
}
|
|
25848
|
-
/** A member of a {@link VaultGroup}. */
|
|
25849
|
-
interface VaultGroupMember {
|
|
25850
|
-
/** What callers pass to `deposit` and `redeem` to pick this vault. */
|
|
25851
|
-
readonly id: string;
|
|
25852
|
-
/** The vault, whose batchers are where claims and quits happen. */
|
|
25853
|
-
readonly vault: Vault;
|
|
25854
|
-
}
|
|
25855
|
-
/** Options for {@link VaultGroup.redeem}; a deposit takes plain {@link JoinOptions}. */
|
|
25856
|
-
interface VaultGroupRedeemOptions extends JoinOptions {
|
|
25857
|
-
/**
|
|
25858
|
-
* Unix timestamp until which the router's operator grant on each share
|
|
25859
|
-
* token is valid, for a grant this redemption has to make. Defaults to the
|
|
25860
|
-
* chain's current time + 1 hour.
|
|
25861
|
-
*/
|
|
25862
|
-
operatorUntil?: number;
|
|
25863
|
-
}
|
|
25864
|
-
/**
|
|
25865
|
-
* How a group submission reaches the batchers.
|
|
25866
|
-
*
|
|
25867
|
-
* - `"router"`: one transaction through the router, which joins every leg.
|
|
25868
|
-
* - `"legs"`: one transfer per member, each straight to its batcher. Only
|
|
25869
|
-
* private when the wallet lands them atomically, as an EIP-5792 bundle
|
|
25870
|
-
* does; sent one by one, a user who stops partway reveals the vaults the
|
|
25871
|
-
* remaining legs would have named.
|
|
25872
|
-
*/
|
|
25873
|
-
type JoinDelivery = "router" | "legs";
|
|
25874
|
-
/** One member's leg of a submission. */
|
|
25875
|
-
interface VaultGroupLeg {
|
|
25876
|
-
/** The member this leg belongs to. */
|
|
25877
|
-
readonly vaultId: string;
|
|
25878
|
-
/** The batcher this leg joins. */
|
|
25879
|
-
readonly batcher: Address;
|
|
25880
|
-
/** The token this leg spends: `cAsset` for a deposit, the member's share token for a redemption. */
|
|
25881
|
-
readonly token: Address;
|
|
25882
|
-
/** The plaintext amount: the chosen member's `amount`, zero for every other member. */
|
|
25883
|
-
readonly amount: bigint;
|
|
25884
|
-
}
|
|
25885
|
-
/** One write of a prepared submission. */
|
|
25886
|
-
interface PreparedVaultGroupWrite {
|
|
25887
|
-
/** The leg this write funds. A router write carries the chosen member's. */
|
|
25888
|
-
readonly leg: VaultGroupLeg;
|
|
25889
|
-
/** The call, ready for the host's own signer, bundler or queue. */
|
|
25890
|
-
readonly call: WriteContractConfig;
|
|
25891
|
-
}
|
|
25892
|
-
/** An ERC-7984 operator grant a submission relies on. */
|
|
25893
|
-
interface VaultGroupOperator {
|
|
25894
|
-
/** The member whose share token the grant is on. */
|
|
25895
|
-
readonly vaultId: string;
|
|
25896
|
-
/** The share token the grant is on. */
|
|
25897
|
-
readonly token: Address;
|
|
25898
|
-
/** The router, which pulls the token. */
|
|
25899
|
-
readonly spender: Address;
|
|
25900
|
-
}
|
|
25901
|
-
/** A submission built but not sent: what {@link VaultGroup.prepareDeposit} and {@link VaultGroup.prepareRedeem} return. */
|
|
25902
|
-
interface PreparedVaultGroupJoin {
|
|
25903
|
-
/** Whether the legs join deposit or redeem batchers. */
|
|
25904
|
-
readonly direction: Direction;
|
|
25905
|
-
/** The member the caller chose; every other leg is a decoy. */
|
|
25906
|
-
readonly vaultId: string;
|
|
25907
|
-
/** The account the legs come from, which the batchers credit. */
|
|
25908
|
-
readonly account: Address;
|
|
25909
|
-
/** The delivery the writes take: the one asked for, or `"legs"` for a group of one. */
|
|
25910
|
-
readonly delivery: JoinDelivery;
|
|
25911
|
-
/** One leg per member, in group order. */
|
|
25912
|
-
readonly legs: readonly VaultGroupLeg[];
|
|
25913
|
-
/** The writes to send, in order: one through the router, or one per leg. */
|
|
25914
|
-
readonly writes: readonly PreparedVaultGroupWrite[];
|
|
25915
|
-
/**
|
|
25916
|
-
* The operator grants the writes rely on: the router on each share token
|
|
25917
|
-
* of a `"router"` redemption, otherwise none. The host grants the ones the
|
|
25918
|
-
* account lacks before sending the writes.
|
|
25608
|
+
* @param encryptedInput - Encrypted values to decrypt, each paired with its contract address.
|
|
25609
|
+
* @param options - Per-call `signal` and `timeout` forwarded to the relayer round-trip.
|
|
25610
|
+
* @returns A record mapping each encrypted value to its decrypted clear-text value.
|
|
25611
|
+
* @throws if no signer is configured. {@link SignerNotConfiguredError}
|
|
25612
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
25613
|
+
*
|
|
25614
|
+
* @example
|
|
25615
|
+
* ```ts
|
|
25616
|
+
* const values = await sdk.decryption.decryptValues([
|
|
25617
|
+
* { encryptedValue: balance, contractAddress: cUSDT },
|
|
25618
|
+
* ]);
|
|
25619
|
+
* console.log(values[balance]); // 1000n
|
|
25620
|
+
* ```
|
|
25919
25621
|
*/
|
|
25920
|
-
|
|
25921
|
-
/** {@link decodeVaultGroupJoins} bound to this submission's legs and account. */
|
|
25922
|
-
decodeJoins(logs: readonly RawLog[]): DecodedVaultGroupJoins;
|
|
25923
|
-
}
|
|
25924
|
-
/** What {@link decodeVaultGroupJoins} found in a submission's logs. */
|
|
25925
|
-
interface DecodedVaultGroupJoins {
|
|
25926
|
-
/** One entry per leg whose `Joined` log was found, in leg order. */
|
|
25927
|
-
readonly joins: readonly VaultGroupJoin[];
|
|
25928
|
-
/** The ids of the members whose leg has no `Joined` log in the logs given. */
|
|
25929
|
-
readonly unconfirmed: readonly string[];
|
|
25930
|
-
}
|
|
25931
|
-
/** Options for {@link VaultGroup.prepareDeposit} and {@link VaultGroup.prepareRedeem}. */
|
|
25932
|
-
interface PrepareVaultGroupJoinOptions extends Omit<JoinOptions, "onJoinSubmitted"> {
|
|
25622
|
+
decryptValues(encryptedInput: EncryptedInput[], options?: RelayerRequestOptions): Promise<Record<EncryptedValue, ClearValue>>;
|
|
25933
25623
|
/**
|
|
25934
|
-
*
|
|
25935
|
-
*
|
|
25936
|
-
*
|
|
25624
|
+
* Decrypt one or more FHE encrypted values using delegated credentials.
|
|
25625
|
+
*
|
|
25626
|
+
* Mirrors {@link decryptValues} with delegated credentials — same caching and
|
|
25627
|
+
* zero-value short-circuit. Before reading from cache or calling the relayer,
|
|
25628
|
+
* every non-zero encrypted value's contract must have an active delegation from the
|
|
25629
|
+
* delegator to the connected signer; missing or expired delegations fail fast.
|
|
25630
|
+
*
|
|
25631
|
+
* @param encryptedInputs - FHE encrypted values paired with their contract addresses.
|
|
25632
|
+
* @param delegatorAddress - The address that granted delegation rights.
|
|
25633
|
+
* @param accountAddress - Address used as the cache key's "requester"
|
|
25634
|
+
* dimension. Defaults to `delegatorAddress`. Pass the actual account address
|
|
25635
|
+
* when decrypting on behalf of someone whose balance is stored under a
|
|
25636
|
+
* different address (e.g. `decryptBalanceAs` with an explicit `accountAddress`).
|
|
25637
|
+
* @param options - Delegated-decrypt options. By default the call rides out the
|
|
25638
|
+
* gateway propagation window ({@link DelegatedDecryptOptions.waitForPropagation});
|
|
25639
|
+
* pass `{ waitForPropagation: false }` to fail fast instead.
|
|
25640
|
+
* @returns Map of encrypted value → clear-text value.
|
|
25641
|
+
*
|
|
25642
|
+
* @example
|
|
25643
|
+
* ```ts
|
|
25644
|
+
* const values = await sdk.decryption.delegatedDecryptValues([
|
|
25645
|
+
* { encryptedValue: balance, contractAddress: tokenAddr },
|
|
25646
|
+
* ], delegatorAddr);
|
|
25647
|
+
* console.log(values[balance]); // 1000n
|
|
25648
|
+
* ```
|
|
25937
25649
|
*/
|
|
25938
|
-
|
|
25939
|
-
/** Defaults to `"router"`. A group of one always goes `"legs"`. */
|
|
25940
|
-
delivery?: JoinDelivery;
|
|
25650
|
+
delegatedDecryptValues(encryptedInputs: EncryptedInput[], delegatorAddress: Address, accountAddress?: Address, options?: DelegatedDecryptOptions): Promise<Record<EncryptedValue, ClearValue>>;
|
|
25941
25651
|
/**
|
|
25942
|
-
*
|
|
25943
|
-
*
|
|
25944
|
-
*
|
|
25945
|
-
*
|
|
25946
|
-
*
|
|
25652
|
+
* Publicly decrypt one or more FHE encrypted values.
|
|
25653
|
+
*
|
|
25654
|
+
* Signer-independent: works without a configured signer.
|
|
25655
|
+
* Returns the decryption proof alongside the clear-text values so callers
|
|
25656
|
+
* can submit on-chain finalization transactions (e.g. `finalizeUnwrap`).
|
|
25657
|
+
*
|
|
25658
|
+
* @param encryptedValues - FHE encrypted values to decrypt publicly.
|
|
25659
|
+
* @param options - Per-call `signal` and `timeout` forwarded to the relayer round-trip.
|
|
25660
|
+
* @returns Clear-text values, ABI-encoded values, and the decryption proof.
|
|
25661
|
+
*
|
|
25662
|
+
* @example
|
|
25663
|
+
* ```ts
|
|
25664
|
+
* const { clearValues, decryptionProof, abiEncodedClearValues } =
|
|
25665
|
+
* await sdk.decryption.decryptPublicValues([encryptedValue]);
|
|
25666
|
+
* ```
|
|
25947
25667
|
*/
|
|
25948
|
-
|
|
25949
|
-
}
|
|
25950
|
-
/** What one leg's batcher reported. */
|
|
25951
|
-
interface VaultGroupJoin {
|
|
25952
|
-
/** The member this leg joined, by id. */
|
|
25953
|
-
vaultId: string;
|
|
25954
|
-
/** The batcher this leg joined, where its claim and quit happen. */
|
|
25955
|
-
batcher: Address;
|
|
25956
|
-
/** The token this leg spent: `cAsset` for a deposit, the member's share token for a redemption. */
|
|
25957
|
-
token: Address;
|
|
25958
|
-
/** The batch the leg landed in; what that batcher's `claim` and `quit` take. */
|
|
25959
|
-
batchId: bigint;
|
|
25668
|
+
decryptPublicValues(encryptedValues: EncryptedValue[], options?: RelayerRequestOptions): Promise<DecryptPublicValuesResult>;
|
|
25960
25669
|
/**
|
|
25961
|
-
*
|
|
25962
|
-
*
|
|
25963
|
-
*
|
|
25670
|
+
* Batch-decrypt delegated encrypted values with per-entry error isolation.
|
|
25671
|
+
*
|
|
25672
|
+
* Attempts a single batch request first. If the batch fails with a non-fatal
|
|
25673
|
+
* error (e.g. one entry is invalid), falls back to per-entry decryption so
|
|
25674
|
+
* healthy entries still resolve. Each item in the result carries either a
|
|
25675
|
+
* decrypted value or an error — callers decide how to surface partial failures.
|
|
25676
|
+
*
|
|
25677
|
+
* @param encryptedInputs - FHE encrypted values paired with their contract addresses.
|
|
25678
|
+
* @param delegatorAddress - The address that granted delegation rights.
|
|
25679
|
+
* @param accountAddress - The account on whose behalf decryption is performed. Defaults to `delegatorAddress`.
|
|
25680
|
+
* @param maxConcurrency - Maximum parallel decrypt calls during per-entry fallback.
|
|
25681
|
+
* @param waitForPropagation - Ride out the gateway propagation window on the
|
|
25682
|
+
* initial batch attempt (default `true`). See {@link DelegatedDecryptOptions.waitForPropagation}.
|
|
25683
|
+
* @returns Per-entry results, each with a value or an error.
|
|
25684
|
+
* @throws if no signer is configured. {@link SignerNotConfiguredError}
|
|
25685
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
25686
|
+
* @throws A failure that affects the whole session (rejected signature, RPC
|
|
25687
|
+
* rate limit, revoked KMS context) rejects the call instead of landing in a
|
|
25688
|
+
* per-entry error.
|
|
25689
|
+
*
|
|
25690
|
+
* @example
|
|
25691
|
+
* ```ts
|
|
25692
|
+
* const result = await sdk.decryption.delegatedBatchDecryptValues({
|
|
25693
|
+
* encryptedInputs: [
|
|
25694
|
+
* { encryptedValue: encryptedValue1, contractAddress: tokenA },
|
|
25695
|
+
* { encryptedValue: encryptedValue2, contractAddress: tokenB },
|
|
25696
|
+
* ],
|
|
25697
|
+
* delegatorAddress: "0xDelegator",
|
|
25698
|
+
* maxConcurrency: 5,
|
|
25699
|
+
* });
|
|
25700
|
+
* for (const item of result.items) {
|
|
25701
|
+
* if (item.error) console.error(item.encryptedValue, item.error);
|
|
25702
|
+
* else console.log(item.encryptedValue, item.value);
|
|
25703
|
+
* }
|
|
25704
|
+
* ```
|
|
25964
25705
|
*/
|
|
25965
|
-
|
|
25966
|
-
|
|
25967
|
-
|
|
25968
|
-
|
|
25969
|
-
|
|
25970
|
-
|
|
25971
|
-
/** One entry per leg, in group order, decoys included. */
|
|
25972
|
-
joins: readonly VaultGroupJoin[];
|
|
25973
|
-
}
|
|
25974
|
-
/** What an {@link UnlistedConfidentialTokenError} carries. */
|
|
25975
|
-
interface UnlistedConfidentialTokenDetails {
|
|
25976
|
-
/** The confidential token the registry does not list. */
|
|
25977
|
-
readonly token: Address;
|
|
25978
|
-
/** The token wrapper registry the router checks. */
|
|
25979
|
-
readonly registry: Address;
|
|
25980
|
-
}
|
|
25981
|
-
/**
|
|
25982
|
-
* A confidential token is not listed in the registry the vault router checks,
|
|
25983
|
-
* so the router would reject a transfer of it.
|
|
25984
|
-
*/
|
|
25985
|
-
declare class UnlistedConfidentialTokenError extends ZamaError {
|
|
25986
|
-
/** The confidential token the registry does not list. */
|
|
25987
|
-
readonly token: Address;
|
|
25988
|
-
/** The token wrapper registry the router checks. */
|
|
25989
|
-
readonly registry: Address;
|
|
25990
|
-
constructor(message: string, details: UnlistedConfidentialTokenDetails, options?: ErrorOptions);
|
|
25991
|
-
}
|
|
25992
|
-
/** What a {@link VaultBatcherPausedError} carries. */
|
|
25993
|
-
interface VaultBatcherPausedDetails {
|
|
25994
|
-
/** The batcher that reported `paused()`. */
|
|
25995
|
-
readonly batcher: Address;
|
|
25996
|
-
/** The id of the group member whose leg would have joined it. */
|
|
25997
|
-
readonly vaultId: string;
|
|
25998
|
-
}
|
|
25999
|
-
/**
|
|
26000
|
-
* A batcher one leg of a group submission would join is paused, so the whole
|
|
26001
|
-
* submission would revert. Pausing gates `join` and `dispatchBatch`; quitting
|
|
26002
|
-
* and claiming on it still work.
|
|
26003
|
-
*/
|
|
26004
|
-
declare class VaultBatcherPausedError extends ZamaError {
|
|
26005
|
-
/** The batcher that reported `paused()`. */
|
|
26006
|
-
readonly batcher: Address;
|
|
26007
|
-
/** The id of the group member whose leg would have joined it. */
|
|
26008
|
-
readonly vaultId: string;
|
|
26009
|
-
constructor(message: string, details: VaultBatcherPausedDetails, options?: ErrorOptions);
|
|
26010
|
-
}
|
|
26011
|
-
/** What a {@link VaultBatchNotDispatchedError} carries. */
|
|
26012
|
-
interface VaultBatchNotDispatchedDetails {
|
|
26013
|
-
/** The batcher the batch belongs to. */
|
|
26014
|
-
readonly batcher: Address;
|
|
26015
|
-
/** The batch that was to be finalized. */
|
|
26016
|
-
readonly batchId: bigint;
|
|
26017
|
-
/** The state the batch is in instead. */
|
|
26018
|
-
readonly state: BatchState;
|
|
26019
|
-
}
|
|
26020
|
-
/**
|
|
26021
|
-
* A batch cannot be finalized because it is not `Dispatched`: it is still
|
|
26022
|
-
* open, or it was already settled or canceled, by a keeper or anyone else.
|
|
26023
|
-
*/
|
|
26024
|
-
declare class VaultBatchNotDispatchedError extends ZamaError {
|
|
26025
|
-
/** The batcher the batch belongs to. */
|
|
26026
|
-
readonly batcher: Address;
|
|
26027
|
-
/** The batch that was to be finalized. */
|
|
26028
|
-
readonly batchId: bigint;
|
|
26029
|
-
/** The state the batch is in instead. */
|
|
26030
|
-
readonly state: BatchState;
|
|
26031
|
-
constructor(message: string, details: VaultBatchNotDispatchedDetails, options?: ErrorOptions);
|
|
26032
|
-
}
|
|
26033
|
-
/** What a {@link VaultGroupJoinUnconfirmedError} carries. */
|
|
26034
|
-
interface VaultGroupJoinUnconfirmedDetails {
|
|
26035
|
-
/** The mined transaction. */
|
|
26036
|
-
readonly txHash: Hex;
|
|
26037
|
-
/** Its receipt, for callers that want to inspect the logs themselves. */
|
|
26038
|
-
readonly receipt: TransactionReceipt;
|
|
26039
|
-
/** The legs whose `Joined` log the SDK matched, with the batch each landed in. */
|
|
26040
|
-
readonly joins: readonly VaultGroupJoin[];
|
|
26041
|
-
/** The ids of the members whose `Joined` log the SDK could not match; not a list of legs that did not join. */
|
|
26042
|
-
readonly unconfirmed: readonly string[];
|
|
26043
|
-
}
|
|
26044
|
-
/**
|
|
26045
|
-
* A group submission was mined, but the SDK could not match a `Joined` event
|
|
26046
|
-
* in its receipt to every leg. The router is all-or-nothing, so either the
|
|
26047
|
-
* transaction reverted and nothing moved, or it succeeded and *every* leg
|
|
26048
|
-
* joined, the `unconfirmed` ones included; look the transaction up before
|
|
26049
|
-
* resubmitting. `joins` gives the batch ids the SDK could read.
|
|
26050
|
-
*/
|
|
26051
|
-
declare class VaultGroupJoinUnconfirmedError extends ZamaError {
|
|
26052
|
-
/** The mined transaction. */
|
|
26053
|
-
readonly txHash: Hex;
|
|
26054
|
-
/** Its receipt, for callers that want to inspect the logs themselves. */
|
|
26055
|
-
readonly receipt: TransactionReceipt;
|
|
26056
|
-
/** The legs whose `Joined` log the SDK matched, with the batch each landed in. */
|
|
26057
|
-
readonly joins: readonly VaultGroupJoin[];
|
|
26058
|
-
/** The ids of the members whose `Joined` log the SDK could not match; not a list of legs that did not join. */
|
|
26059
|
-
readonly unconfirmed: readonly string[];
|
|
26060
|
-
constructor(message: string, details: VaultGroupJoinUnconfirmedDetails, options?: ErrorOptions);
|
|
26061
|
-
}
|
|
26062
|
-
/**
|
|
26063
|
-
* Maps each {@link ZamaErrorCode} to the error class thrown with that code, so
|
|
26064
|
-
* {@link matchZamaError} handlers receive the matched subtype instead of the base
|
|
26065
|
-
* `ZamaError`.
|
|
26066
|
-
*/
|
|
26067
|
-
interface ErrorForCode {
|
|
26068
|
-
/** Thrown for {@link ZamaErrorCode.SigningRejected}. */
|
|
26069
|
-
[ZamaErrorCode.SigningRejected]: SigningRejectedError;
|
|
26070
|
-
/** Thrown for {@link ZamaErrorCode.SigningFailed}. */
|
|
26071
|
-
[ZamaErrorCode.SigningFailed]: SigningFailedError;
|
|
26072
|
-
/** Thrown for {@link ZamaErrorCode.EncryptionFailed}. */
|
|
26073
|
-
[ZamaErrorCode.EncryptionFailed]: EncryptionFailedError;
|
|
26074
|
-
/** Thrown for {@link ZamaErrorCode.DecryptionFailed}. */
|
|
26075
|
-
[ZamaErrorCode.DecryptionFailed]: DecryptionFailedError;
|
|
26076
|
-
/** Thrown for {@link ZamaErrorCode.EncryptOffloadUnavailable}. */
|
|
26077
|
-
[ZamaErrorCode.EncryptOffloadUnavailable]: EncryptOffloadUnavailableError;
|
|
26078
|
-
/** Thrown for {@link ZamaErrorCode.TransactionReverted}. */
|
|
26079
|
-
[ZamaErrorCode.TransactionReverted]: TransactionRevertedError;
|
|
26080
|
-
/** Thrown for {@link ZamaErrorCode.HcuBlockLimitExceeded}. */
|
|
26081
|
-
[ZamaErrorCode.HcuBlockLimitExceeded]: HcuBlockLimitExceededError;
|
|
26082
|
-
/** Thrown for {@link ZamaErrorCode.HcuTransactionLimitExceeded}. */
|
|
26083
|
-
[ZamaErrorCode.HcuTransactionLimitExceeded]: HcuTransactionLimitExceededError;
|
|
26084
|
-
/** Thrown for {@link ZamaErrorCode.TransportKeyPairExpired}. */
|
|
26085
|
-
[ZamaErrorCode.TransportKeyPairExpired]: TransportKeyPairExpiredError;
|
|
26086
|
-
/** Thrown for {@link ZamaErrorCode.InvalidTransportKeyPair}. */
|
|
26087
|
-
[ZamaErrorCode.InvalidTransportKeyPair]: InvalidTransportKeyPairError;
|
|
26088
|
-
/** Thrown for {@link ZamaErrorCode.RevokedKmsContext}. */
|
|
26089
|
-
[ZamaErrorCode.RevokedKmsContext]: RevokedKmsContextError;
|
|
26090
|
-
/** Thrown for {@link ZamaErrorCode.NoCiphertext}. */
|
|
26091
|
-
[ZamaErrorCode.NoCiphertext]: NoCiphertextError;
|
|
26092
|
-
/** Thrown for {@link ZamaErrorCode.RelayerRequestFailed}. */
|
|
26093
|
-
[ZamaErrorCode.RelayerRequestFailed]: RelayerRequestFailedError;
|
|
26094
|
-
/** Thrown for {@link ZamaErrorCode.NotEntitled}. */
|
|
26095
|
-
[ZamaErrorCode.NotEntitled]: NotEntitledError;
|
|
26096
|
-
/** Thrown for {@link ZamaErrorCode.RpcRateLimited}. */
|
|
26097
|
-
[ZamaErrorCode.RpcRateLimited]: RpcRateLimitError;
|
|
26098
|
-
/** Thrown for {@link ZamaErrorCode.Configuration}. */
|
|
26099
|
-
[ZamaErrorCode.Configuration]: ConfigurationError;
|
|
26100
|
-
/** Thrown for {@link ZamaErrorCode.DelegationSelfNotAllowed}. */
|
|
26101
|
-
[ZamaErrorCode.DelegationSelfNotAllowed]: DelegationSelfNotAllowedError;
|
|
26102
|
-
/** Thrown for {@link ZamaErrorCode.DelegationCooldown}. */
|
|
26103
|
-
[ZamaErrorCode.DelegationCooldown]: DelegationCooldownError;
|
|
26104
|
-
/** Thrown for {@link ZamaErrorCode.DelegationNotFound}. */
|
|
26105
|
-
[ZamaErrorCode.DelegationNotFound]: DelegationNotFoundError;
|
|
26106
|
-
/** Thrown for {@link ZamaErrorCode.DelegationExpired}. */
|
|
26107
|
-
[ZamaErrorCode.DelegationExpired]: DelegationExpiredError;
|
|
26108
|
-
/** Thrown for {@link ZamaErrorCode.InsufficientConfidentialBalance}. */
|
|
26109
|
-
[ZamaErrorCode.InsufficientConfidentialBalance]: InsufficientConfidentialBalanceError;
|
|
26110
|
-
/** Thrown for {@link ZamaErrorCode.InsufficientERC20Balance}. */
|
|
26111
|
-
[ZamaErrorCode.InsufficientERC20Balance]: InsufficientERC20BalanceError;
|
|
26112
|
-
/** Thrown for {@link ZamaErrorCode.InsufficientAllowance}. */
|
|
26113
|
-
[ZamaErrorCode.InsufficientAllowance]: InsufficientAllowanceError;
|
|
26114
|
-
/** Thrown for {@link ZamaErrorCode.BalanceCheckUnavailable}. */
|
|
26115
|
-
[ZamaErrorCode.BalanceCheckUnavailable]: BalanceCheckUnavailableError;
|
|
26116
|
-
/** Thrown for {@link ZamaErrorCode.ERC20ReadFailed}. */
|
|
26117
|
-
[ZamaErrorCode.ERC20ReadFailed]: ERC20ReadFailedError;
|
|
26118
|
-
/** Thrown for {@link ZamaErrorCode.DelegationExpiryUnchanged}. */
|
|
26119
|
-
[ZamaErrorCode.DelegationExpiryUnchanged]: DelegationExpiryUnchangedError;
|
|
26120
|
-
/** Thrown for {@link ZamaErrorCode.DelegationDelegateEqualsContract}. */
|
|
26121
|
-
[ZamaErrorCode.DelegationDelegateEqualsContract]: DelegationDelegateEqualsContractError;
|
|
26122
|
-
/** Thrown for {@link ZamaErrorCode.DelegationDelegateCannotBeWildcard}. */
|
|
26123
|
-
[ZamaErrorCode.DelegationDelegateCannotBeWildcard]: DelegationDelegateCannotBeWildcardError;
|
|
26124
|
-
/** Thrown for {@link ZamaErrorCode.DelegationContractIsSelf}. */
|
|
26125
|
-
[ZamaErrorCode.DelegationContractIsSelf]: DelegationContractIsSelfError;
|
|
26126
|
-
/** Thrown for {@link ZamaErrorCode.AclPaused}. */
|
|
26127
|
-
[ZamaErrorCode.AclPaused]: AclPausedError;
|
|
26128
|
-
/** Thrown for {@link ZamaErrorCode.DelegationExpirationTooSoon}. */
|
|
26129
|
-
[ZamaErrorCode.DelegationExpirationTooSoon]: DelegationExpirationTooSoonError;
|
|
26130
|
-
/** Thrown for {@link ZamaErrorCode.DelegationNotPropagated}. */
|
|
26131
|
-
[ZamaErrorCode.DelegationNotPropagated]: DelegationNotPropagatedError;
|
|
26132
|
-
/** Thrown for {@link ZamaErrorCode.ChainMismatch}. */
|
|
26133
|
-
[ZamaErrorCode.ChainMismatch]: ChainMismatchError;
|
|
26134
|
-
/** Thrown for {@link ZamaErrorCode.SignerNotConfigured}. */
|
|
26135
|
-
[ZamaErrorCode.SignerNotConfigured]: SignerNotConfiguredError;
|
|
26136
|
-
/** Thrown for {@link ZamaErrorCode.WalletNotConnected}. */
|
|
26137
|
-
[ZamaErrorCode.WalletNotConnected]: WalletNotConnectedError;
|
|
26138
|
-
/** Thrown for {@link ZamaErrorCode.WalletAccountNotReady}. */
|
|
26139
|
-
[ZamaErrorCode.WalletAccountNotReady]: WalletAccountNotReadyError;
|
|
26140
|
-
/** Thrown for {@link ZamaErrorCode.KeyWrappingFailed}. */
|
|
26141
|
-
[ZamaErrorCode.KeyWrappingFailed]: KeyWrappingError;
|
|
26142
|
-
/** Thrown for {@link ZamaErrorCode.TransportKeyPairChanged}. */
|
|
26143
|
-
[ZamaErrorCode.TransportKeyPairChanged]: TransportKeyPairChangedError;
|
|
26144
|
-
/** Thrown for {@link ZamaErrorCode.PreparedPermitChainMismatch}. */
|
|
26145
|
-
[ZamaErrorCode.PreparedPermitChainMismatch]: PreparedPermitChainMismatchError;
|
|
26146
|
-
/** Thrown for {@link ZamaErrorCode.PreparedPermitExpired}. */
|
|
26147
|
-
[ZamaErrorCode.PreparedPermitExpired]: PreparedPermitExpiredError;
|
|
26148
|
-
/** Thrown for {@link ZamaErrorCode.UnshieldAlreadyFinalized}. */
|
|
26149
|
-
[ZamaErrorCode.UnshieldAlreadyFinalized]: UnshieldAlreadyFinalizedError;
|
|
26150
|
-
/** Thrown for {@link ZamaErrorCode.UnlistedConfidentialToken}. */
|
|
26151
|
-
[ZamaErrorCode.UnlistedConfidentialToken]: UnlistedConfidentialTokenError;
|
|
26152
|
-
/** Thrown for {@link ZamaErrorCode.VaultBatcherPaused}. */
|
|
26153
|
-
[ZamaErrorCode.VaultBatcherPaused]: VaultBatcherPausedError;
|
|
26154
|
-
/** Thrown for {@link ZamaErrorCode.VaultBatchNotDispatched}. */
|
|
26155
|
-
[ZamaErrorCode.VaultBatchNotDispatched]: VaultBatchNotDispatchedError;
|
|
26156
|
-
/** Thrown for {@link ZamaErrorCode.VaultGroupJoinUnconfirmed}. */
|
|
26157
|
-
[ZamaErrorCode.VaultGroupJoinUnconfirmed]: VaultGroupJoinUnconfirmedError;
|
|
25706
|
+
delegatedBatchDecryptValues({ encryptedInputs, delegatorAddress, accountAddress, maxConcurrency, waitForPropagation, operation }: {
|
|
25707
|
+
encryptedInputs: EncryptedInput[];
|
|
25708
|
+
delegatorAddress: Address;
|
|
25709
|
+
accountAddress?: Address;
|
|
25710
|
+
maxConcurrency?: number;
|
|
25711
|
+
} & DelegatedDecryptOptions): Promise<BatchDecryptResult>;
|
|
26158
25712
|
}
|
|
26159
|
-
|
|
26160
|
-
* Pattern-match on a {@link ZamaError} by its error code. Each handler receives the
|
|
26161
|
-
* error class for its code, so subclass fields are available without a cast.
|
|
26162
|
-
* Falls through to the `_` wildcard handler if no specific handler matches.
|
|
26163
|
-
* Returns `undefined` if the error is not a `ZamaError` and no `_` handler is provided.
|
|
26164
|
-
*
|
|
26165
|
-
* @example
|
|
26166
|
-
* ```ts
|
|
26167
|
-
* matchZamaError(error, {
|
|
26168
|
-
* SIGNING_REJECTED: () => toast("Please approve in wallet"),
|
|
26169
|
-
* INSUFFICIENT_CONFIDENTIAL_BALANCE: (e) => toast(`Need ${e.requested}, have ${e.available}`),
|
|
26170
|
-
* RELAYER_REQUEST_FAILED: (e) => toast(`Relayer failed (${e.statusCode})`),
|
|
26171
|
-
* _: () => toast("Unknown error"),
|
|
26172
|
-
* });
|
|
26173
|
-
* ```
|
|
26174
|
-
*/
|
|
26175
|
-
declare function matchZamaError<R>(error: unknown, handlers: { [K in ZamaErrorCode]?: (error: ErrorForCode[K]) => R; } & {
|
|
26176
|
-
_?: (error: unknown) => R;
|
|
26177
|
-
}): R | undefined;
|
|
26178
|
-
export { MutationFactoryOptions as $, unwrapRequesterContract as $n, ZamaErrorCode as $t, BatchBalancesResult as A, isConfidentialWrapperContract as An, EncryptOffloadUnavailableError as At, Permits as B, confidentialTransferAndCallContract as Bn, DelegationNotFoundError as Bt, VaultMemberConfig as C, isHandleDelegatedContract as Cn, BalanceCheckUnavailableError as Ct, VaultBatcher as D, ERC7984_INTERFACE_ID as Dn, InsufficientConfidentialBalanceError as Dt, PreparedFinalize as E, ERC1363_INTERFACE_ID as En, InsufficientAllowanceError as Et, DefaultRegistryAddresses as F, decimalsContract as Fn, DelegationDelegateCannotBeWildcardError as Ft, BatchDecryptItem as G, inferredTotalSupplyContract as Gn, NoCiphertextError as Gt, Delegations as H, confidentialTransferFromAndCallContract as Hn, DelegationSelfNotAllowedError as Ht, ListPairsOptions as I, nameContract as In, DelegationDelegateEqualsContractError as It, DecryptResult as J, setOperatorContract as Jn, RevokedKmsContextError as Jt, BatchDecryptResult as K, isOperatorContract as Kn, PreparedPermitChainMismatchError as Kt, WrappersRegistry as L, symbolContract as Ln, DelegationExpirationTooSoonError as Lt, Token as M, allowanceContract as Mn, AclPausedError as Mt, ZamaSDK as N, approveContract as Nn, DelegationContractIsSelfError as Nt, VaultBatcherOptions as O, ERC7984_WRAPPER_INTERFACE_ID as On, InsufficientERC20BalanceError as Ot, ZamaSDKOptions as P, balanceOfContract as Pn, DelegationCooldownError as Pt, zamaQueryKeys as Q, unwrapFromBalanceContract as Qn, ZamaError as Qt, WrappersRegistryConfig as R, confidentialBalanceOfContract as Rn, DelegationExpiredError as Rt, VaultGroupRedeemOptions as S, getDelegationExpiryContract as Sn, RelayerRequestFailedError as St, createVault as T, transferAndCallContract as Tn, ERC20ReadFailedError as Tt, DelegationStatus as U, confidentialTransferFromContract as Un, InvalidTransportKeyPairError as Ut, Offline as V, confidentialTransferContract as Vn, DelegationNotPropagatedError as Vt, Decryption as W, finalizeUnwrapContract as Wn, KeyWrappingError as Wt, decryptValuesQueryOptions as X, unwrapAmountContract as Xn, TransportKeyPairExpiredError as Xt, EncryptedInput as Y, underlyingContract as Yn, TransportKeyPairChangedError as Yt, SignerQueryContext as Z, unwrapContract as Zn, ChainMismatchError as Zt, VaultGroupJoin as _, getTokenPairsContract as _n, WalletAccountNotReadyError as _t, VaultBatchNotDispatchedDetails as a, PreparedPermit as an, VaultAddresses as at, VaultGroupMember as b, isConfidentialTokenValidContract as bn, NotEntitledError as bt, VaultBatcherPausedError as c, SerializedTransportKeyPair as cn, UnshieldAlreadyFinalizedError as ct, DecodedVaultGroupJoins as d, PaginatedResult as dn, TransactionRevertedError as dt, isRetryable as en, wrapContract as er, QueryFactoryOptions as et, JoinDelivery as f, TokenWrapperPair as fn, SigningErrorMetadata as ft, VaultGroupConfig as g, getTokenPairContract as gn, SignerRequiredError as gt, PreparedVaultGroupWrite as h, getTokenAddressContract as hn, SignerNotConfiguredError as ht, UnlistedConfidentialTokenError as i, PreparePermitRequest as in, JoinResult as it, BatchDecryptAsOptions as j, supportsInterfaceContract as jn, EncryptionFailedError as jt, createVaultBatcher as k, isConfidentialTokenContract as kn, DecryptionFailedError as kt, VaultGroupJoinUnconfirmedDetails as l, SignedPreparedPermit as ln, HcuBlockLimitExceededError as lt, PreparedVaultGroupJoin as m, getConfidentialTokenAddressContract as mn, SigningRejectedError as mt, matchZamaError as n, parsePreparedPermit as nn, BatchStatus as nt, VaultBatchNotDispatchedError as o, SerializedPermit as on, VaultJoinOptions as ot, PrepareVaultGroupJoinOptions as p, TokenWrapperPairWithMetadata as pn, SigningFailedError as pt, DelegatedDecryptOptions as q, rateContract as qn, PreparedPermitExpiredError as qt, UnlistedConfidentialTokenDetails as r, Permission as rn, JoinOptions as rt, VaultBatcherPausedDetails as s, SerializedPermitEip712 as sn, UnshieldAlreadyFinalizedDetails as st, ErrorForCode as t, retryAfterSeconds as tn, BatchState as tt, VaultGroupJoinUnconfirmedError as u, ChecksummedAddress as un, HcuTransactionLimitExceededError as ut, VaultGroupJoinResult as v, getTokenPairsLengthContract as vn, WalletNotConnectedError as vt, Vault as w, revokeDelegationContract as wn, BalanceErrorDetails as wt, VaultGroupOperator as x, delegateForUserDecryptionContract as xn, ConfigurationError as xt, VaultGroupLeg as y, getTokenPairsSliceContract as yn, RpcRateLimitError as yt, WrappedToken as z, confidentialTotalSupplyContract as zn, DelegationExpiryUnchangedError as zt };
|
|
25713
|
+
export { VaultCall as $, PreparedPermit as $t, VaultBatcherPausedDetails as A, nameContract as An, DelegationDelegateEqualsContractError as At, GroupJoinInput as B, isOperatorContract as Bn, PreparedPermitChainMismatchError as Bt, Delegations as C, isConfidentialTokenContract as Cn, DecryptionFailedError as Ct, matchZamaError as D, approveContract as Dn, DelegationContractIsSelfError as Dt, ErrorForCode as E, allowanceContract as En, AclPausedError as Et, BatchAction as F, confidentialTransferContract as Fn, DelegationNotPropagatedError as Ft, JoinOptions as G, unwrapContract as Gn, ChainMismatchError as Gt, JoinCall as H, setOperatorContract as Hn, RevokedKmsContextError as Ht, BatchRef as I, confidentialTransferFromAndCallContract as In, DelegationSelfNotAllowedError as It, OpenBatch as J, wrapContract as Jn, isRetryable as Jt, JoinOutcome as K, unwrapFromBalanceContract as Kn, ZamaError as Kt, BatchState as L, confidentialTransferFromContract as Ln, InvalidTransportKeyPairError as Lt, VaultJoinUnconfirmedDetails as M, confidentialBalanceOfContract as Mn, DelegationExpiredError as Mt, VaultJoinUnconfirmedError as N, confidentialTotalSupplyContract as Nn, DelegationExpiryUnchangedError as Nt, VaultBatchNotDispatchedDetails as O, balanceOfContract as On, DelegationCooldownError as Ot, Batch as P, confidentialTransferAndCallContract as Pn, DelegationNotFoundError as Pt, SendJoinOptions as Q, PreparePermitRequest as Qt, BatcherRef as R, finalizeUnwrapContract as Rn, KeyWrappingError as Rt, Offline as S, ERC7984_WRAPPER_INTERFACE_ID as Sn, InsufficientERC20BalanceError as St, Permits as T, supportsInterfaceContract as Tn, EncryptionFailedError as Tt, JoinDirection as U, underlyingContract as Un, TransportKeyPairChangedError as Ut, GroupJoinOptions as V, rateContract as Vn, PreparedPermitExpiredError as Vt, JoinInput as W, unwrapAmountContract as Wn, TransportKeyPairExpiredError as Wt, PreparedFinalize as X, parsePreparedPermit as Xt, OperatorApprovalCall as Y, retryAfterSeconds as Yt, PreparedJoin as Z, Permission as Zt, WrappersRegistryConfig as _, isHandleDelegatedContract as _n, BalanceCheckUnavailableError as _t, DecryptResult as a, PaginatedResult as an, TransactionRevertedError as at, BatchDecryptAsOptions as b, ERC1363_INTERFACE_ID as bn, InsufficientAllowanceError as bt, SignerQueryContext as c, getConfidentialTokenAddressContract as cn, SigningRejectedError as ct, QueryFactoryOptions as d, getTokenPairsContract as dn, WalletAccountNotReadyError as dt, SerializedPermit as en, VaultLeg as et, ZamaSDK as f, getTokenPairsLengthContract as fn, WalletNotConnectedError as ft, WrappersRegistry as g, getDelegationExpiryContract as gn, RelayerRequestFailedError as gt, ListPairsOptions as h, delegateForUserDecryptionContract as hn, ConfigurationError as ht, DelegatedDecryptOptions as i, ChecksummedAddress as in, HcuTransactionLimitExceededError as it, VaultBatcherPausedError as j, symbolContract as jn, DelegationExpirationTooSoonError as jt, VaultBatchNotDispatchedError as k, decimalsContract as kn, DelegationDelegateCannotBeWildcardError as kt, zamaQueryKeys as l, getTokenAddressContract as ln, SignerNotConfiguredError as lt, DefaultRegistryAddresses as m, isConfidentialTokenValidContract as mn, NotEntitledError as mt, BatchDecryptItem as n, SerializedTransportKeyPair as nn, UnshieldAlreadyFinalizedError as nt, EncryptedInput as o, TokenWrapperPair as on, SigningErrorMetadata as ot, ZamaSDKOptions as p, getTokenPairsSliceContract as pn, RpcRateLimitError as pt, JoinRoute as q, unwrapRequesterContract as qn, ZamaErrorCode as qt, BatchDecryptResult as r, SignedPreparedPermit as rn, HcuBlockLimitExceededError as rt, decryptValuesQueryOptions as s, TokenWrapperPairWithMetadata as sn, SigningFailedError as st, Decryption as t, SerializedPermitEip712 as tn, UnshieldAlreadyFinalizedDetails as tt, MutationFactoryOptions as u, getTokenPairContract as un, SignerRequiredError as ut, WrappedToken as v, revokeDelegationContract as vn, BalanceErrorDetails as vt, DelegationStatus as w, isConfidentialWrapperContract as wn, EncryptOffloadUnavailableError as wt, Token as x, ERC7984_INTERFACE_ID as xn, InsufficientConfidentialBalanceError as xt, BatchBalancesResult as y, transferAndCallContract as yn, ERC20ReadFailedError as yt, Call as z, inferredTotalSupplyContract as zn, NoCiphertextError as zt };
|