@zama-fhe/sdk 2.3.0-alpha.4 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/activity.cjs +1 -1
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/query/index.cjs.map +1 -1
- package/dist/cjs/relayer.cjs +1 -1
- package/dist/cjs/relayer.cjs.map +1 -1
- package/dist/esm/{activity-CitpHeLO.d.ts → activity-DTBvolDB.d.ts} +195 -15
- package/dist/esm/{activity-CNU7ZLpc.js → activity-b2RsqKHW.js} +2 -2
- package/dist/esm/{activity-CNU7ZLpc.js.map → activity-b2RsqKHW.js.map} +1 -1
- package/dist/esm/cleartext/index.d.ts +2 -2
- package/dist/esm/cleartext/index.js +1 -1
- package/dist/esm/{cleartext-BO5OIem2.js → cleartext-Bzxet3H7.js} +2 -2
- package/dist/esm/{cleartext-BO5OIem2.js.map → cleartext-Bzxet3H7.js.map} +1 -1
- package/dist/esm/{encryption-UaXE1L_W.js → encryption-CmIPBcfP.js} +2 -2
- package/dist/esm/{encryption-UaXE1L_W.js.map → encryption-CmIPBcfP.js.map} +1 -1
- package/dist/esm/ethers/index.d.ts +2 -2
- package/dist/esm/{index-C3ELlhM8.d.ts → index-BXdXzzx4.d.ts} +2 -2
- package/dist/esm/index.d.ts +5 -128
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/node/index.d.ts +2 -2
- package/dist/esm/node/index.js +1 -1
- package/dist/esm/query/index.d.ts +10 -18
- package/dist/esm/query/index.js +1 -1
- package/dist/esm/query/index.js.map +1 -1
- package/dist/esm/relayer-C6u3eOlN.js +2 -0
- package/dist/esm/relayer-C6u3eOlN.js.map +1 -0
- package/dist/esm/{relayer-sdk-Cqx3HnZh.d.ts → relayer-sdk-C_4bkxxH.d.ts} +2 -2
- package/dist/esm/{relayer-sdk.types-BhV3n5qO.d.ts → relayer-sdk.types-C9GAgQ7q.d.ts} +23 -2
- package/dist/esm/viem/index.d.ts +2 -2
- package/package.json +1 -1
- package/dist/esm/relayer-DfjPWTBf.js +0 -2
- package/dist/esm/relayer-DfjPWTBf.js.map +0 -1
|
@@ -376,6 +376,27 @@ interface TransferCallbacks {
|
|
|
376
376
|
onTransferSubmitted?: (txHash: Hex) => void;
|
|
377
377
|
}
|
|
378
378
|
//#endregion
|
|
379
|
+
//#region src/types/options.d.ts
|
|
380
|
+
/** Options for {@link ConfidentialToken.confidentialTransfer}. */
|
|
381
|
+
interface TransferOptions extends TransferCallbacks {
|
|
382
|
+
/** Skip confidential balance validation (e.g. for smart wallets). Default: `false`. */
|
|
383
|
+
skipBalanceCheck?: boolean;
|
|
384
|
+
}
|
|
385
|
+
/** Options for {@link Token.shield}. */
|
|
386
|
+
interface ShieldOptions extends ShieldCallbacks {
|
|
387
|
+
/** ERC-20 approval strategy: `"exact"` approves only `amount`, `"max"` approves unlimited, `"skip"` assumes pre-existing approval. Default: `"exact"`. */
|
|
388
|
+
approvalStrategy?: "max" | "exact" | "skip";
|
|
389
|
+
/** Extra ETH to send for native wrappers. */
|
|
390
|
+
fees?: bigint;
|
|
391
|
+
/** Recipient address for the shielded tokens. Defaults to the connected wallet. */
|
|
392
|
+
to?: Address;
|
|
393
|
+
}
|
|
394
|
+
/** Options for {@link ConfidentialToken.unshield}. */
|
|
395
|
+
interface UnshieldOptions extends UnshieldCallbacks {
|
|
396
|
+
/** Skip confidential balance validation (e.g. for smart wallets). Default: `false`. */
|
|
397
|
+
skipBalanceCheck?: boolean;
|
|
398
|
+
}
|
|
399
|
+
//#endregion
|
|
379
400
|
//#region src/relayer/relayer-sdk.types.d.ts
|
|
380
401
|
/** Network configuration for the Relayer SDK */
|
|
381
402
|
type NetworkType = "hardhat" | "sepolia" | "mainnet";
|
|
@@ -505,5 +526,5 @@ interface DelegatedUserDecryptParams {
|
|
|
505
526
|
/** SDK status */
|
|
506
527
|
type RelayerSDKStatus = "idle" | "initializing" | "ready" | "error";
|
|
507
528
|
//#endregion
|
|
508
|
-
export {
|
|
509
|
-
//# sourceMappingURL=relayer-sdk.types-
|
|
529
|
+
export { GetPublicKeyRequest as $, ReadContractConfig as A, CreateEIP712Payload as B, GenericSigner as C, TransactionResult as D, TransactionReceipt as E, WriteFunctionName as F, DelegatedUserDecryptResponseData as G, CreateEIP712ResponseData as H, BaseRequest as I, EncryptResponseData as J, EncryptPayload as K, CreateDelegatedEIP712Payload as L, ReadFunctionName as M, WriteContractArgs as N, ContractAbi as O, WriteContractConfig as P, GenericLogger as Q, CreateDelegatedEIP712Request as R, GenericStorage as S, RawLog as T, DelegatedUserDecryptPayload as U, CreateEIP712Request as V, DelegatedUserDecryptRequest as W, GenerateKeypairRequest as X, ErrorResponse as Y, GenerateKeypairResponseData as Z, ShieldCallbacks as _, EncryptParams as a, PublicDecryptRequest as at, DelegatedStoredCredentials as b, NetworkType as c, RequestZKProofVerificationResponseData as ct, RelayerWebConfig as d, UserDecryptPayload as dt, GetPublicKeyResponseData as et, RelayerWebSecurityConfig as f, UserDecryptRequest as ft, UnshieldOptions as g, WorkerResponse as gt, TransferOptions as h, WorkerRequestType as ht, EncryptInput as i, NodeInitRequest as it, ReadContractReturnType as j, ReadContractArgs as k, PublicDecryptResult as l, SuccessResponse as lt, ShieldOptions as m, WorkerRequest as mt, DelegatedUserDecryptParams as n, GetPublicParamsResponseData as nt, EncryptResult as o, PublicDecryptResponseData as ot, UserDecryptParams as p, UserDecryptResponseData as pt, EncryptRequest as q, EIP712TypedData as r, InitRequest as rt, Handle as s, RequestZKProofVerificationRequest as st, ClearValueType as t, GetPublicParamsRequest as tt, RelayerSDKStatus as u, UpdateCsrfRequest as ut, TransferCallbacks as v, SignerLifecycleCallbacks as w, StoredCredentials as x, UnshieldCallbacks as y, CreateDelegatedEIP712ResponseData as z };
|
|
530
|
+
//# sourceMappingURL=relayer-sdk.types-C9GAgQ7q.d.ts.map
|
package/dist/esm/viem/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as BatchTransferData } from "../index-
|
|
1
|
+
import { A as ReadContractConfig, C as GenericSigner, E as TransactionReceipt, P as WriteContractConfig, r as EIP712TypedData, s as Handle, w as SignerLifecycleCallbacks } from "../relayer-sdk.types-C9GAgQ7q.js";
|
|
2
|
+
import { h as BatchTransferData } from "../index-BXdXzzx4.js";
|
|
3
3
|
import { Abi, Address, ContractFunctionArgs, ContractFunctionName, ContractFunctionReturnType, EIP1193Provider, Hex, PublicClient, WalletClient } from "viem";
|
|
4
4
|
|
|
5
5
|
//#region src/viem/viem-signer.d.ts
|
package/package.json
CHANGED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const e={SigningRejected:`SIGNING_REJECTED`,SigningFailed:`SIGNING_FAILED`,EncryptionFailed:`ENCRYPTION_FAILED`,DecryptionFailed:`DECRYPTION_FAILED`,ApprovalFailed:`APPROVAL_FAILED`,TransactionReverted:`TRANSACTION_REVERTED`,KeypairExpired:`KEYPAIR_EXPIRED`,InvalidKeypair:`INVALID_KEYPAIR`,NoCiphertext:`NO_CIPHERTEXT`,RelayerRequestFailed:`RELAYER_REQUEST_FAILED`,Configuration:`CONFIGURATION`,DelegationSelfNotAllowed:`DELEGATION_SELF_NOT_ALLOWED`,DelegationCooldown:`DELEGATION_COOLDOWN`,DelegationNotFound:`DELEGATION_NOT_FOUND`,DelegationExpired:`DELEGATION_EXPIRED`,DelegationExpiryUnchanged:`DELEGATION_EXPIRY_UNCHANGED`,DelegationDelegateEqualsContract:`DELEGATION_DELEGATE_EQUALS_CONTRACT`,DelegationContractIsSelf:`DELEGATION_CONTRACT_IS_SELF`,AclPaused:`ACL_PAUSED`,DelegationExpirationTooSoon:`DELEGATION_EXPIRATION_TOO_SOON`,DelegationNotPropagated:`DELEGATION_NOT_PROPAGATED`};var t=class extends Error{code;constructor(e,t,n){super(t,n),Object.setPrototypeOf(this,new.target.prototype),this.name=`ZamaError`,this.code=e}};function n(e,n){if(e instanceof t){let t=n[e.code];if(t)return t(e)}return n._?.(e)}var r=class extends t{statusCode;constructor(t,n,r){super(e.RelayerRequestFailed,t,r),this.name=`RelayerRequestFailedError`,this.statusCode=n}},i=class extends t{constructor(t,n){super(e.Configuration,t,n),this.name=`ConfigurationError`}};export{n as a,e as i,r as n,t as r,i as t};
|
|
2
|
-
//# sourceMappingURL=relayer-DfjPWTBf.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"relayer-DfjPWTBf.js","names":[],"sources":["../../src/errors/base.ts","../../src/errors/relayer.ts"],"sourcesContent":["/**\n * Typed error codes thrown by the SDK.\n * Use `error.code` or `instanceof` to programmatically handle specific failure modes.\n *\n * @example\n * ```ts\n * try {\n * await token.confidentialTransfer(\"0xTo\", 100n);\n * } catch (e) {\n * if (e instanceof SigningRejectedError) {\n * // User rejected the wallet signature\n * }\n * }\n * ```\n */\nexport const ZamaErrorCode = {\n /** User rejected the wallet signature prompt. */\n SigningRejected: \"SIGNING_REJECTED\",\n /** Wallet signature failed for a reason other than rejection. */\n SigningFailed: \"SIGNING_FAILED\",\n /** FHE encryption failed. */\n EncryptionFailed: \"ENCRYPTION_FAILED\",\n /** FHE decryption failed. */\n DecryptionFailed: \"DECRYPTION_FAILED\",\n /** ERC-20 approval transaction failed. */\n ApprovalFailed: \"APPROVAL_FAILED\",\n /** On-chain transaction reverted. */\n TransactionReverted: \"TRANSACTION_REVERTED\",\n /** FHE keypair has expired and needs regeneration. */\n KeypairExpired: \"KEYPAIR_EXPIRED\",\n /** Relayer rejected FHE keypair (stale, expired, or malformed). */\n InvalidKeypair: \"INVALID_KEYPAIR\",\n /** No FHE ciphertext exists for this account (never shielded). */\n NoCiphertext: \"NO_CIPHERTEXT\",\n /** Relayer HTTP request failed. */\n RelayerRequestFailed: \"RELAYER_REQUEST_FAILED\",\n /** SDK configuration is invalid (e.g. forbidden chain ID, unsupported type). */\n Configuration: \"CONFIGURATION\",\n /** Delegation cannot target self (delegate === msg.sender). */\n DelegationSelfNotAllowed: \"DELEGATION_SELF_NOT_ALLOWED\",\n /** Only one delegate/revoke per (delegator, delegate, contract) per block. */\n DelegationCooldown: \"DELEGATION_COOLDOWN\",\n /** No active delegation found for this (delegator, delegate, contract) tuple. */\n DelegationNotFound: \"DELEGATION_NOT_FOUND\",\n /** The delegation has expired. */\n DelegationExpired: \"DELEGATION_EXPIRED\",\n /** The new expiration date equals the current one — no on-chain change needed. */\n DelegationExpiryUnchanged: \"DELEGATION_EXPIRY_UNCHANGED\",\n /** Delegate address cannot be the contract address. */\n DelegationDelegateEqualsContract: \"DELEGATION_DELEGATE_EQUALS_CONTRACT\",\n /** Contract address cannot be the sender address. */\n DelegationContractIsSelf: \"DELEGATION_CONTRACT_IS_SELF\",\n /** The ACL contract is paused. */\n AclPaused: \"ACL_PAUSED\",\n /** Expiration date is too soon (must be at least 1 hour in the future). */\n DelegationExpirationTooSoon: \"DELEGATION_EXPIRATION_TOO_SOON\",\n /** Delegation exists on-chain but hasn't propagated to the gateway yet. */\n DelegationNotPropagated: \"DELEGATION_NOT_PROPAGATED\",\n} as const;\n\n/** Union of all {@link ZamaErrorCode} string values. */\nexport type ZamaErrorCode = (typeof ZamaErrorCode)[keyof typeof ZamaErrorCode];\n\n/**\n * Base error thrown by all SDK operations.\n * Carries a {@link ZamaErrorCode} for programmatic error handling.\n * Prefer catching specific subclasses (e.g. {@link EncryptionFailedError}).\n */\nexport class ZamaError extends Error {\n /** Machine-readable error code. */\n readonly code: ZamaErrorCode;\n\n constructor(code: ZamaErrorCode, message: string, options?: ErrorOptions) {\n super(message, options);\n Object.setPrototypeOf(this, new.target.prototype);\n this.name = \"ZamaError\";\n this.code = code;\n }\n}\n\n/**\n * Pattern-match on a {@link ZamaError} by its error code.\n * Falls through to the `_` wildcard handler if no specific handler matches.\n * Returns `undefined` if the error is not a `ZamaError` and no `_` handler is provided.\n *\n * @example\n * ```ts\n * matchZamaError(error, {\n * SIGNING_REJECTED: () => toast(\"Please approve in wallet\"),\n * TRANSACTION_REVERTED: (e) => toast(`Tx failed: ${e.message}`),\n * _: () => toast(\"Unknown error\"),\n * });\n * ```\n */\nexport function matchZamaError<R>(\n error: unknown,\n handlers: Partial<Record<ZamaErrorCode, (error: ZamaError) => R>> & {\n _?: (error: unknown) => R;\n },\n): R | undefined {\n if (error instanceof ZamaError) {\n const handler = handlers[error.code];\n if (handler) {\n return handler(error);\n }\n }\n return handlers._?.(error);\n}\n","import { ZamaError, ZamaErrorCode } from \"./base\";\n\n/** Relayer HTTP request failed. */\nexport class RelayerRequestFailedError extends ZamaError {\n /** HTTP status code from the relayer, if available. */\n readonly statusCode: number | undefined;\n\n constructor(message: string, statusCode?: number, options?: ErrorOptions) {\n super(ZamaErrorCode.RelayerRequestFailed, message, options);\n this.name = \"RelayerRequestFailedError\";\n this.statusCode = statusCode;\n }\n}\n\n/** SDK configuration is invalid (e.g. forbidden chain ID, unsupported type). */\nexport class ConfigurationError extends ZamaError {\n constructor(message: string, options?: ErrorOptions) {\n super(ZamaErrorCode.Configuration, message, options);\n this.name = \"ConfigurationError\";\n }\n}\n"],"mappings":"AAeA,MAAa,EAAgB,CAE3B,gBAAiB,mBAEjB,cAAe,iBAEf,iBAAkB,oBAElB,iBAAkB,oBAElB,eAAgB,kBAEhB,oBAAqB,uBAErB,eAAgB,kBAEhB,eAAgB,kBAEhB,aAAc,gBAEd,qBAAsB,yBAEtB,cAAe,gBAEf,yBAA0B,8BAE1B,mBAAoB,sBAEpB,mBAAoB,uBAEpB,kBAAmB,qBAEnB,0BAA2B,8BAE3B,iCAAkC,sCAElC,yBAA0B,8BAE1B,UAAW,aAEX,4BAA6B,iCAE7B,wBAAyB,4BAC1B,CAUD,IAAa,EAAb,cAA+B,KAAM,CAEnC,KAEA,YAAY,EAAqB,EAAiB,EAAwB,CACxE,MAAM,EAAS,EAAQ,CACvB,OAAO,eAAe,KAAM,IAAI,OAAO,UAAU,CACjD,KAAK,KAAO,YACZ,KAAK,KAAO,IAkBhB,SAAgB,EACd,EACA,EAGe,CACf,GAAI,aAAiB,EAAW,CAC9B,IAAM,EAAU,EAAS,EAAM,MAC/B,GAAI,EACF,OAAO,EAAQ,EAAM,CAGzB,OAAO,EAAS,IAAI,EAAM,CCvG5B,IAAa,EAAb,cAA+C,CAAU,CAEvD,WAEA,YAAY,EAAiB,EAAqB,EAAwB,CACxE,MAAM,EAAc,qBAAsB,EAAS,EAAQ,CAC3D,KAAK,KAAO,4BACZ,KAAK,WAAa,IAKT,EAAb,cAAwC,CAAU,CAChD,YAAY,EAAiB,EAAwB,CACnD,MAAM,EAAc,cAAe,EAAS,EAAQ,CACpD,KAAK,KAAO"}
|