@zama-fhe/sdk 3.6.0 → 3.7.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/base-signer.cjs +1 -1
- package/dist/cjs/base-signer.cjs.map +1 -1
- package/dist/cjs/chains.cjs +1 -1
- package/dist/cjs/chains.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/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/relayer.cjs +1 -1
- package/dist/cjs/relayer.cjs.map +1 -1
- package/dist/cjs/token.cjs +1 -1
- package/dist/cjs/token.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 +1 -1
- package/dist/cjs/wrappers-registry.cjs.map +1 -1
- package/dist/esm/base-signer--sBO2qJp.js +2 -0
- package/dist/esm/base-signer--sBO2qJp.js.map +1 -0
- package/dist/esm/{base-signer-Iu5Lszrf.d.ts → base-signer-S2Ogf6L4.d.ts} +2 -2
- package/dist/esm/chains/index.d.ts +1 -1
- package/dist/esm/chains/index.js +1 -1
- package/dist/esm/chains-DEpKup1n.js +2 -0
- package/dist/esm/chains-DEpKup1n.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-iE4sWgSP.js → cleartext-DcbDCDXj.js} +2 -2
- package/dist/esm/{cleartext-iE4sWgSP.js.map → cleartext-DcbDCDXj.js.map} +1 -1
- package/dist/esm/{cleartext-B2DI8fgm.d.ts → cleartext-pv2blbFU.d.ts} +2 -2
- package/dist/esm/encrypt.worker.js +51 -51
- package/dist/esm/{encryption-BKoalB4o.js → encryption-DJljZ2oV.js} +2 -2
- package/dist/esm/{encryption-BKoalB4o.js.map → encryption-DJljZ2oV.js.map} +1 -1
- package/dist/esm/ethers/index.d.ts +5 -5
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/ethers/index.js.map +1 -1
- package/dist/esm/fhevm-relayer-CPmCytDX.js +8 -0
- package/dist/esm/fhevm-relayer-CPmCytDX.js.map +1 -0
- package/dist/esm/{index-BCh3VaZo.d.ts → index-DRrrBtMX.d.ts} +2000 -1115
- package/dist/esm/{index-ijgDL4IC.d.ts → index-Gk1S0gjO.d.ts} +14 -1
- package/dist/esm/{index-S6QjPkZE.d.ts → index-tfvbrVa2.d.ts} +4 -4
- package/dist/esm/index.d.ts +108 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +4 -4
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/query/index.d.ts +4 -537
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/relayer-B6Zo6EkX.js +2 -0
- package/dist/esm/relayer-B6Zo6EkX.js.map +1 -0
- package/dist/esm/token-BMQ6xlrk.js +2 -0
- package/dist/esm/{token-BejFVO8m.js.map → token-BMQ6xlrk.js.map} +1 -1
- package/dist/esm/{types-D3W3J65M.d.ts → types-BOyFfG7D.d.ts} +42 -7
- package/dist/esm/{types-Ce9Lhvrf.d.ts → types-BRIpBy9n.d.ts} +3 -3
- package/dist/esm/{types-CFDG6lIJ.d.ts → types-OXQqX_kH.d.ts} +3 -3
- package/dist/esm/{validation-BRu06AM_.js → validation-DWe2k89s.js} +2 -2
- package/dist/esm/{validation-BRu06AM_.js.map → validation-DWe2k89s.js.map} +1 -1
- package/dist/esm/viem/index.d.ts +5 -5
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/viem/index.js.map +1 -1
- package/dist/esm/web/index.d.ts +1 -1
- package/dist/esm/web/index.js +1 -1
- package/dist/esm/wrappers-registry-BfQr2QHn.js +2 -0
- package/dist/esm/wrappers-registry-BfQr2QHn.js.map +1 -0
- package/package.json +2 -2
- package/dist/esm/base-signer-DGIEzavu.js +0 -2
- package/dist/esm/base-signer-DGIEzavu.js.map +0 -1
- package/dist/esm/chains-ByyCdrrd.js +0 -2
- package/dist/esm/chains-ByyCdrrd.js.map +0 -1
- package/dist/esm/fhevm-relayer-Cm-ZR1vP.js +0 -8
- package/dist/esm/fhevm-relayer-Cm-ZR1vP.js.map +0 -1
- package/dist/esm/relayer-CVKO9GmQ.js +0 -2
- package/dist/esm/relayer-CVKO9GmQ.js.map +0 -1
- package/dist/esm/token-BejFVO8m.js +0 -2
- package/dist/esm/wrappers-registry-BLe7PkZi.js +0 -2
- package/dist/esm/wrappers-registry-BLe7PkZi.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { f as FheChain } from "./index-
|
|
2
|
-
import { $t as
|
|
3
|
-
import "./cleartext-
|
|
4
|
-
import "./types-
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
7
|
-
import { Address,
|
|
1
|
+
import { f as FheChain } from "./index-Gk1S0gjO.js";
|
|
2
|
+
import { $t as TransactionResult, Ct as TransferCallbacks, D as GenericSigner, O as WalletAccount, S as TransactionKind, _ as PrepareTransactionRequest, an as EncryptParams, bt as UnwrapResult, c as GenericStorage, en as ClearValue, g as PrepareOptions, gt as ShieldOptions, i as ZamaConfig, l as GenericProvider, o as ZamaConfigGeneric, on as EncryptResult, pn as RelayerSDK, sn as EncryptedValue, tn as DecryptPublicValuesResult, un as FhevmRelayerOptions, v as PreparedFor, vt as TransferOptions, wt as UnshieldCallbacks, xt as WrapOptions, yt as UnshieldOptions } from "./types-BOyFfG7D.js";
|
|
3
|
+
import "./cleartext-pv2blbFU.js";
|
|
4
|
+
import "./types-OXQqX_kH.js";
|
|
5
|
+
import "./types-BRIpBy9n.js";
|
|
6
|
+
import "./index-tfvbrVa2.js";
|
|
7
|
+
import { Address, Hex } from "viem";
|
|
8
8
|
import { z } from "zod/mini";
|
|
9
9
|
import { MutationFunctionContext, QueryKey, QueryObserverOptions, skipToken } from "@tanstack/query-core";
|
|
10
10
|
//#region src/config/create.d.ts
|
|
@@ -17446,6 +17446,16 @@ declare function delegateForUserDecryptionContract(aclAddress: Address, delegate
|
|
|
17446
17446
|
readonly internalType: "uint64";
|
|
17447
17447
|
}];
|
|
17448
17448
|
readonly stateMutability: "view";
|
|
17449
|
+
}, {
|
|
17450
|
+
readonly type: "function";
|
|
17451
|
+
readonly name: "invalidateDecryptionSignaturesBefore";
|
|
17452
|
+
readonly inputs: readonly [{
|
|
17453
|
+
readonly name: "timestamp";
|
|
17454
|
+
readonly type: "uint256";
|
|
17455
|
+
readonly internalType: "uint256";
|
|
17456
|
+
}];
|
|
17457
|
+
readonly outputs: readonly [];
|
|
17458
|
+
readonly stateMutability: "nonpayable";
|
|
17449
17459
|
}, {
|
|
17450
17460
|
readonly type: "function";
|
|
17451
17461
|
readonly name: "isAccountDenied";
|
|
@@ -17664,6 +17674,16 @@ declare function revokeDelegationContract(aclAddress: Address, delegateAddress:
|
|
|
17664
17674
|
readonly internalType: "uint64";
|
|
17665
17675
|
}];
|
|
17666
17676
|
readonly stateMutability: "view";
|
|
17677
|
+
}, {
|
|
17678
|
+
readonly type: "function";
|
|
17679
|
+
readonly name: "invalidateDecryptionSignaturesBefore";
|
|
17680
|
+
readonly inputs: readonly [{
|
|
17681
|
+
readonly name: "timestamp";
|
|
17682
|
+
readonly type: "uint256";
|
|
17683
|
+
readonly internalType: "uint256";
|
|
17684
|
+
}];
|
|
17685
|
+
readonly outputs: readonly [];
|
|
17686
|
+
readonly stateMutability: "nonpayable";
|
|
17667
17687
|
}, {
|
|
17668
17688
|
readonly type: "function";
|
|
17669
17689
|
readonly name: "isAccountDenied";
|
|
@@ -17786,6 +17806,235 @@ declare function revokeDelegationContract(aclAddress: Address, delegateAddress:
|
|
|
17786
17806
|
readonly functionName: "revokeDelegationForUserDecryption";
|
|
17787
17807
|
readonly args: readonly [`0x${string}`, `0x${string}`];
|
|
17788
17808
|
};
|
|
17809
|
+
/**
|
|
17810
|
+
* Returns the contract config to invalidate every decryption signature signed
|
|
17811
|
+
* by `msg.sender` before `timestamp` (`0n` resolves to now on-chain).
|
|
17812
|
+
*
|
|
17813
|
+
* @example
|
|
17814
|
+
* ```ts
|
|
17815
|
+
* const txHash = await signer.writeContract(
|
|
17816
|
+
* invalidateDecryptionSignaturesBeforeContract(aclAddress, 0n),
|
|
17817
|
+
* );
|
|
17818
|
+
* ```
|
|
17819
|
+
*/
|
|
17820
|
+
declare function invalidateDecryptionSignaturesBeforeContract(aclAddress: Address, timestamp: bigint): {
|
|
17821
|
+
readonly address: `0x${string}`;
|
|
17822
|
+
readonly abi: readonly [{
|
|
17823
|
+
readonly type: "function";
|
|
17824
|
+
readonly name: "allow";
|
|
17825
|
+
readonly inputs: readonly [{
|
|
17826
|
+
readonly name: "handle";
|
|
17827
|
+
readonly type: "bytes32";
|
|
17828
|
+
readonly internalType: "bytes32";
|
|
17829
|
+
}, {
|
|
17830
|
+
readonly name: "account";
|
|
17831
|
+
readonly type: "address";
|
|
17832
|
+
readonly internalType: "address";
|
|
17833
|
+
}];
|
|
17834
|
+
readonly outputs: readonly [];
|
|
17835
|
+
readonly stateMutability: "nonpayable";
|
|
17836
|
+
}, {
|
|
17837
|
+
readonly type: "function";
|
|
17838
|
+
readonly name: "allowForDecryption";
|
|
17839
|
+
readonly inputs: readonly [{
|
|
17840
|
+
readonly name: "handlesList";
|
|
17841
|
+
readonly type: "bytes32[]";
|
|
17842
|
+
readonly internalType: "bytes32[]";
|
|
17843
|
+
}];
|
|
17844
|
+
readonly outputs: readonly [];
|
|
17845
|
+
readonly stateMutability: "nonpayable";
|
|
17846
|
+
}, {
|
|
17847
|
+
readonly type: "function";
|
|
17848
|
+
readonly name: "allowTransient";
|
|
17849
|
+
readonly inputs: readonly [{
|
|
17850
|
+
readonly name: "ciphertext";
|
|
17851
|
+
readonly type: "bytes32";
|
|
17852
|
+
readonly internalType: "bytes32";
|
|
17853
|
+
}, {
|
|
17854
|
+
readonly name: "account";
|
|
17855
|
+
readonly type: "address";
|
|
17856
|
+
readonly internalType: "address";
|
|
17857
|
+
}];
|
|
17858
|
+
readonly outputs: readonly [];
|
|
17859
|
+
readonly stateMutability: "nonpayable";
|
|
17860
|
+
}, {
|
|
17861
|
+
readonly type: "function";
|
|
17862
|
+
readonly name: "cleanTransientStorage";
|
|
17863
|
+
readonly inputs: readonly [];
|
|
17864
|
+
readonly outputs: readonly [];
|
|
17865
|
+
readonly stateMutability: "nonpayable";
|
|
17866
|
+
}, {
|
|
17867
|
+
readonly type: "function";
|
|
17868
|
+
readonly name: "delegateForUserDecryption";
|
|
17869
|
+
readonly inputs: readonly [{
|
|
17870
|
+
readonly name: "delegate";
|
|
17871
|
+
readonly type: "address";
|
|
17872
|
+
readonly internalType: "address";
|
|
17873
|
+
}, {
|
|
17874
|
+
readonly name: "contractAddress";
|
|
17875
|
+
readonly type: "address";
|
|
17876
|
+
readonly internalType: "address";
|
|
17877
|
+
}, {
|
|
17878
|
+
readonly name: "expirationDate";
|
|
17879
|
+
readonly type: "uint64";
|
|
17880
|
+
readonly internalType: "uint64";
|
|
17881
|
+
}];
|
|
17882
|
+
readonly outputs: readonly [];
|
|
17883
|
+
readonly stateMutability: "nonpayable";
|
|
17884
|
+
}, {
|
|
17885
|
+
readonly type: "function";
|
|
17886
|
+
readonly name: "getUserDecryptionDelegationExpirationDate";
|
|
17887
|
+
readonly inputs: readonly [{
|
|
17888
|
+
readonly name: "delegator";
|
|
17889
|
+
readonly type: "address";
|
|
17890
|
+
readonly internalType: "address";
|
|
17891
|
+
}, {
|
|
17892
|
+
readonly name: "delegate";
|
|
17893
|
+
readonly type: "address";
|
|
17894
|
+
readonly internalType: "address";
|
|
17895
|
+
}, {
|
|
17896
|
+
readonly name: "contractAddress";
|
|
17897
|
+
readonly type: "address";
|
|
17898
|
+
readonly internalType: "address";
|
|
17899
|
+
}];
|
|
17900
|
+
readonly outputs: readonly [{
|
|
17901
|
+
readonly name: "";
|
|
17902
|
+
readonly type: "uint64";
|
|
17903
|
+
readonly internalType: "uint64";
|
|
17904
|
+
}];
|
|
17905
|
+
readonly stateMutability: "view";
|
|
17906
|
+
}, {
|
|
17907
|
+
readonly type: "function";
|
|
17908
|
+
readonly name: "invalidateDecryptionSignaturesBefore";
|
|
17909
|
+
readonly inputs: readonly [{
|
|
17910
|
+
readonly name: "timestamp";
|
|
17911
|
+
readonly type: "uint256";
|
|
17912
|
+
readonly internalType: "uint256";
|
|
17913
|
+
}];
|
|
17914
|
+
readonly outputs: readonly [];
|
|
17915
|
+
readonly stateMutability: "nonpayable";
|
|
17916
|
+
}, {
|
|
17917
|
+
readonly type: "function";
|
|
17918
|
+
readonly name: "isAccountDenied";
|
|
17919
|
+
readonly inputs: readonly [{
|
|
17920
|
+
readonly name: "account";
|
|
17921
|
+
readonly type: "address";
|
|
17922
|
+
readonly internalType: "address";
|
|
17923
|
+
}];
|
|
17924
|
+
readonly outputs: readonly [{
|
|
17925
|
+
readonly name: "";
|
|
17926
|
+
readonly type: "bool";
|
|
17927
|
+
readonly internalType: "bool";
|
|
17928
|
+
}];
|
|
17929
|
+
readonly stateMutability: "view";
|
|
17930
|
+
}, {
|
|
17931
|
+
readonly type: "function";
|
|
17932
|
+
readonly name: "isAllowed";
|
|
17933
|
+
readonly inputs: readonly [{
|
|
17934
|
+
readonly name: "handle";
|
|
17935
|
+
readonly type: "bytes32";
|
|
17936
|
+
readonly internalType: "bytes32";
|
|
17937
|
+
}, {
|
|
17938
|
+
readonly name: "account";
|
|
17939
|
+
readonly type: "address";
|
|
17940
|
+
readonly internalType: "address";
|
|
17941
|
+
}];
|
|
17942
|
+
readonly outputs: readonly [{
|
|
17943
|
+
readonly name: "";
|
|
17944
|
+
readonly type: "bool";
|
|
17945
|
+
readonly internalType: "bool";
|
|
17946
|
+
}];
|
|
17947
|
+
readonly stateMutability: "view";
|
|
17948
|
+
}, {
|
|
17949
|
+
readonly type: "function";
|
|
17950
|
+
readonly name: "isAllowedForDecryption";
|
|
17951
|
+
readonly inputs: readonly [{
|
|
17952
|
+
readonly name: "handle";
|
|
17953
|
+
readonly type: "bytes32";
|
|
17954
|
+
readonly internalType: "bytes32";
|
|
17955
|
+
}];
|
|
17956
|
+
readonly outputs: readonly [{
|
|
17957
|
+
readonly name: "";
|
|
17958
|
+
readonly type: "bool";
|
|
17959
|
+
readonly internalType: "bool";
|
|
17960
|
+
}];
|
|
17961
|
+
readonly stateMutability: "view";
|
|
17962
|
+
}, {
|
|
17963
|
+
readonly type: "function";
|
|
17964
|
+
readonly name: "isHandleDelegatedForUserDecryption";
|
|
17965
|
+
readonly inputs: readonly [{
|
|
17966
|
+
readonly name: "delegator";
|
|
17967
|
+
readonly type: "address";
|
|
17968
|
+
readonly internalType: "address";
|
|
17969
|
+
}, {
|
|
17970
|
+
readonly name: "delegate";
|
|
17971
|
+
readonly type: "address";
|
|
17972
|
+
readonly internalType: "address";
|
|
17973
|
+
}, {
|
|
17974
|
+
readonly name: "contractAddress";
|
|
17975
|
+
readonly type: "address";
|
|
17976
|
+
readonly internalType: "address";
|
|
17977
|
+
}, {
|
|
17978
|
+
readonly name: "handle";
|
|
17979
|
+
readonly type: "bytes32";
|
|
17980
|
+
readonly internalType: "bytes32";
|
|
17981
|
+
}];
|
|
17982
|
+
readonly outputs: readonly [{
|
|
17983
|
+
readonly name: "";
|
|
17984
|
+
readonly type: "bool";
|
|
17985
|
+
readonly internalType: "bool";
|
|
17986
|
+
}];
|
|
17987
|
+
readonly stateMutability: "view";
|
|
17988
|
+
}, {
|
|
17989
|
+
readonly type: "function";
|
|
17990
|
+
readonly name: "multicall";
|
|
17991
|
+
readonly inputs: readonly [{
|
|
17992
|
+
readonly name: "data";
|
|
17993
|
+
readonly type: "bytes[]";
|
|
17994
|
+
readonly internalType: "bytes[]";
|
|
17995
|
+
}];
|
|
17996
|
+
readonly outputs: readonly [{
|
|
17997
|
+
readonly name: "results";
|
|
17998
|
+
readonly type: "bytes[]";
|
|
17999
|
+
readonly internalType: "bytes[]";
|
|
18000
|
+
}];
|
|
18001
|
+
readonly stateMutability: "payable";
|
|
18002
|
+
}, {
|
|
18003
|
+
readonly type: "function";
|
|
18004
|
+
readonly name: "persistAllowed";
|
|
18005
|
+
readonly inputs: readonly [{
|
|
18006
|
+
readonly name: "handle";
|
|
18007
|
+
readonly type: "bytes32";
|
|
18008
|
+
readonly internalType: "bytes32";
|
|
18009
|
+
}, {
|
|
18010
|
+
readonly name: "account";
|
|
18011
|
+
readonly type: "address";
|
|
18012
|
+
readonly internalType: "address";
|
|
18013
|
+
}];
|
|
18014
|
+
readonly outputs: readonly [{
|
|
18015
|
+
readonly name: "";
|
|
18016
|
+
readonly type: "bool";
|
|
18017
|
+
readonly internalType: "bool";
|
|
18018
|
+
}];
|
|
18019
|
+
readonly stateMutability: "view";
|
|
18020
|
+
}, {
|
|
18021
|
+
readonly type: "function";
|
|
18022
|
+
readonly name: "revokeDelegationForUserDecryption";
|
|
18023
|
+
readonly inputs: readonly [{
|
|
18024
|
+
readonly name: "delegate";
|
|
18025
|
+
readonly type: "address";
|
|
18026
|
+
readonly internalType: "address";
|
|
18027
|
+
}, {
|
|
18028
|
+
readonly name: "contractAddress";
|
|
18029
|
+
readonly type: "address";
|
|
18030
|
+
readonly internalType: "address";
|
|
18031
|
+
}];
|
|
18032
|
+
readonly outputs: readonly [];
|
|
18033
|
+
readonly stateMutability: "nonpayable";
|
|
18034
|
+
}];
|
|
18035
|
+
readonly functionName: "invalidateDecryptionSignaturesBefore";
|
|
18036
|
+
readonly args: readonly [bigint];
|
|
18037
|
+
};
|
|
17789
18038
|
/**
|
|
17790
18039
|
* Returns the contract config to read the delegation expiry date.
|
|
17791
18040
|
*
|
|
@@ -17882,6 +18131,16 @@ declare function getDelegationExpiryContract(aclAddress: Address, delegatorAddre
|
|
|
17882
18131
|
readonly internalType: "uint64";
|
|
17883
18132
|
}];
|
|
17884
18133
|
readonly stateMutability: "view";
|
|
18134
|
+
}, {
|
|
18135
|
+
readonly type: "function";
|
|
18136
|
+
readonly name: "invalidateDecryptionSignaturesBefore";
|
|
18137
|
+
readonly inputs: readonly [{
|
|
18138
|
+
readonly name: "timestamp";
|
|
18139
|
+
readonly type: "uint256";
|
|
18140
|
+
readonly internalType: "uint256";
|
|
18141
|
+
}];
|
|
18142
|
+
readonly outputs: readonly [];
|
|
18143
|
+
readonly stateMutability: "nonpayable";
|
|
17885
18144
|
}, {
|
|
17886
18145
|
readonly type: "function";
|
|
17887
18146
|
readonly name: "isAccountDenied";
|
|
@@ -18100,6 +18359,16 @@ declare function isHandleDelegatedContract(aclAddress: Address, delegatorAddress
|
|
|
18100
18359
|
readonly internalType: "uint64";
|
|
18101
18360
|
}];
|
|
18102
18361
|
readonly stateMutability: "view";
|
|
18362
|
+
}, {
|
|
18363
|
+
readonly type: "function";
|
|
18364
|
+
readonly name: "invalidateDecryptionSignaturesBefore";
|
|
18365
|
+
readonly inputs: readonly [{
|
|
18366
|
+
readonly name: "timestamp";
|
|
18367
|
+
readonly type: "uint256";
|
|
18368
|
+
readonly internalType: "uint256";
|
|
18369
|
+
}];
|
|
18370
|
+
readonly outputs: readonly [];
|
|
18371
|
+
readonly stateMutability: "nonpayable";
|
|
18103
18372
|
}, {
|
|
18104
18373
|
readonly type: "function";
|
|
18105
18374
|
readonly name: "isAccountDenied";
|
|
@@ -19611,9 +19880,28 @@ type ChecksummedAddress = Address & {
|
|
|
19611
19880
|
readonly [checksummedTag]: true;
|
|
19612
19881
|
};
|
|
19613
19882
|
//#endregion
|
|
19614
|
-
//#region src/credentials/
|
|
19883
|
+
//#region src/credentials/utils.d.ts
|
|
19615
19884
|
/**
|
|
19616
|
-
*
|
|
19885
|
+
* Sentinel requesting a V2 permissive ("wildcard") permit from
|
|
19886
|
+
* {@link CredentialService.grantPermit} / {@link Permits.grantPermit} /
|
|
19887
|
+
* {@link Permits.grantDelegationPermit} — one permit covering every contract,
|
|
19888
|
+
* present and future, instead of an explicit list. Always an explicit opt-in:
|
|
19889
|
+
* passing a contract list, however large, never signs a wildcard permit.
|
|
19890
|
+
*
|
|
19891
|
+
* @example
|
|
19892
|
+
* ```ts
|
|
19893
|
+
* import { WILDCARD_PERMIT } from "@zama-fhe/sdk";
|
|
19894
|
+
*
|
|
19895
|
+
* await sdk.permits.grantPermit(WILDCARD_PERMIT);
|
|
19896
|
+
* ```
|
|
19897
|
+
*/
|
|
19898
|
+
declare const WILDCARD_PERMIT: "wildcard";
|
|
19899
|
+
/** The type of {@link WILDCARD_PERMIT}. */
|
|
19900
|
+
type WildcardPermit = typeof WILDCARD_PERMIT;
|
|
19901
|
+
//#endregion
|
|
19902
|
+
//#region src/credentials/types.d.ts
|
|
19903
|
+
/**
|
|
19904
|
+
* Serialized transport key pair — ML-KEM public + private key as hex, the shape
|
|
19617
19905
|
* we persist and hand to the decrypt path. Mirrors `@fhevm/sdk`'s
|
|
19618
19906
|
* `serializeTransportKeyPair` output; the private half is plaintext, so treat it
|
|
19619
19907
|
* as sensitive.
|
|
@@ -19660,27 +19948,54 @@ interface SerializedPermit {
|
|
|
19660
19948
|
signature: Hex;
|
|
19661
19949
|
/** Address that produced the signature. */
|
|
19662
19950
|
signerAddress: ChecksummedAddress;
|
|
19951
|
+
/**
|
|
19952
|
+
* V2 (unified) permits only — delegation is metadata alongside the signed
|
|
19953
|
+
* message, not part of it. Absent for V1 (where delegation lives inside
|
|
19954
|
+
* `eip712.message`) and for a non-delegated V2 permit.
|
|
19955
|
+
*/
|
|
19956
|
+
delegatorAddress?: ChecksummedAddress;
|
|
19663
19957
|
}
|
|
19664
|
-
/**
|
|
19665
|
-
|
|
19666
|
-
* contract addresses for a bounded time window. Wraps the serialized `@fhevm/sdk`
|
|
19667
|
-
* permit ({@link SerializedPermit}) alongside the scope/coverage metadata the
|
|
19668
|
-
* permission store indexes on.
|
|
19669
|
-
*
|
|
19670
|
-
* Mirrors {@link PermissionSchema}; kept in sync by a `.test-d.ts` guard.
|
|
19671
|
-
*/
|
|
19672
|
-
interface Permission {
|
|
19958
|
+
/** Fields shared by every permit version, regardless of shape. */
|
|
19959
|
+
interface PermissionBase {
|
|
19673
19960
|
/** Public key of the transport key pair this permit is bound to, hex-encoded. */
|
|
19674
19961
|
keypairPublicKey: Hex;
|
|
19675
|
-
/**
|
|
19962
|
+
/**
|
|
19963
|
+
* Contract addresses this permit grants decrypt access to. Never empty for
|
|
19964
|
+
* a V1 permit; an empty list on a V2 permit is a wildcard — see {@link PermissionV2}.
|
|
19965
|
+
*/
|
|
19676
19966
|
contractAddresses: ChecksummedAddress[];
|
|
19677
19967
|
/** The signed serialized permit. */
|
|
19678
19968
|
serializedPermit: SerializedPermit;
|
|
19679
19969
|
/** Unix timestamp (seconds) when the permit becomes valid. */
|
|
19680
19970
|
startTimestamp: number;
|
|
19681
|
-
|
|
19971
|
+
}
|
|
19972
|
+
/** A V1 ("legacy") permit — always scoped to a specific, non-empty contract list. */
|
|
19973
|
+
interface PermissionV1 extends PermissionBase {
|
|
19974
|
+
/** Discriminant identifying this as a {@link PermissionV1}. */
|
|
19975
|
+
version: 1;
|
|
19976
|
+
/** Validity window length in days from {@link PermissionBase.startTimestamp}. */
|
|
19682
19977
|
durationDays: number;
|
|
19683
19978
|
}
|
|
19979
|
+
/**
|
|
19980
|
+
* A V2 (unified) permit. `contractAddresses: []` is a *wildcard* (permissive)
|
|
19981
|
+
* permit — it covers every contract, not zero.
|
|
19982
|
+
*/
|
|
19983
|
+
interface PermissionV2 extends PermissionBase {
|
|
19984
|
+
/** Discriminant identifying this as a {@link PermissionV2}. */
|
|
19985
|
+
version: 2;
|
|
19986
|
+
/** Validity window length in seconds from {@link PermissionBase.startTimestamp}. */
|
|
19987
|
+
durationSeconds: number;
|
|
19988
|
+
}
|
|
19989
|
+
/**
|
|
19990
|
+
* A signed EIP-712 permit binding a signer (and optional delegator) to a set of
|
|
19991
|
+
* contract addresses for a bounded time window. Wraps the serialized `@fhevm/sdk`
|
|
19992
|
+
* permit ({@link SerializedPermit}) alongside the scope/coverage metadata the
|
|
19993
|
+
* permission store indexes on.
|
|
19994
|
+
*
|
|
19995
|
+
* Discriminated by `version`: {@link PermissionV1} or {@link PermissionV2}.
|
|
19996
|
+
* Mirrors {@link PermissionSchema}; kept in sync by a `.test-d.ts` guard.
|
|
19997
|
+
*/
|
|
19998
|
+
type Permission = PermissionV1 | PermissionV2;
|
|
19684
19999
|
/**
|
|
19685
20000
|
* Offline `preparePermit` request — `grantPermit`'s parameters split around
|
|
19686
20001
|
* the wallet signature. `signer` and `delegator` are explicit addresses, not
|
|
@@ -19690,8 +20005,12 @@ interface Permission {
|
|
|
19690
20005
|
interface PreparePermitRequest {
|
|
19691
20006
|
/** Address that will sign the returned EIP-712 typed data. */
|
|
19692
20007
|
signer: Address;
|
|
19693
|
-
/**
|
|
19694
|
-
|
|
20008
|
+
/**
|
|
20009
|
+
* Contract addresses to authorize, or {@link WildcardPermit} to request a
|
|
20010
|
+
* V2 permit covering every contract. Maximum {@link MAX_CONTRACTS_PER_PERMIT}
|
|
20011
|
+
* per call — no chunking. Ignored (and unchecked) when requesting a wildcard.
|
|
20012
|
+
*/
|
|
20013
|
+
contracts: readonly Address[] | WildcardPermit;
|
|
19695
20014
|
/** Delegator address, for a delegated permit. Omit for a self permit. */
|
|
19696
20015
|
delegator?: Address;
|
|
19697
20016
|
/** Permit validity window in days. Defaults to the SDK's configured `permitTTL`. */
|
|
@@ -19703,24 +20022,40 @@ interface PreparePermitRequest {
|
|
|
19703
20022
|
* out-of-process signer returns for it.
|
|
19704
20023
|
*
|
|
19705
20024
|
* Deliberately minimal: `chainId`, `contracts`, `startTimestamp`,
|
|
19706
|
-
* `durationDays`, and the transport public key are all
|
|
19707
|
-
* {@link eip712}'s `domain`/`message` directly
|
|
19708
|
-
* signature-verified payload) — carrying
|
|
19709
|
-
* create two sources of truth that could
|
|
19710
|
-
* for display/logging use.
|
|
20025
|
+
* `durationDays`/`durationSeconds`, and the transport public key are all
|
|
20026
|
+
* readable off {@link PreparedPermitBase.eip712}'s `domain`/`message` directly
|
|
20027
|
+
* (and, once registered, off the signature-verified payload) — carrying
|
|
20028
|
+
* separate top-level copies would only create two sources of truth that could
|
|
20029
|
+
* disagree. Read them from `eip712` for display/logging use.
|
|
19711
20030
|
*
|
|
19712
|
-
* `version
|
|
19713
|
-
*
|
|
19714
|
-
* process boundary as-is.
|
|
20031
|
+
* Discriminated by `version`: {@link PreparedPermitV1} (protocol ≤0.13) or
|
|
20032
|
+
* {@link PreparedPermitV2} (protocol ≥0.14, unified/wildcard). JSON-safe —
|
|
20033
|
+
* ships across a process boundary as-is.
|
|
19715
20034
|
*/
|
|
19716
|
-
|
|
19717
|
-
|
|
19718
|
-
|
|
20035
|
+
type PreparedPermit = PreparedPermitV1 | PreparedPermitV2;
|
|
20036
|
+
/** Fields shared by every prepared-permit version. */
|
|
20037
|
+
interface PreparedPermitBase {
|
|
19719
20038
|
/** The EIP-712 typed data to sign with `eth_signTypedData_v4`. */
|
|
19720
20039
|
eip712: SerializedPermitEip712;
|
|
19721
20040
|
/** Address expected to sign {@link eip712}. */
|
|
19722
20041
|
signerAddress: ChecksummedAddress;
|
|
19723
20042
|
}
|
|
20043
|
+
/** A V1 ("legacy") prepared permit. Delegation, if any, lives inside `eip712.message`. */
|
|
20044
|
+
interface PreparedPermitV1 extends PreparedPermitBase {
|
|
20045
|
+
/** Discriminant identifying this as a {@link PreparedPermitV1}. */
|
|
20046
|
+
version: 1;
|
|
20047
|
+
}
|
|
20048
|
+
/**
|
|
20049
|
+
* A V2 (unified) prepared permit. V2 delegation is post-sign metadata, not
|
|
20050
|
+
* part of the signed message, so a delegated request carries it here instead
|
|
20051
|
+
* of inside `eip712.message`.
|
|
20052
|
+
*/
|
|
20053
|
+
interface PreparedPermitV2 extends PreparedPermitBase {
|
|
20054
|
+
/** Discriminant identifying this as a {@link PreparedPermitV2}. */
|
|
20055
|
+
version: 2;
|
|
20056
|
+
/** Delegator address, for a delegated permit. Absent for a self permit. */
|
|
20057
|
+
delegatorAddress?: ChecksummedAddress;
|
|
20058
|
+
}
|
|
19724
20059
|
//#endregion
|
|
19725
20060
|
//#region src/errors/base.d.ts
|
|
19726
20061
|
/**
|
|
@@ -19789,6 +20124,8 @@ declare const ZamaErrorCode: {
|
|
|
19789
20124
|
readonly DelegationExpiryUnchanged: "DELEGATION_EXPIRY_UNCHANGED";
|
|
19790
20125
|
/** Delegate address cannot be the contract address. */
|
|
19791
20126
|
readonly DelegationDelegateEqualsContract: "DELEGATION_DELEGATE_EQUALS_CONTRACT";
|
|
20127
|
+
/** Delegate address cannot be the wildcard address — it's only valid as `contractAddress`. */
|
|
20128
|
+
readonly DelegationDelegateCannotBeWildcard: "DELEGATION_DELEGATE_CANNOT_BE_WILDCARD";
|
|
19792
20129
|
/** Contract address cannot be the sender address. */
|
|
19793
20130
|
readonly DelegationContractIsSelf: "DELEGATION_CONTRACT_IS_SELF";
|
|
19794
20131
|
/** The ACL contract is paused. */
|
|
@@ -19813,6 +20150,14 @@ declare const ZamaErrorCode: {
|
|
|
19813
20150
|
readonly PreparedPermitChainMismatch: "PREPARED_PERMIT_CHAIN_MISMATCH";
|
|
19814
20151
|
/** A prepared permit's validity window elapsed before its signature was registered. */
|
|
19815
20152
|
readonly PreparedPermitExpired: "PREPARED_PERMIT_EXPIRED";
|
|
20153
|
+
/** V2 (unified) decryption permits — including wildcard permits — need protocol v0.14+; the connected chain hasn't upgraded yet. */
|
|
20154
|
+
readonly UnifiedPermitNotSupported: "UNIFIED_PERMIT_NOT_SUPPORTED";
|
|
20155
|
+
/** A stored V2/wildcard permit's scope is needed, but the connected relayer instance doesn't support unified decryption yet. */
|
|
20156
|
+
readonly UnifiedDecryptionUnsupported: "UNIFIED_DECRYPTION_UNSUPPORTED";
|
|
20157
|
+
/** `invalidateDecryptionSignatures` was given a cutoff at or below the account's current one; the ACL only moves it forward. */
|
|
20158
|
+
readonly InvalidationTimestampTooLow: "INVALIDATION_TIMESTAMP_TOO_LOW";
|
|
20159
|
+
/** `invalidateDecryptionSignatures` was given a cutoff in the future; the ACL only accepts now or earlier. */
|
|
20160
|
+
readonly InvalidationTimestampInFuture: "INVALIDATION_TIMESTAMP_IN_FUTURE";
|
|
19816
20161
|
/** The unwrap request was already finalized on-chain; there is nothing left to resume. */
|
|
19817
20162
|
readonly UnshieldAlreadyFinalized: "UNSHIELD_ALREADY_FINALIZED";
|
|
19818
20163
|
};
|
|
@@ -19974,6 +20319,45 @@ declare class PreparedPermitChainMismatchError extends ZamaError {
|
|
|
19974
20319
|
declare class PreparedPermitExpiredError extends ZamaError {
|
|
19975
20320
|
constructor(message: string, options?: ErrorOptions);
|
|
19976
20321
|
}
|
|
20322
|
+
/**
|
|
20323
|
+
* The connected chain doesn't support V2 (unified) decryption permits yet —
|
|
20324
|
+
* including {@link WILDCARD_PERMIT} — because it hasn't upgraded to protocol
|
|
20325
|
+
* v0.14 or later. Thrown before any wallet prompt: the SDK detects this from
|
|
20326
|
+
* the chain's on-chain KMS context, without a signature attempt. V1 permits
|
|
20327
|
+
* (an explicit contract list, not `WILDCARD_PERMIT`) are unaffected — grant
|
|
20328
|
+
* one of those instead, or retry once the network upgrades.
|
|
20329
|
+
*/
|
|
20330
|
+
declare class UnifiedPermitNotSupportedError extends ZamaError {
|
|
20331
|
+
constructor(message: string, options?: ErrorOptions);
|
|
20332
|
+
}
|
|
20333
|
+
/**
|
|
20334
|
+
* A stored V2 (unified/wildcard) permit's scope is needed for this decrypt,
|
|
20335
|
+
* but the connected relayer instance hasn't deployed the `/v3/user-decrypt`
|
|
20336
|
+
* route it requires. Distinct from {@link UnifiedPermitNotSupportedError}:
|
|
20337
|
+
* that one fires at *signing* time because the *chain* hasn't upgraded to
|
|
20338
|
+
* protocol v0.14+; this one fires at *decrypt* time even though the chain and
|
|
20339
|
+
* the stored permit are both V2-capable — only this particular relayer
|
|
20340
|
+
* instance hasn't deployed the route yet. Grant a specific-contract (V1)
|
|
20341
|
+
* permit instead, or retry once the relayer upgrades.
|
|
20342
|
+
*/
|
|
20343
|
+
declare class UnifiedDecryptionUnsupportedError extends ZamaError {
|
|
20344
|
+
constructor(message: string, options?: ErrorOptions);
|
|
20345
|
+
}
|
|
20346
|
+
/**
|
|
20347
|
+
* The requested invalidation cutoff was not strictly later than the account's
|
|
20348
|
+
* current one. The ACL only ever moves the cutoff forward, so re-sending the
|
|
20349
|
+
* same or an older timestamp always reverts.
|
|
20350
|
+
*/
|
|
20351
|
+
declare class InvalidationTimestampTooLowError extends ZamaError {
|
|
20352
|
+
constructor(message: string, options?: ErrorOptions);
|
|
20353
|
+
}
|
|
20354
|
+
/**
|
|
20355
|
+
* The requested invalidation cutoff was in the future. The ACL refuses to
|
|
20356
|
+
* invalidate signatures that have not been produced yet.
|
|
20357
|
+
*/
|
|
20358
|
+
declare class InvalidationTimestampInFutureError extends ZamaError {
|
|
20359
|
+
constructor(message: string, options?: ErrorOptions);
|
|
20360
|
+
}
|
|
19977
20361
|
//#endregion
|
|
19978
20362
|
//#region src/errors/delegation.d.ts
|
|
19979
20363
|
/** Delegation cannot target self (delegate === msg.sender). */
|
|
@@ -20000,6 +20384,10 @@ declare class DelegationExpiryUnchangedError extends ZamaError {
|
|
|
20000
20384
|
declare class DelegationDelegateEqualsContractError extends ZamaError {
|
|
20001
20385
|
constructor(message: string, options?: ErrorOptions);
|
|
20002
20386
|
}
|
|
20387
|
+
/** Delegate address cannot be the wildcard address — it's only valid as `contractAddress`. */
|
|
20388
|
+
declare class DelegationDelegateCannotBeWildcardError extends ZamaError {
|
|
20389
|
+
constructor(message: string, options?: ErrorOptions);
|
|
20390
|
+
}
|
|
20003
20391
|
/** Contract address cannot be the sender address. */
|
|
20004
20392
|
declare class DelegationContractIsSelfError extends ZamaError {
|
|
20005
20393
|
constructor(message: string, options?: ErrorOptions);
|
|
@@ -20358,6 +20746,8 @@ interface ErrorForCode {
|
|
|
20358
20746
|
[ZamaErrorCode.DelegationExpiryUnchanged]: DelegationExpiryUnchangedError;
|
|
20359
20747
|
/** Thrown for {@link ZamaErrorCode.DelegationDelegateEqualsContract}. */
|
|
20360
20748
|
[ZamaErrorCode.DelegationDelegateEqualsContract]: DelegationDelegateEqualsContractError;
|
|
20749
|
+
/** Thrown for {@link ZamaErrorCode.DelegationDelegateCannotBeWildcard}. */
|
|
20750
|
+
[ZamaErrorCode.DelegationDelegateCannotBeWildcard]: DelegationDelegateCannotBeWildcardError;
|
|
20361
20751
|
/** Thrown for {@link ZamaErrorCode.DelegationContractIsSelf}. */
|
|
20362
20752
|
[ZamaErrorCode.DelegationContractIsSelf]: DelegationContractIsSelfError;
|
|
20363
20753
|
/** Thrown for {@link ZamaErrorCode.AclPaused}. */
|
|
@@ -20382,6 +20772,14 @@ interface ErrorForCode {
|
|
|
20382
20772
|
[ZamaErrorCode.PreparedPermitChainMismatch]: PreparedPermitChainMismatchError;
|
|
20383
20773
|
/** Thrown for {@link ZamaErrorCode.PreparedPermitExpired}. */
|
|
20384
20774
|
[ZamaErrorCode.PreparedPermitExpired]: PreparedPermitExpiredError;
|
|
20775
|
+
/** Thrown for {@link ZamaErrorCode.UnifiedPermitNotSupported}. */
|
|
20776
|
+
[ZamaErrorCode.UnifiedPermitNotSupported]: UnifiedPermitNotSupportedError;
|
|
20777
|
+
/** Thrown for {@link ZamaErrorCode.UnifiedDecryptionUnsupported}. */
|
|
20778
|
+
[ZamaErrorCode.UnifiedDecryptionUnsupported]: UnifiedDecryptionUnsupportedError;
|
|
20779
|
+
/** Thrown for {@link ZamaErrorCode.InvalidationTimestampTooLow}. */
|
|
20780
|
+
[ZamaErrorCode.InvalidationTimestampTooLow]: InvalidationTimestampTooLowError;
|
|
20781
|
+
/** Thrown for {@link ZamaErrorCode.InvalidationTimestampInFuture}. */
|
|
20782
|
+
[ZamaErrorCode.InvalidationTimestampInFuture]: InvalidationTimestampInFutureError;
|
|
20385
20783
|
/** Thrown for {@link ZamaErrorCode.UnshieldAlreadyFinalized}. */
|
|
20386
20784
|
[ZamaErrorCode.UnshieldAlreadyFinalized]: UnshieldAlreadyFinalizedError;
|
|
20387
20785
|
}
|
|
@@ -20436,21 +20834,29 @@ declare class Permits {
|
|
|
20436
20834
|
* rejection is preserved (already-signed chunks are persisted before the
|
|
20437
20835
|
* next prompt).
|
|
20438
20836
|
*
|
|
20439
|
-
* @
|
|
20837
|
+
* Pass {@link WILDCARD_PERMIT} instead of an address list to request a V2
|
|
20838
|
+
* permissive permit covering every contract, present and future — an
|
|
20839
|
+
* explicit opt-in, not something a large address list implies. A stolen
|
|
20840
|
+
* wildcard permit decrypts anything the signer owns until it expires, so
|
|
20841
|
+
* prefer a specific contract list unless the caller genuinely needs
|
|
20842
|
+
* unbounded coverage.
|
|
20843
|
+
*
|
|
20844
|
+
* @param contracts - Contract addresses to authorize, or {@link WILDCARD_PERMIT}.
|
|
20440
20845
|
* @throws if `transportKeyPairDerivationSecret` is configured and the keypair fails to wrap or
|
|
20441
20846
|
* unwrap. {@link KeyWrappingError}
|
|
20442
20847
|
*/
|
|
20443
|
-
grantPermit(contracts: Address[]): Promise<void>;
|
|
20848
|
+
grantPermit(contracts: Address[] | WildcardPermit): Promise<void>;
|
|
20444
20849
|
/**
|
|
20445
20850
|
* Sign and store an EIP-712 delegation permit authorizing decryption on
|
|
20446
|
-
* behalf of `delegator`. Same idempotence/chunking semantics as
|
|
20851
|
+
* behalf of `delegator`. Same idempotence/chunking/wildcard semantics as
|
|
20852
|
+
* {@link grantPermit}.
|
|
20447
20853
|
*
|
|
20448
20854
|
* @param delegator - The address that delegated decryption rights to the connected signer.
|
|
20449
|
-
* @param contracts - Contract addresses to authorize.
|
|
20855
|
+
* @param contracts - Contract addresses to authorize, or {@link WILDCARD_PERMIT}.
|
|
20450
20856
|
* @throws if `transportKeyPairDerivationSecret` is configured and the keypair fails to wrap or
|
|
20451
20857
|
* unwrap. {@link KeyWrappingError}
|
|
20452
20858
|
*/
|
|
20453
|
-
grantDelegationPermit(delegator: Address, contracts: Address[]): Promise<void>;
|
|
20859
|
+
grantDelegationPermit(delegator: Address, contracts: Address[] | WildcardPermit): Promise<void>;
|
|
20454
20860
|
/**
|
|
20455
20861
|
* Pure store lookup: is there a permit covering `contracts`?
|
|
20456
20862
|
* No wallet prompt, no transport key pair generation. Returns `false` when no signer
|
|
@@ -20498,7 +20904,8 @@ declare class Permits {
|
|
|
20498
20904
|
* (and `prepared.delegatorAddress`, if present), not a connected signer.
|
|
20499
20905
|
*
|
|
20500
20906
|
* @param prepared - The payload `sdk.offline.preparePermit` returned.
|
|
20501
|
-
* @param signature - The
|
|
20907
|
+
* @param signature - The `eth_signTypedData_v4` signature over `prepared.eip712`.
|
|
20908
|
+
* V2 permits also accept a variable-length ERC-1271 (smart-wallet) blob.
|
|
20502
20909
|
* @throws if `prepared` doesn't match the `PreparedPermit` shape (e.g. it crossed a
|
|
20503
20910
|
* process boundary and was corrupted). {@link ConfigurationError}
|
|
20504
20911
|
* @throws if the chain embedded in `prepared.eip712` doesn't match the active chain. {@link PreparedPermitChainMismatchError}
|
|
@@ -20566,10 +20973,32 @@ declare class Permits {
|
|
|
20566
20973
|
* unwrap. {@link KeyWrappingError}
|
|
20567
20974
|
*/
|
|
20568
20975
|
warmTransportKeyPairScope(scopeId: string): Promise<void>;
|
|
20976
|
+
/**
|
|
20977
|
+
* Invalidate every decryption signature signed before `timestamp`, via
|
|
20978
|
+
* `ACL.invalidateDecryptionSignaturesBefore`. The KMS Connector rejects
|
|
20979
|
+
* any decryption request whose permit predates the new cutoff — the
|
|
20980
|
+
* recourse when a permissive/wildcard permit or its signing key is
|
|
20981
|
+
* compromised, or on a multisig (ERC-1271/Safe) owner rotation. Call this
|
|
20982
|
+
* on every multisig signer rotation and on suspected signing-key compromise.
|
|
20983
|
+
*
|
|
20984
|
+
* On success, this signer's locally-stored permits for the current chain
|
|
20985
|
+
* are cleared automatically — they would now only fail against the KMS
|
|
20986
|
+
* Connector.
|
|
20987
|
+
*
|
|
20988
|
+
* @param timestamp - Oldest timestamp that remains valid. Omit to invalidate
|
|
20989
|
+
* everything up to now.
|
|
20990
|
+
* @throws if no signer is configured. {@link SignerNotConfiguredError}
|
|
20991
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
20992
|
+
* @throws if `timestamp` is not strictly later than the account's current
|
|
20993
|
+
* cutoff. {@link InvalidationTimestampTooLowError}
|
|
20994
|
+
* @throws if `timestamp` is in the future. {@link InvalidationTimestampInFutureError}
|
|
20995
|
+
* @throws if the invalidation transaction reverts for any other reason. {@link TransactionRevertedError}
|
|
20996
|
+
*/
|
|
20997
|
+
invalidateDecryptionSignatures(timestamp?: Date): Promise<TransactionResult>;
|
|
20569
20998
|
}
|
|
20570
20999
|
//#endregion
|
|
20571
21000
|
//#region src/services/delegation-service.d.ts
|
|
20572
|
-
/** Delegation activity and expiry, resolved from
|
|
21001
|
+
/** Delegation activity and expiry, resolved from the active contract or wildcard grant. */
|
|
20573
21002
|
interface DelegationStatus {
|
|
20574
21003
|
/** Whether the delegation is currently active (exists and not expired). */
|
|
20575
21004
|
isActive: boolean;
|
|
@@ -20602,7 +21031,8 @@ declare class Delegations {
|
|
|
20602
21031
|
* window with a bounded internal retry, so you can decrypt right after this
|
|
20603
21032
|
* resolves.
|
|
20604
21033
|
*
|
|
20605
|
-
* @param contractAddress - The confidential contract address to delegate on
|
|
21034
|
+
* @param contractAddress - The confidential contract address to delegate on, or
|
|
21035
|
+
* {@link WILDCARD_CONTRACT} to cover every contract with a single delegation.
|
|
20606
21036
|
* @param delegateAddress - Address to delegate decryption rights to.
|
|
20607
21037
|
* @param expirationDate - Optional expiration date (defaults to permanent delegation via `uint64.max`).
|
|
20608
21038
|
* @returns The transaction hash and mined receipt.
|
|
@@ -20610,6 +21040,7 @@ declare class Delegations {
|
|
|
20610
21040
|
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
20611
21041
|
* @throws if `expirationDate` is less than 1 hour in the future. {@link DelegationExpirationTooSoonError}
|
|
20612
21042
|
* @throws if the delegate equals the connected wallet. {@link DelegationSelfNotAllowedError}
|
|
21043
|
+
* @throws if the delegate is the wildcard address. {@link DelegationDelegateCannotBeWildcardError}
|
|
20613
21044
|
* @throws if the delegate equals the contract address. {@link DelegationDelegateEqualsContractError}
|
|
20614
21045
|
* @throws if the new expiry equals the current one. {@link DelegationExpiryUnchangedError}
|
|
20615
21046
|
* @throws if the delegation transaction reverts. {@link TransactionRevertedError}
|
|
@@ -20683,1192 +21114,1517 @@ declare class Delegations {
|
|
|
20683
21114
|
}): Promise<DelegationStatus>;
|
|
20684
21115
|
}
|
|
20685
21116
|
//#endregion
|
|
20686
|
-
//#region src/
|
|
21117
|
+
//#region src/query/utils.d.ts
|
|
21118
|
+
/** Union of TanStack Query option keys stripped by {@link filterQueryOptions}, leaving only domain parameters. */
|
|
21119
|
+
type StrippedQueryOptionKeys = "gcTime" | "staleTime" | "enabled" | "select" | "refetchInterval" | "refetchOnMount" | "refetchOnWindowFocus" | "refetchOnReconnect" | "retry" | "retryDelay" | "retryOnMount" | "queryFn" | "queryKey" | "queryKeyHashFn" | "initialData" | "initialDataUpdatedAt" | "placeholderData" | "structuralSharing" | "throwOnError" | "meta" | "query" | "pollingInterval";
|
|
20687
21120
|
/**
|
|
20688
|
-
*
|
|
20689
|
-
*
|
|
20690
|
-
*
|
|
20691
|
-
*
|
|
21121
|
+
* Remove TanStack behavioral options from a query config object so only domain
|
|
21122
|
+
* parameters remain for the lower-level factory.
|
|
21123
|
+
*
|
|
21124
|
+
* @example
|
|
21125
|
+
* ```ts
|
|
21126
|
+
* const params = filterQueryOptions({
|
|
21127
|
+
* query: { enabled: false },
|
|
21128
|
+
* gcTime: 60_000,
|
|
21129
|
+
* owner: "0xabc",
|
|
21130
|
+
* });
|
|
21131
|
+
* // => { owner: "0xabc" }
|
|
21132
|
+
* ```
|
|
20692
21133
|
*/
|
|
20693
|
-
declare
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
|
|
20699
|
-
|
|
20700
|
-
|
|
20701
|
-
|
|
20702
|
-
|
|
20703
|
-
|
|
20704
|
-
*
|
|
20705
|
-
* @remarks
|
|
20706
|
-
* `request.from` is only a declaration — the SDK does not prove the caller
|
|
20707
|
-
* controls it, and an EIP-1559 unsigned tx carries no `from` field at all
|
|
20708
|
-
* (the on-chain sender is whichever key signs the bytes). Point `from` at
|
|
20709
|
-
* the account the custodian will sign with; custodians enforce key-control
|
|
20710
|
-
* at sign time — a signing request for a key the credential can't use fails
|
|
20711
|
-
* there — so a mismatched `from` cannot make the custodian sign from an
|
|
20712
|
-
* account you don't control. Verifying control of `from` up front is still
|
|
20713
|
-
* the application's responsibility.
|
|
20714
|
-
*/
|
|
20715
|
-
prepare<K extends TransactionKind>(request: Extract<PrepareTransactionRequest, {
|
|
20716
|
-
kind: K;
|
|
20717
|
-
}>, options?: PrepareOptions): Promise<PreparedFor<K>>;
|
|
20718
|
-
/**
|
|
20719
|
-
* Build the offline-signing payload for a decryption permit: the unsigned
|
|
20720
|
-
* EIP-712 typed data plus everything `sdk.permits.registerPermit` needs to
|
|
20721
|
-
* verify and persist the signature an out-of-process signer returns for it.
|
|
20722
|
-
*
|
|
20723
|
-
* Not a `prepare()` transaction kind: a permit is not a transaction —
|
|
20724
|
-
* nothing is broadcast, and registering the signature is a local operation,
|
|
20725
|
-
* not a relayer round-trip.
|
|
20726
|
-
*
|
|
20727
|
-
* Signer-optional, like {@link prepare}: `request.signer` is an explicit
|
|
20728
|
-
* address, not a connected wallet account. Building the typed data still
|
|
20729
|
-
* reads the chain's KMS signers context on-chain — signer-offline, not
|
|
20730
|
-
* network-offline.
|
|
20731
|
-
*
|
|
20732
|
-
* One permit per call: unlike `sdk.permits.grantPermit`, this never widens
|
|
20733
|
-
* an existing permit or chunks over 10 contracts — `request.contracts` maps
|
|
20734
|
-
* to exactly one signature.
|
|
20735
|
-
*
|
|
20736
|
-
* @throws if `request.contracts` is empty or exceeds 10 addresses, `request.delegator`
|
|
20737
|
-
* equals `request.signer`, or `request.durationDays` exceeds the V1 permit maximum
|
|
20738
|
-
* of 365 days. {@link ConfigurationError}
|
|
20739
|
-
* @throws if a concurrent `permits.revokeTransportKeyPair()` rotates the transport key
|
|
20740
|
-
* pair while this call is generating one. {@link TransportKeyPairChangedError}
|
|
20741
|
-
*/
|
|
20742
|
-
preparePermit(request: PreparePermitRequest): Promise<PreparedPermit>;
|
|
20743
|
-
}
|
|
21134
|
+
declare function filterQueryOptions<TOptions extends Record<string, unknown>>(options: TOptions): Omit<TOptions, StrippedQueryOptionKeys>;
|
|
21135
|
+
/**
|
|
21136
|
+
* Stable hash function for query keys.
|
|
21137
|
+
* Sorts object keys recursively and converts bigint values to strings.
|
|
21138
|
+
*
|
|
21139
|
+
* @remarks
|
|
21140
|
+
* bigint values are serialized as decimal strings, so `42n` and `"42"` hash to
|
|
21141
|
+
* the same token when they occupy the same position. This collision is accepted
|
|
21142
|
+
* by design for the current query-key conventions in this package.
|
|
21143
|
+
*/
|
|
21144
|
+
declare function hashFn(queryKey: readonly unknown[]): string;
|
|
20744
21145
|
//#endregion
|
|
20745
|
-
//#region src/
|
|
20746
|
-
/**
|
|
20747
|
-
|
|
20748
|
-
|
|
20749
|
-
|
|
20750
|
-
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
20755
|
-
|
|
20756
|
-
|
|
20757
|
-
|
|
20758
|
-
|
|
20759
|
-
|
|
20760
|
-
|
|
20761
|
-
|
|
20762
|
-
maxConcurrency?: number;
|
|
20763
|
-
/** Called when decryption fails for a single token. Return a fallback bigint. */
|
|
20764
|
-
onError?: (error: Error, address: Address) => bigint;
|
|
21146
|
+
//#region src/query/factory-types.d.ts
|
|
21147
|
+
/**
|
|
21148
|
+
* TanStack Query options object returned by the SDK's `*QueryOptions` factories:
|
|
21149
|
+
* `QueryObserverOptions` with `queryKey` and `queryFn` required and the
|
|
21150
|
+
* cache-internal keys (`queryHash`, `queryKeyHashFn`, `throwOnError`) removed.
|
|
21151
|
+
*/
|
|
21152
|
+
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"> & {
|
|
21153
|
+
queryFn: Exclude<QueryObserverOptions<TQueryFnData, TError, TData, TQueryFnData, TQueryKey>["queryFn"], typeof skipToken | undefined>;
|
|
21154
|
+
};
|
|
21155
|
+
/** TanStack Query mutation options object returned by the SDK's `*MutationOptions` factories. */
|
|
21156
|
+
interface MutationFactoryOptions<TMutationKey extends readonly unknown[], TVariables, TData, TOnMutateResult = unknown> {
|
|
21157
|
+
/** Cache key identifying the mutation. */
|
|
21158
|
+
mutationKey: TMutationKey;
|
|
21159
|
+
/** Runs the mutation for the given variables. */
|
|
21160
|
+
mutationFn: (variables: TVariables) => Promise<TData>;
|
|
21161
|
+
/** Optional callback invoked after the mutation succeeds. */
|
|
21162
|
+
onSuccess?: (data: TData, variables: TVariables, onMutateResult: TOnMutateResult, context: MutationFunctionContext) => void;
|
|
20765
21163
|
}
|
|
20766
|
-
|
|
20767
|
-
|
|
20768
|
-
|
|
20769
|
-
|
|
20770
|
-
/**
|
|
20771
|
-
|
|
21164
|
+
//#endregion
|
|
21165
|
+
//#region src/query/signer-query-context.d.ts
|
|
21166
|
+
/** Connected-wallet context threaded into query factories to scope cache keys and gate signer-dependent queries. */
|
|
21167
|
+
interface SignerQueryContext {
|
|
21168
|
+
/** Connected wallet account; queries that need a signer stay disabled until it is set. */
|
|
21169
|
+
walletAccount?: WalletAccount;
|
|
20772
21170
|
}
|
|
21171
|
+
//#endregion
|
|
21172
|
+
//#region src/query/query-keys.d.ts
|
|
20773
21173
|
/**
|
|
20774
|
-
*
|
|
20775
|
-
* Hides FHE complexity (encryption, decryption, EIP-712 signing) behind
|
|
20776
|
-
* familiar ERC-20-like methods.
|
|
20777
|
-
*
|
|
20778
|
-
* For ERC-7984 wrappers (shield/unshield), use {@link WrappedToken} instead —
|
|
20779
|
-
* it extends `Token` with wrapper-specific operations.
|
|
21174
|
+
* Canonical query-key namespace for `@zama-fhe/sdk/query`.
|
|
20780
21175
|
*
|
|
20781
|
-
*
|
|
20782
|
-
*
|
|
20783
|
-
*
|
|
21176
|
+
* @example
|
|
21177
|
+
* ```ts
|
|
21178
|
+
* queryClient.invalidateQueries({
|
|
21179
|
+
* queryKey: zamaQueryKeys.confidentialBalance.token("0xToken"),
|
|
21180
|
+
* });
|
|
21181
|
+
* ```
|
|
20784
21182
|
*/
|
|
20785
|
-
declare
|
|
20786
|
-
|
|
20787
|
-
|
|
20788
|
-
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
|
|
20794
|
-
|
|
20795
|
-
|
|
20796
|
-
|
|
20797
|
-
|
|
20798
|
-
|
|
20799
|
-
|
|
20800
|
-
|
|
20801
|
-
|
|
20802
|
-
|
|
20803
|
-
|
|
20804
|
-
|
|
20805
|
-
|
|
20806
|
-
|
|
20807
|
-
|
|
20808
|
-
|
|
20809
|
-
|
|
20810
|
-
|
|
20811
|
-
|
|
20812
|
-
|
|
20813
|
-
|
|
20814
|
-
|
|
20815
|
-
|
|
20816
|
-
|
|
20817
|
-
|
|
20818
|
-
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
|
|
20828
|
-
|
|
20829
|
-
|
|
20830
|
-
|
|
20831
|
-
|
|
20832
|
-
|
|
20833
|
-
|
|
20834
|
-
|
|
20835
|
-
|
|
20836
|
-
|
|
20837
|
-
|
|
20838
|
-
|
|
20839
|
-
|
|
20840
|
-
|
|
20841
|
-
|
|
20842
|
-
|
|
20843
|
-
|
|
20844
|
-
|
|
20845
|
-
|
|
20846
|
-
|
|
20847
|
-
|
|
20848
|
-
|
|
20849
|
-
|
|
20850
|
-
|
|
20851
|
-
|
|
20852
|
-
|
|
20853
|
-
|
|
21183
|
+
declare const zamaQueryKeys: {
|
|
21184
|
+
readonly confidentialBalance: {
|
|
21185
|
+
readonly all: readonly ["zama.confidentialBalance"];
|
|
21186
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.confidentialBalance", {
|
|
21187
|
+
readonly tokenAddress: `0x${string}`;
|
|
21188
|
+
}];
|
|
21189
|
+
readonly owner: (tokenAddress: Address, owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalance", {
|
|
21190
|
+
readonly owner?: `0x${string}` | undefined;
|
|
21191
|
+
readonly walletAddress: `0x${string}`;
|
|
21192
|
+
readonly walletChainId: number;
|
|
21193
|
+
readonly tokenAddress: `0x${string}`;
|
|
21194
|
+
} | {
|
|
21195
|
+
readonly owner?: `0x${string}` | undefined;
|
|
21196
|
+
readonly walletAddress?: undefined;
|
|
21197
|
+
readonly walletChainId?: undefined;
|
|
21198
|
+
readonly tokenAddress: `0x${string}`;
|
|
21199
|
+
}];
|
|
21200
|
+
};
|
|
21201
|
+
readonly confidentialBalances: {
|
|
21202
|
+
readonly all: readonly ["zama.confidentialBalances"];
|
|
21203
|
+
readonly tokens: (tokenAddresses: Address[], owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalances", {
|
|
21204
|
+
readonly owner?: `0x${string}` | undefined;
|
|
21205
|
+
readonly walletAddress: `0x${string}`;
|
|
21206
|
+
readonly walletChainId: number;
|
|
21207
|
+
readonly tokenAddresses: `0x${string}`[];
|
|
21208
|
+
} | {
|
|
21209
|
+
readonly owner?: `0x${string}` | undefined;
|
|
21210
|
+
readonly walletAddress?: undefined;
|
|
21211
|
+
readonly walletChainId?: undefined;
|
|
21212
|
+
readonly tokenAddresses: `0x${string}`[];
|
|
21213
|
+
}];
|
|
21214
|
+
};
|
|
21215
|
+
readonly tokenMetadata: {
|
|
21216
|
+
readonly all: readonly ["zama.tokenMetadata"];
|
|
21217
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.tokenMetadata", {
|
|
21218
|
+
readonly tokenAddress: `0x${string}`;
|
|
21219
|
+
}];
|
|
21220
|
+
};
|
|
21221
|
+
readonly isConfidential: {
|
|
21222
|
+
readonly all: readonly ["zama.isConfidential"];
|
|
21223
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.isConfidential", {
|
|
21224
|
+
readonly tokenAddress: `0x${string}`;
|
|
21225
|
+
}];
|
|
21226
|
+
};
|
|
21227
|
+
readonly isWrapper: {
|
|
21228
|
+
readonly all: readonly ["zama.isWrapper"];
|
|
21229
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.isWrapper", {
|
|
21230
|
+
readonly tokenAddress: `0x${string}`;
|
|
21231
|
+
}];
|
|
21232
|
+
};
|
|
21233
|
+
readonly wrapperDiscovery: {
|
|
21234
|
+
readonly all: readonly ["zama.wrapperDiscovery"];
|
|
21235
|
+
readonly token: (tokenAddress?: Address, erc20Address?: Address, registryAddress?: Address) => readonly ["zama.wrapperDiscovery", {
|
|
21236
|
+
readonly registryAddress?: `0x${string}` | undefined;
|
|
21237
|
+
readonly erc20Address?: `0x${string}` | undefined;
|
|
21238
|
+
readonly tokenAddress?: `0x${string}` | undefined;
|
|
21239
|
+
}];
|
|
21240
|
+
};
|
|
21241
|
+
readonly underlyingAllowance: {
|
|
21242
|
+
readonly all: readonly ["zama.underlyingAllowance"];
|
|
21243
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.underlyingAllowance", {
|
|
21244
|
+
readonly tokenAddress: `0x${string}`;
|
|
21245
|
+
}];
|
|
21246
|
+
readonly scope: (tokenAddress: Address, owner?: Address) => readonly ["zama.underlyingAllowance", {
|
|
21247
|
+
readonly owner?: `0x${string}` | undefined;
|
|
21248
|
+
readonly tokenAddress: `0x${string}`;
|
|
21249
|
+
}];
|
|
21250
|
+
};
|
|
21251
|
+
readonly confidentialIsOperator: {
|
|
21252
|
+
readonly all: readonly ["zama.confidentialIsOperator"];
|
|
21253
|
+
readonly token: (tokenAddress?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
21254
|
+
tokenAddress: `0x${string}`;
|
|
21255
|
+
} | {
|
|
21256
|
+
tokenAddress?: undefined;
|
|
21257
|
+
}];
|
|
21258
|
+
readonly scope: (tokenAddress?: Address, holder?: Address, spender?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
21259
|
+
readonly spender?: `0x${string}` | undefined;
|
|
21260
|
+
readonly holder?: `0x${string}` | undefined;
|
|
21261
|
+
readonly tokenAddress?: `0x${string}` | undefined;
|
|
21262
|
+
}];
|
|
21263
|
+
};
|
|
21264
|
+
readonly totalSupply: {
|
|
21265
|
+
readonly all: readonly ["zama.totalSupply"];
|
|
21266
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.totalSupply", {
|
|
21267
|
+
readonly tokenAddress: `0x${string}`;
|
|
21268
|
+
}];
|
|
21269
|
+
};
|
|
21270
|
+
readonly pendingUnshield: {
|
|
21271
|
+
readonly all: readonly ["zama.pendingUnshield"];
|
|
21272
|
+
readonly token: (tokenAddress: Address) => readonly ["zama.pendingUnshield", {
|
|
21273
|
+
readonly tokenAddress: `0x${string}`;
|
|
21274
|
+
}];
|
|
21275
|
+
};
|
|
21276
|
+
readonly hasPermit: {
|
|
21277
|
+
readonly all: readonly ["zama.hasPermit"];
|
|
21278
|
+
readonly scope: (contractAddresses: Address[], walletAccount?: WalletAccount) => readonly ["zama.hasPermit", {
|
|
21279
|
+
readonly contractAddresses: `0x${string}`[];
|
|
21280
|
+
readonly walletAddress: `0x${string}`;
|
|
21281
|
+
readonly walletChainId: number;
|
|
21282
|
+
} | {
|
|
21283
|
+
readonly contractAddresses: `0x${string}`[];
|
|
21284
|
+
readonly walletAddress?: undefined;
|
|
21285
|
+
readonly walletChainId?: undefined;
|
|
21286
|
+
}];
|
|
21287
|
+
};
|
|
21288
|
+
readonly delegationStatus: {
|
|
21289
|
+
readonly all: readonly ["zama.delegationStatus"];
|
|
21290
|
+
readonly contract: (contractAddress?: Address) => readonly ["zama.delegationStatus", {
|
|
21291
|
+
contractAddress: `0x${string}`;
|
|
21292
|
+
} | {
|
|
21293
|
+
contractAddress?: undefined;
|
|
21294
|
+
}];
|
|
21295
|
+
readonly scope: (contractAddress?: Address, delegator?: Address, delegate?: Address) => readonly ["zama.delegationStatus", {
|
|
21296
|
+
readonly delegateAddress?: `0x${string}` | undefined;
|
|
21297
|
+
readonly delegatorAddress?: `0x${string}` | undefined;
|
|
21298
|
+
readonly contractAddress?: `0x${string}` | undefined;
|
|
21299
|
+
}];
|
|
21300
|
+
};
|
|
21301
|
+
readonly decryption: {
|
|
21302
|
+
readonly all: readonly ["zama.decryption"];
|
|
21303
|
+
readonly encryptedValue: (encryptedValue: string, contractAddress?: Address) => readonly ["zama.decryption", {
|
|
21304
|
+
readonly contractAddress?: `0x${string}` | undefined;
|
|
21305
|
+
readonly encryptedValue: string;
|
|
21306
|
+
}];
|
|
21307
|
+
readonly encryptedInputs: (encryptedInputs: readonly {
|
|
21308
|
+
encryptedValue: string;
|
|
21309
|
+
contractAddress: Address;
|
|
21310
|
+
}[], walletAccount?: WalletAccount) => readonly ["zama.decryption", {
|
|
21311
|
+
readonly encryptedInputs: {
|
|
21312
|
+
encryptedValue: Hex;
|
|
21313
|
+
contractAddress: `0x${string}`;
|
|
21314
|
+
}[];
|
|
21315
|
+
readonly walletAddress: `0x${string}`;
|
|
21316
|
+
readonly walletChainId: number;
|
|
21317
|
+
} | {
|
|
21318
|
+
readonly encryptedInputs: {
|
|
21319
|
+
encryptedValue: Hex;
|
|
21320
|
+
contractAddress: `0x${string}`;
|
|
21321
|
+
}[];
|
|
21322
|
+
readonly walletAddress?: undefined;
|
|
21323
|
+
readonly walletChainId?: undefined;
|
|
21324
|
+
}];
|
|
21325
|
+
};
|
|
21326
|
+
readonly wrappersRegistry: {
|
|
21327
|
+
readonly all: readonly ["zama.wrappersRegistry"];
|
|
21328
|
+
readonly chainId: () => readonly ["zama.wrappersRegistry", {
|
|
21329
|
+
readonly type: "chainId";
|
|
21330
|
+
}];
|
|
21331
|
+
readonly tokenPairs: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21332
|
+
readonly type: "tokenPairs";
|
|
21333
|
+
readonly registryAddress: `0x${string}`;
|
|
21334
|
+
}];
|
|
21335
|
+
readonly confidentialTokenAddress: (registryAddress: Address, tokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21336
|
+
readonly type: "confidentialTokenAddress";
|
|
21337
|
+
readonly registryAddress: `0x${string}`;
|
|
21338
|
+
readonly tokenAddress: `0x${string}`;
|
|
21339
|
+
}];
|
|
21340
|
+
readonly tokenAddress: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21341
|
+
readonly type: "tokenAddress";
|
|
21342
|
+
readonly registryAddress: `0x${string}`;
|
|
21343
|
+
readonly confidentialTokenAddress: `0x${string}`;
|
|
21344
|
+
}];
|
|
21345
|
+
readonly tokenPairsLength: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21346
|
+
readonly type: "tokenPairsLength";
|
|
21347
|
+
readonly registryAddress: `0x${string}`;
|
|
21348
|
+
}];
|
|
21349
|
+
readonly tokenPairsSlice: (registryAddress: Address, fromIndex: string, toIndex: string) => readonly ["zama.wrappersRegistry", {
|
|
21350
|
+
readonly type: "tokenPairsSlice";
|
|
21351
|
+
readonly registryAddress: `0x${string}`;
|
|
21352
|
+
readonly fromIndex: string;
|
|
21353
|
+
readonly toIndex: string;
|
|
21354
|
+
}];
|
|
21355
|
+
readonly tokenPair: (registryAddress: Address, index: string) => readonly ["zama.wrappersRegistry", {
|
|
21356
|
+
readonly type: "tokenPair";
|
|
21357
|
+
readonly registryAddress: `0x${string}`;
|
|
21358
|
+
readonly index: string;
|
|
21359
|
+
}];
|
|
21360
|
+
readonly isConfidentialTokenValid: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21361
|
+
readonly type: "isConfidentialTokenValid";
|
|
21362
|
+
readonly registryAddress: `0x${string}`;
|
|
21363
|
+
readonly confidentialTokenAddress: `0x${string}`;
|
|
21364
|
+
}];
|
|
21365
|
+
readonly listPairs: (registryAddress: Address, page: number, pageSize: number, metadata: boolean) => readonly ["zama.wrappersRegistry", {
|
|
21366
|
+
readonly type: "listPairs";
|
|
21367
|
+
readonly registryAddress: `0x${string}`;
|
|
21368
|
+
readonly page: number;
|
|
21369
|
+
readonly pageSize: number;
|
|
21370
|
+
readonly metadata: boolean;
|
|
21371
|
+
}];
|
|
21372
|
+
};
|
|
21373
|
+
};
|
|
21374
|
+
//#endregion
|
|
21375
|
+
//#region src/query/invalidation.d.ts
|
|
21376
|
+
/** Minimal query shape read by the invalidation predicates. */
|
|
21377
|
+
interface QueryLike {
|
|
21378
|
+
/** The query's cache key. */
|
|
21379
|
+
queryKey: readonly unknown[];
|
|
21380
|
+
}
|
|
21381
|
+
/** Minimal filter shape accepted by the invalidation helpers, matching TanStack Query's `QueryFilters`. */
|
|
21382
|
+
interface QueryFilterLike {
|
|
21383
|
+
/** Match queries whose key starts with this prefix. */
|
|
21384
|
+
queryKey?: readonly unknown[];
|
|
21385
|
+
/** Match queries for which this returns `true`. */
|
|
21386
|
+
predicate?: (query: QueryLike) => boolean;
|
|
21387
|
+
}
|
|
21388
|
+
/** Minimal `QueryClient` surface used by the invalidation helpers. */
|
|
21389
|
+
interface QueryClientLike {
|
|
21390
|
+
/** Mark matching queries stale so they refetch. */
|
|
21391
|
+
invalidateQueries(filters: QueryFilterLike): void | Promise<void>;
|
|
21392
|
+
/** Remove matching queries from the cache entirely. */
|
|
21393
|
+
removeQueries(filters: QueryFilterLike): void;
|
|
21394
|
+
}
|
|
21395
|
+
/** Invalidates the caches affected by an unwrap: confidential balances, underlying allowance, and pending unshields. */
|
|
21396
|
+
declare function invalidateAfterUnwrap(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21397
|
+
/** Invalidates the caches affected by a wrap: confidential balances and underlying allowance. */
|
|
21398
|
+
declare function invalidateAfterWrap(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21399
|
+
/** Invalidates the confidential balance queries for a token (single-token and batched). */
|
|
21400
|
+
declare function invalidateBalanceQueries(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21401
|
+
/** Invalidates the caches affected by a shield: confidential balances and underlying allowance. */
|
|
21402
|
+
declare function invalidateAfterShield(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21403
|
+
/** Invalidates the caches affected by an unshield request: confidential balances, underlying allowance, and pending unshields. */
|
|
21404
|
+
declare function invalidateAfterUnshield(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21405
|
+
/** Invalidates the pending-unshield cache once an unshield has settled on-chain. */
|
|
21406
|
+
declare function invalidateAfterUnshieldSettled(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21407
|
+
/** Invalidates the confidential balance caches affected by a transfer. */
|
|
21408
|
+
declare function invalidateAfterTransfer(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21409
|
+
/** Invalidates the underlying-allowance cache after approving the underlying ERC-20. */
|
|
21410
|
+
declare function invalidateAfterApproveUnderlying(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21411
|
+
/** Invalidates the operator-status cache after changing a token operator. */
|
|
21412
|
+
declare function invalidateAfterSetOperator(queryClient: QueryClientLike, tokenAddress: Address): void;
|
|
21413
|
+
/** Invalidates any wagmi `useBalance`/`readContract` balance queries so ERC-20 balances refresh. */
|
|
21414
|
+
declare function invalidateWagmiBalanceQueries(queryClient: QueryClientLike): void;
|
|
21415
|
+
/** Clears wallet-local caches (decryption, permits) and invalidates all Zama queries — call on wallet connect/disconnect so a stale entitlement can't leak across accounts. */
|
|
21416
|
+
declare function invalidateWalletLifecycleQueries(queryClient: QueryClientLike): void;
|
|
21417
|
+
//#endregion
|
|
21418
|
+
//#region src/query/token-metadata.d.ts
|
|
21419
|
+
/** ERC-20 token metadata returned by {@link tokenMetadataQueryOptions}. */
|
|
21420
|
+
interface TokenMetadata {
|
|
21421
|
+
/** Human-readable token name. */
|
|
21422
|
+
name: string;
|
|
21423
|
+
/** Token ticker symbol. */
|
|
21424
|
+
symbol: string;
|
|
21425
|
+
/** Number of decimals the token uses. */
|
|
21426
|
+
decimals: number;
|
|
21427
|
+
}
|
|
21428
|
+
/** Configuration for {@link tokenMetadataQueryOptions}. */
|
|
21429
|
+
interface TokenMetadataQueryConfig {
|
|
21430
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21431
|
+
query?: Record<string, unknown>;
|
|
21432
|
+
}
|
|
21433
|
+
/** Builds TanStack Query options for reading an ERC-20 token's name, symbol, and decimals. */
|
|
21434
|
+
declare function tokenMetadataQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: TokenMetadataQueryConfig): QueryFactoryOptions<TokenMetadata, Error, TokenMetadata, ReturnType<typeof zamaQueryKeys.tokenMetadata.token>>;
|
|
21435
|
+
//#endregion
|
|
21436
|
+
//#region src/query/is-confidential.d.ts
|
|
21437
|
+
/** Configuration for {@link isConfidentialQueryOptions} and {@link isWrapperQueryOptions}. */
|
|
21438
|
+
interface IsConfidentialQueryConfig {
|
|
21439
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21440
|
+
query?: Record<string, unknown>;
|
|
21441
|
+
}
|
|
21442
|
+
/** Builds TanStack Query options for reading whether a token address implements the confidential (ERC-7984) token interface. */
|
|
21443
|
+
declare function isConfidentialQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isConfidential.token>>;
|
|
21444
|
+
/** Builds TanStack Query options for reading whether a token address is a confidential wrapper (ERC-7984 wrapper) contract. */
|
|
21445
|
+
declare function isWrapperQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: IsConfidentialQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.isWrapper.token>>;
|
|
21446
|
+
//#endregion
|
|
21447
|
+
//#region src/query/total-supply.d.ts
|
|
21448
|
+
/** Configuration for {@link totalSupplyQueryOptions}. */
|
|
21449
|
+
interface TotalSupplyQueryConfig {
|
|
21450
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21451
|
+
query?: Record<string, unknown>;
|
|
21452
|
+
}
|
|
21453
|
+
/** Builds TanStack Query options for reading a token's total supply. */
|
|
21454
|
+
declare function totalSupplyQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: TotalSupplyQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.totalSupply.token>>;
|
|
21455
|
+
//#endregion
|
|
21456
|
+
//#region src/wrappers-registry.d.ts
|
|
21457
|
+
/**
|
|
21458
|
+
* Default wrappers registry addresses for known chains.
|
|
21459
|
+
* Only includes chains where a registry is deployed (excludes Hardhat).
|
|
21460
|
+
*
|
|
21461
|
+
* @deprecated Read `registryAddress` from the chain presets instead (e.g.
|
|
21462
|
+
* `sepolia.registryAddress`). Will be removed in the next major version.
|
|
21463
|
+
*/
|
|
21464
|
+
declare const DefaultRegistryAddresses: Record<number, Address>;
|
|
21465
|
+
/** Configuration for {@link WrappersRegistry}. */
|
|
21466
|
+
interface WrappersRegistryConfig {
|
|
21467
|
+
/** Read-only chain provider used for every registry lookup. */
|
|
21468
|
+
provider: GenericProvider;
|
|
21469
|
+
/**
|
|
21470
|
+
* Per-chain registry address overrides, merged on top of
|
|
21471
|
+
* {@link DefaultRegistryAddresses}. Use this to supply a registry
|
|
21472
|
+
* address for custom or local chains (e.g. Hardhat).
|
|
20854
21473
|
*
|
|
20855
21474
|
* @example
|
|
20856
21475
|
* ```ts
|
|
20857
|
-
*
|
|
20858
|
-
*
|
|
21476
|
+
* new WrappersRegistry({
|
|
21477
|
+
* provider,
|
|
21478
|
+
* registryAddresses: { [31337]: "0xYourHardhatRegistry" },
|
|
20859
21479
|
* });
|
|
20860
21480
|
* ```
|
|
20861
21481
|
*/
|
|
20862
|
-
|
|
20863
|
-
delegatorAddress: Address;
|
|
20864
|
-
accountAddress?: Address;
|
|
20865
|
-
}): Promise<bigint>;
|
|
21482
|
+
registryAddresses?: Record<number, Address>;
|
|
20866
21483
|
/**
|
|
20867
|
-
*
|
|
20868
|
-
*
|
|
20869
|
-
* addresses in a single wallet signature, then delegates each decrypt to
|
|
20870
|
-
* `sdk.decryption.decryptValues`.
|
|
20871
|
-
*
|
|
20872
|
-
* Tokens that fail to decrypt land in `errors`; the batch keeps going.
|
|
20873
|
-
*
|
|
20874
|
-
* @param tokens - Array of {@link Token} instances bound to the same SDK.
|
|
20875
|
-
* @param owner - Balance owner address.
|
|
20876
|
-
* @returns `{ results, errors }` partitioning the per-token outcomes.
|
|
20877
|
-
* @throws A failure that affects the whole session (rejected signature,
|
|
20878
|
-
* misconfiguration, RPC rate limit, key unwrapping failure, revoked KMS
|
|
20879
|
-
* context) rejects the call instead of landing in `errors`.
|
|
20880
|
-
*
|
|
20881
|
-
* @example
|
|
20882
|
-
* ```ts
|
|
20883
|
-
* const { results, errors } = await Token.batchBalancesOf(tokens, owner);
|
|
20884
|
-
* ```
|
|
21484
|
+
* How long cached registry results remain valid, in seconds.
|
|
21485
|
+
* Default: `86400` (24 hours).
|
|
20885
21486
|
*/
|
|
20886
|
-
|
|
21487
|
+
registryTTL?: number;
|
|
21488
|
+
}
|
|
21489
|
+
/** Options for {@link WrappersRegistry.listPairs}. */
|
|
21490
|
+
interface ListPairsOptions {
|
|
21491
|
+
/** Page number (1-indexed). Default: `1`. */
|
|
21492
|
+
page?: number;
|
|
21493
|
+
/** Number of items per page. Default: `100`. */
|
|
21494
|
+
pageSize?: number;
|
|
20887
21495
|
/**
|
|
20888
|
-
*
|
|
20889
|
-
*
|
|
20890
|
-
*
|
|
20891
|
-
* **Error handling:** If a per-token decryption fails and no `onError` callback
|
|
20892
|
-
* is provided, errors are collected and thrown as an aggregated
|
|
20893
|
-
* `DecryptionFailedError`. When the relayer returns no value for an encrypted value,
|
|
20894
|
-
* a `DecryptionFailedError` is thrown for that token (never silently returns `0n`).
|
|
20895
|
-
* Pass `onError: () => 0n` to opt into the silent zero behavior.
|
|
20896
|
-
*
|
|
20897
|
-
* @param tokens - Array of Token instances to decrypt balances for.
|
|
20898
|
-
* @param options - Delegated decryption configuration.
|
|
20899
|
-
* @returns A Map from token address to decrypted balance.
|
|
20900
|
-
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
20901
|
-
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
20902
|
-
* @throws if any decryption fails and no `onError` is provided. {@link DecryptionFailedError}
|
|
20903
|
-
* @throws A failure that affects the whole session (rejected signature, RPC
|
|
20904
|
-
* rate limit, revoked KMS context) rejects the call even when `onError` is
|
|
20905
|
-
* provided.
|
|
20906
|
-
*
|
|
20907
|
-
* @example
|
|
20908
|
-
* ```ts
|
|
20909
|
-
* const balances = await Token.batchDecryptBalancesAs(tokens, {
|
|
20910
|
-
* delegatorAddress: "0xDelegator",
|
|
20911
|
-
* onError: (err, addr) => { console.error(addr, err); return 0n; },
|
|
20912
|
-
* });
|
|
20913
|
-
* ```
|
|
21496
|
+
* When `true`, fetches on-chain metadata (name, symbol, decimals) for both
|
|
21497
|
+
* the ERC-20 and confidential token, plus totalSupply for the ERC-20.
|
|
21498
|
+
* Default: `false`.
|
|
20914
21499
|
*/
|
|
20915
|
-
|
|
20916
|
-
|
|
21500
|
+
metadata?: boolean;
|
|
21501
|
+
}
|
|
21502
|
+
/**
|
|
21503
|
+
* High-level interface for the on-chain token wrappers registry.
|
|
21504
|
+
*
|
|
21505
|
+
* Uses the configured {@link GenericProvider} to resolve the correct registry
|
|
21506
|
+
* contract address for the current chain and exposes typed read helpers for
|
|
21507
|
+
* every registry query. Results are cached in memory with a configurable TTL
|
|
21508
|
+
* (default 24 hours).
|
|
21509
|
+
*
|
|
21510
|
+
* @example
|
|
21511
|
+
* ```ts
|
|
21512
|
+
* const registry = new WrappersRegistry({ provider });
|
|
21513
|
+
*
|
|
21514
|
+
* // Paginated listing
|
|
21515
|
+
* const page1 = await registry.listPairs({ page: 1, pageSize: 20 });
|
|
21516
|
+
*
|
|
21517
|
+
* // Structured lookups
|
|
21518
|
+
* const result = await registry.getConfidentialToken(erc20Address);
|
|
21519
|
+
* if (result) console.log(result.confidentialTokenAddress);
|
|
21520
|
+
*
|
|
21521
|
+
* // Force refresh
|
|
21522
|
+
* registry.refresh();
|
|
21523
|
+
* ```
|
|
21524
|
+
*/
|
|
21525
|
+
declare class WrappersRegistry {
|
|
21526
|
+
#private;
|
|
21527
|
+
/** Read-only chain access used for registry contract reads. */
|
|
21528
|
+
readonly provider: GenericProvider;
|
|
21529
|
+
constructor(config: WrappersRegistryConfig);
|
|
20917
21530
|
/**
|
|
20918
|
-
*
|
|
20919
|
-
*
|
|
20920
|
-
* By default, the SDK validates the confidential balance before submitting.
|
|
20921
|
-
* If a cached plaintext balance exists it is used; otherwise, if credentials
|
|
20922
|
-
* are cached, it decrypts on the fly. Set `skipBalanceCheck: true` to bypass
|
|
20923
|
-
* this validation (e.g. for smart wallets).
|
|
20924
|
-
*
|
|
20925
|
-
* @param to - Recipient address.
|
|
20926
|
-
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
20927
|
-
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
20928
|
-
* @returns The transaction hash and mined receipt.
|
|
20929
|
-
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
20930
|
-
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
20931
|
-
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
20932
|
-
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
20933
|
-
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
20934
|
-
*
|
|
20935
|
-
* @example
|
|
20936
|
-
* ```ts
|
|
20937
|
-
* const txHash = await token.confidentialTransfer("0xRecipient", 1000n);
|
|
20938
|
-
* ```
|
|
21531
|
+
* Synchronous lookup of the registry address for a given chain ID.
|
|
21532
|
+
* Returns `undefined` if no address is configured for that chain.
|
|
20939
21533
|
*/
|
|
20940
|
-
|
|
21534
|
+
getAddress(chainId: number): Address | undefined;
|
|
20941
21535
|
/**
|
|
20942
|
-
*
|
|
20943
|
-
*
|
|
20944
|
-
*
|
|
20945
|
-
* @param from - The address to transfer from (caller must be an approved operator).
|
|
20946
|
-
* @param to - Recipient address.
|
|
20947
|
-
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
20948
|
-
* @returns The transaction hash and mined receipt.
|
|
20949
|
-
*
|
|
20950
|
-
* @example
|
|
20951
|
-
* ```ts
|
|
20952
|
-
* const txHash = await token.confidentialTransferFrom("0xFrom", "0xTo", 500n);
|
|
20953
|
-
* ```
|
|
21536
|
+
* Force-invalidate the in-memory cache. The next call to any read method
|
|
21537
|
+
* will fetch fresh data from the chain.
|
|
20954
21538
|
*/
|
|
20955
|
-
|
|
21539
|
+
refresh(): void;
|
|
20956
21540
|
/**
|
|
20957
|
-
*
|
|
20958
|
-
*
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
*
|
|
20963
|
-
*
|
|
20964
|
-
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
20965
|
-
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
20966
|
-
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
20967
|
-
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
20968
|
-
* @returns The transaction hash and mined receipt.
|
|
21541
|
+
* The cache TTL in milliseconds.
|
|
21542
|
+
* Exposed so query option factories can set a matching `staleTime`.
|
|
21543
|
+
*/
|
|
21544
|
+
get ttlMs(): number;
|
|
21545
|
+
/**
|
|
21546
|
+
* Resolve the registry contract address for the current chain.
|
|
20969
21547
|
*
|
|
20970
|
-
*
|
|
20971
|
-
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
20972
|
-
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
20973
|
-
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
20974
|
-
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
21548
|
+
* Priority: `registryAddresses[chainId]` \> built-in default.
|
|
20975
21549
|
*
|
|
20976
|
-
* @
|
|
20977
|
-
*
|
|
20978
|
-
* const txHash = await token.confidentialTransferAndCall(
|
|
20979
|
-
* "0xRecipient",
|
|
20980
|
-
* 1000n,
|
|
20981
|
-
* "0xabcd", // caller-encoded payload forwarded to the receiver hook
|
|
20982
|
-
* );
|
|
20983
|
-
* ```
|
|
21550
|
+
* @returns The registry contract address for the connected chain.
|
|
21551
|
+
* @throws if no address is configured for the chain. {@link ConfigurationError}
|
|
20984
21552
|
*/
|
|
20985
|
-
|
|
21553
|
+
getRegistryAddress(): Promise<Address>;
|
|
20986
21554
|
/**
|
|
20987
|
-
*
|
|
20988
|
-
* transfer that also invokes the recipient's receiver hook in a single
|
|
20989
|
-
* transaction. The caller must be an approved operator for `from` and crafts
|
|
20990
|
-
* the opaque `data` payload — the SDK does not encode or interpret it.
|
|
21555
|
+
* List token wrapper pairs with page-based pagination.
|
|
20991
21556
|
*
|
|
20992
|
-
*
|
|
20993
|
-
*
|
|
20994
|
-
* @param
|
|
20995
|
-
* @
|
|
20996
|
-
* @param callbacks - Optional progress callbacks.
|
|
20997
|
-
* @returns The transaction hash and mined receipt.
|
|
21557
|
+
* Internally maps to `getTokenConfidentialTokenPairsSlice` on-chain.
|
|
21558
|
+
*
|
|
21559
|
+
* @param options - Pagination and enrichment options.
|
|
21560
|
+
* @returns A {@link PaginatedResult} of pairs.
|
|
20998
21561
|
*
|
|
20999
21562
|
* @example
|
|
21000
21563
|
* ```ts
|
|
21001
|
-
* const
|
|
21002
|
-
*
|
|
21003
|
-
*
|
|
21004
|
-
*
|
|
21005
|
-
*
|
|
21006
|
-
* )
|
|
21564
|
+
* const result = await registry.listPairs({ page: 1, pageSize: 20 });
|
|
21565
|
+
* console.log(`${result.total} pairs, showing page ${result.page}`);
|
|
21566
|
+
*
|
|
21567
|
+
* // With on-chain metadata
|
|
21568
|
+
* const withMeta = await registry.listPairs({ metadata: true, pageSize: 10 });
|
|
21569
|
+
* for (const pair of withMeta.items) {
|
|
21570
|
+
* console.log(pair.underlying.symbol, "→", pair.confidential.symbol);
|
|
21571
|
+
* }
|
|
21007
21572
|
* ```
|
|
21008
21573
|
*/
|
|
21009
|
-
|
|
21574
|
+
listPairs(options: ListPairsOptions & {
|
|
21575
|
+
metadata: true;
|
|
21576
|
+
}): Promise<PaginatedResult<TokenWrapperPairWithMetadata>>;
|
|
21577
|
+
/** Lists registered underlying/confidential token pairs; pass `{ metadata: true }` to include on-chain token metadata. */
|
|
21578
|
+
listPairs(options?: ListPairsOptions): Promise<PaginatedResult<TokenWrapperPair>>;
|
|
21010
21579
|
/**
|
|
21011
|
-
*
|
|
21012
|
-
* Defaults to 1 hour from now if `until` is not specified.
|
|
21580
|
+
* Look up the confidential token for a given plain ERC-20 address.
|
|
21013
21581
|
*
|
|
21014
|
-
* @param
|
|
21015
|
-
* @
|
|
21016
|
-
*
|
|
21582
|
+
* @param tokenAddress - The plain ERC-20 token address.
|
|
21583
|
+
* @returns The lookup result, or `null` if the token has never been registered.
|
|
21584
|
+
* **Note:** revoked tokens (registered then invalidated) return a non-null result
|
|
21585
|
+
* with `isValid: false`. Check `result.isValid` explicitly rather than using
|
|
21586
|
+
* `if (result)` to guard against processing revoked tokens.
|
|
21017
21587
|
*
|
|
21018
21588
|
* @example
|
|
21019
21589
|
* ```ts
|
|
21020
|
-
* const
|
|
21590
|
+
* const result = await registry.getConfidentialToken(usdcAddress);
|
|
21591
|
+
* if (result?.isValid) {
|
|
21592
|
+
* console.log(result.confidentialTokenAddress);
|
|
21593
|
+
* }
|
|
21021
21594
|
* ```
|
|
21022
21595
|
*/
|
|
21023
|
-
|
|
21596
|
+
getConfidentialToken(tokenAddress: Address): Promise<{
|
|
21597
|
+
confidentialTokenAddress: Address;
|
|
21598
|
+
isValid: boolean;
|
|
21599
|
+
} | null>;
|
|
21024
21600
|
/**
|
|
21025
|
-
*
|
|
21601
|
+
* Reverse lookup — find the plain ERC-20 for a given confidential token.
|
|
21026
21602
|
*
|
|
21027
|
-
* @param
|
|
21028
|
-
* @
|
|
21029
|
-
* @returns `true` if the spender is an approved operator for the holder.
|
|
21603
|
+
* @param confidentialTokenAddress - The confidential token address.
|
|
21604
|
+
* @returns The lookup result, or `null` if no pair is registered.
|
|
21030
21605
|
*
|
|
21031
21606
|
* @example
|
|
21032
21607
|
* ```ts
|
|
21033
|
-
*
|
|
21034
|
-
*
|
|
21608
|
+
* const result = await registry.getUnderlyingToken(cUsdcAddress);
|
|
21609
|
+
* if (result) {
|
|
21610
|
+
* console.log(result.tokenAddress, result.isValid);
|
|
21035
21611
|
* }
|
|
21036
21612
|
* ```
|
|
21037
21613
|
*/
|
|
21038
|
-
|
|
21039
|
-
|
|
21040
|
-
|
|
21041
|
-
}
|
|
21042
|
-
//#endregion
|
|
21043
|
-
//#region src/token/wrapped-token.d.ts
|
|
21044
|
-
/**
|
|
21045
|
-
* Confidential ERC-20 wrapper (ERC-7984 ERC20Wrapper).
|
|
21046
|
-
*
|
|
21047
|
-
* Extends {@link Token} with wrapper-specific operations:
|
|
21048
|
-
* - `shield` / `unshield` — convert between the underlying ERC-20 and confidential balance
|
|
21049
|
-
* - `unwrap` / `unwrapAll` / `finalizeUnwrap` — low-level two-phase primitives
|
|
21050
|
-
* - `underlying` / `allowance` — wrapper reads
|
|
21051
|
-
*
|
|
21052
|
-
* `WrappedToken.address` is the wrapper contract address itself — the wrapper
|
|
21053
|
-
* IS the confidential token.
|
|
21054
|
-
*/
|
|
21055
|
-
declare class WrappedToken extends Token {
|
|
21056
|
-
#private;
|
|
21614
|
+
getUnderlyingToken(confidentialTokenAddress: Address): Promise<{
|
|
21615
|
+
tokenAddress: Address;
|
|
21616
|
+
isValid: boolean;
|
|
21617
|
+
} | null>;
|
|
21057
21618
|
/**
|
|
21058
|
-
*
|
|
21619
|
+
* Fetch all token wrapper pairs from the registry.
|
|
21059
21620
|
*
|
|
21060
|
-
* @returns
|
|
21621
|
+
* @returns All registered `TokenWrapperPair` entries.
|
|
21061
21622
|
*/
|
|
21062
|
-
|
|
21623
|
+
getTokenPairs(): Promise<readonly TokenWrapperPair[]>;
|
|
21063
21624
|
/**
|
|
21064
|
-
*
|
|
21065
|
-
*
|
|
21066
|
-
*
|
|
21067
|
-
* go straight to the `approve` + `wrap` path without re-probing.
|
|
21625
|
+
* Get the total number of token wrapper pairs.
|
|
21626
|
+
*
|
|
21627
|
+
* @returns The count as a bigint.
|
|
21068
21628
|
*/
|
|
21069
|
-
|
|
21629
|
+
getTokenPairsLength(): Promise<bigint>;
|
|
21070
21630
|
/**
|
|
21071
|
-
*
|
|
21072
|
-
* underlying token.
|
|
21631
|
+
* Fetch a range of token wrapper pairs (paginated by index).
|
|
21073
21632
|
*
|
|
21074
|
-
* @param
|
|
21075
|
-
* @
|
|
21633
|
+
* @param fromIndex - Start index (inclusive).
|
|
21634
|
+
* @param toIndex - End index (exclusive).
|
|
21635
|
+
* @returns The slice of `TokenWrapperPair` entries.
|
|
21076
21636
|
*/
|
|
21077
|
-
|
|
21637
|
+
getTokenPairsSlice(fromIndex: bigint, toIndex: bigint): Promise<readonly TokenWrapperPair[]>;
|
|
21078
21638
|
/**
|
|
21079
|
-
*
|
|
21080
|
-
*
|
|
21081
|
-
* The execution path is decided automatically by ERC-165 introspection on
|
|
21082
|
-
* the underlying ERC-20:
|
|
21083
|
-
* - **`transferAndCall`** (single tx): when the underlying supports
|
|
21084
|
-
* ERC-1363, no approval is required — the wrapper's `onTransferReceived`
|
|
21085
|
-
* callback mints confidential tokens directly. `approvalStrategy` is
|
|
21086
|
-
* **ignored** on this path. See {@link ShieldPath}.
|
|
21087
|
-
* - **`approveAndWrap`** (two-tx fallback): otherwise, an `approve` is
|
|
21088
|
-
* followed by a `wrap`. Approval is controlled by `approvalStrategy`
|
|
21089
|
-
* (`"exact"` by default, `"max"` for unlimited, `"skip"` to opt out).
|
|
21090
|
-
*
|
|
21091
|
-
* The ERC-20 balance is validated before submitting (public read, no
|
|
21092
|
-
* signing required) so the call works for all wallet types, including
|
|
21093
|
-
* smart wallets.
|
|
21094
|
-
*
|
|
21095
|
-
* @param amount - The plaintext amount to shield.
|
|
21096
|
-
* @param options - Optional: `approvalStrategy`, `to`, callbacks.
|
|
21097
|
-
* @returns The transaction hash and mined receipt.
|
|
21098
|
-
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
21099
|
-
* @throws if the ERC-20 balance is less than `amount`. {@link InsufficientERC20BalanceError}
|
|
21100
|
-
* @throws if the ERC-20 approval or shield transaction reverts. {@link TransactionRevertedError}
|
|
21639
|
+
* Fetch a single token wrapper pair by index.
|
|
21101
21640
|
*
|
|
21102
|
-
* @
|
|
21103
|
-
*
|
|
21104
|
-
* const txHash = await wrappedToken.shield(1000n);
|
|
21105
|
-
* ```
|
|
21641
|
+
* @param index - Zero-based pair index.
|
|
21642
|
+
* @returns The `TokenWrapperPair` at that index.
|
|
21106
21643
|
*/
|
|
21107
|
-
|
|
21644
|
+
getTokenPair(index: bigint): Promise<TokenWrapperPair>;
|
|
21108
21645
|
/**
|
|
21109
|
-
*
|
|
21110
|
-
*
|
|
21111
|
-
* Escape hatch for splitting shield across two signatures: call
|
|
21112
|
-
* {@link approveUnderlying} first, then `wrap`. Most callers should use
|
|
21113
|
-
* {@link shield}, which routes and orchestrates approval automatically.
|
|
21114
|
-
*
|
|
21115
|
-
* Validates the ERC-20 balance and the allowance granted to this wrapper
|
|
21116
|
-
* (public reads, no signing) and fails early with a clear error.
|
|
21117
|
-
*
|
|
21118
|
-
* @param amount - The plaintext amount to wrap.
|
|
21119
|
-
* @param options - Optional `to` recipient and `onWrapSubmitted` callback.
|
|
21120
|
-
* @returns The transaction hash and mined receipt.
|
|
21121
|
-
* @throws if reading the ERC-20 balance or allowance fails. {@link ERC20ReadFailedError}
|
|
21122
|
-
* @throws if the ERC-20 balance is less than `amount`. {@link InsufficientERC20BalanceError}
|
|
21123
|
-
* @throws if the allowance granted to the wrapper is less than `amount`. {@link InsufficientAllowanceError}
|
|
21646
|
+
* Look up the confidential token address for a given plain ERC-20 token.
|
|
21124
21647
|
*
|
|
21125
|
-
* @
|
|
21126
|
-
*
|
|
21127
|
-
*
|
|
21128
|
-
*
|
|
21129
|
-
* ```
|
|
21648
|
+
* @param tokenAddress - The plain ERC-20 token address.
|
|
21649
|
+
* @returns A tuple `[isValid, confidentialTokenAddress]`. `isValid` is `true` only for a
|
|
21650
|
+
* registered, non-revoked wrapper. The address is the zero address when no pair is registered.
|
|
21651
|
+
* A non-zero address with `isValid=false` means the wrapper was registered but later revoked.
|
|
21130
21652
|
*/
|
|
21131
|
-
|
|
21653
|
+
getConfidentialTokenAddress(tokenAddress: Address): Promise<readonly [boolean, Address]>;
|
|
21132
21654
|
/**
|
|
21133
|
-
*
|
|
21134
|
-
* Defaults to max uint256. Resets to zero first if there's an existing
|
|
21135
|
-
* non-zero allowance (required by tokens like USDT).
|
|
21136
|
-
*
|
|
21137
|
-
* @param amount - Optional approval amount. Defaults to max uint256.
|
|
21138
|
-
* @returns The transaction hash and mined receipt.
|
|
21655
|
+
* Reverse lookup — find the plain ERC-20 for a given confidential token.
|
|
21139
21656
|
*
|
|
21140
|
-
* @
|
|
21141
|
-
*
|
|
21142
|
-
*
|
|
21143
|
-
*
|
|
21144
|
-
* ```
|
|
21657
|
+
* @param confidentialTokenAddress - The confidential token address.
|
|
21658
|
+
* @returns A tuple `[isValid, tokenAddress]`. `isValid` is `true` only for a registered,
|
|
21659
|
+
* non-revoked wrapper. The address is the zero address when no pair is registered.
|
|
21660
|
+
* A non-zero address with `isValid=false` means the wrapper was registered but later revoked.
|
|
21145
21661
|
*/
|
|
21146
|
-
|
|
21662
|
+
getTokenAddress(confidentialTokenAddress: Address): Promise<readonly [boolean, Address]>;
|
|
21147
21663
|
/**
|
|
21148
|
-
*
|
|
21149
|
-
* Orchestrates: unshield → wait for receipt → parse event → finalize.
|
|
21150
|
-
*
|
|
21151
|
-
* By default, the SDK validates the confidential balance before submitting.
|
|
21152
|
-
* Set `skipBalanceCheck: true` to bypass this validation (e.g. for smart wallets).
|
|
21153
|
-
*
|
|
21154
|
-
* @param amount - The plaintext amount to unshield.
|
|
21155
|
-
* @param options - Optional: `skipBalanceCheck` (default `false`), callbacks.
|
|
21156
|
-
* @returns The finalize transaction hash and mined receipt.
|
|
21664
|
+
* Check whether a confidential token is registered and valid.
|
|
21157
21665
|
*
|
|
21158
|
-
* @
|
|
21159
|
-
*
|
|
21160
|
-
* const txHash = await wrappedToken.unshield(500n);
|
|
21161
|
-
* ```
|
|
21666
|
+
* @param confidentialTokenAddress - The confidential token address to check.
|
|
21667
|
+
* @returns `true` if the token is a known valid wrapper in the registry.
|
|
21162
21668
|
*/
|
|
21163
|
-
|
|
21669
|
+
isConfidentialTokenValid(confidentialTokenAddress: Address): Promise<boolean>;
|
|
21670
|
+
}
|
|
21671
|
+
//#endregion
|
|
21672
|
+
//#region src/query/wrapper-discovery.d.ts
|
|
21673
|
+
/** Configuration for {@link wrapperDiscoveryQueryOptions}. */
|
|
21674
|
+
interface WrapperDiscoveryQueryConfig {
|
|
21164
21675
|
/**
|
|
21165
|
-
*
|
|
21166
|
-
*
|
|
21167
|
-
*
|
|
21168
|
-
|
|
21169
|
-
|
|
21170
|
-
|
|
21676
|
+
* Address of any confidential token you control.
|
|
21677
|
+
* Used to scope the query cache key and to gate whether the query
|
|
21678
|
+
* is enabled — it does not affect which wrapper the registry returns.
|
|
21679
|
+
*/
|
|
21680
|
+
tokenAddress?: Address;
|
|
21681
|
+
/**
|
|
21682
|
+
* The ERC-20 token address to discover the confidential wrapper for.
|
|
21683
|
+
* The registry is resolved automatically from chain config.
|
|
21684
|
+
*/
|
|
21685
|
+
erc20Address?: Address;
|
|
21686
|
+
/**
|
|
21687
|
+
* The resolved registry contract address for the current chain.
|
|
21688
|
+
* Included in the query key so that switching chains invalidates
|
|
21689
|
+
* stale cached results. Pass `undefined` when the chain ID is not
|
|
21690
|
+
* yet known — the query will be disabled.
|
|
21691
|
+
*/
|
|
21692
|
+
registryAddress?: Address;
|
|
21693
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21694
|
+
query?: Record<string, unknown>;
|
|
21695
|
+
}
|
|
21696
|
+
/** Builds TanStack Query options for discovering the confidential wrapper address for a given ERC-20 token (resolves to `null` when none is registered). */
|
|
21697
|
+
declare function wrapperDiscoveryQueryOptions(registry: WrappersRegistry, config: WrapperDiscoveryQueryConfig): QueryFactoryOptions<Address | null, Error, Address | null, ReturnType<typeof zamaQueryKeys.wrapperDiscovery.token>>;
|
|
21698
|
+
//#endregion
|
|
21699
|
+
//#region src/query/underlying-allowance.d.ts
|
|
21700
|
+
/** Configuration for {@link underlyingAllowanceQueryOptions}. */
|
|
21701
|
+
interface UnderlyingAllowanceQueryConfig {
|
|
21702
|
+
/** Owner whose underlying-token allowance to read; the query stays disabled until provided. */
|
|
21703
|
+
owner?: Address;
|
|
21704
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21705
|
+
query?: Record<string, unknown>;
|
|
21706
|
+
}
|
|
21707
|
+
/** Builds TanStack Query options for reading the ERC-20 allowance the owner has granted a confidential wrapper on its underlying token. */
|
|
21708
|
+
declare function underlyingAllowanceQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config: UnderlyingAllowanceQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.underlyingAllowance.scope>>;
|
|
21709
|
+
//#endregion
|
|
21710
|
+
//#region src/query/pending-unshield.d.ts
|
|
21711
|
+
/** Configuration for {@link pendingUnshieldQueryOptions}. */
|
|
21712
|
+
interface PendingUnshieldQueryConfig {
|
|
21713
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21714
|
+
query?: Record<string, unknown>;
|
|
21715
|
+
}
|
|
21716
|
+
/**
|
|
21717
|
+
* Query options for reading the unwrap tx hash of an unshield that was
|
|
21718
|
+
* interrupted between its two phases (returns `null` if none is pending).
|
|
21719
|
+
*
|
|
21720
|
+
* Backed by {@link ZamaSDK} storage via `WrappedToken.getPendingUnshield()`.
|
|
21721
|
+
* `staleTime: 0` so the value reflects storage on mount; the unshield/unwrap
|
|
21722
|
+
* mutations also invalidate this key on success.
|
|
21723
|
+
*/
|
|
21724
|
+
declare function pendingUnshieldQueryOptions(sdk: ZamaSDK, tokenAddress: Address, config?: PendingUnshieldQueryConfig): QueryFactoryOptions<Hex | null, Error, Hex | null, ReturnType<typeof zamaQueryKeys.pendingUnshield.token>>;
|
|
21725
|
+
//#endregion
|
|
21726
|
+
//#region src/query/confidential-is-operator.d.ts
|
|
21727
|
+
/** Configuration for {@link confidentialIsOperatorQueryOptions}. */
|
|
21728
|
+
interface ConfidentialIsOperatorQueryConfig {
|
|
21729
|
+
/** Token holder whose operator authorization to check; the query stays disabled until provided. */
|
|
21730
|
+
holder?: Address;
|
|
21731
|
+
/** Spender address to check for operator authorization; the query stays disabled until provided. */
|
|
21732
|
+
spender?: Address;
|
|
21733
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
21734
|
+
query?: Record<string, unknown>;
|
|
21735
|
+
}
|
|
21736
|
+
/** Builds TanStack Query options for reading whether a spender is an authorized operator of a holder on a confidential token. */
|
|
21737
|
+
declare function confidentialIsOperatorQueryOptions(sdk: ZamaSDK, tokenAddress: Address | undefined, config: ConfidentialIsOperatorQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.confidentialIsOperator.scope>>;
|
|
21738
|
+
//#endregion
|
|
21739
|
+
//#region src/token/token.d.ts
|
|
21740
|
+
/** Options for {@link Token.batchDecryptBalancesAs}. */
|
|
21741
|
+
interface BatchDecryptAsOptions {
|
|
21742
|
+
/** The address of the account that delegated decryption rights. */
|
|
21743
|
+
delegatorAddress: Address;
|
|
21744
|
+
/** Pre-fetched encrypted values. When omitted, they are fetched from the chain. */
|
|
21745
|
+
encryptedValues?: EncryptedValue[];
|
|
21746
|
+
/**
|
|
21747
|
+
* The account whose on-chain balance to read. Defaults to the delegator
|
|
21748
|
+
* address, which is the common case (the delegator grants permission to
|
|
21749
|
+
* decrypt their own balance). Only set this when the account differs
|
|
21750
|
+
* from the delegator.
|
|
21171
21751
|
*
|
|
21172
|
-
*
|
|
21173
|
-
* ```ts
|
|
21174
|
-
* const txHash = await wrappedToken.unshieldAll();
|
|
21175
|
-
* ```
|
|
21752
|
+
* Matches the `account` parameter of `confidentialBalanceOf(account)` on-chain.
|
|
21176
21753
|
*/
|
|
21177
|
-
|
|
21754
|
+
accountAddress?: Address;
|
|
21755
|
+
/** Maximum number of concurrent decrypt calls. Default: 10. */
|
|
21756
|
+
maxConcurrency?: number;
|
|
21757
|
+
/** Called when decryption fails for a single token. Return a fallback bigint. */
|
|
21758
|
+
onError?: (error: Error, address: Address) => bigint;
|
|
21759
|
+
}
|
|
21760
|
+
/** Result of {@link Token.batchBalancesOf}. */
|
|
21761
|
+
interface BatchBalancesResult {
|
|
21762
|
+
/** Successfully decrypted balances, keyed by token address. */
|
|
21763
|
+
results: Map<Address, bigint>;
|
|
21764
|
+
/** Per-token errors for tokens that failed to decrypt. */
|
|
21765
|
+
errors: Map<Address, ZamaError>;
|
|
21766
|
+
}
|
|
21767
|
+
/**
|
|
21768
|
+
* High-level interface for an ERC-7984 confidential token.
|
|
21769
|
+
* Hides FHE complexity (encryption, decryption, EIP-712 signing) behind
|
|
21770
|
+
* familiar ERC-20-like methods.
|
|
21771
|
+
*
|
|
21772
|
+
* For ERC-7984 wrappers (shield/unshield), use {@link WrappedToken} instead —
|
|
21773
|
+
* it extends `Token` with wrapper-specific operations.
|
|
21774
|
+
*
|
|
21775
|
+
* Decryption, credentials, caching, and event emission are handled by the
|
|
21776
|
+
* owning {@link ZamaSDK} — this class only exposes token-scoped helpers
|
|
21777
|
+
* that delegate to `sdk.decryption.decryptValues` and `sdk.permits.grantPermit`.
|
|
21778
|
+
*/
|
|
21779
|
+
declare class Token {
|
|
21780
|
+
#private;
|
|
21781
|
+
/** The SDK instance this token operates through. */
|
|
21782
|
+
readonly sdk: ZamaSDK;
|
|
21783
|
+
/** Checksummed address of the confidential token contract. */
|
|
21784
|
+
readonly address: Address;
|
|
21785
|
+
constructor(sdk: ZamaSDK, address: Address);
|
|
21786
|
+
/** Read the token name from the contract. */
|
|
21787
|
+
name(): Promise<string>;
|
|
21788
|
+
/** Read the token symbol from the contract. */
|
|
21789
|
+
symbol(): Promise<string>;
|
|
21790
|
+
/** Read the token decimals from the contract. */
|
|
21791
|
+
decimals(): Promise<number>;
|
|
21178
21792
|
/**
|
|
21179
|
-
*
|
|
21180
|
-
* Useful when the user already submitted the unwrap but the finalize step
|
|
21181
|
-
* was interrupted (e.g. page reload, network error).
|
|
21182
|
-
*
|
|
21183
|
-
* @param unwrapTxHash - The transaction hash of the previously submitted unwrap.
|
|
21184
|
-
* @param callbacks - Optional progress callbacks.
|
|
21185
|
-
* @returns The finalize transaction hash and mined receipt.
|
|
21186
|
-
* @throws if the unwrap request was already finalized on-chain; the persisted
|
|
21187
|
-
* pending-unshield state is cleared first. {@link UnshieldAlreadyFinalizedError}
|
|
21793
|
+
* ERC-165 check for {@link ERC7984_INTERFACE_ID} support.
|
|
21188
21794
|
*
|
|
21189
|
-
* @
|
|
21190
|
-
* ```ts
|
|
21191
|
-
* const txHash = await wrappedToken.resumeUnshield(previousUnwrapTxHash);
|
|
21192
|
-
* ```
|
|
21795
|
+
* @returns `true` if the contract implements the ERC-7984 confidential token interface.
|
|
21193
21796
|
*/
|
|
21194
|
-
|
|
21797
|
+
isConfidential(): Promise<boolean>;
|
|
21195
21798
|
/**
|
|
21196
|
-
*
|
|
21197
|
-
* two phases, or `null` if none is pending for this wrapper.
|
|
21198
|
-
*
|
|
21199
|
-
* The SDK persists this automatically when {@link unshield}/{@link unshieldAll}
|
|
21200
|
-
* submit phase 1, and clears it once phase 2 finalizes. Use the returned hash
|
|
21201
|
-
* to surface a "resume" affordance, then pass it to {@link resumeUnshield}.
|
|
21202
|
-
* Resuming is intentionally caller-driven — auto-resuming on load would fire a
|
|
21203
|
-
* wallet transaction unprompted.
|
|
21204
|
-
*
|
|
21205
|
-
* The pointer is verified on-chain before it is reported: if the unwrap
|
|
21206
|
-
* request was already finalized (e.g. the tab closed before the SDK could
|
|
21207
|
-
* clear storage), the stale pointer is cleared and `null` is returned. When
|
|
21208
|
-
* the verification read fails, the pointer is returned unverified: a
|
|
21209
|
-
* network error never deletes recovery state.
|
|
21210
|
-
*
|
|
21211
|
-
* @returns The pending unwrap tx hash, or `null`.
|
|
21799
|
+
* ERC-165 check for IERC7984ERC20Wrapper support.
|
|
21212
21800
|
*
|
|
21213
|
-
* @
|
|
21214
|
-
*
|
|
21215
|
-
* const unwrapTxHash = await wrappedToken.getPendingUnshield();
|
|
21216
|
-
* if (unwrapTxHash) await wrappedToken.resumeUnshield(unwrapTxHash);
|
|
21217
|
-
* ```
|
|
21801
|
+
* @returns `true` if the contract implements the ERC-7984 wrapper interface
|
|
21802
|
+
* ({@link ERC7984_WRAPPER_INTERFACE_ID}, `0x1f1c62b2`).
|
|
21218
21803
|
*/
|
|
21219
|
-
|
|
21804
|
+
isWrapper(): Promise<boolean>;
|
|
21220
21805
|
/**
|
|
21221
|
-
*
|
|
21222
|
-
*
|
|
21223
|
-
* request is processed on-chain.
|
|
21806
|
+
* Decrypt and return the plaintext balance for the given owner.
|
|
21807
|
+
* Acquires FHE credentials via a wallet signature if none are cached.
|
|
21224
21808
|
*
|
|
21225
|
-
* @param
|
|
21226
|
-
* @returns The
|
|
21809
|
+
* @param owner - Balance owner address.
|
|
21810
|
+
* @returns The decrypted plaintext balance as a bigint.
|
|
21811
|
+
* @throws if FHE decryption fails. {@link DecryptionFailedError}
|
|
21227
21812
|
*
|
|
21228
21813
|
* @example
|
|
21229
21814
|
* ```ts
|
|
21230
|
-
* const
|
|
21231
|
-
* await wrappedToken.finalizeUnwrap(result.unwrapRequestId);
|
|
21815
|
+
* const balance = await token.balanceOf("0xOwner");
|
|
21232
21816
|
* ```
|
|
21233
21817
|
*/
|
|
21234
|
-
|
|
21818
|
+
balanceOf(owner: Address): Promise<bigint>;
|
|
21235
21819
|
/**
|
|
21236
|
-
*
|
|
21237
|
-
* Uses the on-chain encrypted balance directly (no encryption needed).
|
|
21238
|
-
* Throws if the balance is zero.
|
|
21820
|
+
* Return the raw encrypted balance without decrypting.
|
|
21239
21821
|
*
|
|
21240
|
-
* @
|
|
21241
|
-
* @
|
|
21822
|
+
* @param owner - Balance owner address.
|
|
21823
|
+
* @returns The encrypted balance as a hex string.
|
|
21242
21824
|
*
|
|
21243
21825
|
* @example
|
|
21244
21826
|
* ```ts
|
|
21245
|
-
* const
|
|
21246
|
-
* await wrappedToken.finalizeUnwrap(result.unwrapRequestId);
|
|
21827
|
+
* const encryptedValue = await token.confidentialBalanceOf("0xOwner");
|
|
21247
21828
|
* ```
|
|
21248
21829
|
*/
|
|
21249
|
-
|
|
21830
|
+
confidentialBalanceOf(owner: Address): Promise<EncryptedValue>;
|
|
21250
21831
|
/**
|
|
21251
|
-
*
|
|
21252
|
-
*
|
|
21832
|
+
* Decrypt the balance of a delegator using delegated decryption credentials.
|
|
21833
|
+
* The connected signer acts as the delegatee who has been granted permission
|
|
21834
|
+
* by the delegator to decrypt their balance.
|
|
21253
21835
|
*
|
|
21254
|
-
*
|
|
21255
|
-
*
|
|
21256
|
-
*
|
|
21257
|
-
*
|
|
21258
|
-
* @returns The transaction hash and mined receipt.
|
|
21836
|
+
* Clear values are cached in storage keyed by `(account, token, encryptedValue)`.
|
|
21837
|
+
* Because every on-chain balance change produces a new encrypted value,
|
|
21838
|
+
* stale cache entries are never served. Cache write failures are silently
|
|
21839
|
+
* ignored — they do not affect the returned value.
|
|
21259
21840
|
*
|
|
21260
|
-
* @
|
|
21261
|
-
*
|
|
21262
|
-
*
|
|
21263
|
-
*
|
|
21264
|
-
*
|
|
21265
|
-
|
|
21266
|
-
|
|
21267
|
-
}
|
|
21268
|
-
//#endregion
|
|
21269
|
-
//#region src/wrappers-registry.d.ts
|
|
21270
|
-
/**
|
|
21271
|
-
* Default wrappers registry addresses for known chains.
|
|
21272
|
-
* Only includes chains where a registry is deployed (excludes Hardhat).
|
|
21273
|
-
*
|
|
21274
|
-
* @deprecated Read `registryAddress` from the chain presets instead (e.g.
|
|
21275
|
-
* `sepolia.registryAddress`). Will be removed in the next major version.
|
|
21276
|
-
*/
|
|
21277
|
-
declare const DefaultRegistryAddresses: Record<number, Address>;
|
|
21278
|
-
/** Configuration for {@link WrappersRegistry}. */
|
|
21279
|
-
interface WrappersRegistryConfig {
|
|
21280
|
-
/** Read-only chain provider used for every registry lookup. */
|
|
21281
|
-
provider: GenericProvider;
|
|
21282
|
-
/**
|
|
21283
|
-
* Per-chain registry address overrides, merged on top of
|
|
21284
|
-
* {@link DefaultRegistryAddresses}. Use this to supply a registry
|
|
21285
|
-
* address for custom or local chains (e.g. Hardhat).
|
|
21841
|
+
* @param delegatorAddress - The address of the account that delegated decryption rights.
|
|
21842
|
+
* @param accountAddress - The account whose on-chain balance to read. Defaults
|
|
21843
|
+
* to the delegator address.
|
|
21844
|
+
* @returns The decrypted plaintext balance as a bigint.
|
|
21845
|
+
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
21846
|
+
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
21847
|
+
* @throws if delegated decryption fails. {@link DecryptionFailedError}
|
|
21286
21848
|
*
|
|
21287
21849
|
* @example
|
|
21288
21850
|
* ```ts
|
|
21289
|
-
*
|
|
21290
|
-
*
|
|
21291
|
-
* registryAddresses: { [31337]: "0xYourHardhatRegistry" },
|
|
21851
|
+
* const balance = await token.decryptBalanceAs({
|
|
21852
|
+
* delegatorAddress: "0xDelegator",
|
|
21292
21853
|
* });
|
|
21293
21854
|
* ```
|
|
21294
21855
|
*/
|
|
21295
|
-
|
|
21296
|
-
|
|
21297
|
-
|
|
21298
|
-
|
|
21299
|
-
*/
|
|
21300
|
-
registryTTL?: number;
|
|
21301
|
-
}
|
|
21302
|
-
/** Options for {@link WrappersRegistry.listPairs}. */
|
|
21303
|
-
interface ListPairsOptions {
|
|
21304
|
-
/** Page number (1-indexed). Default: `1`. */
|
|
21305
|
-
page?: number;
|
|
21306
|
-
/** Number of items per page. Default: `100`. */
|
|
21307
|
-
pageSize?: number;
|
|
21308
|
-
/**
|
|
21309
|
-
* When `true`, fetches on-chain metadata (name, symbol, decimals) for both
|
|
21310
|
-
* the ERC-20 and confidential token, plus totalSupply for the ERC-20.
|
|
21311
|
-
* Default: `false`.
|
|
21312
|
-
*/
|
|
21313
|
-
metadata?: boolean;
|
|
21314
|
-
}
|
|
21315
|
-
/**
|
|
21316
|
-
* High-level interface for the on-chain token wrappers registry.
|
|
21317
|
-
*
|
|
21318
|
-
* Uses the configured {@link GenericProvider} to resolve the correct registry
|
|
21319
|
-
* contract address for the current chain and exposes typed read helpers for
|
|
21320
|
-
* every registry query. Results are cached in memory with a configurable TTL
|
|
21321
|
-
* (default 24 hours).
|
|
21322
|
-
*
|
|
21323
|
-
* @example
|
|
21324
|
-
* ```ts
|
|
21325
|
-
* const registry = new WrappersRegistry({ provider });
|
|
21326
|
-
*
|
|
21327
|
-
* // Paginated listing
|
|
21328
|
-
* const page1 = await registry.listPairs({ page: 1, pageSize: 20 });
|
|
21329
|
-
*
|
|
21330
|
-
* // Structured lookups
|
|
21331
|
-
* const result = await registry.getConfidentialToken(erc20Address);
|
|
21332
|
-
* if (result) console.log(result.confidentialTokenAddress);
|
|
21333
|
-
*
|
|
21334
|
-
* // Force refresh
|
|
21335
|
-
* registry.refresh();
|
|
21336
|
-
* ```
|
|
21337
|
-
*/
|
|
21338
|
-
declare class WrappersRegistry {
|
|
21339
|
-
#private;
|
|
21340
|
-
/** Read-only chain access used for registry contract reads. */
|
|
21341
|
-
readonly provider: GenericProvider;
|
|
21342
|
-
constructor(config: WrappersRegistryConfig);
|
|
21343
|
-
/**
|
|
21344
|
-
* Synchronous lookup of the registry address for a given chain ID.
|
|
21345
|
-
* Returns `undefined` if no address is configured for that chain.
|
|
21346
|
-
*/
|
|
21347
|
-
getAddress(chainId: number): Address | undefined;
|
|
21348
|
-
/**
|
|
21349
|
-
* Force-invalidate the in-memory cache. The next call to any read method
|
|
21350
|
-
* will fetch fresh data from the chain.
|
|
21351
|
-
*/
|
|
21352
|
-
refresh(): void;
|
|
21353
|
-
/**
|
|
21354
|
-
* The cache TTL in milliseconds.
|
|
21355
|
-
* Exposed so query option factories can set a matching `staleTime`.
|
|
21356
|
-
*/
|
|
21357
|
-
get ttlMs(): number;
|
|
21856
|
+
decryptBalanceAs({ delegatorAddress, accountAddress }: {
|
|
21857
|
+
delegatorAddress: Address;
|
|
21858
|
+
accountAddress?: Address;
|
|
21859
|
+
}): Promise<bigint>;
|
|
21358
21860
|
/**
|
|
21359
|
-
*
|
|
21861
|
+
* Decrypt confidential balances for multiple tokens in parallel, returning
|
|
21862
|
+
* successes and per-token errors separately. Pre-authorizes all token
|
|
21863
|
+
* addresses in a single wallet signature, then delegates each decrypt to
|
|
21864
|
+
* `sdk.decryption.decryptValues`.
|
|
21360
21865
|
*
|
|
21361
|
-
*
|
|
21866
|
+
* Tokens that fail to decrypt land in `errors`; the batch keeps going.
|
|
21867
|
+
*
|
|
21868
|
+
* @param tokens - Array of {@link Token} instances bound to the same SDK.
|
|
21869
|
+
* @param owner - Balance owner address.
|
|
21870
|
+
* @returns `{ results, errors }` partitioning the per-token outcomes.
|
|
21871
|
+
* @throws A failure that affects the whole session (rejected signature,
|
|
21872
|
+
* misconfiguration, RPC rate limit, key unwrapping failure, revoked KMS
|
|
21873
|
+
* context) rejects the call instead of landing in `errors`.
|
|
21362
21874
|
*
|
|
21363
|
-
* @
|
|
21364
|
-
*
|
|
21875
|
+
* @example
|
|
21876
|
+
* ```ts
|
|
21877
|
+
* const { results, errors } = await Token.batchBalancesOf(tokens, owner);
|
|
21878
|
+
* ```
|
|
21365
21879
|
*/
|
|
21366
|
-
|
|
21880
|
+
static batchBalancesOf(tokens: Token[], owner: Address): Promise<BatchBalancesResult>;
|
|
21367
21881
|
/**
|
|
21368
|
-
*
|
|
21882
|
+
* Batch decrypt confidential balances as a delegate across multiple tokens.
|
|
21883
|
+
* Mirrors {@link batchBalancesOf} but uses delegated credentials.
|
|
21369
21884
|
*
|
|
21370
|
-
*
|
|
21885
|
+
* **Error handling:** If a per-token decryption fails and no `onError` callback
|
|
21886
|
+
* is provided, errors are collected and thrown as an aggregated
|
|
21887
|
+
* `DecryptionFailedError`. When the relayer returns no value for an encrypted value,
|
|
21888
|
+
* a `DecryptionFailedError` is thrown for that token (never silently returns `0n`).
|
|
21889
|
+
* Pass `onError: () => 0n` to opt into the silent zero behavior.
|
|
21371
21890
|
*
|
|
21372
|
-
* @param
|
|
21373
|
-
* @
|
|
21891
|
+
* @param tokens - Array of Token instances to decrypt balances for.
|
|
21892
|
+
* @param options - Delegated decryption configuration.
|
|
21893
|
+
* @returns A Map from token address to decrypted balance.
|
|
21894
|
+
* @throws if no active delegation exists. {@link DelegationNotFoundError}
|
|
21895
|
+
* @throws if the delegation has expired. {@link DelegationExpiredError}
|
|
21896
|
+
* @throws if any decryption fails and no `onError` is provided. {@link DecryptionFailedError}
|
|
21897
|
+
* @throws A failure that affects the whole session (rejected signature, RPC
|
|
21898
|
+
* rate limit, revoked KMS context) rejects the call even when `onError` is
|
|
21899
|
+
* provided.
|
|
21374
21900
|
*
|
|
21375
21901
|
* @example
|
|
21376
21902
|
* ```ts
|
|
21377
|
-
* const
|
|
21378
|
-
*
|
|
21379
|
-
*
|
|
21380
|
-
*
|
|
21381
|
-
* const withMeta = await registry.listPairs({ metadata: true, pageSize: 10 });
|
|
21382
|
-
* for (const pair of withMeta.items) {
|
|
21383
|
-
* console.log(pair.underlying.symbol, "→", pair.confidential.symbol);
|
|
21384
|
-
* }
|
|
21903
|
+
* const balances = await Token.batchDecryptBalancesAs(tokens, {
|
|
21904
|
+
* delegatorAddress: "0xDelegator",
|
|
21905
|
+
* onError: (err, addr) => { console.error(addr, err); return 0n; },
|
|
21906
|
+
* });
|
|
21385
21907
|
* ```
|
|
21386
21908
|
*/
|
|
21387
|
-
|
|
21388
|
-
|
|
21389
|
-
}): Promise<PaginatedResult<TokenWrapperPairWithMetadata>>;
|
|
21390
|
-
/** Lists registered underlying/confidential token pairs; pass `{ metadata: true }` to include on-chain token metadata. */
|
|
21391
|
-
listPairs(options?: ListPairsOptions): Promise<PaginatedResult<TokenWrapperPair>>;
|
|
21909
|
+
static batchDecryptBalancesAs(tokens: Token[], options: BatchDecryptAsOptions): Promise<Map<Address, bigint>>;
|
|
21910
|
+
private static readBalanceHandlesBatch;
|
|
21392
21911
|
/**
|
|
21393
|
-
*
|
|
21912
|
+
* Confidential transfer. Encrypts the amount via FHE, then calls the contract.
|
|
21394
21913
|
*
|
|
21395
|
-
*
|
|
21396
|
-
*
|
|
21397
|
-
*
|
|
21398
|
-
*
|
|
21399
|
-
*
|
|
21914
|
+
* By default, the SDK validates the confidential balance before submitting.
|
|
21915
|
+
* If a cached plaintext balance exists it is used; otherwise, if credentials
|
|
21916
|
+
* are cached, it decrypts on the fly. Set `skipBalanceCheck: true` to bypass
|
|
21917
|
+
* this validation (e.g. for smart wallets).
|
|
21918
|
+
*
|
|
21919
|
+
* @param to - Recipient address.
|
|
21920
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
21921
|
+
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
21922
|
+
* @returns The transaction hash and mined receipt.
|
|
21923
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
21924
|
+
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
21925
|
+
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
21926
|
+
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
21927
|
+
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
21400
21928
|
*
|
|
21401
21929
|
* @example
|
|
21402
21930
|
* ```ts
|
|
21403
|
-
* const
|
|
21404
|
-
* if (result?.isValid) {
|
|
21405
|
-
* console.log(result.confidentialTokenAddress);
|
|
21406
|
-
* }
|
|
21931
|
+
* const txHash = await token.confidentialTransfer("0xRecipient", 1000n);
|
|
21407
21932
|
* ```
|
|
21408
21933
|
*/
|
|
21409
|
-
|
|
21410
|
-
confidentialTokenAddress: Address;
|
|
21411
|
-
isValid: boolean;
|
|
21412
|
-
} | null>;
|
|
21934
|
+
confidentialTransfer(to: Address, amount: bigint, options?: TransferOptions): Promise<TransactionResult>;
|
|
21413
21935
|
/**
|
|
21414
|
-
*
|
|
21936
|
+
* Operator encrypted transfer on behalf of another address.
|
|
21937
|
+
* The caller must be an approved operator for `from`.
|
|
21415
21938
|
*
|
|
21416
|
-
* @param
|
|
21417
|
-
* @
|
|
21939
|
+
* @param from - The address to transfer from (caller must be an approved operator).
|
|
21940
|
+
* @param to - Recipient address.
|
|
21941
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
21942
|
+
* @returns The transaction hash and mined receipt.
|
|
21418
21943
|
*
|
|
21419
21944
|
* @example
|
|
21420
21945
|
* ```ts
|
|
21421
|
-
* const
|
|
21422
|
-
* if (result) {
|
|
21423
|
-
* console.log(result.tokenAddress, result.isValid);
|
|
21424
|
-
* }
|
|
21946
|
+
* const txHash = await token.confidentialTransferFrom("0xFrom", "0xTo", 500n);
|
|
21425
21947
|
* ```
|
|
21426
21948
|
*/
|
|
21427
|
-
|
|
21428
|
-
tokenAddress: Address;
|
|
21429
|
-
isValid: boolean;
|
|
21430
|
-
} | null>;
|
|
21949
|
+
confidentialTransferFrom(from: Address, to: Address, amount: bigint, callbacks?: TransferCallbacks): Promise<TransactionResult>;
|
|
21431
21950
|
/**
|
|
21432
|
-
*
|
|
21951
|
+
* ERC-7984 `confidentialTransferAndCall`: encrypted transfer that also invokes
|
|
21952
|
+
* the recipient's receiver hook (`onConfidentialTransferReceived`) in a single
|
|
21953
|
+
* transaction. The caller crafts the opaque `data` payload — the SDK does not
|
|
21954
|
+
* encode, validate, or interpret it.
|
|
21433
21955
|
*
|
|
21434
|
-
*
|
|
21435
|
-
*/
|
|
21436
|
-
getTokenPairs(): Promise<readonly TokenWrapperPair[]>;
|
|
21437
|
-
/**
|
|
21438
|
-
* Get the total number of token wrapper pairs.
|
|
21956
|
+
* Balance validation follows the same rules as {@link Token.confidentialTransfer}.
|
|
21439
21957
|
*
|
|
21440
|
-
* @
|
|
21441
|
-
|
|
21442
|
-
|
|
21443
|
-
|
|
21444
|
-
*
|
|
21958
|
+
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
21959
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
21960
|
+
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
21961
|
+
* @param options - Optional: `skipBalanceCheck` (default `false`).
|
|
21962
|
+
* @returns The transaction hash and mined receipt.
|
|
21445
21963
|
*
|
|
21446
|
-
* @
|
|
21447
|
-
* @
|
|
21448
|
-
* @
|
|
21449
|
-
|
|
21450
|
-
|
|
21451
|
-
/**
|
|
21452
|
-
* Fetch a single token wrapper pair by index.
|
|
21964
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
21965
|
+
* @throws if the balance is less than `amount`. {@link InsufficientConfidentialBalanceError}
|
|
21966
|
+
* @throws if balance validation requires decryption that is not possible. {@link BalanceCheckUnavailableError}
|
|
21967
|
+
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
21968
|
+
* @throws if the on-chain transfer reverts. {@link TransactionRevertedError}
|
|
21453
21969
|
*
|
|
21454
|
-
* @
|
|
21455
|
-
*
|
|
21970
|
+
* @example
|
|
21971
|
+
* ```ts
|
|
21972
|
+
* const txHash = await token.confidentialTransferAndCall(
|
|
21973
|
+
* "0xRecipient",
|
|
21974
|
+
* 1000n,
|
|
21975
|
+
* "0xabcd", // caller-encoded payload forwarded to the receiver hook
|
|
21976
|
+
* );
|
|
21977
|
+
* ```
|
|
21456
21978
|
*/
|
|
21457
|
-
|
|
21979
|
+
confidentialTransferAndCall(to: Address, amount: bigint, data: Hex, options?: TransferOptions): Promise<TransactionResult>;
|
|
21458
21980
|
/**
|
|
21459
|
-
*
|
|
21981
|
+
* ERC-7984 `confidentialTransferFromAndCall`: operator-initiated encrypted
|
|
21982
|
+
* transfer that also invokes the recipient's receiver hook in a single
|
|
21983
|
+
* transaction. The caller must be an approved operator for `from` and crafts
|
|
21984
|
+
* the opaque `data` payload — the SDK does not encode or interpret it.
|
|
21460
21985
|
*
|
|
21461
|
-
* @param
|
|
21462
|
-
* @
|
|
21463
|
-
*
|
|
21464
|
-
*
|
|
21986
|
+
* @param from - The address to transfer from (caller must be an approved operator).
|
|
21987
|
+
* @param to - Recipient address. Must implement the ERC-7984 receiver hook.
|
|
21988
|
+
* @param amount - Plaintext amount to transfer (encrypted automatically via FHE).
|
|
21989
|
+
* @param data - Opaque bytes forwarded to the recipient's receiver hook.
|
|
21990
|
+
* @param callbacks - Optional progress callbacks.
|
|
21991
|
+
* @returns The transaction hash and mined receipt.
|
|
21992
|
+
*
|
|
21993
|
+
* @example
|
|
21994
|
+
* ```ts
|
|
21995
|
+
* const txHash = await token.confidentialTransferFromAndCall(
|
|
21996
|
+
* "0xFrom",
|
|
21997
|
+
* "0xRecipient",
|
|
21998
|
+
* 500n,
|
|
21999
|
+
* "0xabcd",
|
|
22000
|
+
* );
|
|
22001
|
+
* ```
|
|
21465
22002
|
*/
|
|
21466
|
-
|
|
22003
|
+
confidentialTransferFromAndCall(from: Address, to: Address, amount: bigint, data: Hex, callbacks?: TransferCallbacks): Promise<TransactionResult>;
|
|
21467
22004
|
/**
|
|
21468
|
-
*
|
|
22005
|
+
* Set operator approval for the confidential token.
|
|
22006
|
+
* Defaults to 1 hour from now if `until` is not specified.
|
|
21469
22007
|
*
|
|
21470
|
-
* @param
|
|
21471
|
-
* @
|
|
21472
|
-
*
|
|
21473
|
-
*
|
|
22008
|
+
* @param operator - The address to set as an operator.
|
|
22009
|
+
* @param until - Optional Unix timestamp for approval expiry. Defaults to now + 1 hour.
|
|
22010
|
+
* @returns The transaction hash and mined receipt.
|
|
22011
|
+
*
|
|
22012
|
+
* @example
|
|
22013
|
+
* ```ts
|
|
22014
|
+
* const txHash = await token.setOperator("0xOperator");
|
|
22015
|
+
* ```
|
|
21474
22016
|
*/
|
|
21475
|
-
|
|
22017
|
+
setOperator(operator: Address, until?: number): Promise<TransactionResult>;
|
|
21476
22018
|
/**
|
|
21477
|
-
* Check
|
|
22019
|
+
* Check if a spender is an approved operator for a given holder.
|
|
21478
22020
|
*
|
|
21479
|
-
* @param
|
|
21480
|
-
* @
|
|
22021
|
+
* @param holder - The token holder address.
|
|
22022
|
+
* @param spender - The address to check operator approval for.
|
|
22023
|
+
* @returns `true` if the spender is an approved operator for the holder.
|
|
22024
|
+
*
|
|
22025
|
+
* @example
|
|
22026
|
+
* ```ts
|
|
22027
|
+
* if (await token.isOperator("0xHolder", "0xSpender")) {
|
|
22028
|
+
* // spender can call transferFrom on behalf of holder
|
|
22029
|
+
* }
|
|
22030
|
+
* ```
|
|
21481
22031
|
*/
|
|
21482
|
-
|
|
22032
|
+
isOperator(holder: Address, spender: Address): Promise<boolean>;
|
|
22033
|
+
/** Verify all tokens share the same SDK instance and return it. */
|
|
22034
|
+
private static assertSameSdk;
|
|
21483
22035
|
}
|
|
21484
22036
|
//#endregion
|
|
21485
|
-
//#region src/
|
|
21486
|
-
/** Instance-level options that are deliberately not part of the shareable config object. */
|
|
21487
|
-
interface ZamaSDKOptions {
|
|
21488
|
-
/**
|
|
21489
|
-
* Encrypts the transport key pair's private half at rest. Headless environments only
|
|
21490
|
-
* (CLI tools, servers, agents); the constructor rejects it in browser contexts. Supply
|
|
21491
|
-
* at least 32 random bytes, or a string of at least 64 characters, from a CSPRNG or
|
|
21492
|
-
* secrets manager. The SDK copies a Uint8Array secret and zeroizes its own copy after
|
|
21493
|
-
* key import; it never touches your buffer, so zeroize yours after construction.
|
|
21494
|
-
* The SDK never persists or exposes this value. Omit for the default:
|
|
21495
|
-
* plaintext at rest, security delegated to the storage backend.
|
|
21496
|
-
*/
|
|
21497
|
-
transportKeyPairDerivationSecret?: string | Uint8Array;
|
|
21498
|
-
}
|
|
22037
|
+
//#region src/token/wrapped-token.d.ts
|
|
21499
22038
|
/**
|
|
21500
|
-
*
|
|
22039
|
+
* Confidential ERC-20 wrapper (ERC-7984 ERC20Wrapper).
|
|
21501
22040
|
*
|
|
21502
|
-
*
|
|
21503
|
-
*
|
|
21504
|
-
*
|
|
21505
|
-
*
|
|
21506
|
-
*
|
|
22041
|
+
* Extends {@link Token} with wrapper-specific operations:
|
|
22042
|
+
* - `shield` / `unshield` — convert between the underlying ERC-20 and confidential balance
|
|
22043
|
+
* - `unwrap` / `unwrapAll` / `finalizeUnwrap` — low-level two-phase primitives
|
|
22044
|
+
* - `underlying` / `allowance` — wrapper reads
|
|
22045
|
+
*
|
|
22046
|
+
* `WrappedToken.address` is the wrapper contract address itself — the wrapper
|
|
22047
|
+
* IS the confidential token.
|
|
21507
22048
|
*/
|
|
21508
|
-
declare class
|
|
22049
|
+
declare class WrappedToken extends Token {
|
|
21509
22050
|
#private;
|
|
21510
|
-
/** Read-only chain access used for all contract reads. */
|
|
21511
|
-
readonly provider: GenericProvider;
|
|
21512
|
-
/** Wallet signer used for write operations, or `undefined` when the SDK is read-only. */
|
|
21513
|
-
readonly signer: GenericSigner | undefined;
|
|
21514
|
-
/** Storage for cached permits and transport key pairs. */
|
|
21515
|
-
readonly storage: GenericStorage;
|
|
21516
22051
|
/**
|
|
21517
|
-
*
|
|
21518
|
-
*
|
|
22052
|
+
* Read the underlying ERC-20 token address from the wrapper contract.
|
|
22053
|
+
*
|
|
22054
|
+
* @returns The underlying ERC-20 token address.
|
|
22055
|
+
*/
|
|
22056
|
+
underlying(): Promise<Address>;
|
|
22057
|
+
/**
|
|
22058
|
+
* Check whether the underlying ERC-20 supports ERC-1363 (payable token).
|
|
22059
|
+
* Result is cached per WrappedToken instance (negative results included):
|
|
22060
|
+
* once we know an underlying does not support ERC-1363, subsequent shields
|
|
22061
|
+
* go straight to the `approve` + `wrap` path without re-probing.
|
|
22062
|
+
*/
|
|
22063
|
+
isPayable(): Promise<boolean>;
|
|
22064
|
+
/**
|
|
22065
|
+
* Read the ERC-20 allowance granted by `owner` to this wrapper for the
|
|
22066
|
+
* underlying token.
|
|
22067
|
+
*
|
|
22068
|
+
* @param owner - The owner address whose allowance to read.
|
|
22069
|
+
* @returns The current allowance as a bigint.
|
|
21519
22070
|
*/
|
|
21520
|
-
|
|
21521
|
-
/** Permit and keypair management. */
|
|
21522
|
-
readonly permits: Permits;
|
|
21523
|
-
/** On-chain decryption-delegation management. */
|
|
21524
|
-
readonly delegations: Delegations;
|
|
21525
|
-
/** FHE decryption (user, delegated user, public). */
|
|
21526
|
-
readonly decryption: Decryption;
|
|
21527
|
-
/** Offline-signing pipeline: `prepare` builds an unsigned tx the caller signs and broadcasts out-of-process — for HSM, policy-engine, and cross-process custody workflows. */
|
|
21528
|
-
readonly offline: Offline;
|
|
21529
|
-
constructor(config: ZamaConfig, options?: ZamaSDKOptions);
|
|
22071
|
+
allowance(owner: Address): Promise<bigint>;
|
|
21530
22072
|
/**
|
|
21531
|
-
*
|
|
22073
|
+
* Shield public ERC-20 tokens into confidential tokens.
|
|
22074
|
+
*
|
|
22075
|
+
* The execution path is decided automatically by ERC-165 introspection on
|
|
22076
|
+
* the underlying ERC-20:
|
|
22077
|
+
* - **`transferAndCall`** (single tx): when the underlying supports
|
|
22078
|
+
* ERC-1363, no approval is required — the wrapper's `onTransferReceived`
|
|
22079
|
+
* callback mints confidential tokens directly. `approvalStrategy` is
|
|
22080
|
+
* **ignored** on this path. See {@link ShieldPath}.
|
|
22081
|
+
* - **`approveAndWrap`** (two-tx fallback): otherwise, an `approve` is
|
|
22082
|
+
* followed by a `wrap`. Approval is controlled by `approvalStrategy`
|
|
22083
|
+
* (`"exact"` by default, `"max"` for unlimited, `"skip"` to opt out).
|
|
22084
|
+
*
|
|
22085
|
+
* The ERC-20 balance is validated before submitting (public read, no
|
|
22086
|
+
* signing required) so the call works for all wallet types, including
|
|
22087
|
+
* smart wallets.
|
|
22088
|
+
*
|
|
22089
|
+
* @param amount - The plaintext amount to shield.
|
|
22090
|
+
* @param options - Optional: `approvalStrategy`, `to`, callbacks.
|
|
22091
|
+
* @returns The transaction hash and mined receipt.
|
|
22092
|
+
* @throws if signer and provider are on different chains. {@link ChainMismatchError}
|
|
22093
|
+
* @throws if the ERC-20 balance is less than `amount`. {@link InsufficientERC20BalanceError}
|
|
22094
|
+
* @throws if the ERC-20 approval or shield transaction reverts. {@link TransactionRevertedError}
|
|
22095
|
+
*
|
|
22096
|
+
* @example
|
|
22097
|
+
* ```ts
|
|
22098
|
+
* const txHash = await wrappedToken.shield(1000n);
|
|
22099
|
+
* ```
|
|
21532
22100
|
*/
|
|
21533
|
-
|
|
22101
|
+
shield(amount: bigint, options?: ShieldOptions): Promise<TransactionResult>;
|
|
21534
22102
|
/**
|
|
21535
|
-
*
|
|
21536
|
-
* Inherits the registry addresses derived from the SDK's chain configs, so
|
|
21537
|
-
* the result is consistent with {@link ZamaSDK.registry}.
|
|
22103
|
+
* Wrap already-approved underlying ERC-20 into confidential tokens.
|
|
21538
22104
|
*
|
|
21539
|
-
*
|
|
21540
|
-
*
|
|
22105
|
+
* Escape hatch for splitting shield across two signatures: call
|
|
22106
|
+
* {@link approveUnderlying} first, then `wrap`. Most callers should use
|
|
22107
|
+
* {@link shield}, which routes and orchestrates approval automatically.
|
|
22108
|
+
*
|
|
22109
|
+
* Validates the ERC-20 balance and the allowance granted to this wrapper
|
|
22110
|
+
* (public reads, no signing) and fails early with a clear error.
|
|
22111
|
+
*
|
|
22112
|
+
* @param amount - The plaintext amount to wrap.
|
|
22113
|
+
* @param options - Optional `to` recipient and `onWrapSubmitted` callback.
|
|
22114
|
+
* @returns The transaction hash and mined receipt.
|
|
22115
|
+
* @throws if reading the ERC-20 balance or allowance fails. {@link ERC20ReadFailedError}
|
|
22116
|
+
* @throws if the ERC-20 balance is less than `amount`. {@link InsufficientERC20BalanceError}
|
|
22117
|
+
* @throws if the allowance granted to the wrapper is less than `amount`. {@link InsufficientAllowanceError}
|
|
21541
22118
|
*
|
|
21542
22119
|
* @example
|
|
21543
22120
|
* ```ts
|
|
21544
|
-
*
|
|
21545
|
-
*
|
|
22121
|
+
* await wrappedToken.approveUnderlying(1000n);
|
|
22122
|
+
* await wrappedToken.wrap(1000n);
|
|
22123
|
+
* ```
|
|
22124
|
+
*/
|
|
22125
|
+
wrap(amount: bigint, options?: WrapOptions): Promise<TransactionResult>;
|
|
22126
|
+
/**
|
|
22127
|
+
* Approve this wrapper contract to spend the underlying ERC-20.
|
|
22128
|
+
* Defaults to max uint256. Resets to zero first if there's an existing
|
|
22129
|
+
* non-zero allowance (required by tokens like USDT).
|
|
21546
22130
|
*
|
|
21547
|
-
*
|
|
21548
|
-
*
|
|
22131
|
+
* @param amount - Optional approval amount. Defaults to max uint256.
|
|
22132
|
+
* @returns The transaction hash and mined receipt.
|
|
21549
22133
|
*
|
|
21550
|
-
*
|
|
22134
|
+
* @example
|
|
22135
|
+
* ```ts
|
|
22136
|
+
* await wrappedToken.approveUnderlying(); // max approval
|
|
22137
|
+
* await wrappedToken.approveUnderlying(1000n); // exact amount
|
|
21551
22138
|
* ```
|
|
21552
22139
|
*/
|
|
21553
|
-
|
|
22140
|
+
approveUnderlying(amount?: bigint): Promise<TransactionResult>;
|
|
21554
22141
|
/**
|
|
21555
|
-
*
|
|
22142
|
+
* Unshield a specific amount and finalize in one call.
|
|
22143
|
+
* Orchestrates: unshield → wait for receipt → parse event → finalize.
|
|
21556
22144
|
*
|
|
21557
|
-
*
|
|
21558
|
-
*
|
|
21559
|
-
*
|
|
22145
|
+
* By default, the SDK validates the confidential balance before submitting.
|
|
22146
|
+
* Set `skipBalanceCheck: true` to bypass this validation (e.g. for smart wallets).
|
|
22147
|
+
*
|
|
22148
|
+
* @param amount - The plaintext amount to unshield.
|
|
22149
|
+
* @param options - Optional: `skipBalanceCheck` (default `false`), callbacks.
|
|
22150
|
+
* @returns The finalize transaction hash and mined receipt.
|
|
21560
22151
|
*
|
|
21561
22152
|
* @example
|
|
21562
22153
|
* ```ts
|
|
21563
|
-
* const
|
|
21564
|
-
* values: [{ value: 1000n, type: "euint64" }],
|
|
21565
|
-
* contractAddress: "0xToken",
|
|
21566
|
-
* userAddress: "0xUser",
|
|
21567
|
-
* });
|
|
22154
|
+
* const txHash = await wrappedToken.unshield(500n);
|
|
21568
22155
|
* ```
|
|
21569
22156
|
*/
|
|
21570
|
-
|
|
22157
|
+
unshield(amount: bigint, options?: UnshieldOptions): Promise<TransactionResult>;
|
|
21571
22158
|
/**
|
|
21572
|
-
*
|
|
21573
|
-
*
|
|
22159
|
+
* Unshield the entire balance and finalize in one call.
|
|
22160
|
+
* Orchestrates: unshieldAll → wait for receipt → parse event → finalize.
|
|
21574
22161
|
*
|
|
21575
|
-
*
|
|
22162
|
+
* @param callbacks - Optional progress callbacks for each phase.
|
|
22163
|
+
* @returns The finalize transaction hash and mined receipt.
|
|
22164
|
+
* @throws if the balance is zero. {@link DecryptionFailedError}
|
|
21576
22165
|
*
|
|
21577
|
-
* @
|
|
21578
|
-
*
|
|
22166
|
+
* @example
|
|
22167
|
+
* ```ts
|
|
22168
|
+
* const txHash = await wrappedToken.unshieldAll();
|
|
22169
|
+
* ```
|
|
22170
|
+
*/
|
|
22171
|
+
unshieldAll(callbacks?: UnshieldCallbacks): Promise<TransactionResult>;
|
|
22172
|
+
/**
|
|
22173
|
+
* Resume an in-progress unshield from an existing unwrap tx hash.
|
|
22174
|
+
* Useful when the user already submitted the unwrap but the finalize step
|
|
22175
|
+
* was interrupted (e.g. page reload, network error).
|
|
22176
|
+
*
|
|
22177
|
+
* @param unwrapTxHash - The transaction hash of the previously submitted unwrap.
|
|
22178
|
+
* @param callbacks - Optional progress callbacks.
|
|
22179
|
+
* @returns The finalize transaction hash and mined receipt.
|
|
22180
|
+
* @throws if the unwrap request was already finalized on-chain; the persisted
|
|
22181
|
+
* pending-unshield state is cleared first. {@link UnshieldAlreadyFinalizedError}
|
|
21579
22182
|
*
|
|
21580
22183
|
* @example
|
|
21581
22184
|
* ```ts
|
|
21582
|
-
* const
|
|
21583
|
-
* const balance = await token.balanceOf(userAddress);
|
|
22185
|
+
* const txHash = await wrappedToken.resumeUnshield(previousUnwrapTxHash);
|
|
21584
22186
|
* ```
|
|
21585
22187
|
*/
|
|
21586
|
-
|
|
22188
|
+
resumeUnshield(unwrapTxHash: Hex, callbacks?: UnshieldCallbacks): Promise<TransactionResult>;
|
|
21587
22189
|
/**
|
|
21588
|
-
*
|
|
21589
|
-
*
|
|
22190
|
+
* Return the unwrap tx hash of an unshield that was interrupted between its
|
|
22191
|
+
* two phases, or `null` if none is pending for this wrapper.
|
|
21590
22192
|
*
|
|
21591
|
-
*
|
|
21592
|
-
*
|
|
22193
|
+
* The SDK persists this automatically when {@link unshield}/{@link unshieldAll}
|
|
22194
|
+
* submit phase 1, and clears it once phase 2 finalizes. Use the returned hash
|
|
22195
|
+
* to surface a "resume" affordance, then pass it to {@link resumeUnshield}.
|
|
22196
|
+
* Resuming is intentionally caller-driven — auto-resuming on load would fire a
|
|
22197
|
+
* wallet transaction unprompted.
|
|
22198
|
+
*
|
|
22199
|
+
* The pointer is verified on-chain before it is reported: if the unwrap
|
|
22200
|
+
* request was already finalized (e.g. the tab closed before the SDK could
|
|
22201
|
+
* clear storage), the stale pointer is cleared and `null` is returned. When
|
|
22202
|
+
* the verification read fails, the pointer is returned unverified: a
|
|
22203
|
+
* network error never deletes recovery state.
|
|
22204
|
+
*
|
|
22205
|
+
* @returns The pending unwrap tx hash, or `null`.
|
|
21593
22206
|
*
|
|
21594
22207
|
* @example
|
|
21595
22208
|
* ```ts
|
|
21596
|
-
* const
|
|
21597
|
-
* await
|
|
22209
|
+
* const unwrapTxHash = await wrappedToken.getPendingUnshield();
|
|
22210
|
+
* if (unwrapTxHash) await wrappedToken.resumeUnshield(unwrapTxHash);
|
|
21598
22211
|
* ```
|
|
21599
22212
|
*/
|
|
21600
|
-
|
|
22213
|
+
getPendingUnshield(): Promise<Hex | null>;
|
|
21601
22214
|
/**
|
|
21602
|
-
*
|
|
21603
|
-
*
|
|
21604
|
-
*
|
|
21605
|
-
*
|
|
21606
|
-
*
|
|
22215
|
+
* Request an unwrap for a specific amount. Encrypts the amount first.
|
|
22216
|
+
* Pass the result's `unwrapRequestId` to {@link finalizeUnwrap} once the
|
|
22217
|
+
* request is processed on-chain.
|
|
22218
|
+
*
|
|
22219
|
+
* @param amount - The plaintext amount to unwrap (encrypted automatically).
|
|
22220
|
+
* @returns The tx hash, mined receipt, and the `unwrapRequestId` for `finalizeUnwrap`.
|
|
22221
|
+
*
|
|
22222
|
+
* @example
|
|
22223
|
+
* ```ts
|
|
22224
|
+
* const result = await wrappedToken.unwrap(500n);
|
|
22225
|
+
* await wrappedToken.finalizeUnwrap(result.unwrapRequestId);
|
|
22226
|
+
* ```
|
|
21607
22227
|
*/
|
|
21608
|
-
|
|
22228
|
+
unwrap(amount: bigint): Promise<UnwrapResult>;
|
|
21609
22229
|
/**
|
|
21610
|
-
*
|
|
21611
|
-
*
|
|
22230
|
+
* Request an unwrap for the entire confidential balance.
|
|
22231
|
+
* Uses the on-chain encrypted balance directly (no encryption needed).
|
|
22232
|
+
* Throws if the balance is zero.
|
|
22233
|
+
*
|
|
22234
|
+
* @returns The tx hash, mined receipt, and the `unwrapRequestId` for `finalizeUnwrap`.
|
|
22235
|
+
* @throws if the balance is zero. {@link DecryptionFailedError}
|
|
22236
|
+
*
|
|
22237
|
+
* @example
|
|
22238
|
+
* ```ts
|
|
22239
|
+
* const result = await wrappedToken.unwrapAll();
|
|
22240
|
+
* await wrappedToken.finalizeUnwrap(result.unwrapRequestId);
|
|
22241
|
+
* ```
|
|
21612
22242
|
*/
|
|
21613
|
-
|
|
22243
|
+
unwrapAll(): Promise<UnwrapResult>;
|
|
21614
22244
|
/**
|
|
21615
|
-
*
|
|
21616
|
-
*
|
|
21617
|
-
*
|
|
22245
|
+
* Complete an unwrap by fetching the public decryption proof and finalizing.
|
|
22246
|
+
* Call this once the unwrap request has been processed on-chain.
|
|
22247
|
+
*
|
|
22248
|
+
* @param unwrapRequestId - The `unwrapRequestId` from an {@link UnwrapResult}
|
|
22249
|
+
* (`result.unwrapRequestId`) returned by {@link unwrap} / {@link unwrapAll},
|
|
22250
|
+
* or one decoded from an `UnwrapRequested` event (e.g. when finalizing
|
|
22251
|
+
* across sessions).
|
|
22252
|
+
* @returns The transaction hash and mined receipt.
|
|
21618
22253
|
*
|
|
21619
22254
|
* @example
|
|
21620
22255
|
* ```ts
|
|
21621
|
-
* {
|
|
21622
|
-
*
|
|
21623
|
-
* await sdk.permits.grantPermit([cUSDT]);
|
|
21624
|
-
* const balance = await sdk.createToken(cUSDT).balanceOf(userAddress);
|
|
21625
|
-
* } // sdk.terminate() called automatically here
|
|
22256
|
+
* const { unwrapRequestId } = await wrappedToken.unwrap(500n);
|
|
22257
|
+
* await wrappedToken.finalizeUnwrap(unwrapRequestId);
|
|
21626
22258
|
* ```
|
|
21627
22259
|
*/
|
|
21628
|
-
|
|
22260
|
+
finalizeUnwrap(unwrapRequestId: EncryptedValue): Promise<TransactionResult>;
|
|
22261
|
+
}
|
|
22262
|
+
//#endregion
|
|
22263
|
+
//#region src/query/confidential-balance.d.ts
|
|
22264
|
+
/** Configuration for {@link confidentialBalanceQueryOptions}. */
|
|
22265
|
+
interface ConfidentialBalanceQueryConfig {
|
|
22266
|
+
/** Address of the confidential token to read the balance of. */
|
|
22267
|
+
tokenAddress: Address;
|
|
22268
|
+
/** Account whose confidential balance to read; the query stays disabled until provided. */
|
|
22269
|
+
account?: Address;
|
|
22270
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
22271
|
+
query?: Record<string, unknown>;
|
|
22272
|
+
}
|
|
22273
|
+
/** Query options for a single confidential token balance. Auto-gated on `account`. */
|
|
22274
|
+
declare function confidentialBalanceQueryOptions(token: Token, config: ConfidentialBalanceQueryConfig, signerContext?: SignerQueryContext): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.confidentialBalance.owner>>;
|
|
22275
|
+
//#endregion
|
|
22276
|
+
//#region src/query/confidential-balances.d.ts
|
|
22277
|
+
/** Configuration for {@link confidentialBalancesQueryOptions}. */
|
|
22278
|
+
interface ConfidentialBalancesQueryConfig {
|
|
22279
|
+
/** Account whose confidential balances to read; the query stays disabled until provided. */
|
|
22280
|
+
account?: Address;
|
|
22281
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
22282
|
+
query?: Record<string, unknown>;
|
|
22283
|
+
}
|
|
22284
|
+
/** Builds TanStack Query options for reading the confidential balances of several tokens for one account in a single batch. */
|
|
22285
|
+
declare function confidentialBalancesQueryOptions(tokens: Token[], config?: ConfidentialBalancesQueryConfig, signerContext?: SignerQueryContext): QueryFactoryOptions<BatchBalancesResult, Error, BatchBalancesResult, ReturnType<typeof zamaQueryKeys.confidentialBalances.tokens>>;
|
|
22286
|
+
//#endregion
|
|
22287
|
+
//#region src/query/wrappers-registry.d.ts
|
|
22288
|
+
/** Base configuration shared by the wrappers-registry query option factories. */
|
|
22289
|
+
interface WrappersRegistryQueryConfig {
|
|
22290
|
+
/** Registry contract address for the current chain; used as a query key discriminator. */
|
|
22291
|
+
registryAddress: Address | undefined;
|
|
22292
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
22293
|
+
query?: Record<string, unknown>;
|
|
22294
|
+
}
|
|
22295
|
+
/** Builds TanStack Query options for reading all token wrapper pairs registered in the wrappers registry. */
|
|
22296
|
+
declare function tokenPairsQueryOptions(sdk: ZamaSDK, config: WrappersRegistryQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairs>>;
|
|
22297
|
+
/** Configuration for {@link confidentialTokenAddressQueryOptions}. */
|
|
22298
|
+
interface ConfidentialTokenAddressQueryConfig extends WrappersRegistryQueryConfig {
|
|
22299
|
+
/** Underlying ERC-20 token address whose confidential counterpart to look up. */
|
|
22300
|
+
tokenAddress?: Address;
|
|
22301
|
+
}
|
|
22302
|
+
/** Builds TanStack Query options for reading the confidential token address registered for a given underlying ERC-20 token. */
|
|
22303
|
+
declare function confidentialTokenAddressQueryOptions(sdk: ZamaSDK, config: ConfidentialTokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.confidentialTokenAddress>>;
|
|
22304
|
+
/** Configuration for {@link tokenAddressQueryOptions}. */
|
|
22305
|
+
interface TokenAddressQueryConfig extends WrappersRegistryQueryConfig {
|
|
22306
|
+
/** Confidential token address whose underlying ERC-20 counterpart to look up. */
|
|
22307
|
+
confidentialTokenAddress?: Address;
|
|
22308
|
+
}
|
|
22309
|
+
/** Builds TanStack Query options for reading the underlying ERC-20 token address registered for a given confidential token. */
|
|
22310
|
+
declare function tokenAddressQueryOptions(sdk: ZamaSDK, config: TokenAddressQueryConfig): QueryFactoryOptions<readonly [boolean, Address], Error, readonly [boolean, Address], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenAddress>>;
|
|
22311
|
+
/** Builds TanStack Query options for reading the total number of token wrapper pairs in the registry. */
|
|
22312
|
+
declare function tokenPairsLengthQueryOptions(sdk: ZamaSDK, config: WrappersRegistryQueryConfig): QueryFactoryOptions<bigint, Error, bigint, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsLength>>;
|
|
22313
|
+
/** Configuration for {@link tokenPairsSliceQueryOptions}. */
|
|
22314
|
+
interface TokenPairsSliceQueryConfig extends WrappersRegistryQueryConfig {
|
|
22315
|
+
/** Zero-based index of the first pair in the slice (inclusive). */
|
|
22316
|
+
fromIndex?: bigint;
|
|
22317
|
+
/** Index bounding the end of the slice. */
|
|
22318
|
+
toIndex?: bigint;
|
|
22319
|
+
}
|
|
22320
|
+
/** Builds TanStack Query options for reading a contiguous slice of the registry's token wrapper pairs. */
|
|
22321
|
+
declare function tokenPairsSliceQueryOptions(sdk: ZamaSDK, config: TokenPairsSliceQueryConfig): QueryFactoryOptions<readonly TokenWrapperPair[], Error, readonly TokenWrapperPair[], ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPairsSlice>>;
|
|
22322
|
+
/** Configuration for {@link tokenPairQueryOptions}. */
|
|
22323
|
+
interface TokenPairQueryConfig extends WrappersRegistryQueryConfig {
|
|
22324
|
+
/** Zero-based index of the token wrapper pair to read. */
|
|
22325
|
+
index?: bigint;
|
|
22326
|
+
}
|
|
22327
|
+
/** Builds TanStack Query options for reading a single token wrapper pair by its index in the registry. */
|
|
22328
|
+
declare function tokenPairQueryOptions(sdk: ZamaSDK, config: TokenPairQueryConfig): QueryFactoryOptions<TokenWrapperPair, Error, TokenWrapperPair, ReturnType<typeof zamaQueryKeys.wrappersRegistry.tokenPair>>;
|
|
22329
|
+
/** Configuration for {@link isConfidentialTokenValidQueryOptions}. */
|
|
22330
|
+
interface IsConfidentialTokenValidQueryConfig extends WrappersRegistryQueryConfig {
|
|
22331
|
+
/** Confidential token address to validate against the registry. */
|
|
22332
|
+
confidentialTokenAddress?: Address;
|
|
22333
|
+
}
|
|
22334
|
+
/** Builds TanStack Query options for checking whether a confidential token is registered and valid in the registry. */
|
|
22335
|
+
declare function isConfidentialTokenValidQueryOptions(sdk: ZamaSDK, config: IsConfidentialTokenValidQueryConfig): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.wrappersRegistry.isConfidentialTokenValid>>;
|
|
22336
|
+
/** Configuration for {@link listPairsQueryOptions}. */
|
|
22337
|
+
interface ListPairsQueryConfig {
|
|
22338
|
+
/**
|
|
22339
|
+
* The registry address for this chain — used as a query key discriminator.
|
|
22340
|
+
* The registry instance already knows how to resolve the address for the
|
|
22341
|
+
* current chain; this field just keeps the TanStack Query cache isolated
|
|
22342
|
+
* per registry contract.
|
|
22343
|
+
*/
|
|
22344
|
+
registryAddress: Address | undefined;
|
|
22345
|
+
/** 1-based page number to fetch; defaults to `1`. */
|
|
22346
|
+
page?: number;
|
|
22347
|
+
/** Number of pairs per page; defaults to `100`. */
|
|
22348
|
+
pageSize?: number;
|
|
22349
|
+
/** When `true`, resolve each pair's on-chain metadata; defaults to `false`. */
|
|
22350
|
+
metadata?: boolean;
|
|
22351
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
22352
|
+
query?: Record<string, unknown>;
|
|
22353
|
+
}
|
|
22354
|
+
/**
|
|
22355
|
+
* Query options for paginated listing of token wrapper pairs.
|
|
22356
|
+
*
|
|
22357
|
+
* Accepts a {@link WrappersRegistry} instance rather than a raw provider so that the
|
|
22358
|
+
* class-level TTL cache is shared across multiple `queryFn` executions. Pass
|
|
22359
|
+
* `sdk.registry` (the ZamaSDK lazy singleton) to ensure a single shared cache.
|
|
22360
|
+
*/
|
|
22361
|
+
declare function listPairsQueryOptions(registry: WrappersRegistry, config: ListPairsQueryConfig): QueryFactoryOptions<PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>, Error, PaginatedResult<TokenWrapperPair | TokenWrapperPairWithMetadata>, ReturnType<typeof zamaQueryKeys.wrappersRegistry.listPairs>>;
|
|
22362
|
+
//#endregion
|
|
22363
|
+
//#region src/query/shield.d.ts
|
|
22364
|
+
/** Variables for {@link shieldMutationOptions}. */
|
|
22365
|
+
interface ShieldParams extends ShieldOptions {
|
|
22366
|
+
/** Amount of the public ERC-20 to shield, in the token's base units. */
|
|
22367
|
+
amount: bigint;
|
|
22368
|
+
}
|
|
22369
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.shield | shielding} a public ERC-20 into its confidential form. @see {@link ShieldParams} */
|
|
22370
|
+
declare function shieldMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.shield", Address], ShieldParams, TransactionResult>;
|
|
22371
|
+
//#endregion
|
|
22372
|
+
//#region src/query/transfer.d.ts
|
|
22373
|
+
/** Variables for {@link confidentialTransferMutationOptions}. */
|
|
22374
|
+
interface ConfidentialTransferParams extends TransferOptions {
|
|
22375
|
+
/** Recipient address. */
|
|
22376
|
+
to: Address;
|
|
22377
|
+
/** Amount of tokens to transfer, in the token's base units. */
|
|
22378
|
+
amount: bigint;
|
|
22379
|
+
}
|
|
22380
|
+
/** Builds TanStack Query mutation options for {@link Token.confidentialTransfer | transferring} confidential tokens. @see {@link ConfidentialTransferParams} */
|
|
22381
|
+
declare function confidentialTransferMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransfer", Address], ConfidentialTransferParams, TransactionResult>;
|
|
22382
|
+
//#endregion
|
|
22383
|
+
//#region src/query/transfer-and-call.d.ts
|
|
22384
|
+
/** Variables for {@link confidentialTransferAndCallMutationOptions}. */
|
|
22385
|
+
interface ConfidentialTransferAndCallParams extends TransferOptions {
|
|
22386
|
+
/** Recipient address. */
|
|
22387
|
+
to: Address;
|
|
22388
|
+
/** Amount of tokens to transfer, in the token's base units. */
|
|
22389
|
+
amount: bigint;
|
|
22390
|
+
/** Opaque bytes forwarded to the recipient's ERC-7984 receiver hook. */
|
|
22391
|
+
data: Hex;
|
|
22392
|
+
}
|
|
22393
|
+
/** Builds TanStack Query mutation options for {@link Token.confidentialTransferAndCall | transferring} confidential tokens and invoking the recipient's receiver hook. @see {@link ConfidentialTransferAndCallParams} */
|
|
22394
|
+
declare function confidentialTransferAndCallMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransferAndCall", Address], ConfidentialTransferAndCallParams, TransactionResult>;
|
|
22395
|
+
//#endregion
|
|
22396
|
+
//#region src/query/transfer-from.d.ts
|
|
22397
|
+
/** Variables for {@link confidentialTransferFromMutationOptions}. */
|
|
22398
|
+
interface ConfidentialTransferFromParams {
|
|
22399
|
+
/** Address to transfer from. */
|
|
22400
|
+
from: Address;
|
|
22401
|
+
/** Recipient address. */
|
|
22402
|
+
to: Address;
|
|
22403
|
+
/** Amount of tokens to transfer, in the token's base units. */
|
|
22404
|
+
amount: bigint;
|
|
22405
|
+
/** Optional progress callbacks for the multi-step transfer flow. */
|
|
22406
|
+
callbacks?: TransferCallbacks;
|
|
22407
|
+
}
|
|
22408
|
+
/** Builds TanStack Query mutation options for {@link Token.confidentialTransferFrom | transferring} confidential tokens from another account (operator flow). @see {@link ConfidentialTransferFromParams} */
|
|
22409
|
+
declare function confidentialTransferFromMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransferFrom", Address], ConfidentialTransferFromParams, TransactionResult>;
|
|
22410
|
+
//#endregion
|
|
22411
|
+
//#region src/query/transfer-from-and-call.d.ts
|
|
22412
|
+
/** Variables for {@link confidentialTransferFromAndCallMutationOptions}. */
|
|
22413
|
+
interface ConfidentialTransferFromAndCallParams {
|
|
22414
|
+
/** Address to transfer from. */
|
|
22415
|
+
from: Address;
|
|
22416
|
+
/** Recipient address. */
|
|
22417
|
+
to: Address;
|
|
22418
|
+
/** Amount of tokens to transfer, in the token's base units. */
|
|
22419
|
+
amount: bigint;
|
|
22420
|
+
/** Opaque bytes forwarded to the recipient's ERC-7984 receiver hook. */
|
|
22421
|
+
data: Hex;
|
|
22422
|
+
/** Optional progress callbacks for the multi-step transfer flow. */
|
|
22423
|
+
callbacks?: TransferCallbacks;
|
|
22424
|
+
}
|
|
22425
|
+
/** Builds TanStack Query mutation options for {@link Token.confidentialTransferFromAndCall | transferring} confidential tokens from another account and invoking the recipient's receiver hook. @see {@link ConfidentialTransferFromAndCallParams} */
|
|
22426
|
+
declare function confidentialTransferFromAndCallMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialTransferFromAndCall", Address], ConfidentialTransferFromAndCallParams, TransactionResult>;
|
|
22427
|
+
//#endregion
|
|
22428
|
+
//#region src/query/set-operator.d.ts
|
|
22429
|
+
/** Variables for {@link confidentialSetOperatorMutationOptions}. */
|
|
22430
|
+
interface ConfidentialSetOperatorParams {
|
|
22431
|
+
/** Operator address to authorize. */
|
|
22432
|
+
operator: Address;
|
|
22433
|
+
/** Unix timestamp (seconds) when the operator authorization expires; defaults to one hour from now. */
|
|
22434
|
+
until?: number;
|
|
22435
|
+
}
|
|
22436
|
+
/** Builds TanStack Query mutation options for {@link Token.setOperator | authorizing} an operator on a confidential token. @see {@link ConfidentialSetOperatorParams} */
|
|
22437
|
+
declare function confidentialSetOperatorMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.confidentialSetOperator", Address], ConfidentialSetOperatorParams, TransactionResult>;
|
|
22438
|
+
//#endregion
|
|
22439
|
+
//#region src/query/approve-underlying.d.ts
|
|
22440
|
+
/** Variables for {@link approveUnderlyingMutationOptions}. */
|
|
22441
|
+
interface ApproveUnderlyingParams {
|
|
22442
|
+
/** Amount of the underlying ERC-20 to approve, in its base units; omit for a max approval. */
|
|
22443
|
+
amount?: bigint;
|
|
22444
|
+
}
|
|
22445
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.approveUnderlying | approving} the wrapper to spend the underlying ERC-20. @see {@link ApproveUnderlyingParams} */
|
|
22446
|
+
declare function approveUnderlyingMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.approveUnderlying", Address], ApproveUnderlyingParams, TransactionResult>;
|
|
22447
|
+
//#endregion
|
|
22448
|
+
//#region src/query/unshield.d.ts
|
|
22449
|
+
/** Variables for {@link unshieldMutationOptions}. */
|
|
22450
|
+
interface UnshieldParams extends UnshieldOptions {
|
|
22451
|
+
/** Amount of tokens to unshield, in the token's base units. */
|
|
22452
|
+
amount: bigint;
|
|
22453
|
+
}
|
|
22454
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.unshield | unshielding} a confidential token back into its public ERC-20. @see {@link UnshieldParams} */
|
|
22455
|
+
declare function unshieldMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.unshield", Address], UnshieldParams, TransactionResult>;
|
|
22456
|
+
//#endregion
|
|
22457
|
+
//#region src/query/unshield-all.d.ts
|
|
22458
|
+
/** Variables for {@link unshieldAllMutationOptions}. */
|
|
22459
|
+
interface UnshieldAllParams extends UnshieldCallbacks {}
|
|
22460
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.unshieldAll | unshielding} the entire confidential balance back into the public ERC-20. @see {@link UnshieldAllParams} */
|
|
22461
|
+
declare function unshieldAllMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.unshieldAll", Address], UnshieldAllParams | void, TransactionResult>;
|
|
22462
|
+
//#endregion
|
|
22463
|
+
//#region src/query/resume-unshield.d.ts
|
|
22464
|
+
/** Variables for {@link resumeUnshieldMutationOptions}. */
|
|
22465
|
+
interface ResumeUnshieldParams extends UnshieldCallbacks {
|
|
22466
|
+
/** Hash of the earlier unwrap request transaction to resume from. */
|
|
22467
|
+
unwrapTxHash: Hex;
|
|
21629
22468
|
}
|
|
22469
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.resumeUnshield | resuming} an interrupted unshield from its unwrap request transaction. @see {@link ResumeUnshieldParams} */
|
|
22470
|
+
declare function resumeUnshieldMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.resumeUnshield", Address], ResumeUnshieldParams, TransactionResult>;
|
|
21630
22471
|
//#endregion
|
|
21631
|
-
//#region src/query/
|
|
21632
|
-
/**
|
|
21633
|
-
|
|
21634
|
-
|
|
21635
|
-
|
|
21636
|
-
|
|
21637
|
-
|
|
21638
|
-
|
|
22472
|
+
//#region src/query/unwrap.d.ts
|
|
22473
|
+
/** Variables for {@link unwrapMutationOptions}. */
|
|
22474
|
+
interface UnwrapParams {
|
|
22475
|
+
/** Amount of tokens to unwrap, in the token's base units. */
|
|
22476
|
+
amount: bigint;
|
|
22477
|
+
}
|
|
22478
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.unwrap | unwrapping} a confidential token (request phase of the two-phase unwrap). @see {@link UnwrapParams} */
|
|
22479
|
+
declare function unwrapMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.unwrap", Address], UnwrapParams, UnwrapResult>;
|
|
22480
|
+
//#endregion
|
|
22481
|
+
//#region src/query/wrap.d.ts
|
|
22482
|
+
/** Variables for {@link wrapMutationOptions}. */
|
|
22483
|
+
interface WrapParams extends WrapOptions {
|
|
22484
|
+
/** Amount of the public ERC-20 to wrap, in the token's base units. */
|
|
22485
|
+
amount: bigint;
|
|
22486
|
+
}
|
|
22487
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.wrap | wrapping} a public ERC-20 into its confidential form. @see {@link WrapParams} */
|
|
22488
|
+
declare function wrapMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.wrap", Address], WrapParams, TransactionResult>;
|
|
22489
|
+
//#endregion
|
|
22490
|
+
//#region src/query/unwrap-all.d.ts
|
|
22491
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.unwrapAll | unwrapping} the entire confidential balance. */
|
|
22492
|
+
declare function unwrapAllMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.unwrapAll", Address], void, UnwrapResult>;
|
|
22493
|
+
//#endregion
|
|
22494
|
+
//#region src/query/finalize-unwrap.d.ts
|
|
22495
|
+
/** Variables for {@link finalizeUnwrapMutationOptions}. */
|
|
22496
|
+
type FinalizeUnwrapParams = {
|
|
22497
|
+
/** Identifier from an `UnwrapRequested` event. */
|
|
22498
|
+
unwrapRequestId: EncryptedValue;
|
|
21639
22499
|
};
|
|
21640
|
-
/** TanStack Query mutation options
|
|
21641
|
-
|
|
21642
|
-
|
|
21643
|
-
|
|
21644
|
-
|
|
21645
|
-
|
|
21646
|
-
|
|
21647
|
-
|
|
22500
|
+
/** Builds TanStack Query mutation options for {@link WrappedToken.finalizeUnwrap | finalizing} a previously requested unwrap. @see {@link FinalizeUnwrapParams} */
|
|
22501
|
+
declare function finalizeUnwrapMutationOptions(token: WrappedToken): MutationFactoryOptions<readonly ["zama.finalizeUnwrap", Address], FinalizeUnwrapParams, TransactionResult>;
|
|
22502
|
+
//#endregion
|
|
22503
|
+
//#region src/query/encrypt.d.ts
|
|
22504
|
+
/** Builds TanStack Query mutation options for {@link ZamaSDK.encrypt | encrypting} plaintext inputs into an encrypted payload. */
|
|
22505
|
+
declare function encryptMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.encrypt"], EncryptParams, EncryptResult>;
|
|
22506
|
+
//#endregion
|
|
22507
|
+
//#region src/query/delegated-decrypt.d.ts
|
|
22508
|
+
/** Variables for {@link delegatedDecryptValuesMutationOptions}. */
|
|
22509
|
+
interface DelegatedDecryptValuesMutationParams {
|
|
22510
|
+
/** Encrypted values (with their contract addresses) to decrypt. */
|
|
22511
|
+
encryptedInputs: EncryptedInput[];
|
|
22512
|
+
/** Address of the account that delegated decryption rights to the connected wallet. */
|
|
22513
|
+
delegatorAddress: Address;
|
|
21648
22514
|
}
|
|
22515
|
+
/** Builds TanStack Query mutation options for {@link Decryption.delegatedDecryptValues | decrypting} encrypted values via delegated decryption credentials. @see {@link DelegatedDecryptValuesMutationParams} */
|
|
22516
|
+
declare function delegatedDecryptValuesMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.delegatedDecryptValues"], DelegatedDecryptValuesMutationParams, Readonly<Record<EncryptedValue, ClearValue>>>;
|
|
21649
22517
|
//#endregion
|
|
21650
|
-
//#region src/query/
|
|
22518
|
+
//#region src/query/public-decrypt.d.ts
|
|
22519
|
+
/** Builds TanStack Query mutation options for {@link Decryption.decryptPublicValues | publicly decrypting} encrypted values, caching each clear result. */
|
|
22520
|
+
declare function decryptPublicValuesMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.decryptPublicValues"], EncryptedValue[], DecryptPublicValuesResult>;
|
|
22521
|
+
//#endregion
|
|
22522
|
+
//#region src/query/grant-permit.d.ts
|
|
21651
22523
|
/**
|
|
21652
|
-
*
|
|
21653
|
-
*
|
|
21654
|
-
*
|
|
21655
|
-
* ```ts
|
|
21656
|
-
* queryClient.invalidateQueries({
|
|
21657
|
-
* queryKey: zamaQueryKeys.confidentialBalance.token("0xToken"),
|
|
21658
|
-
* });
|
|
21659
|
-
* ```
|
|
22524
|
+
* Builds TanStack Query mutation options for {@link Permits.grantPermit | granting}
|
|
22525
|
+
* decryption permits for the given contract addresses, or {@link WILDCARD_PERMIT}
|
|
22526
|
+
* for a permissive V2 permit covering every contract.
|
|
21660
22527
|
*/
|
|
21661
|
-
declare
|
|
21662
|
-
readonly confidentialBalance: {
|
|
21663
|
-
readonly all: readonly ["zama.confidentialBalance"];
|
|
21664
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.confidentialBalance", {
|
|
21665
|
-
readonly tokenAddress: `0x${string}`;
|
|
21666
|
-
}];
|
|
21667
|
-
readonly owner: (tokenAddress: Address, owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalance", {
|
|
21668
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21669
|
-
readonly walletAddress: `0x${string}`;
|
|
21670
|
-
readonly walletChainId: number;
|
|
21671
|
-
readonly tokenAddress: `0x${string}`;
|
|
21672
|
-
} | {
|
|
21673
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21674
|
-
readonly walletAddress?: undefined;
|
|
21675
|
-
readonly walletChainId?: undefined;
|
|
21676
|
-
readonly tokenAddress: `0x${string}`;
|
|
21677
|
-
}];
|
|
21678
|
-
};
|
|
21679
|
-
readonly confidentialBalances: {
|
|
21680
|
-
readonly all: readonly ["zama.confidentialBalances"];
|
|
21681
|
-
readonly tokens: (tokenAddresses: Address[], owner?: Address, walletAccount?: WalletAccount) => readonly ["zama.confidentialBalances", {
|
|
21682
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21683
|
-
readonly walletAddress: `0x${string}`;
|
|
21684
|
-
readonly walletChainId: number;
|
|
21685
|
-
readonly tokenAddresses: `0x${string}`[];
|
|
21686
|
-
} | {
|
|
21687
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21688
|
-
readonly walletAddress?: undefined;
|
|
21689
|
-
readonly walletChainId?: undefined;
|
|
21690
|
-
readonly tokenAddresses: `0x${string}`[];
|
|
21691
|
-
}];
|
|
21692
|
-
};
|
|
21693
|
-
readonly tokenMetadata: {
|
|
21694
|
-
readonly all: readonly ["zama.tokenMetadata"];
|
|
21695
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.tokenMetadata", {
|
|
21696
|
-
readonly tokenAddress: `0x${string}`;
|
|
21697
|
-
}];
|
|
21698
|
-
};
|
|
21699
|
-
readonly isConfidential: {
|
|
21700
|
-
readonly all: readonly ["zama.isConfidential"];
|
|
21701
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.isConfidential", {
|
|
21702
|
-
readonly tokenAddress: `0x${string}`;
|
|
21703
|
-
}];
|
|
21704
|
-
};
|
|
21705
|
-
readonly isWrapper: {
|
|
21706
|
-
readonly all: readonly ["zama.isWrapper"];
|
|
21707
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.isWrapper", {
|
|
21708
|
-
readonly tokenAddress: `0x${string}`;
|
|
21709
|
-
}];
|
|
21710
|
-
};
|
|
21711
|
-
readonly wrapperDiscovery: {
|
|
21712
|
-
readonly all: readonly ["zama.wrapperDiscovery"];
|
|
21713
|
-
readonly token: (tokenAddress?: Address, erc20Address?: Address, registryAddress?: Address) => readonly ["zama.wrapperDiscovery", {
|
|
21714
|
-
readonly registryAddress?: `0x${string}` | undefined;
|
|
21715
|
-
readonly erc20Address?: `0x${string}` | undefined;
|
|
21716
|
-
readonly tokenAddress?: `0x${string}` | undefined;
|
|
21717
|
-
}];
|
|
21718
|
-
};
|
|
21719
|
-
readonly underlyingAllowance: {
|
|
21720
|
-
readonly all: readonly ["zama.underlyingAllowance"];
|
|
21721
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.underlyingAllowance", {
|
|
21722
|
-
readonly tokenAddress: `0x${string}`;
|
|
21723
|
-
}];
|
|
21724
|
-
readonly scope: (tokenAddress: Address, owner?: Address) => readonly ["zama.underlyingAllowance", {
|
|
21725
|
-
readonly owner?: `0x${string}` | undefined;
|
|
21726
|
-
readonly tokenAddress: `0x${string}`;
|
|
21727
|
-
}];
|
|
21728
|
-
};
|
|
21729
|
-
readonly confidentialIsOperator: {
|
|
21730
|
-
readonly all: readonly ["zama.confidentialIsOperator"];
|
|
21731
|
-
readonly token: (tokenAddress?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
21732
|
-
tokenAddress: `0x${string}`;
|
|
21733
|
-
} | {
|
|
21734
|
-
tokenAddress?: undefined;
|
|
21735
|
-
}];
|
|
21736
|
-
readonly scope: (tokenAddress?: Address, holder?: Address, spender?: Address) => readonly ["zama.confidentialIsOperator", {
|
|
21737
|
-
readonly spender?: `0x${string}` | undefined;
|
|
21738
|
-
readonly holder?: `0x${string}` | undefined;
|
|
21739
|
-
readonly tokenAddress?: `0x${string}` | undefined;
|
|
21740
|
-
}];
|
|
21741
|
-
};
|
|
21742
|
-
readonly totalSupply: {
|
|
21743
|
-
readonly all: readonly ["zama.totalSupply"];
|
|
21744
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.totalSupply", {
|
|
21745
|
-
readonly tokenAddress: `0x${string}`;
|
|
21746
|
-
}];
|
|
21747
|
-
};
|
|
21748
|
-
readonly pendingUnshield: {
|
|
21749
|
-
readonly all: readonly ["zama.pendingUnshield"];
|
|
21750
|
-
readonly token: (tokenAddress: Address) => readonly ["zama.pendingUnshield", {
|
|
21751
|
-
readonly tokenAddress: `0x${string}`;
|
|
21752
|
-
}];
|
|
21753
|
-
};
|
|
21754
|
-
readonly hasPermit: {
|
|
21755
|
-
readonly all: readonly ["zama.hasPermit"];
|
|
21756
|
-
readonly scope: (contractAddresses: Address[], walletAccount?: WalletAccount) => readonly ["zama.hasPermit", {
|
|
21757
|
-
readonly contractAddresses: `0x${string}`[];
|
|
21758
|
-
readonly walletAddress: `0x${string}`;
|
|
21759
|
-
readonly walletChainId: number;
|
|
21760
|
-
} | {
|
|
21761
|
-
readonly contractAddresses: `0x${string}`[];
|
|
21762
|
-
readonly walletAddress?: undefined;
|
|
21763
|
-
readonly walletChainId?: undefined;
|
|
21764
|
-
}];
|
|
21765
|
-
};
|
|
21766
|
-
readonly delegationStatus: {
|
|
21767
|
-
readonly all: readonly ["zama.delegationStatus"];
|
|
21768
|
-
readonly contract: (contractAddress?: Address) => readonly ["zama.delegationStatus", {
|
|
21769
|
-
contractAddress: `0x${string}`;
|
|
21770
|
-
} | {
|
|
21771
|
-
contractAddress?: undefined;
|
|
21772
|
-
}];
|
|
21773
|
-
readonly scope: (contractAddress?: Address, delegator?: Address, delegate?: Address) => readonly ["zama.delegationStatus", {
|
|
21774
|
-
readonly delegateAddress?: `0x${string}` | undefined;
|
|
21775
|
-
readonly delegatorAddress?: `0x${string}` | undefined;
|
|
21776
|
-
readonly contractAddress?: `0x${string}` | undefined;
|
|
21777
|
-
}];
|
|
21778
|
-
};
|
|
21779
|
-
readonly decryption: {
|
|
21780
|
-
readonly all: readonly ["zama.decryption"];
|
|
21781
|
-
readonly encryptedValue: (encryptedValue: string, contractAddress?: Address) => readonly ["zama.decryption", {
|
|
21782
|
-
readonly contractAddress?: `0x${string}` | undefined;
|
|
21783
|
-
readonly encryptedValue: string;
|
|
21784
|
-
}];
|
|
21785
|
-
readonly encryptedInputs: (encryptedInputs: readonly {
|
|
21786
|
-
encryptedValue: string;
|
|
21787
|
-
contractAddress: Address;
|
|
21788
|
-
}[], walletAccount?: WalletAccount) => readonly ["zama.decryption", {
|
|
21789
|
-
readonly encryptedInputs: {
|
|
21790
|
-
encryptedValue: Hex;
|
|
21791
|
-
contractAddress: `0x${string}`;
|
|
21792
|
-
}[];
|
|
21793
|
-
readonly walletAddress: `0x${string}`;
|
|
21794
|
-
readonly walletChainId: number;
|
|
21795
|
-
} | {
|
|
21796
|
-
readonly encryptedInputs: {
|
|
21797
|
-
encryptedValue: Hex;
|
|
21798
|
-
contractAddress: `0x${string}`;
|
|
21799
|
-
}[];
|
|
21800
|
-
readonly walletAddress?: undefined;
|
|
21801
|
-
readonly walletChainId?: undefined;
|
|
21802
|
-
}];
|
|
21803
|
-
};
|
|
21804
|
-
readonly wrappersRegistry: {
|
|
21805
|
-
readonly all: readonly ["zama.wrappersRegistry"];
|
|
21806
|
-
readonly chainId: () => readonly ["zama.wrappersRegistry", {
|
|
21807
|
-
readonly type: "chainId";
|
|
21808
|
-
}];
|
|
21809
|
-
readonly tokenPairs: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21810
|
-
readonly type: "tokenPairs";
|
|
21811
|
-
readonly registryAddress: `0x${string}`;
|
|
21812
|
-
}];
|
|
21813
|
-
readonly confidentialTokenAddress: (registryAddress: Address, tokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21814
|
-
readonly type: "confidentialTokenAddress";
|
|
21815
|
-
readonly registryAddress: `0x${string}`;
|
|
21816
|
-
readonly tokenAddress: `0x${string}`;
|
|
21817
|
-
}];
|
|
21818
|
-
readonly tokenAddress: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21819
|
-
readonly type: "tokenAddress";
|
|
21820
|
-
readonly registryAddress: `0x${string}`;
|
|
21821
|
-
readonly confidentialTokenAddress: `0x${string}`;
|
|
21822
|
-
}];
|
|
21823
|
-
readonly tokenPairsLength: (registryAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21824
|
-
readonly type: "tokenPairsLength";
|
|
21825
|
-
readonly registryAddress: `0x${string}`;
|
|
21826
|
-
}];
|
|
21827
|
-
readonly tokenPairsSlice: (registryAddress: Address, fromIndex: string, toIndex: string) => readonly ["zama.wrappersRegistry", {
|
|
21828
|
-
readonly type: "tokenPairsSlice";
|
|
21829
|
-
readonly registryAddress: `0x${string}`;
|
|
21830
|
-
readonly fromIndex: string;
|
|
21831
|
-
readonly toIndex: string;
|
|
21832
|
-
}];
|
|
21833
|
-
readonly tokenPair: (registryAddress: Address, index: string) => readonly ["zama.wrappersRegistry", {
|
|
21834
|
-
readonly type: "tokenPair";
|
|
21835
|
-
readonly registryAddress: `0x${string}`;
|
|
21836
|
-
readonly index: string;
|
|
21837
|
-
}];
|
|
21838
|
-
readonly isConfidentialTokenValid: (registryAddress: Address, confidentialTokenAddress: Address) => readonly ["zama.wrappersRegistry", {
|
|
21839
|
-
readonly type: "isConfidentialTokenValid";
|
|
21840
|
-
readonly registryAddress: `0x${string}`;
|
|
21841
|
-
readonly confidentialTokenAddress: `0x${string}`;
|
|
21842
|
-
}];
|
|
21843
|
-
readonly listPairs: (registryAddress: Address, page: number, pageSize: number, metadata: boolean) => readonly ["zama.wrappersRegistry", {
|
|
21844
|
-
readonly type: "listPairs";
|
|
21845
|
-
readonly registryAddress: `0x${string}`;
|
|
21846
|
-
readonly page: number;
|
|
21847
|
-
readonly pageSize: number;
|
|
21848
|
-
readonly metadata: boolean;
|
|
21849
|
-
}];
|
|
21850
|
-
};
|
|
21851
|
-
};
|
|
22528
|
+
declare function grantPermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.grantPermit"], Address[] | WildcardPermit, void>;
|
|
21852
22529
|
//#endregion
|
|
21853
|
-
//#region src/query/
|
|
21854
|
-
/**
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
22530
|
+
//#region src/query/prepare-permit.d.ts
|
|
22531
|
+
/** Builds TanStack Query mutation options for {@link Offline.preparePermit | preparing} an offline decryption permit. */
|
|
22532
|
+
declare function preparePermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.preparePermit"], PreparePermitRequest, PreparedPermit>;
|
|
22533
|
+
//#endregion
|
|
22534
|
+
//#region src/query/register-permit.d.ts
|
|
22535
|
+
/** Parameters for {@link registerPermitMutationOptions}. */
|
|
22536
|
+
interface RegisterPermitParams {
|
|
22537
|
+
/** The payload `sdk.offline.preparePermit` returned. */
|
|
22538
|
+
prepared: PreparedPermit;
|
|
22539
|
+
/** The `eth_signTypedData_v4` signature over `prepared.eip712`. */
|
|
22540
|
+
signature: Hex;
|
|
21858
22541
|
}
|
|
22542
|
+
/** Builds TanStack Query mutation options for {@link Permits.registerPermit | registering} a signed offline permit. */
|
|
22543
|
+
declare function registerPermitMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.registerPermit"], RegisterPermitParams, void>;
|
|
21859
22544
|
//#endregion
|
|
21860
|
-
//#region src/query/
|
|
21861
|
-
/**
|
|
21862
|
-
interface
|
|
21863
|
-
/**
|
|
21864
|
-
|
|
21865
|
-
/**
|
|
21866
|
-
|
|
22545
|
+
//#region src/query/has-permit.d.ts
|
|
22546
|
+
/** Configuration for {@link hasPermitQueryOptions}. */
|
|
22547
|
+
interface HasPermitQueryConfig {
|
|
22548
|
+
/** Contract addresses to check credentials against. */
|
|
22549
|
+
contractAddresses: Address[];
|
|
22550
|
+
/**
|
|
22551
|
+
* Standard TanStack query options. `hasPermit` intentionally overrides cache
|
|
22552
|
+
* timing because permit state is wallet-local, not server state: every fetch
|
|
22553
|
+
* should read the SDK credential service directly.
|
|
22554
|
+
*/
|
|
22555
|
+
query?: Record<string, unknown>;
|
|
22556
|
+
}
|
|
22557
|
+
/** Builds TanStack Query options for reading whether the connected wallet holds a valid decryption permit for the given contracts. */
|
|
22558
|
+
declare function hasPermitQueryOptions(sdk: ZamaSDK, config: HasPermitQueryConfig, signerContext?: SignerQueryContext): QueryFactoryOptions<boolean, Error, boolean, ReturnType<typeof zamaQueryKeys.hasPermit.scope>>;
|
|
22559
|
+
//#endregion
|
|
22560
|
+
//#region src/query/revoke-permits.d.ts
|
|
22561
|
+
/** TanStack Query mutation factory for {@link Permits.revokePermits}. */
|
|
22562
|
+
declare function revokePermitsMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.revokePermits"], Address[] | void, void>;
|
|
22563
|
+
//#endregion
|
|
22564
|
+
//#region src/query/clear-credentials.d.ts
|
|
22565
|
+
/** TanStack Query mutation factory for {@link Permits.clear}. */
|
|
22566
|
+
declare function clearCredentialsMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.clearCredentials"], void, void>;
|
|
22567
|
+
//#endregion
|
|
22568
|
+
//#region src/query/delegate-decryption.d.ts
|
|
22569
|
+
/** Variables for {@link delegateDecryptionMutationOptions}. */
|
|
22570
|
+
interface DelegateDecryptionParams {
|
|
22571
|
+
/** Address to grant delegated decryption rights to. */
|
|
22572
|
+
delegateAddress: Address;
|
|
22573
|
+
/** When the delegation expires; omit for no expiry. */
|
|
22574
|
+
expirationDate?: Date;
|
|
22575
|
+
}
|
|
22576
|
+
/** Builds TanStack Query mutation options for {@link Delegations.delegateDecryption | granting} delegated decryption rights on a contract. @see {@link DelegateDecryptionParams} */
|
|
22577
|
+
declare function delegateDecryptionMutationOptions(sdk: ZamaSDK, contractAddress: Address): MutationFactoryOptions<readonly ["zama.delegateDecryption", Address], DelegateDecryptionParams, TransactionResult>;
|
|
22578
|
+
//#endregion
|
|
22579
|
+
//#region src/query/decrypt-balance-as.d.ts
|
|
22580
|
+
/** Variables for {@link decryptBalanceAsMutationOptions}. */
|
|
22581
|
+
interface DecryptBalanceAsParams {
|
|
22582
|
+
/** Address of the account that delegated decryption rights to the connected wallet. */
|
|
22583
|
+
delegatorAddress: Address;
|
|
22584
|
+
/** Account whose on-chain balance to read; defaults to the delegator address. */
|
|
22585
|
+
accountAddress?: Address;
|
|
22586
|
+
}
|
|
22587
|
+
/** Builds TanStack Query mutation options for {@link Token.decryptBalanceAs | decrypting} a balance via delegated decryption credentials. @see {@link DecryptBalanceAsParams} */
|
|
22588
|
+
declare function decryptBalanceAsMutationOptions(token: Token): MutationFactoryOptions<readonly ["zama.decryptBalanceAs", Address], DecryptBalanceAsParams, bigint>;
|
|
22589
|
+
//#endregion
|
|
22590
|
+
//#region src/query/batch-decrypt-balances-as.d.ts
|
|
22591
|
+
/** Variables for {@link batchDecryptBalancesAsMutationOptions}. */
|
|
22592
|
+
type BatchDecryptBalancesAsParams = BatchDecryptAsOptions;
|
|
22593
|
+
/** Builds TanStack Query mutation options for {@link Token.batchDecryptBalancesAs | decrypting} multiple token balances via delegated decryption credentials. @see {@link BatchDecryptBalancesAsParams} */
|
|
22594
|
+
declare function batchDecryptBalancesAsMutationOptions(tokens: Token[]): MutationFactoryOptions<readonly ["zama.batchDecryptBalancesAs", ...Address[]], BatchDecryptBalancesAsParams, Map<Address, bigint>>;
|
|
22595
|
+
//#endregion
|
|
22596
|
+
//#region src/query/revoke-delegation.d.ts
|
|
22597
|
+
/** Variables for {@link revokeDelegationMutationOptions}. */
|
|
22598
|
+
interface RevokeDelegationParams {
|
|
22599
|
+
/** Address whose delegated decryption rights to revoke. */
|
|
22600
|
+
delegateAddress: Address;
|
|
22601
|
+
}
|
|
22602
|
+
/** Builds TanStack Query mutation options for {@link Delegations.revokeDelegation | revoking} delegated decryption rights on a contract. @see {@link RevokeDelegationParams} */
|
|
22603
|
+
declare function revokeDelegationMutationOptions(sdk: ZamaSDK, contractAddress: Address): MutationFactoryOptions<readonly ["zama.revokeDelegation", Address], RevokeDelegationParams, TransactionResult>;
|
|
22604
|
+
//#endregion
|
|
22605
|
+
//#region src/query/invalidate-decryption-signatures.d.ts
|
|
22606
|
+
/** Variables for {@link invalidateDecryptionSignaturesMutationOptions}. */
|
|
22607
|
+
interface InvalidateDecryptionSignaturesParams {
|
|
22608
|
+
/** Oldest timestamp that remains valid. Omit to invalidate everything up to now. */
|
|
22609
|
+
timestamp?: Date;
|
|
21867
22610
|
}
|
|
21868
|
-
/**
|
|
21869
|
-
|
|
21870
|
-
|
|
21871
|
-
|
|
22611
|
+
/** Builds TanStack Query mutation options for {@link Permits.invalidateDecryptionSignatures | invalidating} every decryption signature signed before a timestamp. @see {@link InvalidateDecryptionSignaturesParams} */
|
|
22612
|
+
declare function invalidateDecryptionSignaturesMutationOptions(sdk: ZamaSDK): MutationFactoryOptions<readonly ["zama.invalidateDecryptionSignatures"], InvalidateDecryptionSignaturesParams | void, TransactionResult>;
|
|
22613
|
+
//#endregion
|
|
22614
|
+
//#region src/query/delegation-status.d.ts
|
|
22615
|
+
/** Configuration for {@link delegationStatusQueryOptions}. */
|
|
22616
|
+
interface DelegationStatusQueryConfig {
|
|
22617
|
+
/** Contract the delegation applies to; pass `undefined` to keep the query disabled. */
|
|
22618
|
+
contractAddress: Address | undefined;
|
|
22619
|
+
/** Address granting the delegated decryption rights; the query stays disabled until provided. */
|
|
22620
|
+
delegatorAddress?: Address;
|
|
22621
|
+
/** Address receiving the delegated decryption rights; the query stays disabled until provided. */
|
|
22622
|
+
delegateAddress?: Address;
|
|
22623
|
+
/** Additional TanStack Query options merged into the generated query (e.g. `staleTime`, `enabled`). */
|
|
22624
|
+
query?: Record<string, unknown>;
|
|
22625
|
+
}
|
|
22626
|
+
/** Builds TanStack Query options for reading the decryption-delegation status between a delegator and a delegate on a contract. */
|
|
22627
|
+
declare function delegationStatusQueryOptions(sdk: ZamaSDK, config: DelegationStatusQueryConfig): QueryFactoryOptions<DelegationStatus, Error, DelegationStatus, ReturnType<typeof zamaQueryKeys.delegationStatus.scope>>;
|
|
21872
22628
|
//#endregion
|
|
21873
22629
|
//#region src/services/decryption-service.d.ts
|
|
21874
22630
|
/** Options shared by the delegated-decrypt entry points. */
|
|
@@ -21898,6 +22654,224 @@ interface BatchDecryptResult {
|
|
|
21898
22654
|
items: BatchDecryptItem[];
|
|
21899
22655
|
}
|
|
21900
22656
|
//#endregion
|
|
22657
|
+
//#region src/namespaces/offline.d.ts
|
|
22658
|
+
/**
|
|
22659
|
+
* Namespace for the offline-signing pipeline —
|
|
22660
|
+
* `prepare → [external sign + self-publish]` — for institutional custody, HSM
|
|
22661
|
+
* ceremonies, and policy-engine workflows where signing runs out-of-process and
|
|
22662
|
+
* cannot happen synchronously in a single Promise.
|
|
22663
|
+
*/
|
|
22664
|
+
declare class Offline {
|
|
22665
|
+
#private;
|
|
22666
|
+
/**
|
|
22667
|
+
* Build an RLP-encoded unsigned transaction for the given request. The
|
|
22668
|
+
* caller signs it externally — via an HSM ceremony, an out-of-process
|
|
22669
|
+
* custodian, or any signer holding the key — and broadcasts the signed bytes
|
|
22670
|
+
* through its own channel.
|
|
22671
|
+
*
|
|
22672
|
+
* Signer-optional: works without a configured signer (canonical shape for
|
|
22673
|
+
* cross-process custody — the back-end signer service consumes
|
|
22674
|
+
* `prepared.unsignedTx` and returns signed bytes).
|
|
22675
|
+
*
|
|
22676
|
+
* @remarks
|
|
22677
|
+
* `request.from` is only a declaration — the SDK does not prove the caller
|
|
22678
|
+
* controls it, and an EIP-1559 unsigned tx carries no `from` field at all
|
|
22679
|
+
* (the on-chain sender is whichever key signs the bytes). Point `from` at
|
|
22680
|
+
* the account the custodian will sign with; custodians enforce key-control
|
|
22681
|
+
* at sign time — a signing request for a key the credential can't use fails
|
|
22682
|
+
* there — so a mismatched `from` cannot make the custodian sign from an
|
|
22683
|
+
* account you don't control. Verifying control of `from` up front is still
|
|
22684
|
+
* the application's responsibility.
|
|
22685
|
+
*/
|
|
22686
|
+
prepare<K extends TransactionKind>(request: Extract<PrepareTransactionRequest, {
|
|
22687
|
+
kind: K;
|
|
22688
|
+
}>, options?: PrepareOptions): Promise<PreparedFor<K>>;
|
|
22689
|
+
/**
|
|
22690
|
+
* Build the offline-signing payload for a decryption permit: the unsigned
|
|
22691
|
+
* EIP-712 typed data plus everything `sdk.permits.registerPermit` needs to
|
|
22692
|
+
* verify and persist the signature an out-of-process signer returns for it.
|
|
22693
|
+
*
|
|
22694
|
+
* Not a `prepare()` transaction kind: a permit is not a transaction —
|
|
22695
|
+
* nothing is broadcast, and registering the signature is a local operation,
|
|
22696
|
+
* not a relayer round-trip.
|
|
22697
|
+
*
|
|
22698
|
+
* Signer-optional, like {@link prepare}: `request.signer` is an explicit
|
|
22699
|
+
* address, not a connected wallet account. Building the typed data still
|
|
22700
|
+
* reads the chain's KMS signers context on-chain — signer-offline, not
|
|
22701
|
+
* network-offline.
|
|
22702
|
+
*
|
|
22703
|
+
* One permit per call: unlike `sdk.permits.grantPermit`, this never widens
|
|
22704
|
+
* an existing permit or chunks over 10 contracts — `request.contracts` maps
|
|
22705
|
+
* to exactly one signature.
|
|
22706
|
+
*
|
|
22707
|
+
* @throws if `request.contracts` is empty or exceeds 10 addresses, `request.delegator`
|
|
22708
|
+
* equals `request.signer`, or `request.durationDays` exceeds the V1 permit maximum
|
|
22709
|
+
* of 365 days. {@link ConfigurationError}
|
|
22710
|
+
* @throws if a concurrent `permits.revokeTransportKeyPair()` rotates the transport key
|
|
22711
|
+
* pair while this call is generating one. {@link TransportKeyPairChangedError}
|
|
22712
|
+
*/
|
|
22713
|
+
preparePermit(request: PreparePermitRequest): Promise<PreparedPermit>;
|
|
22714
|
+
}
|
|
22715
|
+
//#endregion
|
|
22716
|
+
//#region src/zama-sdk.d.ts
|
|
22717
|
+
/** Instance-level options that are deliberately not part of the shareable config object. */
|
|
22718
|
+
interface ZamaSDKOptions {
|
|
22719
|
+
/**
|
|
22720
|
+
* Encrypts the transport key pair's private half at rest. Headless environments only
|
|
22721
|
+
* (CLI tools, servers, agents); the constructor rejects it in browser contexts. Supply
|
|
22722
|
+
* at least 32 random bytes, or a string of at least 64 characters, from a CSPRNG or
|
|
22723
|
+
* secrets manager. The SDK copies a Uint8Array secret and zeroizes its own copy after
|
|
22724
|
+
* key import; it never touches your buffer, so zeroize yours after construction.
|
|
22725
|
+
* The SDK never persists or exposes this value. Omit for the default:
|
|
22726
|
+
* plaintext at rest, security delegated to the storage backend.
|
|
22727
|
+
*/
|
|
22728
|
+
transportKeyPairDerivationSecret?: string | Uint8Array;
|
|
22729
|
+
}
|
|
22730
|
+
/**
|
|
22731
|
+
* ZamaSDK — composes a RelayerSDK with contract abstraction.
|
|
22732
|
+
*
|
|
22733
|
+
* Exposes domain namespaces for permits, delegations, decryption, offline
|
|
22734
|
+
* signing, and tokens, plus an unchanged registry, a top-level `encrypt`, and
|
|
22735
|
+
* lifecycle methods. Internal `*Service` classes do the work; the namespace
|
|
22736
|
+
* classes own SDK-level guards (chain alignment, signer requirement, event
|
|
22737
|
+
* emission).
|
|
22738
|
+
*/
|
|
22739
|
+
declare class ZamaSDK {
|
|
22740
|
+
#private;
|
|
22741
|
+
/** Read-only chain access used for all contract reads. */
|
|
22742
|
+
readonly provider: GenericProvider;
|
|
22743
|
+
/** Wallet signer used for write operations, or `undefined` when the SDK is read-only. */
|
|
22744
|
+
readonly signer: GenericSigner | undefined;
|
|
22745
|
+
/** Storage for cached permits and transport key pairs. */
|
|
22746
|
+
readonly storage: GenericStorage;
|
|
22747
|
+
/**
|
|
22748
|
+
* A {@link WrappersRegistry} instance auto-configured for the current chain.
|
|
22749
|
+
* Uses built-in defaults from chain configs, and the SDK's `registryTTL` if configured.
|
|
22750
|
+
*/
|
|
22751
|
+
readonly registry: WrappersRegistry;
|
|
22752
|
+
/** Permit and keypair management. */
|
|
22753
|
+
readonly permits: Permits;
|
|
22754
|
+
/** On-chain decryption-delegation management. */
|
|
22755
|
+
readonly delegations: Delegations;
|
|
22756
|
+
/** FHE decryption (user, delegated user, public). */
|
|
22757
|
+
readonly decryption: Decryption;
|
|
22758
|
+
/** Offline-signing pipeline: `prepare` builds an unsigned tx the caller signs and broadcasts out-of-process — for HSM, policy-engine, and cross-process custody workflows. */
|
|
22759
|
+
readonly offline: Offline;
|
|
22760
|
+
constructor(config: ZamaConfig, options?: ZamaSDKOptions);
|
|
22761
|
+
/**
|
|
22762
|
+
* The single-chain relayer backend for the **currently active** chain.
|
|
22763
|
+
*/
|
|
22764
|
+
get relayer(): RelayerSDK;
|
|
22765
|
+
/**
|
|
22766
|
+
* Create a {@link WrappersRegistry} instance bound to this SDK's provider.
|
|
22767
|
+
* Inherits the registry addresses derived from the SDK's chain configs, so
|
|
22768
|
+
* the result is consistent with {@link ZamaSDK.registry}.
|
|
22769
|
+
*
|
|
22770
|
+
* @param registryAddresses - Optional per-chain overrides for this registry instance.
|
|
22771
|
+
* @returns A {@link WrappersRegistry} instance.
|
|
22772
|
+
*
|
|
22773
|
+
* @example
|
|
22774
|
+
* ```ts
|
|
22775
|
+
* // Addresses resolved from the SDK's chain configs
|
|
22776
|
+
* const registry = sdk.createWrappersRegistry();
|
|
22777
|
+
*
|
|
22778
|
+
* // Hardhat or custom chain — override per chain for this registry instance
|
|
22779
|
+
* const registry = sdk.createWrappersRegistry({ [31337]: "0xYourRegistry" });
|
|
22780
|
+
*
|
|
22781
|
+
* const pairs = await registry.getTokenPairs();
|
|
22782
|
+
* ```
|
|
22783
|
+
*/
|
|
22784
|
+
createWrappersRegistry(registryAddresses?: Record<number, Address>): WrappersRegistry;
|
|
22785
|
+
/**
|
|
22786
|
+
* Encrypt one or more plaintext values into FHE ciphertexts.
|
|
22787
|
+
*
|
|
22788
|
+
* @param params - Typed FHE inputs, the target contract address, and the user address.
|
|
22789
|
+
* @returns External encrypted values and the input proof for on-chain submission.
|
|
22790
|
+
* @throws if FHE encryption fails. {@link EncryptionFailedError}
|
|
22791
|
+
*
|
|
22792
|
+
* @example
|
|
22793
|
+
* ```ts
|
|
22794
|
+
* const { encryptedValues, inputProof } = await sdk.encrypt({
|
|
22795
|
+
* values: [{ value: 1000n, type: "euint64" }],
|
|
22796
|
+
* contractAddress: "0xToken",
|
|
22797
|
+
* userAddress: "0xUser",
|
|
22798
|
+
* });
|
|
22799
|
+
* ```
|
|
22800
|
+
*/
|
|
22801
|
+
encrypt(params: EncryptParams, options?: Pick<FhevmRelayerOptions, "signal" | "timeout">): Promise<EncryptResult>;
|
|
22802
|
+
/**
|
|
22803
|
+
* Create a high-level ERC-20-style interface for an ERC-7984 confidential token.
|
|
22804
|
+
* Supports balance queries, transfers, operator approvals, and decryption.
|
|
22805
|
+
*
|
|
22806
|
+
* For ERC-7984 wrappers (shield/unshield/allowance), use {@link createWrappedToken} instead.
|
|
22807
|
+
*
|
|
22808
|
+
* @param address - The confidential token contract address.
|
|
22809
|
+
* @returns A {@link Token} instance bound to this SDK.
|
|
22810
|
+
*
|
|
22811
|
+
* @example
|
|
22812
|
+
* ```ts
|
|
22813
|
+
* const token = sdk.createToken(cUSDT);
|
|
22814
|
+
* const balance = await token.balanceOf(userAddress);
|
|
22815
|
+
* ```
|
|
22816
|
+
*/
|
|
22817
|
+
createToken(address: Address): Token;
|
|
22818
|
+
/**
|
|
22819
|
+
* Create a high-level interface for an ERC-7984 wrapper token.
|
|
22820
|
+
* Extends {@link Token} with shield/unshield/allowance/finalize-unwrap operations.
|
|
22821
|
+
*
|
|
22822
|
+
* @param address - The wrapper token contract address.
|
|
22823
|
+
* @returns A {@link WrappedToken} instance bound to this SDK.
|
|
22824
|
+
*
|
|
22825
|
+
* @example
|
|
22826
|
+
* ```ts
|
|
22827
|
+
* const wrapped = sdk.createWrappedToken(wUSDT);
|
|
22828
|
+
* await wrapped.shield(1_000_000n);
|
|
22829
|
+
* ```
|
|
22830
|
+
*/
|
|
22831
|
+
createWrappedToken(address: Address): WrappedToken;
|
|
22832
|
+
/**
|
|
22833
|
+
* Release the SDK-owned resources: signer lifecycle subscriptions and the
|
|
22834
|
+
* relayer backend's resources, an encrypt worker included. Call this when the
|
|
22835
|
+
* SDK instance is being replaced (e.g. React provider unmount or a Strict Mode
|
|
22836
|
+
* remount). Work already in flight runs to completion, and the instance stays
|
|
22837
|
+
* usable: the next encryption spawns a fresh worker.
|
|
22838
|
+
*/
|
|
22839
|
+
dispose(): void;
|
|
22840
|
+
/**
|
|
22841
|
+
* {@link dispose} plus the signer's own disposal. Call this when the SDK is no
|
|
22842
|
+
* longer needed (e.g. on shutdown). Work already in flight runs to completion.
|
|
22843
|
+
*/
|
|
22844
|
+
terminate(): void;
|
|
22845
|
+
/**
|
|
22846
|
+
* Implements the TC39 Explicit Resource Management protocol.
|
|
22847
|
+
* Calls {@link terminate} when the `using` binding goes out of scope,
|
|
22848
|
+
* unsubscribing signer events and releasing the relayer's resources.
|
|
22849
|
+
*
|
|
22850
|
+
* @example
|
|
22851
|
+
* ```ts
|
|
22852
|
+
* {
|
|
22853
|
+
* using sdk = new ZamaSDK({ relayer, provider, signer, storage });
|
|
22854
|
+
* await sdk.permits.grantPermit([cUSDT]);
|
|
22855
|
+
* const balance = await sdk.createToken(cUSDT).balanceOf(userAddress);
|
|
22856
|
+
* } // sdk.terminate() called automatically here
|
|
22857
|
+
* ```
|
|
22858
|
+
*/
|
|
22859
|
+
[Symbol.dispose](): void;
|
|
22860
|
+
}
|
|
22861
|
+
//#endregion
|
|
22862
|
+
//#region src/query/user-decrypt.d.ts
|
|
22863
|
+
/** A single encrypted value to decrypt, paired with the contract that owns it. */
|
|
22864
|
+
interface EncryptedInput {
|
|
22865
|
+
/** Encrypted handle to decrypt. */
|
|
22866
|
+
encryptedValue: EncryptedValue;
|
|
22867
|
+
/** Address of the contract the encrypted value belongs to. */
|
|
22868
|
+
contractAddress: Address;
|
|
22869
|
+
}
|
|
22870
|
+
/** Decrypted clear values keyed by encrypted handle. */
|
|
22871
|
+
type DecryptResult = Readonly<Record<EncryptedValue, ClearValue>>;
|
|
22872
|
+
/** Builds TanStack Query options for decrypting a batch of encrypted handles into their clear values. */
|
|
22873
|
+
declare function decryptValuesQueryOptions(sdk: ZamaSDK, encryptedInputs: EncryptedInput[], signerContext?: SignerQueryContext): QueryFactoryOptions<DecryptResult, Error, DecryptResult, ReturnType<typeof zamaQueryKeys.decryption.encryptedInputs>>;
|
|
22874
|
+
//#endregion
|
|
21901
22875
|
//#region src/namespaces/decryption.d.ts
|
|
21902
22876
|
/**
|
|
21903
22877
|
* Public namespace for FHE decryption — the canonical way to decrypt.
|
|
@@ -22038,94 +23012,5 @@ declare class Decryption {
|
|
|
22038
23012
|
} & DelegatedDecryptOptions): Promise<BatchDecryptResult>;
|
|
22039
23013
|
}
|
|
22040
23014
|
//#endregion
|
|
22041
|
-
|
|
22042
|
-
|
|
22043
|
-
declare class MemoryStorage implements GenericStorage {
|
|
22044
|
-
#private;
|
|
22045
|
-
/**
|
|
22046
|
-
* Retrieve a value by key.
|
|
22047
|
-
* @returns The stored value, or `null` if the key does not exist.
|
|
22048
|
-
*/
|
|
22049
|
-
get<T = unknown>(key: string): Promise<T | null>;
|
|
22050
|
-
/** Store a value under the given key, overwriting any existing entry. */
|
|
22051
|
-
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
22052
|
-
/** Remove the entry for the given key (no-op if absent). */
|
|
22053
|
-
delete(key: string): Promise<void>;
|
|
22054
|
-
}
|
|
22055
|
-
/** Default singleton for application-wide use. */
|
|
22056
|
-
declare const memoryStorage: MemoryStorage;
|
|
22057
|
-
//#endregion
|
|
22058
|
-
//#region src/storage/indexeddb-storage.d.ts
|
|
22059
|
-
/**
|
|
22060
|
-
* IndexedDB-backed {@link GenericStorage}.
|
|
22061
|
-
*
|
|
22062
|
-
* Stores keypair and permit objects keyed by a hashed wallet address. The
|
|
22063
|
-
* SDK delegates security to the storage backend — values are persisted
|
|
22064
|
-
* verbatim with no SDK-layer encryption.
|
|
22065
|
-
*/
|
|
22066
|
-
declare class IndexedDBStorage implements GenericStorage {
|
|
22067
|
-
#private;
|
|
22068
|
-
constructor(dbName?: string, dbVersion?: number, storeName?: string);
|
|
22069
|
-
/**
|
|
22070
|
-
* Retrieve a value by key.
|
|
22071
|
-
* @returns The stored value, or `null` if the key does not exist.
|
|
22072
|
-
*/
|
|
22073
|
-
get<T = unknown>(key: string): Promise<T | null>;
|
|
22074
|
-
/** Store a value under the given key, overwriting any existing entry. */
|
|
22075
|
-
set<T = unknown>(key: string, value: T): Promise<void>;
|
|
22076
|
-
/** Remove the entry for the given key (no-op if absent). */
|
|
22077
|
-
delete(key: string): Promise<void>;
|
|
22078
|
-
/** Remove all stored entries. */
|
|
22079
|
-
clear(): Promise<void>;
|
|
22080
|
-
}
|
|
22081
|
-
/** Default singleton for application-wide use. */
|
|
22082
|
-
declare const indexedDBStorage: IndexedDBStorage;
|
|
22083
|
-
//#endregion
|
|
22084
|
-
//#region src/storage/chrome-session-storage.d.ts
|
|
22085
|
-
/**
|
|
22086
|
-
* {@link GenericStorage} backed by `chrome.storage.session`.
|
|
22087
|
-
*
|
|
22088
|
-
* Use this in MV3 web extensions so the wallet signature survives
|
|
22089
|
-
* service worker restarts and is shared across popup, background,
|
|
22090
|
-
* and content script contexts.
|
|
22091
|
-
*
|
|
22092
|
-
* @example
|
|
22093
|
-
* ```ts
|
|
22094
|
-
* import { ZamaSDK, indexedDBStorage, chromeSessionStorage } from "@zama-fhe/sdk";
|
|
22095
|
-
* import { createConfig } from "@zama-fhe/sdk/viem";
|
|
22096
|
-
*
|
|
22097
|
-
* const config = createConfig({
|
|
22098
|
-
* chains: [mySepolia],
|
|
22099
|
-
* publicClient,
|
|
22100
|
-
* walletClient,
|
|
22101
|
-
* relayers: { [mySepolia.id]: web() },
|
|
22102
|
-
* storage: indexedDBStorage, // encrypted transport key pair — persistent
|
|
22103
|
-
* permitStorage: chromeSessionStorage, // signed permits — ephemeral
|
|
22104
|
-
* });
|
|
22105
|
-
* const sdk = new ZamaSDK(config);
|
|
22106
|
-
* ```
|
|
22107
|
-
*/
|
|
22108
|
-
declare class ChromeSessionStorage implements GenericStorage {
|
|
22109
|
-
/**
|
|
22110
|
-
* Retrieve a value by key.
|
|
22111
|
-
* @returns The stored value, or `null` if the key does not exist.
|
|
22112
|
-
*/
|
|
22113
|
-
get<T = unknown>(key: string): Promise<T | null>;
|
|
22114
|
-
/** Store a value under the given key, overwriting any existing entry. */
|
|
22115
|
-
set(key: string, value: unknown): Promise<void>;
|
|
22116
|
-
/** Remove the entry for the given key (no-op if absent). */
|
|
22117
|
-
delete(key: string): Promise<void>;
|
|
22118
|
-
}
|
|
22119
|
-
/** Default singleton for application-wide use. */
|
|
22120
|
-
declare const chromeSessionStorage: ChromeSessionStorage;
|
|
22121
|
-
//#endregion
|
|
22122
|
-
//#region src/utils/handles.d.ts
|
|
22123
|
-
/** All-zero encrypted-value sentinel — a 32-byte zero handle representing the cleartext value `0`. */
|
|
22124
|
-
declare const ZERO_ENCRYPTED_VALUE: "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
22125
|
-
/**
|
|
22126
|
-
* Check whether an encrypted value represents the zero value.
|
|
22127
|
-
*/
|
|
22128
|
-
declare function isEncryptedValueZero(encryptedValue: string): boolean;
|
|
22129
|
-
//#endregion
|
|
22130
|
-
export { BalanceErrorDetails as $, ERC7984_INTERFACE_ID as $t, BatchDecryptAsOptions as A, Permission as At, TransactionRevertedError as B, getConfidentialTokenAddressContract as Bt, ZamaSDKOptions as C, wrapContract as Cn, TransportKeyPairChangedError as Ct, WrappersRegistryConfig as D, ZamaErrorCode as Dt, WrappersRegistry as E, ZamaError as Et, Permits as F, SerializedTransportKeyPair as Ft, SignerRequiredError as G, getTokenPairsSliceContract as Gt, SigningFailedError as H, getTokenPairContract as Ht, ErrorForCode as I, ChecksummedAddress as It, RpcRateLimitError as J, getDelegationExpiryContract as Jt, WalletAccountNotReadyError as K, isConfidentialTokenValidContract as Kt, matchZamaError as L, PaginatedResult as Lt, Offline as M, PreparedPermit as Mt, Delegations as N, SerializedPermit as Nt, WrappedToken as O, isRetryable as Ot, DelegationStatus as P, SerializedPermitEip712 as Pt, BalanceCheckUnavailableError as Q, ERC1363_INTERFACE_ID as Qt, UnshieldAlreadyFinalizedDetails as R, TokenWrapperPair as Rt, ZamaSDK as S, unwrapRequesterContract as Sn, RevokedKmsContextError as St, ListPairsOptions as T, ChainMismatchError as Tt, SigningRejectedError as U, getTokenPairsContract as Ut, SigningErrorMetadata as V, getTokenAddressContract as Vt, SignerNotConfiguredError as W, getTokenPairsLengthContract as Wt, ConfigurationError as X, revokeDelegationContract as Xt, NotEntitledError as Y, isHandleDelegatedContract as Yt, RelayerRequestFailedError as Z, transferAndCallContract as Zt, decryptValuesQueryOptions as _, rateContract as _n, InvalidTransportKeyPairError as _t, ChromeSessionStorage as a, approveContract as an, EncryptOffloadUnavailableError as at, MutationFactoryOptions as b, unwrapContract as bn, PreparedPermitChainMismatchError as bt, indexedDBStorage as c, nameContract as cn, DelegationContractIsSelfError as ct, Decryption as d, confidentialTotalSupplyContract as dn, DelegationExpirationTooSoonError as dt, ERC7984_WRAPPER_INTERFACE_ID as en, ERC20ReadFailedError as et, BatchDecryptItem as f, confidentialTransferContract as fn, DelegationExpiredError as ft, EncryptedInput as g, isOperatorContract as gn, DelegationSelfNotAllowedError as gt, DecryptResult as h, inferredTotalSupplyContract as hn, DelegationNotPropagatedError as ht, isEncryptedValueZero as i, allowanceContract as in, DecryptionFailedError as it, Token as j, PreparePermitRequest as jt, BatchBalancesResult as k, retryAfterSeconds as kt, MemoryStorage as l, symbolContract as ln, DelegationCooldownError as lt, DelegatedDecryptOptions as m, finalizeUnwrapContract as mn, DelegationNotFoundError as mt, Hex$1 as n, isConfidentialWrapperContract as nn, InsufficientConfidentialBalanceError as nt, chromeSessionStorage as o, balanceOfContract as on, EncryptionFailedError as ot, BatchDecryptResult as p, confidentialTransferFromContract as pn, DelegationExpiryUnchangedError as pt, WalletNotConnectedError as q, delegateForUserDecryptionContract as qt, ZERO_ENCRYPTED_VALUE as r, supportsInterfaceContract as rn, InsufficientERC20BalanceError as rt, IndexedDBStorage as s, decimalsContract as sn, AclPausedError as st, Address$1 as t, isConfidentialTokenContract as tn, InsufficientAllowanceError as tt, memoryStorage as u, confidentialBalanceOfContract as un, DelegationDelegateEqualsContractError as ut, SignerQueryContext as v, setOperatorContract as vn, KeyWrappingError as vt, DefaultRegistryAddresses as w, createConfig as wn, TransportKeyPairExpiredError as wt, QueryFactoryOptions as x, unwrapFromBalanceContract as xn, PreparedPermitExpiredError as xt, zamaQueryKeys as y, underlyingContract as yn, NoCiphertextError as yt, UnshieldAlreadyFinalizedError as z, TokenWrapperPairWithMetadata as zt };
|
|
22131
|
-
//# sourceMappingURL=index-BCh3VaZo.d.ts.map
|
|
23015
|
+
export { confidentialTransferFromAndCallMutationOptions as $, DelegationExpiryUnchangedError as $n, ERC7984_WRAPPER_INTERFACE_ID as $r, QueryLike as $t, grantPermitMutationOptions as A, SignerRequiredError as An, SerializedPermitEip712 as Ar, Token as At, UnwrapParams as B, InsufficientAllowanceError as Bn, getTokenPairContract as Br, ListPairsOptions as Bt, clearCredentialsMutationOptions as C, createConfig as Ci, UnshieldAlreadyFinalizedDetails as Cn, PermissionV2 as Cr, ConfidentialBalancesQueryConfig as Ct, RegisterPermitParams as D, SigningFailedError as Dn, PreparedPermitV1 as Dr, WrappedToken as Dt, hasPermitQueryOptions as E, SigningErrorMetadata as En, PreparedPermitBase as Er, confidentialBalanceQueryOptions as Et, FinalizeUnwrapParams as F, ConfigurationError as Fn, PaginatedResult as Fr, UnderlyingAllowanceQueryConfig as Ft, unshieldAllMutationOptions as G, EncryptionFailedError as Gn, delegateForUserDecryptionContract as Gr, IsConfidentialQueryConfig as Gt, ResumeUnshieldParams as H, InsufficientERC20BalanceError as Hn, getTokenPairsLengthContract as Hr, WrappersRegistryConfig as Ht, finalizeUnwrapMutationOptions as I, RelayerRequestFailedError as In, TokenWrapperPair as Ir, underlyingAllowanceQueryOptions as It, ApproveUnderlyingParams as J, DelegationCooldownError as Jn, isHandleDelegatedContract as Jr, TokenMetadata as Jt, UnshieldParams as K, AclPausedError as Kn, getDelegationExpiryContract as Kr, isConfidentialQueryOptions as Kt, unwrapAllMutationOptions as L, BalanceCheckUnavailableError as Ln, TokenWrapperPairWithMetadata as Lr, WrapperDiscoveryQueryConfig as Lt, DelegatedDecryptValuesMutationParams as M, WalletNotConnectedError as Mn, WILDCARD_PERMIT as Mr, confidentialIsOperatorQueryOptions as Mt, delegatedDecryptValuesMutationOptions as N, RpcRateLimitError as Nn, WildcardPermit as Nr, PendingUnshieldQueryConfig as Nt, registerPermitMutationOptions as O, SigningRejectedError as On, PreparedPermitV2 as Or, BatchBalancesResult as Ot, encryptMutationOptions as P, NotEntitledError as Pn, ChecksummedAddress as Pr, pendingUnshieldQueryOptions as Pt, ConfidentialTransferFromAndCallParams as Q, DelegationExpiredError as Qn, ERC7984_INTERFACE_ID as Qr, QueryFilterLike as Qt, WrapParams as R, BalanceErrorDetails as Rn, getConfidentialTokenAddressContract as Rr, wrapperDiscoveryQueryOptions as Rt, delegateDecryptionMutationOptions as S, wrapContract as Si, matchZamaError as Sn, PermissionV1 as Sr, tokenPairsSliceQueryOptions as St, HasPermitQueryConfig as T, TransactionRevertedError as Tn, PreparedPermit as Tr, ConfidentialBalanceQueryConfig as Tt, resumeUnshieldMutationOptions as U, DecryptionFailedError as Un, getTokenPairsSliceContract as Ur, TotalSupplyQueryConfig as Ut, unwrapMutationOptions as V, InsufficientConfidentialBalanceError as Vn, getTokenPairsContract as Vr, WrappersRegistry as Vt, UnshieldAllParams as W, EncryptOffloadUnavailableError as Wn, isConfidentialTokenValidContract as Wr, totalSupplyQueryOptions as Wt, ConfidentialSetOperatorParams as X, DelegationDelegateEqualsContractError as Xn, transferAndCallContract as Xr, tokenMetadataQueryOptions as Xt, approveUnderlyingMutationOptions as Y, DelegationDelegateCannotBeWildcardError as Yn, revokeDelegationContract as Yr, TokenMetadataQueryConfig as Yt, confidentialSetOperatorMutationOptions as Z, DelegationExpirationTooSoonError as Zn, ERC1363_INTERFACE_ID as Zr, QueryClientLike as Zt, BatchDecryptBalancesAsParams as _, setOperatorContract as _i, hashFn as _n, ZamaErrorCode as _r, listPairsQueryOptions as _t, ZamaSDK as a, balanceOfContract as ai, invalidateAfterUnshieldSettled as an, InvalidationTimestampTooLowError as ar, confidentialTransferMutationOptions as at, decryptBalanceAsMutationOptions as b, unwrapFromBalanceContract as bi, Permits as bn, Permission as br, tokenPairsLengthQueryOptions as bt, BatchDecryptItem as c, symbolContract as ci, invalidateBalanceQueries as cn, PreparedPermitChainMismatchError as cr, ConfidentialTokenAddressQueryConfig as ct, DelegationStatusQueryConfig as d, confidentialTransferContract as di, zamaQueryKeys as dn, TransportKeyPairChangedError as dr, TokenAddressQueryConfig as dt, isConfidentialTokenContract as ei, invalidateAfterApproveUnderlying as en, DelegationNotFoundError as er, ConfidentialTransferFromParams as et, delegationStatusQueryOptions as f, confidentialTransferFromContract as fi, SignerQueryContext as fn, TransportKeyPairExpiredError as fr, TokenPairQueryConfig as ft, revokeDelegationMutationOptions as g, rateContract as gi, filterQueryOptions as gn, ZamaError as gr, isConfidentialTokenValidQueryOptions as gt, RevokeDelegationParams as h, isOperatorContract as hi, StrippedQueryOptionKeys as hn, ChainMismatchError as hr, confidentialTokenAddressQueryOptions as ht, decryptValuesQueryOptions as i, approveContract as ii, invalidateAfterUnshield as in, InvalidationTimestampInFutureError as ir, ConfidentialTransferParams as it, decryptPublicValuesMutationOptions as j, WalletAccountNotReadyError as jn, SerializedTransportKeyPair as jr, ConfidentialIsOperatorQueryConfig as jt, preparePermitMutationOptions as k, SignerNotConfiguredError as kn, SerializedPermit as kr, BatchDecryptAsOptions as kt, BatchDecryptResult as l, confidentialBalanceOfContract as li, invalidateWagmiBalanceQueries as ln, PreparedPermitExpiredError as lr, IsConfidentialTokenValidQueryConfig as lt, invalidateDecryptionSignaturesMutationOptions as m, inferredTotalSupplyContract as mi, QueryFactoryOptions as mn, UnifiedPermitNotSupportedError as mr, WrappersRegistryQueryConfig as mt, DecryptResult as n, supportsInterfaceContract as ni, invalidateAfterShield as nn, DelegationSelfNotAllowedError as nr, ConfidentialTransferAndCallParams as nt, ZamaSDKOptions as o, decimalsContract as oi, invalidateAfterUnwrap as on, KeyWrappingError as or, ShieldParams as ot, InvalidateDecryptionSignaturesParams as p, finalizeUnwrapContract as pi, MutationFactoryOptions as pn, UnifiedDecryptionUnsupportedError as pr, TokenPairsSliceQueryConfig as pt, unshieldMutationOptions as q, DelegationContractIsSelfError as qn, invalidateDecryptionSignaturesBeforeContract as qr, isWrapperQueryOptions as qt, EncryptedInput as r, allowanceContract as ri, invalidateAfterTransfer as rn, InvalidTransportKeyPairError as rr, confidentialTransferAndCallMutationOptions as rt, Offline as s, nameContract as si, invalidateAfterWrap as sn, NoCiphertextError as sr, shieldMutationOptions as st, Decryption as t, isConfidentialWrapperContract as ti, invalidateAfterSetOperator as tn, DelegationNotPropagatedError as tr, confidentialTransferFromMutationOptions as tt, DelegatedDecryptOptions as u, confidentialTotalSupplyContract as ui, invalidateWalletLifecycleQueries as un, RevokedKmsContextError as ur, ListPairsQueryConfig as ut, batchDecryptBalancesAsMutationOptions as v, underlyingContract as vi, Delegations as vn, isRetryable as vr, tokenAddressQueryOptions as vt, revokePermitsMutationOptions as w, UnshieldAlreadyFinalizedError as wn, PreparePermitRequest as wr, confidentialBalancesQueryOptions as wt, DelegateDecryptionParams as x, unwrapRequesterContract as xi, ErrorForCode as xn, PermissionBase as xr, tokenPairsQueryOptions as xt, DecryptBalanceAsParams as y, unwrapContract as yi, DelegationStatus as yn, retryAfterSeconds as yr, tokenPairQueryOptions as yt, wrapMutationOptions as z, ERC20ReadFailedError as zn, getTokenAddressContract as zr, DefaultRegistryAddresses as zt };
|
|
23016
|
+
//# sourceMappingURL=index-DRrrBtMX.d.ts.map
|