@zama-fhe/sdk 3.7.0 → 3.8.0-beta.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/index.cjs +1 -1
- package/dist/cjs/chains.cjs +1 -1
- package/dist/cjs/chains.cjs.map +1 -1
- package/dist/cjs/erc165.cjs +1 -1
- package/dist/cjs/erc165.cjs.map +1 -1
- package/dist/cjs/fatal-batch.cjs +2 -0
- package/dist/cjs/fatal-batch.cjs.map +1 -0
- package/dist/cjs/fhevm-relayer.cjs +1 -1
- 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/internal/index.cjs +2 -0
- package/dist/cjs/internal/index.cjs.map +1 -0
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/signing.cjs +2 -0
- package/dist/cjs/signing.cjs.map +1 -0
- package/dist/cjs/telemetry.cjs +1 -1
- package/dist/cjs/telemetry.cjs.map +1 -1
- package/dist/cjs/token.cjs +1 -1
- package/dist/cjs/token.cjs.map +1 -1
- package/dist/cjs/vaults/index.cjs +1 -1
- package/dist/cjs/web/index.cjs +1 -1
- package/dist/cjs/wrapped-token.cjs +1 -1
- package/dist/esm/base-signer-BoBsvn5Q.js +2 -0
- package/dist/esm/base-signer-BoBsvn5Q.js.map +1 -0
- package/dist/esm/{base-signer-46j6PRq-.d.ts → base-signer-BxIDBDTF.d.ts} +2 -2
- package/dist/esm/chains/index.d.ts +2 -2
- package/dist/esm/chains/index.js +1 -1
- package/dist/esm/{chains-iPpnjXql.js → chains-BwlDI944.js} +2 -2
- package/dist/esm/chains-BwlDI944.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-DInZ0vz-.d.ts → cleartext-BnTAN4-g.d.ts} +2 -2
- package/dist/esm/{cleartext-CiE1gO7Y.js → cleartext-CvCakQal.js} +2 -2
- package/dist/esm/{cleartext-CiE1gO7Y.js.map → cleartext-CvCakQal.js.map} +1 -1
- package/dist/esm/{index-CpQK8U4F.d.ts → decryption-B0mY2M8N.d.ts} +7 -3
- package/dist/esm/encrypt-worker-client-BW88njEe.d.ts +19 -0
- package/dist/esm/erc165-B8gx2luK.js +2 -0
- package/dist/esm/erc165-B8gx2luK.js.map +1 -0
- package/dist/esm/ethers/index.d.ts +4 -4
- package/dist/esm/ethers/index.js +1 -1
- package/dist/esm/fatal-batch-BiiS7KdS.js +2 -0
- package/dist/esm/fatal-batch-BiiS7KdS.js.map +1 -0
- package/dist/esm/fhevm-relayer-CGvejcdJ.js +8 -0
- package/dist/esm/{fhevm-relayer-DXLb4mIw.js.map → fhevm-relayer-CGvejcdJ.js.map} +1 -1
- package/dist/esm/{index-Cdbp_93f.d.ts → index-D1Wtji3m.d.ts} +4 -26
- package/dist/esm/{index-BKMce5ya.d.ts → index-DXCcwJ77.d.ts} +7 -7
- package/dist/esm/index-DkN4q5Cm.d.ts +1 -0
- package/dist/esm/{index-C1clixw5.d.ts → index-fsWBYM8S.d.ts} +4 -4
- package/dist/esm/index.d.ts +10 -9
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/index.d.ts +26 -0
- package/dist/esm/internal/index.js +2 -0
- package/dist/esm/internal/index.js.map +1 -0
- package/dist/esm/node/index.d.ts +5 -5
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/node/index.js.map +1 -1
- package/dist/esm/query/index.d.ts +6 -5
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/signing-C6nbPCyd.js +2 -0
- package/dist/esm/signing-C6nbPCyd.js.map +1 -0
- package/dist/esm/telemetry-BDnhC-vh.js +2 -0
- package/dist/esm/{telemetry-Dll0Swdj.js.map → telemetry-BDnhC-vh.js.map} +1 -1
- package/dist/esm/token-g6sinwTx.js +2 -0
- package/dist/esm/token-g6sinwTx.js.map +1 -0
- package/dist/esm/{types-Bz42Emet.d.ts → types-C2ccCjoA.d.ts} +3 -3
- package/dist/esm/{types-BIgPY1yI.d.ts → types-CHepK8MK.d.ts} +2 -2
- package/dist/esm/{types-I9lJwH20.d.ts → types-Dc1fpXWt.d.ts} +3 -3
- package/dist/esm/vaults/index.d.ts +3 -2
- package/dist/esm/vaults/index.js +1 -1
- package/dist/esm/viem/index.d.ts +4 -4
- package/dist/esm/viem/index.js +1 -1
- package/dist/esm/web/index.d.ts +2 -17
- package/dist/esm/web/index.js +1 -1
- package/dist/esm/wrapped-token-3usJd0oi.js +2 -0
- package/dist/esm/{wrapped-token-IDUEFpZx.js.map → wrapped-token-3usJd0oi.js.map} +1 -1
- package/package.json +15 -1
- package/dist/esm/base-signer-b1ff2VPI.js +0 -2
- package/dist/esm/base-signer-b1ff2VPI.js.map +0 -1
- package/dist/esm/chains-iPpnjXql.js.map +0 -1
- package/dist/esm/erc165-BAd2z3ay.js +0 -2
- package/dist/esm/erc165-BAd2z3ay.js.map +0 -1
- package/dist/esm/fhevm-relayer-DXLb4mIw.js +0 -8
- package/dist/esm/telemetry-Dll0Swdj.js +0 -2
- package/dist/esm/token-CTvEGQmH.js +0 -2
- package/dist/esm/token-CTvEGQmH.js.map +0 -1
- package/dist/esm/wrapped-token-IDUEFpZx.js +0 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "./types-CHepK8MK.js";
|
|
2
|
+
import { EIP1193Provider } from "viem";
|
|
3
|
+
import "@fhevm/sdk/chains";
|
|
4
|
+
//#region src/worker/encrypt-worker-client.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Watchdog deadlines, in milliseconds, for worker lifecycle steps: each is a
|
|
7
|
+
* ceiling on "the worker never answered", not on legitimate slow work. Encrypt
|
|
8
|
+
* operations themselves are not watched: nothing bounds local WASM compute, so
|
|
9
|
+
* a proof may run for as long as it needs.
|
|
10
|
+
*/
|
|
11
|
+
type EncryptWorkerTimeouts = {
|
|
12
|
+
/** Worker startup + module-graph load; a bundler that mishandled the worker URL fails here. */
|
|
13
|
+
readonly spawn: number;
|
|
14
|
+
/** Client init inside the worker realm: chain reads and WASM compilation. */
|
|
15
|
+
readonly init: number;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
export { EncryptWorkerTimeouts as t };
|
|
19
|
+
//# sourceMappingURL=encrypt-worker-client-BW88njEe.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e,r as t}from"./relayer-C3jVhqSK.js";import{erc20Abi as n,isHex as r}from"viem";var i=class extends t{constructor(t,n){super(e.TransactionReverted,t,n),this.name=`TransactionRevertedError`}},a=class extends t{operation;constructor(e,t,n,r){super(e,n,r),this.name=`SignerRequiredError`,this.operation=t}},o=class extends a{constructor(t,n){super(e.SignerNotConfigured,t,`Cannot ${t} without a signer. Configure one via createConfig({ signer: ... }) or <ZamaProvider config={createConfig({ signer: ... })}>.`,n),this.name=`SignerNotConfiguredError`}},s=class extends a{constructor(t,n){super(e.WalletNotConnected,t,`Cannot ${t} without a connected wallet account.`,n),this.name=`WalletNotConnectedError`}},c=class extends a{constructor(t,n){super(e.WalletAccountNotReady,t,`Cannot ${t} before the wallet account is ready.`,n),this.name=`WalletAccountNotReadyError`}};function l(e,t){if(e==null)throw new o(t);return e}const u={EncryptStart:`encrypt:start`,EncryptEnd:`encrypt:end`,EncryptError:`encrypt:error`,DecryptStart:`decrypt:start`,DecryptEnd:`decrypt:end`,DecryptError:`decrypt:error`,PermitError:`permit:error`,TransactionError:`transaction:error`,ShieldSubmitted:`shield:submitted`,TransferSubmitted:`transfer:submitted`,TransferFromSubmitted:`transferFrom:submitted`,SetOperatorSubmitted:`setOperator:submitted`,ApproveUnderlyingSubmitted:`approveUnderlying:submitted`,WrapSubmitted:`wrap:submitted`,UnwrapSubmitted:`unwrap:submitted`,FinalizeUnwrapSubmitted:`finalizeUnwrap:submitted`,VaultSubmitted:`vault:submitted`,DelegationSubmitted:`delegation:submitted`,RevokeDelegationSubmitted:`revokeDelegation:submitted`,UnshieldPhase1Submitted:`unshield:phase1_submitted`,UnshieldPhase2Started:`unshield:phase2_started`,UnshieldPhase2Submitted:`unshield:phase2_submitted`},d={approveUnderlying:{submittedEvent:e=>({type:u.ApproveUnderlyingSubmitted,txHash:e,step:`approve`})},"approveUnderlying:reset":{submittedEvent:e=>({type:u.ApproveUnderlyingSubmitted,txHash:e,step:`reset`})},delegateDecryption:{submittedEvent:e=>({type:u.DelegationSubmitted,txHash:e})},finalizeUnwrap:{submittedEvent:e=>({type:u.FinalizeUnwrapSubmitted,txHash:e})},revokeDelegation:{submittedEvent:e=>({type:u.RevokeDelegationSubmitted,txHash:e})},setOperator:{submittedEvent:e=>({type:u.SetOperatorSubmitted,txHash:e})},"shield:transferAndCall":{submittedEvent:e=>({type:u.ShieldSubmitted,txHash:e,shieldPath:`transferAndCall`})},"shield:approveAndWrap":{submittedEvent:e=>({type:u.ShieldSubmitted,txHash:e,shieldPath:`approveAndWrap`})},wrap:{submittedEvent:e=>({type:u.WrapSubmitted,txHash:e})},transfer:{submittedEvent:e=>({type:u.TransferSubmitted,txHash:e})},transferAndCall:{submittedEvent:e=>({type:u.TransferSubmitted,txHash:e})},transferFrom:{submittedEvent:e=>({type:u.TransferFromSubmitted,txHash:e})},transferFromAndCall:{submittedEvent:e=>({type:u.TransferFromSubmitted,txHash:e})},unwrap:{submittedEvent:e=>({type:u.UnwrapSubmitted,txHash:e})},unwrapAll:{submittedEvent:e=>({type:u.UnwrapSubmitted,txHash:e})},"vault:join":{submittedEvent:e=>({type:u.VaultSubmitted,txHash:e,vaultOperation:`join`})},"vault:quit":{submittedEvent:e=>({type:u.VaultSubmitted,txHash:e,vaultOperation:`quit`})},"vault:claim":{submittedEvent:e=>({type:u.VaultSubmitted,txHash:e,vaultOperation:`claim`})},"vault:recover":{submittedEvent:e=>({type:u.VaultSubmitted,txHash:e,vaultOperation:`recover`})},"vault:dispatchBatch":{submittedEvent:e=>({type:u.VaultSubmitted,txHash:e,vaultOperation:`dispatchBatch`})}};function f(e,t){if(e==null)throw TypeError(`${t} must not be null or undefined`)}function p(e,t){if(typeof e!=`bigint`)throw TypeError(`${t} must be a bigint, got ${typeof e}`)}function m(e,t){if(!r(e))throw TypeError(`${t} must be a 0x-prefixed hex string, got ${typeof e}`)}async function h(e,t,n){try{await t()}catch(t){n?.warn(`${e} failed`,{error:t})}}const g=[{type:`function`,name:`UPGRADE_INTERFACE_VERSION`,inputs:[],outputs:[{name:``,type:`string`,internalType:`string`}],stateMutability:`view`},{type:`function`,name:`acceptOwnership`,inputs:[],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`blockUser`,inputs:[{name:`user`,type:`address`,internalType:`address`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`confidentialBalanceOf`,inputs:[{name:`account`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`view`},{type:`function`,name:`confidentialProtocolId`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`confidentialTotalSupply`,inputs:[],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`view`},{type:`function`,name:`confidentialTransfer`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransfer`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferAndCall`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferAndCall`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferFrom`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferFrom`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferFromAndCall`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`confidentialTransferFromAndCall`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:`transferred`,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`function`,name:`contractURI`,inputs:[],outputs:[{name:``,type:`string`,internalType:`string`}],stateMutability:`view`},{type:`function`,name:`decimals`,inputs:[],outputs:[{name:``,type:`uint8`,internalType:`uint8`}],stateMutability:`view`},{type:`function`,name:`discloseEncryptedAmount`,inputs:[{name:`encryptedAmount`,type:`bytes32`,internalType:`euint64`},{name:`cleartextAmount`,type:`uint64`,internalType:`uint64`},{name:`decryptionProof`,type:`bytes`,internalType:`bytes`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`finalizeUnwrap`,inputs:[{name:`unwrapRequestId`,type:`bytes32`,internalType:`bytes32`},{name:`unwrapAmountCleartext`,type:`uint64`,internalType:`uint64`},{name:`decryptionProof`,type:`bytes`,internalType:`bytes`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`getUnderlyingDenyListSelector`,inputs:[],outputs:[{name:`isSet`,type:`bool`,internalType:`bool`},{name:`selector`,type:`bytes4`,internalType:`bytes4`}],stateMutability:`view`},{type:`function`,name:`inferredTotalSupply`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`initialize`,inputs:[{name:`name_`,type:`string`,internalType:`string`},{name:`symbol_`,type:`string`,internalType:`string`},{name:`contractURI_`,type:`string`,internalType:`string`},{name:`underlying_`,type:`address`,internalType:`contract IERC20`},{name:`owner_`,type:`address`,internalType:`address`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`isBlocked`,inputs:[{name:`user`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`},{type:`function`,name:`isOperator`,inputs:[{name:`holder`,type:`address`,internalType:`address`},{name:`spender`,type:`address`,internalType:`address`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`},{type:`function`,name:`maxTotalSupply`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`name`,inputs:[],outputs:[{name:``,type:`string`,internalType:`string`}],stateMutability:`view`},{type:`function`,name:`onTransferReceived`,inputs:[{name:`operator`,type:`address`,internalType:`address`},{name:`from`,type:`address`,internalType:`address`},{name:`amount`,type:`uint256`,internalType:`uint256`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bytes4`,internalType:`bytes4`}],stateMutability:`nonpayable`},{type:`function`,name:`owner`,inputs:[],outputs:[{name:``,type:`address`,internalType:`address`}],stateMutability:`view`},{type:`function`,name:`pendingOwner`,inputs:[],outputs:[{name:``,type:`address`,internalType:`address`}],stateMutability:`view`},{type:`function`,name:`proxiableUUID`,inputs:[],outputs:[{name:``,type:`bytes32`,internalType:`bytes32`}],stateMutability:`view`},{type:`function`,name:`rate`,inputs:[],outputs:[{name:``,type:`uint256`,internalType:`uint256`}],stateMutability:`view`},{type:`function`,name:`reinitializeV2`,inputs:[],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`reinitializeV3`,inputs:[{name:`blockedUsers`,type:`address[]`,internalType:`address[]`},{name:`underlyingDenyListSelector`,type:`bytes4`,internalType:`bytes4`},{name:`hasUnderlyingDenyListSelector_`,type:`bool`,internalType:`bool`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`renounceOwnership`,inputs:[],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`requestDiscloseEncryptedAmount`,inputs:[{name:`encryptedAmount`,type:`bytes32`,internalType:`euint64`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`setOperator`,inputs:[{name:`operator`,type:`address`,internalType:`address`},{name:`until`,type:`uint48`,internalType:`uint48`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`supportsInterface`,inputs:[{name:`interfaceId`,type:`bytes4`,internalType:`bytes4`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`},{type:`function`,name:`symbol`,inputs:[],outputs:[{name:``,type:`string`,internalType:`string`}],stateMutability:`view`},{type:`function`,name:`transferOwnership`,inputs:[{name:`newOwner`,type:`address`,internalType:`address`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`unblockUser`,inputs:[{name:`user`,type:`address`,internalType:`address`}],outputs:[],stateMutability:`nonpayable`},{type:`function`,name:`underlying`,inputs:[],outputs:[{name:``,type:`address`,internalType:`address`}],stateMutability:`view`},{type:`function`,name:`unwrap`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`encryptedAmount`,type:`bytes32`,internalType:`externalEuint64`},{name:`inputProof`,type:`bytes`,internalType:`bytes`}],outputs:[{name:``,type:`bytes32`,internalType:`bytes32`}],stateMutability:`nonpayable`},{type:`function`,name:`unwrap`,inputs:[{name:`from`,type:`address`,internalType:`address`},{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`bytes32`,internalType:`euint64`}],outputs:[{name:``,type:`bytes32`,internalType:`bytes32`}],stateMutability:`nonpayable`},{type:`function`,name:`unwrapAmount`,inputs:[{name:`unwrapRequestId`,type:`bytes32`,internalType:`bytes32`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`view`},{type:`function`,name:`unwrapRequester`,inputs:[{name:`unwrapRequestId`,type:`bytes32`,internalType:`bytes32`}],outputs:[{name:``,type:`address`,internalType:`address`}],stateMutability:`view`},{type:`function`,name:`upgradeToAndCall`,inputs:[{name:`newImplementation`,type:`address`,internalType:`address`},{name:`data`,type:`bytes`,internalType:`bytes`}],outputs:[],stateMutability:`payable`},{type:`function`,name:`wrap`,inputs:[{name:`to`,type:`address`,internalType:`address`},{name:`amount`,type:`uint256`,internalType:`uint256`}],outputs:[{name:``,type:`bytes32`,internalType:`euint64`}],stateMutability:`nonpayable`},{type:`event`,name:`AmountDiscloseRequested`,inputs:[{name:`encryptedAmount`,type:`bytes32`,indexed:!0,internalType:`euint64`},{name:`requester`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`AmountDisclosed`,inputs:[{name:`encryptedAmount`,type:`bytes32`,indexed:!0,internalType:`euint64`},{name:`amount`,type:`uint64`,indexed:!1,internalType:`uint64`}],anonymous:!1},{type:`event`,name:`ConfidentialTransfer`,inputs:[{name:`from`,type:`address`,indexed:!0,internalType:`address`},{name:`to`,type:`address`,indexed:!0,internalType:`address`},{name:`amount`,type:`bytes32`,indexed:!0,internalType:`euint64`}],anonymous:!1},{type:`event`,name:`Initialized`,inputs:[{name:`version`,type:`uint64`,indexed:!1,internalType:`uint64`}],anonymous:!1},{type:`event`,name:`OperatorSet`,inputs:[{name:`holder`,type:`address`,indexed:!0,internalType:`address`},{name:`operator`,type:`address`,indexed:!0,internalType:`address`},{name:`until`,type:`uint48`,indexed:!1,internalType:`uint48`}],anonymous:!1},{type:`event`,name:`OwnershipTransferStarted`,inputs:[{name:`previousOwner`,type:`address`,indexed:!0,internalType:`address`},{name:`newOwner`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`OwnershipTransferred`,inputs:[{name:`previousOwner`,type:`address`,indexed:!0,internalType:`address`},{name:`newOwner`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`PublicDecryptionVerified`,inputs:[{name:`handlesList`,type:`bytes32[]`,indexed:!1,internalType:`bytes32[]`},{name:`abiEncodedCleartexts`,type:`bytes`,indexed:!1,internalType:`bytes`}],anonymous:!1},{type:`event`,name:`UnwrapFinalized`,inputs:[{name:`receiver`,type:`address`,indexed:!0,internalType:`address`},{name:`unwrapRequestId`,type:`bytes32`,indexed:!0,internalType:`bytes32`},{name:`encryptedAmount`,type:`bytes32`,indexed:!1,internalType:`euint64`},{name:`cleartextAmount`,type:`uint64`,indexed:!1,internalType:`uint64`}],anonymous:!1},{type:`event`,name:`UnwrapRequested`,inputs:[{name:`receiver`,type:`address`,indexed:!0,internalType:`address`},{name:`unwrapRequestId`,type:`bytes32`,indexed:!0,internalType:`bytes32`},{name:`amount`,type:`bytes32`,indexed:!1,internalType:`euint64`}],anonymous:!1},{type:`event`,name:`Upgraded`,inputs:[{name:`implementation`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`UserBlocked`,inputs:[{name:`user`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`UserUnblocked`,inputs:[{name:`user`,type:`address`,indexed:!0,internalType:`address`}],anonymous:!1},{type:`event`,name:`Wrap`,inputs:[{name:`to`,type:`address`,indexed:!0,internalType:`address`},{name:`roundedAmount`,type:`uint256`,indexed:!1,internalType:`uint256`},{name:`encryptedWrappedAmount`,type:`bytes32`,indexed:!1,internalType:`euint64`}],anonymous:!1},{type:`error`,name:`AddressEmptyCode`,inputs:[{name:`target`,type:`address`,internalType:`address`}]},{type:`error`,name:`BlockedUser`,inputs:[{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC1967InvalidImplementation`,inputs:[{name:`implementation`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC1967NonPayable`,inputs:[]},{type:`error`,name:`ERC7984InvalidReceiver`,inputs:[{name:`receiver`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984InvalidReceiver`,inputs:[{name:`receiver`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984InvalidSender`,inputs:[{name:`sender`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984TotalSupplyOverflow`,inputs:[]},{type:`error`,name:`ERC7984UnauthorizedCaller`,inputs:[{name:`caller`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984UnauthorizedSpender`,inputs:[{name:`holder`,type:`address`,internalType:`address`},{name:`spender`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984UnauthorizedUseOfEncryptedAmount`,inputs:[{name:`amount`,type:`bytes32`,internalType:`euint64`},{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`ERC7984ZeroBalance`,inputs:[{name:`holder`,type:`address`,internalType:`address`}]},{type:`error`,name:`FailedCall`,inputs:[]},{type:`error`,name:`InvalidInitialization`,inputs:[]},{type:`error`,name:`InvalidKMSSignatures`,inputs:[]},{type:`error`,name:`InvalidUnderlyingDenyListResponse`,inputs:[]},{type:`error`,name:`InvalidUnwrapRequest`,inputs:[{name:`unwrapRequestId`,type:`bytes32`,internalType:`bytes32`}]},{type:`error`,name:`NotInitializing`,inputs:[]},{type:`error`,name:`OwnableInvalidOwner`,inputs:[{name:`owner`,type:`address`,internalType:`address`}]},{type:`error`,name:`OwnableUnauthorizedAccount`,inputs:[{name:`account`,type:`address`,internalType:`address`}]},{type:`error`,name:`SafeCastOverflowedUintDowncast`,inputs:[{name:`bits`,type:`uint8`,internalType:`uint8`},{name:`value`,type:`uint256`,internalType:`uint256`}]},{type:`error`,name:`SafeERC20FailedOperation`,inputs:[{name:`token`,type:`address`,internalType:`address`}]},{type:`error`,name:`SenderNotAllowedToUseHandle`,inputs:[{name:`handle`,type:`bytes32`,internalType:`bytes32`},{name:`sender`,type:`address`,internalType:`address`}]},{type:`error`,name:`UUPSUnauthorizedCallContext`,inputs:[]},{type:`error`,name:`UUPSUnsupportedProxiableUUID`,inputs:[{name:`slot`,type:`bytes32`,internalType:`bytes32`}]},{type:`error`,name:`UnderlyingDenyListCallFailed`,inputs:[]},{type:`error`,name:`UnderlyingDenyListedAddress`,inputs:[{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`UserAlreadyBlocked`,inputs:[{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`UserAlreadyUnblocked`,inputs:[{name:`user`,type:`address`,internalType:`address`}]},{type:`error`,name:`ZamaProtocolUnsupported`,inputs:[]}];function _(e,t){return{address:e,abi:g,functionName:`confidentialBalanceOf`,args:[t]}}function v(e,t,n,r){return{address:e,abi:g,functionName:`confidentialTransfer`,args:[t,n,r]}}function y(e,t,n,r,i){return{address:e,abi:g,functionName:`confidentialTransferFrom`,args:[t,n,r,i]}}function b(e,t,n,r,i){return{address:e,abi:g,functionName:`confidentialTransferAndCall`,args:[t,n,r,i]}}function x(e,t,n,r,i,a){return{address:e,abi:g,functionName:`confidentialTransferFromAndCall`,args:[t,n,r,i,a]}}function S(e,t,n){return{address:e,abi:g,functionName:`isOperator`,args:[t,n]}}function C(e,t,n){return{address:e,abi:g,functionName:`setOperator`,args:[t,n??Math.floor(Date.now()/1e3)+3600]}}function w(e,t,n,r,i){return{address:e,abi:g,functionName:`unwrap`,args:[t,n,r,i]}}function T(e,t,n,r){return{address:e,abi:g,functionName:`unwrap`,args:[t,n,r]}}function E(e){return{address:e,abi:g,functionName:`confidentialTotalSupply`,args:[]}}function D(e){return{address:e,abi:g,functionName:`rate`,args:[]}}function O(e,t,n,r){return{address:e,abi:g,functionName:`finalizeUnwrap`,args:[t,n,r]}}function k(e,t){return{address:e,abi:g,functionName:`unwrapRequester`,args:[t]}}function A(e){return{address:e,abi:g,functionName:`underlying`,args:[]}}function j(e){return{address:e,abi:g,functionName:`inferredTotalSupply`,args:[]}}function M(e,t,n){return{address:e,abi:g,functionName:`wrap`,args:[t,n]}}function N(e){return{address:e,abi:n,functionName:`name`,args:[]}}function P(e){return{address:e,abi:n,functionName:`symbol`,args:[]}}function F(e){return{address:e,abi:n,functionName:`decimals`,args:[]}}function I(e){return{address:e,abi:n,functionName:`totalSupply`,args:[]}}function L(e,t){return{address:e,abi:n,functionName:`balanceOf`,args:[t]}}function R(e,t,r){return{address:e,abi:n,functionName:`allowance`,args:[t,r]}}function z(e,t,r){return{address:e,abi:n,functionName:`approve`,args:[t,r]}}const B=[{type:`function`,name:`supportsInterface`,inputs:[{name:`interfaceId`,type:`bytes4`,internalType:`bytes4`}],outputs:[{name:``,type:`bool`,internalType:`bool`}],stateMutability:`view`}],V=`0x4958f2a4`,H=`0x1f1c62b2`,U=`0xb0202a11`;function W(e,t){return{address:e,abi:B,functionName:`supportsInterface`,args:[t]}}function G(e){return W(e,V)}function K(e){return W(e,H)}function q(e){return W(e,U)}export{M as A,s as B,S as C,w as D,A as E,u as F,i as H,d as I,o as L,p as M,m as N,T as O,f as P,a as R,j as S,C as T,l as V,b as _,K as a,y as b,R as c,F as d,I as f,E as g,_ as h,G as i,h as j,k,z as l,P as m,V as n,q as o,N as p,H as r,W as s,U as t,L as u,v,D as w,O as x,x as y,c as z};
|
|
2
|
+
//# sourceMappingURL=erc165-B8gx2luK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc165-B8gx2luK.js","names":[],"sources":["../../src/errors/transaction.ts","../../src/errors/signer.ts","../../src/events/sdk-events.ts","../../src/utils/assertions.ts","../../src/utils/swallow.ts","../../src/abi/confidential-wrapper.abi.ts","../../src/contracts/confidential-wrapper.ts","../../src/contracts/erc20.ts","../../src/abi/erc165.abi.ts","../../src/contracts/erc165.ts"],"sourcesContent":["import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/** On-chain transaction reverted. */\nexport class TransactionRevertedError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.TransactionReverted, message, options);\n this.name = \"TransactionRevertedError\";\n }\n}\n","import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/**\n * Base class for signer/account readiness failures.\n */\nexport class SignerRequiredError extends ZamaError {\n /** Name of the operation that required a signer. */\n readonly operation: string;\n\n constructor(code: ZamaErrorCode, operation: string, message: string, options?: ErrorOptions) {\n super(code, message, options);\n this.name = \"SignerRequiredError\";\n this.operation = operation;\n }\n}\n\n/**\n * Thrown when an operation requires a signer but none is configured.\n *\n * The SDK can be constructed without a signer. Operations that need wallet\n * authority throw this before probing wallet state.\n *\n * @example\n * ```ts\n * try {\n * await token.confidentialTransfer(\"0xTo\", 100n);\n * } catch (e) {\n * if (e instanceof SignerNotConfiguredError) {\n * // Fix SDK/provider configuration.\n * }\n * }\n * ```\n */\nexport class SignerNotConfiguredError extends SignerRequiredError {\n constructor(operation: string, options?: ErrorOptions) {\n super(\n ZamaErrorCode.SignerNotConfigured,\n operation,\n `Cannot ${operation} without a signer. Configure one via createConfig({ signer: ... }) or <ZamaProvider config={createConfig({ signer: ... })}>.`,\n options,\n );\n this.name = \"SignerNotConfiguredError\";\n }\n}\n\n/** Thrown when a signer exists but no wallet account is currently connected. */\nexport class WalletNotConnectedError extends SignerRequiredError {\n constructor(operation: string, options?: ErrorOptions) {\n super(\n ZamaErrorCode.WalletNotConnected,\n operation,\n `Cannot ${operation} without a connected wallet account.`,\n options,\n );\n this.name = \"WalletNotConnectedError\";\n }\n}\n\n/** Thrown when an async adapter has not resolved its initial wallet account yet. */\nexport class WalletAccountNotReadyError extends SignerRequiredError {\n constructor(operation: string, options?: ErrorOptions) {\n super(\n ZamaErrorCode.WalletAccountNotReady,\n operation,\n `Cannot ${operation} before the wallet account is ready.`,\n options,\n );\n this.name = \"WalletAccountNotReadyError\";\n }\n}\n\n/**\n * Narrow a nullable signer-dependent value or throw {@link SignerNotConfiguredError}.\n */\nexport function requireConfigured<T>(value: T, operation: string): NonNullable<T> {\n if (value === null || value === undefined) {\n throw new SignerNotConfiguredError(operation);\n }\n return value as NonNullable<T>;\n}\n","import type { Address, Hex } from \"viem\";\nimport type { ClearValue, EncryptedValue } from \"../relayer/types\";\nimport type { ShieldPath } from \"../types/token\";\n\n/**\n * All SDK event keys, accessible as `ZamaSDKEvents.EncryptStart` etc.\n */\nexport const ZamaSDKEvents = {\n // FHE operations\n EncryptStart: \"encrypt:start\",\n EncryptEnd: \"encrypt:end\",\n EncryptError: \"encrypt:error\",\n DecryptStart: \"decrypt:start\",\n DecryptEnd: \"decrypt:end\",\n DecryptError: \"decrypt:error\",\n // Credential operations\n PermitError: \"permit:error\",\n // Write operations\n TransactionError: \"transaction:error\",\n ShieldSubmitted: \"shield:submitted\",\n TransferSubmitted: \"transfer:submitted\",\n TransferFromSubmitted: \"transferFrom:submitted\",\n SetOperatorSubmitted: \"setOperator:submitted\",\n ApproveUnderlyingSubmitted: \"approveUnderlying:submitted\",\n WrapSubmitted: \"wrap:submitted\",\n UnwrapSubmitted: \"unwrap:submitted\",\n FinalizeUnwrapSubmitted: \"finalizeUnwrap:submitted\",\n VaultSubmitted: \"vault:submitted\",\n // Delegation operations\n DelegationSubmitted: \"delegation:submitted\",\n RevokeDelegationSubmitted: \"revokeDelegation:submitted\",\n // Unshield orchestration\n UnshieldPhase1Submitted: \"unshield:phase1_submitted\",\n UnshieldPhase2Started: \"unshield:phase2_started\",\n UnshieldPhase2Submitted: \"unshield:phase2_submitted\",\n} as const;\n\n/** Union of all SDK event type strings. */\nexport type ZamaSDKEventType = (typeof ZamaSDKEvents)[keyof typeof ZamaSDKEvents];\n\n// -- Base fields present on every event --\n\n/** Fields present on every SDK event; each concrete event extends this. */\nexport interface BaseEvent {\n /**\n * Contract this event relates to, when the operation targets one: the\n * confidential token, or the vault batcher for {@link VaultSubmittedEvent}.\n */\n tokenAddress?: Address;\n /** Unix epoch time (milliseconds) at which the event was emitted. */\n timestamp: number;\n /** Shared identifier linking related events in multi-phase operations (e.g. unshield). */\n operationId?: string;\n}\n\n// -- Per-event typed payloads --\n\n/** Emitted when an FHE encryption starts. */\nexport interface EncryptStartEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.EncryptStart;\n}\n\n/** Emitted when an FHE encryption completes successfully. */\nexport interface EncryptEndEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.EncryptEnd;\n /** Time the encryption took, in milliseconds. */\n durationMs: number;\n}\n\n/** Emitted when an FHE encryption fails. */\nexport interface EncryptErrorEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.EncryptError;\n /** The error that caused the encryption to fail. */\n error: Error;\n /** Time elapsed before the encryption failed, in milliseconds. */\n durationMs: number;\n}\n\n/** Emitted when an FHE decryption starts. */\nexport interface DecryptStartEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.DecryptStart;\n /** Encrypted values being decrypted — correlate with matching DecryptEnd/DecryptError. */\n encryptedValues: EncryptedValue[];\n}\n\n/** Emitted when an FHE decryption completes successfully. */\nexport interface DecryptEndEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.DecryptEnd;\n /** Time the decryption took, in milliseconds. */\n durationMs: number;\n /** Encrypted values that were decrypted. */\n encryptedValues: EncryptedValue[];\n /** Decrypted values keyed by encrypted value — use this to correlate events to specific entries. */\n result: Record<EncryptedValue, ClearValue>;\n}\n\n/** Emitted when an FHE decryption fails. */\nexport interface DecryptErrorEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.DecryptError;\n /** The error that caused the decryption to fail. */\n error: Error;\n /** Time elapsed before the decryption failed, in milliseconds. */\n durationMs: number;\n /** Encrypted values that were being decrypted when the error occurred. */\n encryptedValues: EncryptedValue[];\n}\n\n/**\n * SDK credential/permit operations that emit a {@link PermitErrorEvent} on failure.\n * `grantPermit` and `grantDelegationPermit` are distinguished so an integrator\n * can tell a direct-decrypt permit failure from a delegation-permit failure\n * without parsing the error message.\n */\nexport type PermitOperation = \"grantPermit\" | \"grantDelegationPermit\" | \"registerPermit\";\n\n/**\n * Emitted when signing or registering a decryption permit fails — including\n * wallet/provider signing failures (`SigningFailedError`/`SigningRejectedError`)\n * that would otherwise only be visible by catching the thrown error at the call\n * site. Mirrors {@link TransactionErrorEvent} for the credential/permit path.\n */\nexport interface PermitErrorEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.PermitError;\n /** Which permit operation failed. */\n operation: PermitOperation;\n /** The error that caused the operation to fail. */\n error: Error;\n}\n\n/** Emitted when a write operation's transaction fails (before or after submission). */\nexport interface TransactionErrorEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.TransactionError;\n /** Which SDK operation failed. */\n operation: TransactionOperation;\n /** The error that caused the transaction to fail. */\n error: Error;\n}\n\n/** Emitted when a shield transaction has been submitted to the network. */\nexport interface ShieldSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.ShieldSubmitted;\n /** Hash of the submitted shield transaction. */\n txHash: Hex;\n /** Which execution path was used: single-tx `transferAndCall` or two-tx `approveAndWrap`. */\n shieldPath: ShieldPath;\n}\n\n/** Emitted when a confidential transfer transaction has been submitted to the network. */\nexport interface TransferSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.TransferSubmitted;\n /** Hash of the submitted transfer transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a confidential `transferFrom` transaction has been submitted to the network. */\nexport interface TransferFromSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.TransferFromSubmitted;\n /** Hash of the submitted transferFrom transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a set-operator transaction has been submitted to the network. */\nexport interface SetOperatorSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.SetOperatorSubmitted;\n /** Hash of the submitted setOperator transaction. */\n txHash: Hex;\n}\n\n/** Which vault batcher write a {@link VaultSubmittedEvent} describes. */\nexport type VaultOperation = \"join\" | \"quit\" | \"claim\" | \"recover\" | \"dispatchBatch\";\n\n/** Emitted when a vault batcher transaction has been submitted to the network. */\nexport interface VaultSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.VaultSubmitted;\n /** Hash of the submitted batcher transaction. */\n txHash: Hex;\n /** The batcher write this transaction performs. */\n vaultOperation: VaultOperation;\n}\n\n/** Emitted when an underlying-ERC-20 approval transaction has been submitted to the network. */\nexport interface ApproveUnderlyingSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.ApproveUnderlyingSubmitted;\n /** Hash of the submitted approval transaction. */\n txHash: Hex;\n /** Which approval transaction was submitted. */\n step: \"reset\" | \"approve\";\n}\n\n/**\n * Emitted by the standalone `wrap()` escape hatch (not by `shield()`, which\n * emits {@link ShieldSubmittedEvent}). Distinct so a caller-initiated `wrap`\n * isn't conflated with `shield()`'s internal `approveAndWrap` leg — mirroring\n * how `unwrap` emits its own event rather than reusing the unshield phases.\n */\nexport interface WrapSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.WrapSubmitted;\n /** Hash of the submitted wrap transaction. */\n txHash: Hex;\n}\n\n/** Emitted when an unwrap transaction has been submitted to the network. */\nexport interface UnwrapSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.UnwrapSubmitted;\n /** Hash of the submitted unwrap transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a finalize-unwrap transaction has been submitted to the network. */\nexport interface FinalizeUnwrapSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.FinalizeUnwrapSubmitted;\n /** Hash of the submitted finalizeUnwrap transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a decryption-delegation transaction has been submitted to the network. */\nexport interface DelegationSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.DelegationSubmitted;\n /** Hash of the submitted delegation transaction. */\n txHash: Hex;\n}\n\n/** Emitted when a revoke-delegation transaction has been submitted to the network. */\nexport interface RevokeDelegationSubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.RevokeDelegationSubmitted;\n /** Hash of the submitted revokeDelegation transaction. */\n txHash: Hex;\n}\n\n/** Emitted when the first phase of an unshield (the unwrap request) has been submitted. */\nexport interface UnshieldPhase1SubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.UnshieldPhase1Submitted;\n /** Hash of the submitted phase-1 transaction. */\n txHash: Hex;\n}\n\n/** Emitted when the second phase of an unshield (finalization) starts. */\nexport interface UnshieldPhase2StartedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.UnshieldPhase2Started;\n}\n\n/** Emitted when the second phase of an unshield (finalization) has been submitted. */\nexport interface UnshieldPhase2SubmittedEvent extends BaseEvent {\n /** Event type discriminant. */\n type: typeof ZamaSDKEvents.UnshieldPhase2Submitted;\n /** Hash of the submitted phase-2 transaction. */\n txHash: Hex;\n}\n\n/**\n * Discriminated union of all SDK events.\n *\n * Decrypt events carry encrypted values and decrypted clear-text values so event\n * subscribers can correlate and bind them in UI layers. Events never carry\n * private keys, permit signatures, or ZK proofs.\n */\nexport type ZamaSDKEvent =\n | EncryptStartEvent\n | EncryptEndEvent\n | EncryptErrorEvent\n | DecryptStartEvent\n | DecryptEndEvent\n | DecryptErrorEvent\n | PermitErrorEvent\n | TransactionErrorEvent\n | ShieldSubmittedEvent\n | TransferSubmittedEvent\n | TransferFromSubmittedEvent\n | SetOperatorSubmittedEvent\n | VaultSubmittedEvent\n | ApproveUnderlyingSubmittedEvent\n | WrapSubmittedEvent\n | UnwrapSubmittedEvent\n | FinalizeUnwrapSubmittedEvent\n | DelegationSubmittedEvent\n | RevokeDelegationSubmittedEvent\n | UnshieldPhase1SubmittedEvent\n | UnshieldPhase2StartedEvent\n | UnshieldPhase2SubmittedEvent;\n\n/** Callback invoked with each emitted {@link ZamaSDKEvent}. */\nexport type ZamaSDKEventListener = (event: ZamaSDKEvent) => void;\n\n/**\n * Distributive Omit that preserves the discriminated union. Internal emit-side\n * shape — consumers only ever receive fully-populated {@link ZamaSDKEvent}.\n * @internal\n */\nexport type ZamaSDKEventInput = ZamaSDKEvent extends infer E\n ? E extends ZamaSDKEvent\n ? Omit<E, \"timestamp\" | \"tokenAddress\">\n : never\n : never;\n\n/**\n * SDK transaction operations that emit submitted/error lifecycle events.\n *\n * Operation strings encode the execution-path discriminator for flows that have\n * one (`shield:transferAndCall` vs. `shield:approveAndWrap`), routing both error\n * and success events on a single field — see {@link transactionOperationMetadata}.\n */\nexport type TransactionOperation =\n | \"approveUnderlying\"\n | \"approveUnderlying:reset\"\n | \"delegateDecryption\"\n | \"finalizeUnwrap\"\n | \"revokeDelegation\"\n | \"setOperator\"\n | \"shield:transferAndCall\"\n | \"shield:approveAndWrap\"\n | \"wrap\"\n | \"transfer\"\n | \"transferAndCall\"\n | \"transferFrom\"\n | \"transferFromAndCall\"\n | \"unwrap\"\n | \"unwrapAll\"\n | \"vault:join\"\n | \"vault:quit\"\n | \"vault:claim\"\n | \"vault:recover\"\n | \"vault:dispatchBatch\";\n\n/**\n * Single source of truth for each transaction operation's submitted-event payload.\n *\n * Adding a write op = adding one entry here plus its {@link TransactionOperation}\n * member; the `satisfies Record<TransactionOperation, …>` check enforces that the\n * table and the union stay in lockstep (missing or extra keys fail the build) and\n * that every entry produces a valid {@link ZamaSDKEventInput}.\n *\n * @internal\n */\nexport const transactionOperationMetadata = {\n approveUnderlying: {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.ApproveUnderlyingSubmitted,\n txHash,\n step: \"approve\" as const,\n }),\n },\n \"approveUnderlying:reset\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.ApproveUnderlyingSubmitted,\n txHash,\n step: \"reset\" as const,\n }),\n },\n delegateDecryption: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.DelegationSubmitted, txHash }),\n },\n finalizeUnwrap: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.FinalizeUnwrapSubmitted, txHash }),\n },\n revokeDelegation: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.RevokeDelegationSubmitted, txHash }),\n },\n setOperator: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.SetOperatorSubmitted, txHash }),\n },\n \"shield:transferAndCall\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.ShieldSubmitted,\n txHash,\n shieldPath: \"transferAndCall\" as const,\n }),\n },\n \"shield:approveAndWrap\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.ShieldSubmitted,\n txHash,\n shieldPath: \"approveAndWrap\" as const,\n }),\n },\n wrap: { submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.WrapSubmitted, txHash }) },\n transfer: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.TransferSubmitted, txHash }),\n },\n transferAndCall: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.TransferSubmitted, txHash }),\n },\n transferFrom: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.TransferFromSubmitted, txHash }),\n },\n transferFromAndCall: {\n submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.TransferFromSubmitted, txHash }),\n },\n unwrap: { submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.UnwrapSubmitted, txHash }) },\n unwrapAll: { submittedEvent: (txHash: Hex) => ({ type: ZamaSDKEvents.UnwrapSubmitted, txHash }) },\n \"vault:join\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"join\" as const,\n }),\n },\n \"vault:quit\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"quit\" as const,\n }),\n },\n \"vault:claim\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"claim\" as const,\n }),\n },\n \"vault:recover\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"recover\" as const,\n }),\n },\n \"vault:dispatchBatch\": {\n submittedEvent: (txHash: Hex) => ({\n type: ZamaSDKEvents.VaultSubmitted,\n txHash,\n vaultOperation: \"dispatchBatch\" as const,\n }),\n },\n} satisfies Record<TransactionOperation, { submittedEvent: (txHash: Hex) => ZamaSDKEventInput }>;\n","import { isHex, type Hex } from \"viem\";\n\nexport function assertNonNullable<T>(value: T, context: string): asserts value is NonNullable<T> {\n if (value === null || value === undefined) {\n throw new TypeError(`${context} must not be null or undefined`);\n }\n}\n\nexport function assertObject(\n value: unknown,\n context: string,\n): asserts value is Record<string, unknown> {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new TypeError(`${context} must be an object, got ${typeof value}`);\n }\n}\n\nexport function assertString(value: unknown, context: string): asserts value is string {\n if (typeof value !== \"string\") {\n throw new TypeError(`${context} must be a string, got ${typeof value}`);\n }\n}\n\nexport function assertArray(value: unknown, context: string): asserts value is unknown[] {\n if (!Array.isArray(value)) {\n throw new TypeError(`${context} must be an array, got ${typeof value}`);\n }\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport function assertFunction(value: unknown, context: string): asserts value is Function {\n if (typeof value !== \"function\") {\n throw new TypeError(`${context} must be a function, got ${typeof value}`);\n }\n}\n\nexport function assertBigint(value: unknown, context: string): asserts value is bigint {\n if (typeof value !== \"bigint\") {\n throw new TypeError(`${context} must be a bigint, got ${typeof value}`);\n }\n}\n\nexport function assertHex(value: unknown, context: string): asserts value is Hex {\n if (!isHex(value)) {\n throw new TypeError(`${context} must be a 0x-prefixed hex string, got ${typeof value}`);\n }\n}\n\n/** Assert that `obj[key]` is a string. Narrows `obj` to include `{ [key]: string }`. */\nexport function assertStringProp<\n K extends string,\n O extends Record<string, unknown> = Record<string, unknown>,\n>(obj: O, key: K, context: string): asserts obj is O & Record<K, string> {\n assertString(obj[key], context);\n}\n\n/** Assert that `obj[key]` is a function. Narrows `obj` to include `{ [key]: F }`. */\nexport function assertFunctionProp<\n K extends string,\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n F extends Function,\n O extends Record<string, unknown> = Record<string, unknown>,\n>(obj: O, key: K, context: string): asserts obj is O & Record<K, F> {\n assertFunction(obj[key], context);\n}\n\nexport function assertCondition(condition: boolean, message: string): asserts condition {\n if (!condition) {\n throw new TypeError(message);\n }\n}\n","import type { GenericLogger } from \"../types\";\n\n/**\n * Runs a function and swallows any errors.\n *\n * The swallowed error is a handled, best-effort failure — when a logger is\n * supplied it is routed to the {@link GenericLogger} at `warn`, never to the\n * console. Most SDK call sites pass the SDK-wide logger; a few (e.g. a signer\n * constructed before `createConfig` exists) genuinely have none, so the logger\n * is optional and the failure is then silent.\n */\nexport async function swallow(\n label: string,\n fn: () => Promise<void> | void,\n logger?: GenericLogger,\n): Promise<void> {\n try {\n await fn();\n } catch (error) {\n logger?.warn(`${label} failed`, { error });\n }\n}\n","// DO NOT EDIT: generated by `pnpm abi:build` from\n// contracts/out/ConfidentialWrapperV3.sol/ConfidentialWrapperV3.json.\n// Regenerate after `pnpm contracts:build`; `pnpm abi:check` enforces this in CI.\nexport const confidentialWrapperAbi = [\n {\n type: \"function\",\n name: \"UPGRADE_INTERFACE_VERSION\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"acceptOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"blockUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialBalanceOf\",\n inputs: [{ name: \"account\", type: \"address\", internalType: \"address\" }],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialProtocolId\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransfer\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferAndCall\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFrom\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"confidentialTransferFromAndCall\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"transferred\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"contractURI\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"decimals\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint8\", internalType: \"uint8\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"discloseEncryptedAmount\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"cleartextAmount\", type: \"uint64\", internalType: \"uint64\" },\n { name: \"decryptionProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"finalizeUnwrap\",\n inputs: [\n { name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" },\n { name: \"unwrapAmountCleartext\", type: \"uint64\", internalType: \"uint64\" },\n { name: \"decryptionProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"getUnderlyingDenyListSelector\",\n inputs: [],\n outputs: [\n { name: \"isSet\", type: \"bool\", internalType: \"bool\" },\n { name: \"selector\", type: \"bytes4\", internalType: \"bytes4\" },\n ],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"inferredTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"initialize\",\n inputs: [\n { name: \"name_\", type: \"string\", internalType: \"string\" },\n { name: \"symbol_\", type: \"string\", internalType: \"string\" },\n { name: \"contractURI_\", type: \"string\", internalType: \"string\" },\n { name: \"underlying_\", type: \"address\", internalType: \"contract IERC20\" },\n { name: \"owner_\", type: \"address\", internalType: \"address\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"isBlocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"isOperator\",\n inputs: [\n { name: \"holder\", type: \"address\", internalType: \"address\" },\n { name: \"spender\", type: \"address\", internalType: \"address\" },\n ],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"maxTotalSupply\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"name\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"onTransferReceived\",\n inputs: [\n { name: \"operator\", type: \"address\", internalType: \"address\" },\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes4\", internalType: \"bytes4\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"owner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"pendingOwner\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"proxiableUUID\",\n inputs: [],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"rate\",\n inputs: [],\n outputs: [{ name: \"\", type: \"uint256\", internalType: \"uint256\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"reinitializeV2\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"reinitializeV3\",\n inputs: [\n { name: \"blockedUsers\", type: \"address[]\", internalType: \"address[]\" },\n { name: \"underlyingDenyListSelector\", type: \"bytes4\", internalType: \"bytes4\" },\n { name: \"hasUnderlyingDenyListSelector_\", type: \"bool\", internalType: \"bool\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"renounceOwnership\",\n inputs: [],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"requestDiscloseEncryptedAmount\",\n inputs: [{ name: \"encryptedAmount\", type: \"bytes32\", internalType: \"euint64\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"setOperator\",\n inputs: [\n { name: \"operator\", type: \"address\", internalType: \"address\" },\n { name: \"until\", type: \"uint48\", internalType: \"uint48\" },\n ],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"symbol\",\n inputs: [],\n outputs: [{ name: \"\", type: \"string\", internalType: \"string\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"transferOwnership\",\n inputs: [{ name: \"newOwner\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unblockUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n outputs: [],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"underlying\",\n inputs: [],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"encryptedAmount\", type: \"bytes32\", internalType: \"externalEuint64\" },\n { name: \"inputProof\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrap\",\n inputs: [\n { name: \"from\", type: \"address\", internalType: \"address\" },\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"bytes32\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"function\",\n name: \"unwrapAmount\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"unwrapRequester\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n outputs: [{ name: \"\", type: \"address\", internalType: \"address\" }],\n stateMutability: \"view\",\n },\n {\n type: \"function\",\n name: \"upgradeToAndCall\",\n inputs: [\n { name: \"newImplementation\", type: \"address\", internalType: \"address\" },\n { name: \"data\", type: \"bytes\", internalType: \"bytes\" },\n ],\n outputs: [],\n stateMutability: \"payable\",\n },\n {\n type: \"function\",\n name: \"wrap\",\n inputs: [\n { name: \"to\", type: \"address\", internalType: \"address\" },\n { name: \"amount\", type: \"uint256\", internalType: \"uint256\" },\n ],\n outputs: [{ name: \"\", type: \"bytes32\", internalType: \"euint64\" }],\n stateMutability: \"nonpayable\",\n },\n {\n type: \"event\",\n name: \"AmountDiscloseRequested\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n { name: \"requester\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"AmountDisclosed\",\n inputs: [\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n { name: \"amount\", type: \"uint64\", indexed: false, internalType: \"uint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"ConfidentialTransfer\",\n inputs: [\n { name: \"from\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"to\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"amount\", type: \"bytes32\", indexed: true, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Initialized\",\n inputs: [{ name: \"version\", type: \"uint64\", indexed: false, internalType: \"uint64\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OperatorSet\",\n inputs: [\n { name: \"holder\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"operator\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"until\", type: \"uint48\", indexed: false, internalType: \"uint48\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferStarted\",\n inputs: [\n { name: \"previousOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"newOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"OwnershipTransferred\",\n inputs: [\n { name: \"previousOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"newOwner\", type: \"address\", indexed: true, internalType: \"address\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"PublicDecryptionVerified\",\n inputs: [\n { name: \"handlesList\", type: \"bytes32[]\", indexed: false, internalType: \"bytes32[]\" },\n { name: \"abiEncodedCleartexts\", type: \"bytes\", indexed: false, internalType: \"bytes\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapFinalized\",\n inputs: [\n { name: \"receiver\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"unwrapRequestId\", type: \"bytes32\", indexed: true, internalType: \"bytes32\" },\n { name: \"encryptedAmount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n { name: \"cleartextAmount\", type: \"uint64\", indexed: false, internalType: \"uint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UnwrapRequested\",\n inputs: [\n { name: \"receiver\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"unwrapRequestId\", type: \"bytes32\", indexed: true, internalType: \"bytes32\" },\n { name: \"amount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Upgraded\",\n inputs: [{ name: \"implementation\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserBlocked\",\n inputs: [{ name: \"user\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"UserUnblocked\",\n inputs: [{ name: \"user\", type: \"address\", indexed: true, internalType: \"address\" }],\n anonymous: false,\n },\n {\n type: \"event\",\n name: \"Wrap\",\n inputs: [\n { name: \"to\", type: \"address\", indexed: true, internalType: \"address\" },\n { name: \"roundedAmount\", type: \"uint256\", indexed: false, internalType: \"uint256\" },\n { name: \"encryptedWrappedAmount\", type: \"bytes32\", indexed: false, internalType: \"euint64\" },\n ],\n anonymous: false,\n },\n {\n type: \"error\",\n name: \"AddressEmptyCode\",\n inputs: [{ name: \"target\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"BlockedUser\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC1967InvalidImplementation\",\n inputs: [{ name: \"implementation\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ERC1967NonPayable\", inputs: [] },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [{ name: \"receiver\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidReceiver\",\n inputs: [{ name: \"receiver\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984InvalidSender\",\n inputs: [{ name: \"sender\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ERC7984TotalSupplyOverflow\", inputs: [] },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedCaller\",\n inputs: [{ name: \"caller\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedSpender\",\n inputs: [\n { name: \"holder\", type: \"address\", internalType: \"address\" },\n { name: \"spender\", type: \"address\", internalType: \"address\" },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984UnauthorizedUseOfEncryptedAmount\",\n inputs: [\n { name: \"amount\", type: \"bytes32\", internalType: \"euint64\" },\n { name: \"user\", type: \"address\", internalType: \"address\" },\n ],\n },\n {\n type: \"error\",\n name: \"ERC7984ZeroBalance\",\n inputs: [{ name: \"holder\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"FailedCall\", inputs: [] },\n { type: \"error\", name: \"InvalidInitialization\", inputs: [] },\n { type: \"error\", name: \"InvalidKMSSignatures\", inputs: [] },\n { type: \"error\", name: \"InvalidUnderlyingDenyListResponse\", inputs: [] },\n {\n type: \"error\",\n name: \"InvalidUnwrapRequest\",\n inputs: [{ name: \"unwrapRequestId\", type: \"bytes32\", internalType: \"bytes32\" }],\n },\n { type: \"error\", name: \"NotInitializing\", inputs: [] },\n {\n type: \"error\",\n name: \"OwnableInvalidOwner\",\n inputs: [{ name: \"owner\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"OwnableUnauthorizedAccount\",\n inputs: [{ name: \"account\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"SafeCastOverflowedUintDowncast\",\n inputs: [\n { name: \"bits\", type: \"uint8\", internalType: \"uint8\" },\n { name: \"value\", type: \"uint256\", internalType: \"uint256\" },\n ],\n },\n {\n type: \"error\",\n name: \"SafeERC20FailedOperation\",\n inputs: [{ name: \"token\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"SenderNotAllowedToUseHandle\",\n inputs: [\n { name: \"handle\", type: \"bytes32\", internalType: \"bytes32\" },\n { name: \"sender\", type: \"address\", internalType: \"address\" },\n ],\n },\n { type: \"error\", name: \"UUPSUnauthorizedCallContext\", inputs: [] },\n {\n type: \"error\",\n name: \"UUPSUnsupportedProxiableUUID\",\n inputs: [{ name: \"slot\", type: \"bytes32\", internalType: \"bytes32\" }],\n },\n { type: \"error\", name: \"UnderlyingDenyListCallFailed\", inputs: [] },\n {\n type: \"error\",\n name: \"UnderlyingDenyListedAddress\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"UserAlreadyBlocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n {\n type: \"error\",\n name: \"UserAlreadyUnblocked\",\n inputs: [{ name: \"user\", type: \"address\", internalType: \"address\" }],\n },\n { type: \"error\", name: \"ZamaProtocolUnsupported\", inputs: [] },\n] as const;\n","import type { Address, Hex } from \"viem\";\nimport { confidentialWrapperAbi } from \"../abi/confidential-wrapper.abi\";\nimport type { EncryptedValue } from \"../relayer/types\";\n\n/**\n * Returns the contract config to read an encrypted balance.\n *\n * @example\n * ```ts\n * const handle = await provider.readContract(\n * confidentialBalanceOfContract(tokenAddress, userAddress),\n * );\n * ```\n */\nexport function confidentialBalanceOfContract(tokenAddress: Address, userAddress: Address) {\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialBalanceOf\",\n args: [userAddress],\n } as const;\n}\n\n/**\n * Returns the contract config for a confidential transfer.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * confidentialTransferContract(tokenAddress, to, encryptedValues[0], inputProof),\n * );\n * ```\n */\nexport function confidentialTransferContract(\n encryptedErc20: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTransfer\",\n args: [to, encryptedAmount, inputProof],\n } as const;\n}\n\n/**\n * Returns the contract config for a confidential transferFrom.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * confidentialTransferFromContract(tokenAddress, from, to, encryptedValues[0], inputProof),\n * );\n * ```\n */\nexport function confidentialTransferFromContract(\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTransferFrom\",\n args: [from, to, encryptedAmount, inputProof],\n } as const;\n}\n\n/**\n * Returns the contract config for a confidential transferAndCall. The caller\n * supplies an opaque `data` payload that is forwarded to the recipient's\n * ERC-7984 receiver hook (`onConfidentialTransferReceived`). The SDK does not\n * craft, validate, or inspect `data` — encoding the call site's domain message\n * is the caller's responsibility.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * confidentialTransferAndCallContract(\n * tokenAddress,\n * to,\n * encryptedValues[0],\n * inputProof,\n * data,\n * ),\n * );\n * ```\n */\nexport function confidentialTransferAndCallContract(\n encryptedErc20: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n data: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTransferAndCall\",\n args: [to, encryptedAmount, inputProof, data],\n } as const;\n}\n\n/**\n * Returns the contract config for a confidential transferFromAndCall. The\n * caller supplies an opaque `data` payload forwarded to the recipient's\n * ERC-7984 receiver hook; the SDK does not craft or inspect it.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * confidentialTransferFromAndCallContract(\n * tokenAddress,\n * from,\n * to,\n * encryptedValues[0],\n * inputProof,\n * data,\n * ),\n * );\n * ```\n */\nexport function confidentialTransferFromAndCallContract(\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n data: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTransferFromAndCall\",\n args: [from, to, encryptedAmount, inputProof, data],\n } as const;\n}\n\n/**\n * Returns the contract config for checking operator status.\n *\n * @example\n * ```ts\n * const isOperator = await provider.readContract(\n * isOperatorContract(tokenAddress, holder, spender),\n * );\n * ```\n */\nexport function isOperatorContract(tokenAddress: Address, holder: Address, spender: Address) {\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"isOperator\",\n args: [holder, spender],\n } as const;\n}\n\n/**\n * Returns the contract config for setting an operator.\n * Defaults until to 1 hour from now.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * setOperatorContract(tokenAddress, operator),\n * );\n * ```\n */\nexport function setOperatorContract(tokenAddress: Address, operator: Address, until?: number) {\n const effectiveUntil = until ?? Math.floor(Date.now() / 1000) + 3600;\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"setOperator\",\n args: [operator, effectiveUntil],\n } as const;\n}\n\n/**\n * Returns the contract config for an unwrap with newly encrypted amount.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * unwrapContract(encryptedErc20, from, to, encryptedValues[0], inputProof),\n * );\n * ```\n */\nexport function unwrapContract(\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedAmount: EncryptedValue,\n inputProof: Hex,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"unwrap\",\n args: [from, to, encryptedAmount, inputProof],\n } as const;\n}\n\n/**\n * Returns the contract config for an unwrap with an existing balance handle.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * unwrapFromBalanceContract(encryptedErc20, from, to, encryptedBalance),\n * );\n * ```\n */\nexport function unwrapFromBalanceContract(\n encryptedErc20: Address,\n from: Address,\n to: Address,\n encryptedBalance: EncryptedValue,\n) {\n return {\n address: encryptedErc20,\n abi: confidentialWrapperAbi,\n functionName: \"unwrap\",\n args: [from, to, encryptedBalance],\n } as const;\n}\n\n/**\n * Returns the contract config to read the confidential (encrypted) total supply.\n *\n * @example\n * ```ts\n * const handle = await provider.readContract(\n * confidentialTotalSupplyContract(tokenAddress),\n * );\n * ```\n */\nexport function confidentialTotalSupplyContract(tokenAddress: Address) {\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"confidentialTotalSupply\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config to read the wrap/unwrap conversion rate.\n *\n * @example\n * ```ts\n * const rate = await provider.readContract(rateContract(tokenAddress));\n * ```\n */\nexport function rateContract(tokenAddress: Address) {\n return {\n address: tokenAddress,\n abi: confidentialWrapperAbi,\n functionName: \"rate\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config for finalizing an unwrap.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * finalizeUnwrapContract(wrapper, unwrapRequestId, cleartext, proof),\n * );\n * ```\n */\nexport function finalizeUnwrapContract(\n wrapper: Address,\n unwrapRequestId: EncryptedValue,\n unwrapAmountCleartext: bigint,\n decryptionProof: Hex,\n) {\n return {\n address: wrapper,\n abi: confidentialWrapperAbi,\n functionName: \"finalizeUnwrap\",\n args: [unwrapRequestId, unwrapAmountCleartext, decryptionProof],\n } as const;\n}\n\n/**\n * Returns the contract config to read the requester of an open unwrap request.\n * The wrapper deletes the request on finalize, so the zero address means the\n * request no longer exists.\n *\n * @example\n * ```ts\n * const requester = await provider.readContract(\n * unwrapRequesterContract(wrapperAddress, unwrapRequestId),\n * );\n * ```\n */\nexport function unwrapRequesterContract(wrapperAddress: Address, unwrapRequestId: EncryptedValue) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"unwrapRequester\",\n args: [unwrapRequestId],\n } as const;\n}\n\n/**\n * Returns the contract config to read the underlying ERC-20 token of a wrapper.\n *\n * @example\n * ```ts\n * const token = await provider.readContract(underlyingContract(wrapperAddress));\n * ```\n */\nexport function underlyingContract(wrapperAddress: Address) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"underlying\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config to read the inferred plaintext total supply.\n *\n * @example\n * ```ts\n * const supply = await provider.readContract(\n * inferredTotalSupplyContract(wrapperAddress),\n * );\n * ```\n */\nexport function inferredTotalSupplyContract(wrapperAddress: Address) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"inferredTotalSupply\",\n args: [],\n } as const;\n}\n\n/**\n * Returns the contract config for a wrap (shield) operation.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * wrapContract(wrapperAddress, to, amount),\n * );\n * ```\n */\nexport function wrapContract(wrapperAddress: Address, to: Address, amount: bigint) {\n return {\n address: wrapperAddress,\n abi: confidentialWrapperAbi,\n functionName: \"wrap\",\n args: [to, amount],\n } as const;\n}\n","import { erc20Abi, type Address } from \"viem\";\n\n/**\n * Returns the contract config to read a token's name.\n *\n * @example\n * ```ts\n * const name = await provider.readContract(nameContract(tokenAddress));\n * ```\n */\nexport function nameContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"name\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read a token's symbol.\n *\n * @example\n * ```ts\n * const symbol = await provider.readContract(symbolContract(tokenAddress));\n * ```\n */\nexport function symbolContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"symbol\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read a token's decimals.\n *\n * @example\n * ```ts\n * const decimals = await provider.readContract(decimalsContract(tokenAddress));\n * ```\n */\nexport function decimalsContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"decimals\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 token's total supply.\n *\n * @example\n * ```ts\n * const supply = await provider.readContract(erc20TotalSupplyContract(tokenAddress));\n * ```\n */\nexport function erc20TotalSupplyContract(tokenAddress: Address) {\n return { address: tokenAddress, abi: erc20Abi, functionName: \"totalSupply\", args: [] } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 balance.\n *\n * @example\n * ```ts\n * const balance = await provider.readContract(\n * balanceOfContract(tokenAddress, account),\n * );\n * ```\n */\nexport function balanceOfContract(tokenAddress: Address, account: Address) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"balanceOf\",\n args: [account],\n } as const;\n}\n\n/**\n * Returns the contract config to read an ERC-20 allowance.\n *\n * @example\n * ```ts\n * const allowance = await provider.readContract(\n * allowanceContract(tokenAddress, owner, spender),\n * );\n * ```\n */\nexport function allowanceContract(tokenAddress: Address, owner: Address, spender: Address) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"allowance\",\n args: [owner, spender],\n } as const;\n}\n\n/**\n * Returns the contract config for an ERC-20 approve.\n *\n * @example\n * ```ts\n * const txHash = await signer.writeContract(\n * approveContract(tokenAddress, spender, amount),\n * );\n * ```\n */\nexport function approveContract(tokenAddress: Address, spender: Address, value: bigint) {\n return {\n address: tokenAddress,\n abi: erc20Abi,\n functionName: \"approve\",\n args: [spender, value],\n } as const;\n}\n","// DO NOT EDIT: generated by `pnpm abi:build` from\n// contracts/out/IERC165.sol/IERC165.json.\n// Regenerate after `pnpm contracts:build`; `pnpm abi:check` enforces this in CI.\nexport const erc165Abi = [\n {\n type: \"function\",\n name: \"supportsInterface\",\n inputs: [{ name: \"interfaceId\", type: \"bytes4\", internalType: \"bytes4\" }],\n outputs: [{ name: \"\", type: \"bool\", internalType: \"bool\" }],\n stateMutability: \"view\",\n },\n] as const;\n","import type { Address } from \"viem\";\nimport { erc165Abi } from \"../abi/erc165.abi\";\n\n/** ERC-165 interface ID for IERC7984 (confidential fungible token). */\nexport const ERC7984_INTERFACE_ID = \"0x4958f2a4\" as const;\n\n/** ERC-165 interface ID for IERC7984ERC20Wrapper (confidential wrapper). */\nexport const ERC7984_WRAPPER_INTERFACE_ID = \"0x1f1c62b2\" as const;\n\n/** ERC-165 interface ID for ERC-1363 (payable token — `transferAndCall`). */\nexport const ERC1363_INTERFACE_ID = \"0xb0202a11\" as const;\n\n/**\n * Returns the contract config for an ERC-165 `supportsInterface` check.\n *\n * Use with {@link ERC7984_INTERFACE_ID} to detect confidential tokens,\n * or {@link ERC7984_WRAPPER_INTERFACE_ID} to detect wrappers.\n *\n * @example\n * ```ts\n * const isConfidential = await provider.readContract(\n * supportsInterfaceContract(tokenAddress, ERC7984_INTERFACE_ID),\n * );\n * ```\n */\nexport function supportsInterfaceContract(tokenAddress: Address, interfaceId: Address) {\n return {\n address: tokenAddress,\n abi: erc165Abi,\n functionName: \"supportsInterface\",\n args: [interfaceId],\n } as const;\n}\n\n/**\n * Returns contract config to check if a token implements IERC7984 (confidential fungible token).\n *\n * @example\n * ```ts\n * const isConfidential = await provider.readContract(\n * isConfidentialTokenContract(\"0xTokenAddress\"),\n * );\n * ```\n */\nexport function isConfidentialTokenContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC7984_INTERFACE_ID);\n}\n\n/**\n * Returns contract config to check if a token implements IERC7984ERC20Wrapper (confidential wrapper).\n *\n * @example\n * ```ts\n * const isWrapper = await provider.readContract(\n * isConfidentialWrapperContract(\"0xWrapperAddress\"),\n * );\n * ```\n */\nexport function isConfidentialWrapperContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC7984_WRAPPER_INTERFACE_ID);\n}\n\n/**\n * Returns contract config to check if a token implements ERC-1363 (payable token).\n *\n * @example\n * ```ts\n * const isPayable = await provider.readContract(\n * isPayableTokenContract(\"0xTokenAddress\"),\n * );\n * ```\n */\nexport function isPayableTokenContract(tokenAddress: Address) {\n return supportsInterfaceContract(tokenAddress, ERC1363_INTERFACE_ID);\n}\n"],"mappings":"4FAGA,IAAa,EAAb,cAA8C,CAAU,CACtD,YAAY,EAAiB,EAAwB,CACnD,MAAM,EAAc,oBAAqB,EAAS,CAAO,EACzD,KAAK,KAAO,0BACd,CACF,ECHa,EAAb,cAAyC,CAAU,CAEjD,UAEA,YAAY,EAAqB,EAAmB,EAAiB,EAAwB,CAC3F,MAAM,EAAM,EAAS,CAAO,EAC5B,KAAK,KAAO,sBACZ,KAAK,UAAY,CACnB,CACF,EAmBa,EAAb,cAA8C,CAAoB,CAChE,YAAY,EAAmB,EAAwB,CACrD,MACE,EAAc,oBACd,EACA,UAAU,EAAU,8HACpB,CACF,EACA,KAAK,KAAO,0BACd,CACF,EAGa,EAAb,cAA6C,CAAoB,CAC/D,YAAY,EAAmB,EAAwB,CACrD,MACE,EAAc,mBACd,EACA,UAAU,EAAU,sCACpB,CACF,EACA,KAAK,KAAO,yBACd,CACF,EAGa,EAAb,cAAgD,CAAoB,CAClE,YAAY,EAAmB,EAAwB,CACrD,MACE,EAAc,sBACd,EACA,UAAU,EAAU,sCACpB,CACF,EACA,KAAK,KAAO,4BACd,CACF,EAKA,SAAgB,EAAqB,EAAU,EAAmC,CAChF,GAAI,GAAU,KACZ,MAAM,IAAI,EAAyB,CAAS,EAE9C,OAAO,CACT,CCxEA,MAAa,EAAgB,CAE3B,aAAc,gBACd,WAAY,cACZ,aAAc,gBACd,aAAc,gBACd,WAAY,cACZ,aAAc,gBAEd,YAAa,eAEb,iBAAkB,oBAClB,gBAAiB,mBACjB,kBAAmB,qBACnB,sBAAuB,yBACvB,qBAAsB,wBACtB,2BAA4B,8BAC5B,cAAe,iBACf,gBAAiB,mBACjB,wBAAyB,2BACzB,eAAgB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A4B,EAAuB,CACjE,OAAO,EAA0B,EAAc,CAAoB,CACrE,CAYA,SAAgB,EAA8B,EAAuB,CACnE,OAAO,EAA0B,EAAc,CAA4B,CAC7E,CAYA,SAAgB,EAAuB,EAAuB,CAC5D,OAAO,EAA0B,EAAc,CAAoB,CACrE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { $ as SetOperatorSubmittedEvent, $t as TransactionReceipt, A as WalletAccountListener, B as ApproveUnderlyingSubmittedEvent, D as GenericSigner, F as ReadContractReturnType, G as DelegationSubmittedEvent, H as DecryptEndEvent, I as ReadFunctionName, J as EncryptStartEvent, K as EncryptEndEvent, L as WriteContractArgs, M as ContractAbi, N as ReadContractArgs, O as WalletAccount, P as ReadContractConfig, Q as RevokeDelegationSubmittedEvent, Qt as RawLog, R as WriteContractConfig, U as DecryptErrorEvent, V as BaseEvent, W as DecryptStartEvent, X as PermitErrorEvent, Y as FinalizeUnwrapSubmittedEvent, Z as PermitOperation, a as ZamaConfigBase, at as UnshieldPhase1SubmittedEvent, c as GenericStorage, cn as EncryptedValue, ct as UnwrapSubmittedEvent, dt as WrapSubmittedEvent, et as ShieldSubmittedEvent, fn as FhevmRuntimeConfig, ft as ZamaSDKEvent, ht as ZamaSDKEvents, i as ZamaConfig, in as EIP712TypedData, it as TransferSubmittedEvent, j as WalletAccountStore, k as WalletAccountChange, l as GenericProvider, mt as ZamaSDKEventType, n as RelayerConfig, nt as TransactionOperation, ot as UnshieldPhase2StartedEvent, pt as ZamaSDKEventListener, q as EncryptErrorEvent, rt as TransferFromSubmittedEvent, s as GenericLogger, st as UnshieldPhase2SubmittedEvent, tn as ClearValue, tt as TransactionErrorEvent, vt as ShieldPath, z as WriteFunctionName } from "../types-
|
|
3
|
-
import { t as ZamaConfigEthers } from "../types-
|
|
4
|
-
import { n as MutableWalletAccountStore, t as BaseSigner } from "../base-signer-
|
|
1
|
+
import { d as AtLeastOneChain, f as FheChain, p as FheChainAuth } from "../index-D1Wtji3m.js";
|
|
2
|
+
import { $ as SetOperatorSubmittedEvent, $t as TransactionReceipt, A as WalletAccountListener, B as ApproveUnderlyingSubmittedEvent, D as GenericSigner, F as ReadContractReturnType, G as DelegationSubmittedEvent, H as DecryptEndEvent, I as ReadFunctionName, J as EncryptStartEvent, K as EncryptEndEvent, L as WriteContractArgs, M as ContractAbi, N as ReadContractArgs, O as WalletAccount, P as ReadContractConfig, Q as RevokeDelegationSubmittedEvent, Qt as RawLog, R as WriteContractConfig, U as DecryptErrorEvent, V as BaseEvent, W as DecryptStartEvent, X as PermitErrorEvent, Y as FinalizeUnwrapSubmittedEvent, Z as PermitOperation, a as ZamaConfigBase, at as UnshieldPhase1SubmittedEvent, c as GenericStorage, cn as EncryptedValue, ct as UnwrapSubmittedEvent, dt as WrapSubmittedEvent, et as ShieldSubmittedEvent, fn as FhevmRuntimeConfig, ft as ZamaSDKEvent, ht as ZamaSDKEvents, i as ZamaConfig, in as EIP712TypedData, it as TransferSubmittedEvent, j as WalletAccountStore, k as WalletAccountChange, l as GenericProvider, mt as ZamaSDKEventType, n as RelayerConfig, nt as TransactionOperation, ot as UnshieldPhase2StartedEvent, pt as ZamaSDKEventListener, q as EncryptErrorEvent, rt as TransferFromSubmittedEvent, s as GenericLogger, st as UnshieldPhase2SubmittedEvent, tn as ClearValue, tt as TransactionErrorEvent, vt as ShieldPath, z as WriteFunctionName } from "../types-CHepK8MK.js";
|
|
3
|
+
import { t as ZamaConfigEthers } from "../types-C2ccCjoA.js";
|
|
4
|
+
import { n as MutableWalletAccountStore, t as BaseSigner } from "../base-signer-BxIDBDTF.js";
|
|
5
5
|
import { Abi, Address, ContractFunctionArgs, ContractFunctionName, ContractFunctionReturnType, EIP1193EventMap, EIP1193Events, EIP1193Provider, EIP1193Provider as EIP1193Provider$1, Hex, Hex as Hex$1, ProviderConnectInfo, ProviderMessage, ProviderRpcError } from "viem";
|
|
6
6
|
import { Signer, ethers } from "ethers";
|
|
7
7
|
//#region src/ethers/config.d.ts
|
package/dist/esm/ethers/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"../relayer-C3jVhqSK.js";import{A as t,B as n,D as r,E as i,F as a,H as o,L as s,N as c,O as l,T as u,h as d,j as f,s as p,v as m,x as h,z as g}from"../erc165-
|
|
1
|
+
import{t as e}from"../relayer-C3jVhqSK.js";import{A as t,B as n,D as r,E as i,F as a,H as o,L as s,N as c,O as l,T as u,h as d,j as f,s as p,v as m,x as h,z as g}from"../erc165-B8gx2luK.js";import{i as _,t as v}from"../base-signer-BoBsvn5Q.js";import{a as y,i as b,n as x,o as ee,r as S,s as C,t as w}from"../wrappers-registry-Cm3JJeqx.js";import{t as T}from"../eip1193-subscribe-CNxVHW6y.js";import{ProviderRpcError as E,decodeFunctionResult as D,encodeFunctionData as te,getAddress as O,isHex as k}from"viem";import{BrowserProvider as A,Contract as j,Transaction as M,ethers as N}from"ethers";function P(e){return{to:e.address,data:te({abi:e.abi,functionName:e.functionName,args:e.args}),...e.gas===void 0?{}:{gasLimit:e.gas},...e.value===void 0?{}:{value:e.value}}}async function F(e,t){let n=await e.call(P(t));if(!k(n))throw TypeError(`Expected hex string, got: ${n}`);return D({abi:t.abi,functionName:t.functionName,data:n})}async function I(e,t){let n=await e.sendTransaction(P(t));if(!k(n.hash))throw TypeError(`Expected hex string, got: ${n.hash}`);return n.hash}function L(e,t,n){return F(e,d(t,n))}function R(e,t){return F(e,i(t))}function z(e,t,n){return F(e,p(t,n))}function B(e,t,n,r,i){return I(e,m(t,n,r,i))}function V(e,t,n,i,a,o){return I(e,r(t,n,i,a,o))}function H(e,t,n,r,i){return I(e,l(t,n,r,i))}function U(e,t,n,r,i){return I(e,h(t,n,r,i))}function W(e,t,n,r){return I(e,u(t,n,r))}function G(e,n,r,i){return I(e,t(n,r,i))}function K(e,t){return F(e,b(t))}function q(e,t){return F(e,y(t))}function J(e,t,n,r){return F(e,ee(t,n,r))}function Y(e,t,n){return F(e,S(t,n))}function X(e,t,n){return F(e,w(t,n))}function Z(e,t,n){return F(e,x(t,n))}function ne(e,t,n){return F(e,C(t,n))}var Q=class{#e;constructor(e){`ethereum`in e?this.#e=new A(e.ethereum):this.#e=e.provider}async getChainId(){let e=await this.#e.getNetwork();return Number(e.chainId)}async readContract(e){return F(this.#e,{address:e.address,abi:e.abi,functionName:e.functionName,args:e.args})}async getBlockTimestamp(){let t=await this.#e.getBlock(`latest`);if(!t)throw new e(`EthersProvider.getBlockTimestamp: failed to fetch latest block`);if(t.timestamp===null)throw new e(`EthersProvider.getBlockTimestamp: latest block has no timestamp`);return BigInt(t.timestamp)}async waitForTransactionReceipt(e){let t=await this.#e.waitForTransaction(e);if(!t)throw new o(`EthersProvider.waitForTransactionReceipt: no receipt found for tx ${e}. The transaction may have been dropped from the mempool, or the RPC's wait timeout elapsed.`);return{logs:t.logs.map(e=>({address:e.address,topics:e.topics.filter(e=>e!==null),data:e.data}))}}async prepareTransaction(t){let{from:n,calldata:r}=t,i=new N.Interface(r.abi),a=[];i.forEachFunction(e=>{e.name===r.functionName&&a.push(e)});let s=r.args.length,l=a.length===1?a[0]:a.find(e=>e.inputs.length===s);if(!l)throw Error(`Function ${r.functionName}(${s} args) not found in ABI`);let u=i.encodeFunctionData(l,r.args);c(u,`data`);let d=r.value??0n,f=this.#e.getNetwork(),p=t.nonce===void 0?this.#e.getTransactionCount(n,`pending`):Promise.resolve(t.nonce),m=t.gasLimit===void 0?r.gas??this.#e.estimateGas({from:n,to:r.address,data:u,value:d}).catch(e=>{throw new o(`EthersProvider.prepareTransaction: gas estimation reverted for ${r.functionName} on ${r.address}`,{cause:e})}):Promise.resolve(t.gasLimit),h=t.fees??this.#e.getFeeData(),[g,_,v,y]=await Promise.all([f,p,m,h]),b=y.maxFeePerGas,x=y.maxPriorityFeePerGas;if(b===null||x===null)throw new e(`EthersProvider.prepareTransaction: EIP-1559 fee data unavailable (provider returned null maxFeePerGas). The connected chain may not support EIP-1559 type-2 transactions.`);return M.from({type:2,chainId:Number(g.chainId),nonce:_,to:r.address,data:u,value:d,gasLimit:v,maxFeePerGas:b,maxPriorityFeePerGas:x}).unsignedSerialized}},$=class extends v{#e;#t;#n;#r;#i;constructor(e){super(),`ethereum`in e?(this.#e=new A(e.ethereum),this.#n=e.ethereum,this.#r=T({provider:e.ethereum,getInitialWalletAccount:()=>this.#l(),onWalletAccountChange:({next:e})=>{this.walletAccount.setSnapshot(e)}})):(this.#t=e.signer,this.#r=()=>{},f(`refresh wallet account`,async()=>{await this.refreshWalletAccount()}))}requireWalletAccount(e){let t=this.walletAccount.getSnapshot();if(!t&&!this.walletAccount.isReady())throw new g(e);if(!t)throw new n(e);return t}refreshWalletAccount(){return this.#n?this.#c():this.#t?this.#s(this.#t):Promise.resolve(void 0)}onDispose(){this.#r()}async#a(){if(this.#t)return this.#t;if(!this.#e)throw new s(`resolveSigner`);return this.#e.getSigner()}async#o(e){let t=e.provider;if(!t)return;let[n,r]=await Promise.all([e.getAddress(),t.getNetwork()]);return{address:O(n),chainId:Number(r.chainId)}}async signTypedData(e){let t=await this.#a(),{domain:n,types:r,message:i}=e,{EIP712Domain:a,...o}=r,s=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,[...t]])),c=await t.signTypedData(n,s,i);if(!k(c))throw TypeError(`Expected hex string, got: ${c}`);return c}async writeContract(e){let t=await this.#a(),n=new j(e.address,e.abi,t),r={};e.value!==void 0&&(r.value=e.value),e.gas!==void 0&&(r.gasLimit=e.gas);let i=await n.getFunction(e.functionName)(...e.args,r);if(!k(i.hash))throw TypeError(`Expected hex string, got: ${i.hash}`);return i.hash}async#s(e){return this.#i??=this.#o(e).then(e=>(this.walletAccount.setSnapshot(e),e)).finally(()=>{this.#i=void 0}),this.#i}async#c(){let e=await this.#l();return this.walletAccount.setSnapshot(e),e}async#l(){let e=this.#n;if(!e)return;let[t,n]=await Promise.all([e.request({method:`eth_accounts`}),e.request({method:`eth_chainId`})]);if(!Array.isArray(t)||typeof t[0]!=`string`)return;let r=Number(n);if(!(!Number.isSafeInteger(r)||r<=0))return{address:O(t[0]),chainId:r}}};function re(e){if(`signer`in e&&e.signer){let t=new $({signer:e.signer});if(!e.signer.provider)throw Error(`createConfig requires a Signer with an attached provider for chain reads`);return _(t,new Q({provider:e.signer.provider}),e)}return _(new $({ethereum:e.ethereum}),`provider`in e&&e.provider?new Q({provider:e.provider}):new Q({ethereum:e.ethereum}),e)}export{v as BaseSigner,Q as EthersProvider,$ as EthersSigner,E as ProviderRpcError,a as ZamaSDKEvents,re as createConfig,L as readConfidentialBalanceOfContract,X as readConfidentialTokenAddressContract,ne as readIsConfidentialTokenValidContract,z as readSupportsInterfaceContract,Z as readTokenAddressContract,Y as readTokenPairContract,K as readTokenPairsContract,q as readTokenPairsLengthContract,J as readTokenPairsSliceContract,R as readUnderlyingTokenContract,B as writeConfidentialTransferContract,U as writeFinalizeUnwrapContract,W as writeSetOperatorContract,V as writeUnwrapContract,H as writeUnwrapFromBalanceContract,G as writeWrapContract};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e,r as t,t as n}from"./relayer-C3jVhqSK.js";import{a as r,l as i,n as a,t as o}from"./signing-C6nbPCyd.js";var s=class extends t{retryAfter;constructor(t,n){let{retryAfter:r,...i}=n??{};super(e.RpcRateLimited,t,i),this.name=`RpcRateLimitError`,this.retryAfter=r}};const c={[e.SigningRejected]:a,[e.SigningFailed]:o,[e.Configuration]:n,[e.RpcRateLimited]:s,[e.KeyWrappingFailed]:r,[e.RevokedKmsContext]:i};function l(e){return Object.values(c).some(t=>e instanceof t)}export{l as n,s as r,c as t};
|
|
2
|
+
//# sourceMappingURL=fatal-batch-BiiS7KdS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fatal-batch-BiiS7KdS.js","names":[],"sources":["../../src/errors/rpc.ts","../../src/errors/fatal-batch.ts"],"sourcesContent":["import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/**\n * The consumer's RPC provider rate-limited an on-chain read the SDK performs\n * during decryption (e.g. the ACL check) — HTTP 429 or JSON-RPC `-32005`. An\n * RPC-endpoint problem, **not** a decryption/entitlement failure, and safe to\n * **retry**. Kept distinct from the relayer's own back-pressure\n * ({@link RelayerRequestFailedError}).\n *\n * Backoff for chain RPC is owned by the consumer's transport: viem/ethers\n * already honor the `Retry-After` header and retry internally before this error\n * surfaces, so it is configured on the transport you pass via `chain.network`\n * (not re-implemented here).\n *\n * @example\n * ```ts\n * try {\n * await sdk.decryption.decryptValues([{ encryptedValue, contractAddress }]);\n * } catch (e) {\n * if (e instanceof RpcRateLimitError) {\n * // back off and retry; consider a higher-throughput RPC endpoint\n * }\n * }\n * ```\n */\nexport class RpcRateLimitError extends ZamaError {\n /**\n * Suggested delay before retrying, in **seconds**, when a numeric `retryAfter`\n * is present on the error. Usually `undefined` for chain RPC: the `Retry-After`\n * header is consumed by the consumer's viem/ethers transport (which owns the\n * backoff), not surfaced here — see the class doc.\n */\n readonly retryAfter: number | undefined;\n\n constructor(message: string, options?: ErrorOptions & { retryAfter?: number }) {\n const { retryAfter, ...errorOptions } = options ?? {};\n super(ZamaErrorCode.RpcRateLimited, message, errorOptions);\n this.name = \"RpcRateLimitError\";\n this.retryAfter = retryAfter;\n }\n}\n","import { ZamaErrorCode, type ZamaError } from \"./base\";\nimport { KeyWrappingError, RevokedKmsContextError } from \"./credential\";\nimport { ConfigurationError } from \"./relayer\";\nimport { RpcRateLimitError } from \"./rpc\";\nimport { SigningRejectedError, SigningFailedError } from \"./signing\";\n\nexport const fatalBatchErrors = {\n [ZamaErrorCode.SigningRejected]: SigningRejectedError,\n [ZamaErrorCode.SigningFailed]: SigningFailedError,\n [ZamaErrorCode.Configuration]: ConfigurationError,\n [ZamaErrorCode.RpcRateLimited]: RpcRateLimitError,\n [ZamaErrorCode.KeyWrappingFailed]: KeyWrappingError,\n [ZamaErrorCode.RevokedKmsContext]: RevokedKmsContextError,\n} satisfies Partial<Record<ZamaErrorCode, new (message: string) => ZamaError>>;\n\n/** Systemic failures abort a batch because retrying each item would repeat the same failure. */\nexport function isFatalBatchError(error: unknown): boolean {\n return Object.values(fatalBatchErrors).some((Constructor) => error instanceof Constructor);\n}\n"],"mappings":"uHAyBA,IAAa,EAAb,cAAuC,CAAU,CAO/C,WAEA,YAAY,EAAiB,EAAkD,CAC7E,GAAM,CAAE,aAAY,GAAG,GAAiB,GAAW,CAAC,EACpD,MAAM,EAAc,eAAgB,EAAS,CAAY,EACzD,KAAK,KAAO,oBACZ,KAAK,WAAa,CACpB,CACF,EClCA,MAAa,EAAmB,EAC7B,EAAc,iBAAkB,GAChC,EAAc,eAAgB,GAC9B,EAAc,eAAgB,GAC9B,EAAc,gBAAiB,GAC/B,EAAc,mBAAoB,GAClC,EAAc,mBAAoB,CACrC,EAGA,SAAgB,EAAkB,EAAyB,CACzD,OAAO,OAAO,OAAO,CAAgB,CAAC,CAAC,KAAM,GAAgB,aAAiB,CAAW,CAC3F"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{t as e,x as t,y as n}from"./relayer-C3jVhqSK.js";import{n as r}from"./encryption-6AVd-82z.js";import{n as i,t as a}from"./applied-runtime-3fzqBC2V.js";import{n as o}from"./telemetry-BDnhC-vh.js";import{createPublicClient as s,custom as c,http as l}from"viem";import{createUnsignedLegacyDecryptionPermitEip712 as u}from"@fhevm/sdk/actions/base";import{createFhevmBaseClient as ee,createFhevmDecryptClient as te,createFhevmEncryptClient as d,hasFhevmRuntimeConfig as f}from"@fhevm/sdk/viem";import{createFhevmCleartextBaseClient as ne,createFhevmCleartextDecryptClient as re,createFhevmCleartextEncryptClient as p}from"@fhevm/sdk/viem/cleartext";function m(e){return{id:e.id,fhevm:{contracts:{acl:{address:e.aclContractAddress},inputVerifier:{address:e.inputVerifierContractAddress},kmsVerifier:{address:e.kmsContractAddress},protocolConfig:void 0},relayerUrl:e.relayerUrl,gateway:{id:e.gatewayChainId,contracts:{decryption:{address:e.verifyingContractAddressDecryption},inputVerification:{address:e.verifyingContractAddressInputVerification}}}}}}
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2019 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
*/
|
|
7
|
+
const h=Symbol(`Comlink.proxy`),ie=Symbol(`Comlink.endpoint`),g=Symbol(`Comlink.releaseProxy`),_=Symbol(`Comlink.finalizer`),v=Symbol(`Comlink.thrown`),y=e=>typeof e==`object`&&!!e||typeof e==`function`,b=new Map([[`proxy`,{canHandle:e=>y(e)&&e[h],serialize(e){let{port1:t,port2:n}=new MessageChannel;return S(e,t),[n,[n]]},deserialize(e){return e.start(),w(e)}}],[`throw`,{canHandle:e=>y(e)&&v in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){throw e.isError?Object.assign(Error(e.value.message),e.value):e.value}}]]);function x(e,t){for(let n of e)if(t===n||n===`*`||n instanceof RegExp&&n.test(t))return!0;return!1}function S(e,t=globalThis,n=[`*`]){t.addEventListener(`message`,function r(i){if(!i||!i.data)return;if(!x(n,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}let{id:a,type:o,path:s}=Object.assign({path:[]},i.data),c=(i.data.argumentList||[]).map(L),l;try{let t=s.slice(0,-1).reduce((e,t)=>e[t],e),n=s.reduce((e,t)=>e[t],e);switch(o){case`GET`:l=n;break;case`SET`:t[s.slice(-1)[0]]=L(i.data.value),l=!0;break;case`APPLY`:l=n.apply(t,c);break;case`CONSTRUCT`:l=F(new n(...c));break;case`ENDPOINT`:{let{port1:t,port2:n}=new MessageChannel;S(e,n),l=P(t,[t])}break;case`RELEASE`:l=void 0;break;default:return}}catch(e){l={value:e,[v]:0}}Promise.resolve(l).catch(e=>({value:e,[v]:0})).then(n=>{let[i,s]=I(n);t.postMessage(Object.assign(Object.assign({},i),{id:a}),s),o===`RELEASE`&&(t.removeEventListener(`message`,r),C(t),_ in e&&typeof e[_]==`function`&&e[_]())}).catch(e=>{let[n,r]=I({value:TypeError(`Unserializable return value`),[v]:0});t.postMessage(Object.assign(Object.assign({},n),{id:a}),r)})}),t.start&&t.start()}function ae(e){return e.constructor.name===`MessagePort`}function C(e){ae(e)&&e.close()}function w(e,t){let n=new Map;return e.addEventListener(`message`,function(e){let{data:t}=e;if(!t||!t.id)return;let r=n.get(t.id);if(r)try{r(t)}finally{n.delete(t.id)}}),j(e,n,[],t)}function T(e){if(e)throw Error(`Proxy has been released and is not useable`)}function E(e){return R(e,new Map,{type:`RELEASE`}).then(()=>{C(e)})}const D=new WeakMap,O=`FinalizationRegistry`in globalThis&&new FinalizationRegistry(e=>{let t=(D.get(e)||0)-1;D.set(e,t),t===0&&E(e)});function k(e,t){let n=(D.get(t)||0)+1;D.set(t,n),O&&O.register(e,t,e)}function A(e){O&&O.unregister(e)}function j(e,t,n=[],r=function(){}){let i=!1,a=new Proxy(r,{get(r,o){if(T(i),o===g)return()=>{A(a),E(e),t.clear(),i=!0};if(o===`then`){if(n.length===0)return{then:()=>a};let r=R(e,t,{type:`GET`,path:n.map(e=>e.toString())}).then(L);return r.then.bind(r)}return j(e,t,[...n,o])},set(r,a,o){T(i);let[s,c]=I(o);return R(e,t,{type:`SET`,path:[...n,a].map(e=>e.toString()),value:s},c).then(L)},apply(r,a,o){T(i);let s=n[n.length-1];if(s===ie)return R(e,t,{type:`ENDPOINT`}).then(L);if(s===`bind`)return j(e,t,n.slice(0,-1));let[c,l]=M(o);return R(e,t,{type:`APPLY`,path:n.map(e=>e.toString()),argumentList:c},l).then(L)},construct(r,a){T(i);let[o,s]=M(a);return R(e,t,{type:`CONSTRUCT`,path:n.map(e=>e.toString()),argumentList:o},s).then(L)}});return k(a,e),a}function oe(e){return Array.prototype.concat.apply([],e)}function M(e){let t=e.map(I);return[t.map(e=>e[0]),oe(t.map(e=>e[1]))]}const N=new WeakMap;function P(e,t){return N.set(e,t),e}function F(e){return Object.assign(e,{[h]:!0})}function I(e){for(let[t,n]of b)if(n.canHandle(e)){let[r,i]=n.serialize(e);return[{type:`HANDLER`,name:t,value:r},i]}return[{type:`RAW`,value:e},N.get(e)||[]]}function L(e){switch(e.type){case`HANDLER`:return b.get(e.name).deserialize(e.value);case`RAW`:return e.value}}function R(e,t,n,r){return new Promise(i=>{let a=z();t.set(a,i),e.start&&e.start(),e.postMessage(Object.assign({id:a},n),r)})}function z(){return[,,,,].fill(0).map(()=>Math.floor(Math.random()*(2**53-1)).toString(16)).join(`-`)}function B(e){return typeof e==`object`&&!!e&&e.wireError===!0}const V=[`statusCode`,`status`,`retryAfter`,`timeoutMs`,`relayerApiError`,`code`,`data`,`shortMessage`,`details`,`error`,`info`];function H(e){try{return structuredClone(e),!0}catch{return!1}}function U(e){let n=e.response;return t(n?.headers)}function W(e){try{return JSON.stringify(e)??String(e)}catch{return String(e)}}function G(e){let t={};for(let n of V){let r=e[n];r!==void 0&&H(r)&&(t[n]=r)}if(!n(t.retryAfter)){let n=U(e);n!==void 0&&(t.retryAfter=n)}return t}function K(e,t=6){if(B(e))return e;let n=e=>t>0&&e!==void 0?K(e,t-1):void 0;if(e instanceof Error)return{wireError:!0,name:e.name,message:e.message,stack:e.stack,props:G(e),cause:n(e.cause)};if(typeof e==`object`&&e){let{message:t,cause:r}=e;return{wireError:!0,name:`Error`,message:typeof t==`string`?t:W(e),stack:void 0,props:G(e),cause:n(r)}}return{wireError:!0,name:`Error`,message:typeof e==`string`?e:W(e),stack:void 0,props:{},cause:void 0}}function q(e){let t=Error(e.message,e.cause?{cause:q(e.cause)}:{});return t.name=e.name,e.stack!==void 0&&(t.stack=e.stack),Object.assign(t,e.props),t}function se(){return new Worker(new URL(`./encrypt.worker.js`,import.meta.url),{type:`module`,name:`zama-fhe-encrypt`})}const J={spawn:1e4,init:3e5},Y=new WeakSet;var X=class extends Error{crashed;constructor(e,t){super(e,t),this.name=`WorkerUnavailableError`,this.crashed=t?.crashed??!1}};function ce(e){if(typeof e!=`object`||!e)return!1;let{name:t,message:n}=e;return t===`DataCloneError`||t===`TypeError`&&typeof n==`string`&&n.includes(`Unserializable return value`)}function Z(e){if(e?.aborted)throw e.reason??new DOMException(`The operation was aborted.`,`AbortError`)}const Q={count:0,last:void 0,warnedFor:-1};function le(e){if(e===void 0)return{key:e,transfers:[]};let t=e.publicKeyBytes.bytes,n=e.crsBytes.bytes;if(!(t instanceof Uint8Array)||!(n instanceof Uint8Array))return{key:e,transfers:[]};let r=t.slice(),i=n.slice();return{key:{...e,publicKeyBytes:{...e.publicKeyBytes,bytes:r},crsBytes:{...e.crsBytes,bytes:i}},transfers:[r.buffer,i.buffer]}}function ue(){let e,t=new Promise((t,n)=>{e=n});return t.catch(()=>{}),{initPromise:void 0,worker:void 0,api:void 0,doomed:t,doom:e}}var de=class{#e;#t;#n=!1;#r=Q;#i=0;#a=new Map;#o;#s=0;#c=!1;constructor(e){this.#e=e}init=()=>{let e=this.#t??=ue();if(e.initPromise===void 0){let t=this.#f(()=>this.#u(e)).catch(n=>{throw e.initPromise===t&&(e.initPromise=void 0),n});e.initPromise=t}return e.initPromise};encryptValue=e=>this.#f(()=>this.#l(t=>t.encryptValue(e),(t,n,r)=>t.encryptValue(n,{...e,options:r}),e.options));encryptValues=e=>this.#f(()=>this.#l(t=>t.encryptValues(e),(t,n,r)=>t.encryptValues(n,{...e,options:r}),e.options));dispose(){this.#c=!0,this.#p()}async#l(e,t,n){let{signal:r,onProgress:i,...a}=n??{};Z(r),await this.init(),Z(r);let o=this.#t,s=o?.api;if(this.#o!==void 0&&(this.#n||s===void 0))return e(await this.#o);if(o===void 0||s===void 0)return e(await this.#b(o,this.#r.last??new X(`Encrypt worker not running.`)));let c=this.#i++,l=()=>void s.abort(c).catch(()=>{});r?.addEventListener(`abort`,l,{once:!0}),i&&this.#a.set(c,i);try{let e=await this.#v(o,t(s,c,a));return this.#r=Q,e}catch(t){if(t instanceof X)return e(await this.#b(o,t));throw t}finally{this.#a.delete(c),r?.removeEventListener(`abort`,l)}}async#u(e){if(this.#n)return;let t=this.#e.blockedReason;if(t!==void 0){await this.#b(e,new X(t));return}let n=await this.#e.prefetchKey();try{let t=await this.#h(e),r=this.#e.network,i=typeof r==`string`?null:F(async e=>{try{return await r.request(e)}catch(e){throw K(e)}}),a=F((e,t)=>{try{this.#e.logger[e](t)}catch(e){this.#d(`logger`,e)}}),o=F((e,t)=>{try{this.#a.get(e)?.(t)}catch(e){this.#d(`onProgress`,e)}}),s=le(n);await this.#v(e,t.init(P({...this.#e.initPayload,clientOptions:{...this.#e.initPayload.clientOptions,fheEncryptionKey:s.key},rpcUrl:typeof r==`string`?r:void 0},s.transfers),i,a,o),{ms:this.#e.timeouts.init,operation:`init`}),e.api=t,this.#r={...this.#r,last:void 0}}catch(t){if(!(t instanceof X))throw this.#y(e,new X(`Encrypt worker init failed.`)),t;await this.#b(e,t)}}#d(e,t){let n=t instanceof Error?t.message:String(t);try{this.#e.logger.warn(`Encrypt offload ${e} callback threw: ${n}`)}catch{}}async#f(e){this.#s++;try{return await e()}finally{this.#s--,this.#p()}}#p(){!this.#c||this.#s>0||(this.#c=!1,this.#t?.worker?.terminate(),this.#t=void 0,this.#o=void 0,this.#n=!1,this.#r=Q)}#m(){let e=this.#e.workerSource;if(e===void 0)return se();if(typeof e==`function`){let t=e();return Y.has(t)&&this.#e.logger.warnAlways(`The offloadWorker factory returned a worker it already handed out; each call must construct a fresh Worker.`),Y.add(t),t}return new Worker(e,{type:`module`,name:`zama-fhe-encrypt`})}async#h(e){let t;try{t=this.#m()}catch(e){throw new X(e instanceof Error?e.message:String(e),{cause:e})}e.worker=t;let n=await this.#g(e,t);return this.#_(e,t),n}#g(e,t){return new Promise((n,r)=>{let i=()=>{clearTimeout(a),t.removeEventListener(`message`,o),t.removeEventListener(`error`,s)},a=setTimeout(()=>{i(),r(new X(`Encrypt worker did not start within ${this.#e.timeouts.spawn}ms.`))},this.#e.timeouts.spawn),o=e=>{e.data===`zama-encrypt-worker-ready`&&(i(),n(w(t)))},s=t=>{i();let n=t.message||`Encrypt worker error.`;r(new X(n)),this.#y(e,new X(n))};t.addEventListener(`message`,o),t.addEventListener(`error`,s)})}#_(e,t){t.addEventListener(`error`,t=>{if(this.#t!==e)return;let n=new X(t.message||`Encrypt worker error.`,{crashed:!0});this.#r={...this.#r,count:this.#r.count+1,last:n},this.#y(e,n)})}async#v(e,t,n){let r=n===void 0?void 0:setTimeout(()=>{this.#y(e,new X(`Encrypt worker ${n.operation} timed out after ${n.ms}ms.`))},n.ms);try{return await Promise.race([t.catch(e=>{let t=B(e)?q(e):e;throw ce(t)?new X(t.message,{cause:t}):t}),e.doomed])}finally{r!==void 0&&clearTimeout(r)}}#y(e,t){e!==void 0&&(this.#t===e&&(this.#t=void 0),e.worker?.terminate(),e.worker=void 0,e.api=void 0,e.initPromise=void 0,e.doom(t))}async#b(e,t){let n=t instanceof Error?t.message:String(t);if(this.#e.strict)throw this.#y(e,new X(`Encrypt worker unavailable.`)),new r(`Encrypt offload required (offloadEncrypt: true) but unavailable: ${n}`,{cause:t});let{transient:i,pinning:a}=this.#x(t);if(this.#n||=!i,this.#y(e,new X(`Encrypt worker degraded to inline.`)),this.#S(n,i,a),this.#o===void 0){let e=(async()=>{let e=this.#e.createInlineClient();return await e.init(),e})().catch(t=>{throw this.#o===e&&(this.#o=void 0),this.#e.logger.warnAlways(`Encrypt inline fallback failed to initialize: ${t instanceof Error?t.message:String(t)}`),t});this.#o=e}return this.#o}#x(e){let t=e instanceof X&&e.crashed&&this.#r.count<2;return{transient:t,pinning:!t&&!this.#n}}#S(e,t,n){if(!n&&this.#r.warnedFor===this.#r.count)return;this.#r={...this.#r,warnedFor:this.#r.count};let r=t?`in-flight encryption falls back`:`encryption falls back`;this.#e.logger.warnAlways(`Encrypt offload unavailable, ${r} to the calling thread: ${e}`)}},fe=class{#e;#t;#n;#r;#i;#a;#o;constructor(e){this.#e=e.chain;let{timeout:t,debug:n,batchRpcCalls:r,moduleVersions:i,fheEncryptionKey:a}=e.options??{},o=this.#e.auth?$(this.#e.auth):void 0,u={publicClient:s({transport:typeof this.#e.network==`string`?l(this.#e.network):c(this.#e.network)}),chain:m(this.#e),options:{batchRpcCalls:r,moduleVersions:i,fheEncryptionKey:a}};this.#i={...o!==void 0&&{auth:o},...t!==void 0&&{timeout:t},...n!==void 0&&{debug:n}},this.#a=e.telemetry;let f=()=>this.#t.fetchFheEncryptionKeyBytes({options:this.#c(void 0)}),h=e=>({init:async()=>{await f(),await e.init()},encryptValue:t=>e.encryptValue(t),encryptValues:t=>e.encryptValues(t),fetchFheEncryptionKeyBytes:t=>e.fetchFheEncryptionKeyBytes(t)});e.cleartext?(this.#t=ne(u),this.#n=re(u),this.#r=h(p(u))):(this.#t=ee(u),this.#n=te(u),this.#r=this.#s(e,u,{prefetchKey:f,createInlineClient:()=>h(d(u))}))}#s(e,t,n){let r=e.offloadEncrypt??!1,i=r===!0,o=typeof Worker==`function`&&(e.offloadWorker!==void 0||!0);if(r===!1||!(i||o))return n.createInlineClient();let s=a(),c=me(s);if(c!==void 0&&!i)return e.logger.warnAlways(`Encryption runs on the calling thread: ${c}.`),n.createInlineClient();let l=new de({initPayload:{chain:t.chain,clientOptions:t.options,runtime:s??{}},network:this.#e.network,prefetchKey:n.prefetchKey,createInlineClient:n.createInlineClient,logger:e.logger,timeouts:e.offloadTimeouts??J,workerSource:e.offloadWorker,blockedReason:c,strict:i});return{init:()=>l.init(),encryptValue:e=>l.encryptValue(e),encryptValues:e=>l.encryptValues(e),fetchFheEncryptionKeyBytes:e=>this.#t.fetchFheEncryptionKeyBytes(e),dispose:()=>l.dispose()}}get chain(){return this.#e}#c(e){let{operation:t,...n}={...this.#i,...e};return this.#a===void 0?n:{...n,headers:{...n.headers,...o(this.#a,t)}}}#l=()=>(this.#o??=this.#r.init().catch(e=>{throw this.#o=void 0,e}),this.#o);dispose=()=>{this.#o=void 0,this.#r.dispose?.()};decryptPublicValue=async e=>(await this.#t.init(),this.#t.decryptPublicValue({...e,options:this.#c(e.options)}));decryptPublicValues=async e=>(await this.#t.init(),this.#t.decryptPublicValues({...e,options:this.#c(e.options)}));decryptPublicValuesWithSignatures=async e=>(await this.#t.init(),this.#t.decryptPublicValuesWithSignatures({...e,options:this.#c(e.options)}));encryptValue=async e=>(await this.#l(),this.#r.encryptValue({...e,options:this.#c(e.options)}));encryptValues=async e=>(await this.#l(),this.#r.encryptValues({...e,options:this.#c(e.options)}));decryptValue=async e=>(await this.#n.init(),this.#n.decryptValue({...e,options:this.#c(e.options)}));decryptValues=async e=>(await this.#n.init(),this.#n.decryptValues({...e,options:this.#c(e.options)}));decryptValuesFromPairs=async e=>(await this.#n.init(),this.#n.decryptValuesFromPairs({...e,options:this.#c(e.options)}));fetchFheEncryptionKeyBytes=async e=>(await this.#t.init(),this.#t.fetchFheEncryptionKeyBytes({...e,options:this.#c(e?.options)}));signDecryptionPermit=async e=>(await this.#t.init(),this.#t.signDecryptionPermit(e));createUnsignedLegacyDecryptionPermitEip712=e=>u(this.#t,e);serializeTransportKeyPair=e=>this.#n.serializeTransportKeyPair(e);serializeSignedDecryptionPermit=e=>this.#t.serializeSignedDecryptionPermit(e);parseTransportKeyPair=async e=>(await this.#n.init(),this.#n.parseTransportKeyPair(e));parseSignedDecryptionPermit=async e=>{await this.#t.init();let{serializedPermit:t}=e;return this.#t.parseSignedDecryptionPermit({...e,serializedPermit:{...t,signature:pe(t.signature)}})};generateTransportKeyPair=async()=>(await this.#n.init(),this.#n.generateTransportKeyPair())};function pe(e){if(e.length!==132)return e;let t=parseInt(e.slice(130),16);return t!==0&&t!==1?e:`${e.slice(0,130)}${t===0?`1b`:`1c`}`}function me(e){if(i())return`a runtime locateFile cannot cross the encrypt worker boundary`;if(e===void 0&&f())return`a runtime config set outside createConfig cannot be replicated in the encrypt worker realm`}function $(t){let n=t.__type;switch(n){case`ApiKeyHeader`:return{type:n,value:t.value,header:t.header};case`ApiKeyCookie`:return{type:n,value:t.value,cookie:t.cookie};case`BearerToken`:return{type:n,token:t.token};default:throw new e(`Unknown auth type: ${String(n)}`)}}export{$ as n,J as r,fe as t};
|
|
8
|
+
//# sourceMappingURL=fhevm-relayer-CGvejcdJ.js.map
|