@zama-fhe/sdk 1.0.0-alpha.10

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.
Files changed (38) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +801 -0
  3. package/dist/chunk-5QJTGZHY.js +101 -0
  4. package/dist/chunk-5QJTGZHY.js.map +1 -0
  5. package/dist/chunk-6JRD26PS.js +114 -0
  6. package/dist/chunk-6JRD26PS.js.map +1 -0
  7. package/dist/chunk-PHE3BSIB.js +5143 -0
  8. package/dist/chunk-PHE3BSIB.js.map +1 -0
  9. package/dist/chunk-UF47M3QR.js +32 -0
  10. package/dist/chunk-UF47M3QR.js.map +1 -0
  11. package/dist/chunk-WYWAO3QE.js +182 -0
  12. package/dist/chunk-WYWAO3QE.js.map +1 -0
  13. package/dist/cleartext/index.d.ts +45 -0
  14. package/dist/cleartext/index.js +522 -0
  15. package/dist/cleartext/index.js.map +1 -0
  16. package/dist/ethers/index.d.ts +86 -0
  17. package/dist/ethers/index.js +148 -0
  18. package/dist/ethers/index.js.map +1 -0
  19. package/dist/index.d.ts +33405 -0
  20. package/dist/index.js +3563 -0
  21. package/dist/index.js.map +1 -0
  22. package/dist/node/index.d.ts +195 -0
  23. package/dist/node/index.js +337 -0
  24. package/dist/node/index.js.map +1 -0
  25. package/dist/relayer-sdk-Dh9aQmBm.d.ts +39 -0
  26. package/dist/relayer-sdk.node-worker.d.ts +2 -0
  27. package/dist/relayer-sdk.node-worker.js +348 -0
  28. package/dist/relayer-sdk.node-worker.js.map +1 -0
  29. package/dist/relayer-sdk.types-CgHZ6qZn.d.ts +327 -0
  30. package/dist/relayer-sdk.worker.js +511 -0
  31. package/dist/relayer-sdk.worker.js.map +1 -0
  32. package/dist/relayer-utils-phBmWrNB.d.ts +10 -0
  33. package/dist/token.types-CUTkehsp.d.ts +299 -0
  34. package/dist/transfer-batcher-CNtrNMz6.d.ts +197 -0
  35. package/dist/viem/index.d.ts +58 -0
  36. package/dist/viem/index.js +143 -0
  37. package/dist/viem/index.js.map +1 -0
  38. package/package.json +90 -0
@@ -0,0 +1,299 @@
1
+ import { Address } from '@zama-fhe/relayer-sdk/bundle';
2
+ import { E as EIP712TypedData, H as Hex } from './relayer-sdk.types-CgHZ6qZn.js';
3
+
4
+ /**
5
+ * Framework-agnostic event decoders for confidential token contracts.
6
+ * No viem/ethers dependency — works with raw log data from any provider.
7
+ */
8
+
9
+ /** Framework-agnostic log shape compatible with any Ethereum provider. */
10
+ interface RawLog {
11
+ /** Indexed event topics (topic[0] is the event signature hash). */
12
+ readonly topics: readonly string[];
13
+ /** ABI-encoded non-indexed event data. */
14
+ readonly data: string;
15
+ }
16
+ /**
17
+ * Event topic0 constants (keccak256 of the canonical Solidity signature).
18
+ * Pass to `getLogs({ topics: [Object.values(Topics)] })` to fetch all events.
19
+ */
20
+ declare const Topics: {
21
+ /** `ConfidentialTransfer(address indexed from, address indexed to, bytes32 indexed amount)` */
22
+ readonly ConfidentialTransfer: "0x67500e8d0ed826d2194f514dd0d8124f35648ab6e3fb5e6ed867134cffe661e9";
23
+ /** `Wrapped(uint64 mintAmount, uint256 amountIn, uint256 feeAmount, address indexed to_, uint256 indexed mintTxId)` */
24
+ readonly Wrapped: "0x1f7907f4d84043abe0fb7c74e8865ee5fe93fe4f691c54a7b8fa9d6fb17c7cba";
25
+ /** `UnwrapRequested(address indexed receiver, bytes32 amount)` */
26
+ readonly UnwrapRequested: "0x77d02d353c5629272875d11f1b34ec4c65d7430b075575b78cd2502034c469ee";
27
+ /** `UnwrappedFinalized(bytes32 indexed burntAmountHandle, ...)` */
28
+ readonly UnwrappedFinalized: "0xc64e7c81b18b674fc5b037d8a0041bfe3332d86c780a4688f404ee01fbabb152";
29
+ /** `UnwrappedStarted(bool returnVal, uint256 indexed requestId, ...)` */
30
+ readonly UnwrappedStarted: "0x3838891d4843c6d7f9f494570b6fd8843f4e3c3ddb817c1411760bd31b819806";
31
+ };
32
+ /** Decoded `ConfidentialTransfer` event — an encrypted token transfer. */
33
+ interface ConfidentialTransferEvent {
34
+ readonly eventName: "ConfidentialTransfer";
35
+ /** Sender address. */
36
+ readonly from: string;
37
+ /** Receiver address. */
38
+ readonly to: string;
39
+ /** FHE ciphertext handle for the transferred amount. */
40
+ readonly encryptedAmountHandle: string;
41
+ }
42
+ /** Decoded `Wrapped` event — an ERC-20 shield (wrap) operation. */
43
+ interface WrappedEvent {
44
+ readonly eventName: "Wrapped";
45
+ /** Confidential tokens minted. */
46
+ readonly mintAmount: bigint;
47
+ /** Underlying ERC-20 tokens deposited. */
48
+ readonly amountIn: bigint;
49
+ /** Fee deducted during wrapping. */
50
+ readonly feeAmount: bigint;
51
+ /** Receiver of the minted confidential tokens. */
52
+ readonly to: string;
53
+ /** On-chain mint transaction ID. */
54
+ readonly mintTxId: bigint;
55
+ }
56
+ /** Decoded `UnwrapRequested` event — an unshield request submitted. */
57
+ interface UnwrapRequestedEvent {
58
+ readonly eventName: "UnwrapRequested";
59
+ /** Address that will receive the unwrapped ERC-20 tokens. */
60
+ readonly receiver: string;
61
+ /** FHE ciphertext handle for the requested unshield amount. */
62
+ readonly encryptedAmount: Address;
63
+ }
64
+ /** Decoded `UnwrappedFinalized` event — an unshield completed on-chain. */
65
+ interface UnwrappedFinalizedEvent {
66
+ readonly eventName: "UnwrappedFinalized";
67
+ /** FHE handle of the burnt confidential balance. */
68
+ readonly burntAmountHandle: string;
69
+ /** Whether the finalization succeeded. */
70
+ readonly finalizeSuccess: boolean;
71
+ /** Whether the fee transfer succeeded. */
72
+ readonly feeTransferSuccess: boolean;
73
+ /** Amount of confidential tokens burnt. */
74
+ readonly burnAmount: bigint;
75
+ /** Amount of underlying ERC-20 tokens returned. */
76
+ readonly unwrapAmount: bigint;
77
+ /** Fee deducted during unwrapping. */
78
+ readonly feeAmount: bigint;
79
+ /** Next on-chain transaction ID. */
80
+ readonly nextTxId: bigint;
81
+ }
82
+ /** Decoded `UnwrappedStarted` event — the relayer began processing an unshield. */
83
+ interface UnwrappedStartedEvent {
84
+ readonly eventName: "UnwrappedStarted";
85
+ /** Whether the unwrap start succeeded. */
86
+ readonly returnVal: boolean;
87
+ /** On-chain request ID. */
88
+ readonly requestId: bigint;
89
+ /** On-chain transaction ID. */
90
+ readonly txId: bigint;
91
+ /** Receiver address. */
92
+ readonly to: string;
93
+ /** Refund address (if applicable). */
94
+ readonly refund: string;
95
+ /** FHE handle of the requested amount. */
96
+ readonly requestedAmount: string;
97
+ /** FHE handle of the burn amount. */
98
+ readonly burnAmount: string;
99
+ }
100
+ /** Union of all decoded confidential token event types. */
101
+ type OnChainEvent = ConfidentialTransferEvent | WrappedEvent | UnwrapRequestedEvent | UnwrappedFinalizedEvent | UnwrappedStartedEvent;
102
+ /**
103
+ * ConfidentialTransfer(address indexed from, address indexed to, bytes32 indexed amount)
104
+ * All 3 params indexed → topics[1..3], no data.
105
+ */
106
+ declare function decodeConfidentialTransfer(log: RawLog): ConfidentialTransferEvent | null;
107
+ /**
108
+ * Wrapped(uint64 mintAmount, uint256 amountIn, uint256 feeAmount, address indexed to_, uint256 indexed mintTxId)
109
+ * Indexed: to_ (topics[1]), mintTxId (topics[2])
110
+ * Data: mintAmount (uint64, abi-encoded as uint256), amountIn, feeAmount
111
+ */
112
+ declare function decodeWrapped(log: RawLog): WrappedEvent | null;
113
+ /**
114
+ * UnwrapRequested(address indexed receiver, bytes32 amount)
115
+ * Indexed: receiver (topics[1])
116
+ * Data: amount (bytes32)
117
+ */
118
+ declare function decodeUnwrapRequested(log: RawLog): UnwrapRequestedEvent | null;
119
+ /**
120
+ * UnwrappedFinalized(bytes32 indexed burntAmountHandle, bool finalizeSuccess, bool feeTransferSuccess,
121
+ * uint64 burnAmount, uint256 unwrapAmount, uint256 feeAmount, uint256 indexed nextTxId)
122
+ * Indexed: burntAmountHandle (topics[1]), nextTxId (topics[2])
123
+ * Data: finalizeSuccess, feeTransferSuccess, burnAmount, unwrapAmount, feeAmount
124
+ */
125
+ declare function decodeUnwrappedFinalized(log: RawLog): UnwrappedFinalizedEvent | null;
126
+ /**
127
+ * UnwrappedStarted(bool returnVal, uint256 indexed requestId, uint256 indexed txId, address indexed to,
128
+ * address refund, bytes32 requestedAmount, bytes32 burnAmount)
129
+ * Indexed: requestId (topics[1]), txId (topics[2]), to (topics[3])
130
+ * Data: returnVal, refund, requestedAmount, burnAmount
131
+ */
132
+ declare function decodeUnwrappedStarted(log: RawLog): UnwrappedStartedEvent | null;
133
+ /**
134
+ * Try all decoders on a single log and return the first match, or `null`.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * const event = decodeOnChainEvent(log);
139
+ * if (event?.eventName === "ConfidentialTransfer") {
140
+ * console.log(event.from, event.to);
141
+ * }
142
+ * ```
143
+ */
144
+ declare function decodeOnChainEvent(log: RawLog): OnChainEvent | null;
145
+ /**
146
+ * Batch-decode an array of logs, skipping unrecognized entries.
147
+ *
148
+ * @example
149
+ * ```ts
150
+ * const events = decodeOnChainEvents(receipt.logs);
151
+ * ```
152
+ */
153
+ declare function decodeOnChainEvents(logs: readonly RawLog[]): OnChainEvent[];
154
+ /**
155
+ * Find the first {@link UnwrapRequestedEvent} in a logs array.
156
+ *
157
+ * @example
158
+ * ```ts
159
+ * const event = findUnwrapRequested(receipt.logs);
160
+ * if (event) console.log(event.receiver, event.encryptedAmount);
161
+ * ```
162
+ */
163
+ declare function findUnwrapRequested(logs: readonly RawLog[]): UnwrapRequestedEvent | null;
164
+ /**
165
+ * Find the first {@link WrappedEvent} in a logs array.
166
+ *
167
+ * @example
168
+ * ```ts
169
+ * const event = findWrapped(receipt.logs);
170
+ * if (event) console.log(event.to, event.amountIn);
171
+ * ```
172
+ */
173
+ declare function findWrapped(logs: readonly RawLog[]): WrappedEvent | null;
174
+ /**
175
+ * All 5 confidential token event topic0 hashes.
176
+ * Pass to `getLogs({ topics: [TOKEN_TOPICS] })` to fetch
177
+ * all confidential token events in a single RPC call.
178
+ */
179
+ declare const TOKEN_TOPICS: readonly ["0x67500e8d0ed826d2194f514dd0d8124f35648ab6e3fb5e6ed867134cffe661e9", "0x1f7907f4d84043abe0fb7c74e8865ee5fe93fe4f691c54a7b8fa9d6fb17c7cba", "0x77d02d353c5629272875d11f1b34ec4c65d7430b075575b78cd2502034c469ee", "0xc64e7c81b18b674fc5b037d8a0041bfe3332d86c780a4688f404ee01fbabb152", "0x3838891d4843c6d7f9f494570b6fd8843f4e3c3ddb817c1411760bd31b819806"];
180
+
181
+ /** Framework-agnostic transaction receipt (only the fields the SDK needs). */
182
+ interface TransactionReceipt {
183
+ /** Event logs emitted during the transaction. */
184
+ readonly logs: readonly RawLog[];
185
+ }
186
+ /** Result of a write operation: the tx hash and its mined receipt. */
187
+ interface TransactionResult {
188
+ /** The transaction hash. */
189
+ txHash: Hex;
190
+ /** The mined transaction receipt. */
191
+ receipt: TransactionReceipt;
192
+ }
193
+ /**
194
+ * Minimal contract call configuration.
195
+ * Matches the shape returned by contract call builder functions in `src/contracts/`.
196
+ */
197
+ interface ContractCallConfig {
198
+ /** Target contract address. */
199
+ readonly address: Address;
200
+ /** ABI fragment for the function being called. */
201
+ readonly abi: readonly unknown[];
202
+ /** Solidity function name. */
203
+ readonly functionName: string;
204
+ /** Encoded function arguments. */
205
+ readonly args: readonly unknown[];
206
+ /** Native value to send with the transaction (for payable functions). */
207
+ readonly value?: bigint;
208
+ /** Gas limit override. */
209
+ readonly gas?: bigint;
210
+ }
211
+ /** Callbacks for signer lifecycle events (wallet disconnect, account switch). */
212
+ interface SignerLifecycleCallbacks {
213
+ /** Called when the wallet disconnects. */
214
+ onDisconnect?: () => void;
215
+ /** Called when the active account changes. */
216
+ onAccountChange?: (newAddress: Address) => void;
217
+ }
218
+ /**
219
+ * Framework-agnostic signer interface.
220
+ * Wallet devs implement this with their library of choice.
221
+ * The React SDK ships pre-built adapters for wagmi/viem/ethers.
222
+ */
223
+ interface GenericSigner {
224
+ /** Return the chain ID of the connected network. */
225
+ getChainId(): Promise<number>;
226
+ /** The connected wallet address. */
227
+ getAddress: () => Promise<Address>;
228
+ /** Sign EIP-712 typed data (used for decrypt authorization). */
229
+ signTypedData(typedData: EIP712TypedData): Promise<Hex>;
230
+ /** Send a write transaction and return the tx hash. */
231
+ writeContract<C extends ContractCallConfig>(config: C): Promise<Hex>;
232
+ /** Execute a read-only call and return the decoded result. */
233
+ readContract<T = unknown, C extends ContractCallConfig = ContractCallConfig>(config: C): Promise<T>;
234
+ /** Wait for a transaction to be mined and return its receipt. */
235
+ waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
236
+ /**
237
+ * Subscribe to wallet lifecycle events (disconnect, account change).
238
+ * Returns an unsubscribe function. When no EIP-1193 provider is available,
239
+ * returns a no-op unsubscribe.
240
+ *
241
+ * Optional — server-side signers or custom implementations that don't
242
+ * support lifecycle events can omit this method entirely.
243
+ */
244
+ subscribe?: (callbacks: SignerLifecycleCallbacks) => () => void;
245
+ }
246
+ /**
247
+ * Pluggable key-value store for persisting FHE credentials.
248
+ *
249
+ * The SDK stores objects directly (not JSON strings). Implementations must
250
+ * preserve value types through round-trips — e.g. `IndexedDBStorage` uses
251
+ * structured clone, `MemoryStorage` stores values as-is. If your custom
252
+ * backend serializes to JSON internally, it must handle `JSON.parse` /
253
+ * `JSON.stringify` transparently so callers always receive the original type.
254
+ */
255
+ interface GenericStorage {
256
+ get<T = unknown>(key: string): Promise<T | null>;
257
+ set<T = unknown>(key: string, value: T): Promise<void>;
258
+ delete(key: string): Promise<void>;
259
+ }
260
+ /** Stored FHE credential data (serialized as JSON in the credential store). */
261
+ interface StoredCredentials {
262
+ /** FHE public key (hex-encoded). */
263
+ publicKey: string;
264
+ /** FHE private key (hex-encoded, encrypted at rest via AES-GCM). */
265
+ privateKey: string;
266
+ /** EIP-712 signature authorizing decryption. */
267
+ signature: string;
268
+ /** Contract addresses this credential is authorized for. */
269
+ contractAddresses: Address[];
270
+ /** Unix timestamp (seconds) when the credential became valid. */
271
+ startTimestamp: number;
272
+ /** Number of days the credential remains valid. */
273
+ durationDays: number;
274
+ }
275
+ /** Progress callbacks for multi-step unshield operations. */
276
+ interface UnshieldCallbacks {
277
+ /** Fired after the unwrap transaction is submitted. */
278
+ onUnwrapSubmitted?: (txHash: Hex) => void;
279
+ /** Fired when the finalization step begins (receipt parsed, about to finalize). */
280
+ onFinalizing?: () => void;
281
+ /** Fired after the finalize transaction is submitted. */
282
+ onFinalizeSubmitted?: (txHash: Hex) => void;
283
+ }
284
+ /** Progress callbacks for multi-step shield operations. */
285
+ interface ShieldCallbacks {
286
+ /** Fired after the ERC-20 approval transaction is submitted (skipped when `approvalStrategy: "skip"`). */
287
+ onApprovalSubmitted?: (txHash: Hex) => void;
288
+ /** Fired after the shield (wrap) transaction is submitted. */
289
+ onShieldSubmitted?: (txHash: Hex) => void;
290
+ }
291
+ /** Progress callbacks for multi-step confidential transfer operations. */
292
+ interface TransferCallbacks {
293
+ /** Fired after FHE encryption of the transfer amount completes. */
294
+ onEncryptComplete?: () => void;
295
+ /** Fired after the transfer transaction is submitted. */
296
+ onTransferSubmitted?: (txHash: Hex) => void;
297
+ }
298
+
299
+ export { type ContractCallConfig as C, type GenericSigner as G, type OnChainEvent as O, type RawLog as R, type SignerLifecycleCallbacks as S, type TransactionReceipt as T, type UnshieldCallbacks as U, type WrappedEvent as W, type GenericStorage as a, type StoredCredentials as b, type TransferCallbacks as c, type TransactionResult as d, type ShieldCallbacks as e, type ConfidentialTransferEvent as f, TOKEN_TOPICS as g, Topics as h, type UnwrapRequestedEvent as i, type UnwrappedFinalizedEvent as j, type UnwrappedStartedEvent as k, decodeConfidentialTransfer as l, decodeOnChainEvent as m, decodeOnChainEvents as n, decodeUnwrapRequested as o, decodeUnwrappedFinalized as p, decodeUnwrappedStarted as q, decodeWrapped as r, findUnwrapRequested as s, findWrapped as t };
@@ -0,0 +1,197 @@
1
+ import { Address } from '@zama-fhe/relayer-sdk/bundle';
2
+
3
+ /** Batch transfer data for confidentialBatchTransfer. */
4
+ interface BatchTransferData {
5
+ to: Address;
6
+ encryptedAmount: Address;
7
+ inputProof: Address;
8
+ retryFor: bigint;
9
+ }
10
+ /**
11
+ * Returns the contract config for a confidential batch transfer.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const txHash = await signer.writeContract(
16
+ * confidentialBatchTransferContract(batcherAddress, tokenAddress, fromAddress, data, fees),
17
+ * );
18
+ * ```
19
+ */
20
+ declare function confidentialBatchTransferContract(batcherAddress: Address, tokenAddress: Address, fromAddress: Address, batchTransferData: BatchTransferData[], fees: bigint): {
21
+ readonly address: `0x${string}`;
22
+ readonly abi: readonly [{
23
+ readonly inputs: readonly [{
24
+ readonly internalType: "contract AdminProvider";
25
+ readonly name: "adminProvider_";
26
+ readonly type: "address";
27
+ }];
28
+ readonly stateMutability: "nonpayable";
29
+ readonly type: "constructor";
30
+ }, {
31
+ readonly inputs: readonly [{
32
+ readonly internalType: "address";
33
+ readonly name: "holder";
34
+ readonly type: "address";
35
+ }, {
36
+ readonly internalType: "address";
37
+ readonly name: "spender";
38
+ readonly type: "address";
39
+ }];
40
+ readonly name: "ERC7984UnauthorizedSpender";
41
+ readonly type: "error";
42
+ }, {
43
+ readonly inputs: readonly [];
44
+ readonly name: "EmptyTransferArray";
45
+ readonly type: "error";
46
+ }, {
47
+ readonly inputs: readonly [];
48
+ readonly name: "FeeTransferFailed";
49
+ readonly type: "error";
50
+ }, {
51
+ readonly inputs: readonly [];
52
+ readonly name: "InsufficientFee";
53
+ readonly type: "error";
54
+ }, {
55
+ readonly inputs: readonly [];
56
+ readonly name: "OnlyOriginalSenderCanRetry";
57
+ readonly type: "error";
58
+ }, {
59
+ readonly inputs: readonly [];
60
+ readonly name: "ZamaProtocolUnsupported";
61
+ readonly type: "error";
62
+ }, {
63
+ readonly anonymous: false;
64
+ readonly inputs: readonly [{
65
+ readonly indexed: true;
66
+ readonly internalType: "address";
67
+ readonly name: "cToken";
68
+ readonly type: "address";
69
+ }, {
70
+ readonly indexed: true;
71
+ readonly internalType: "address";
72
+ readonly name: "sender";
73
+ readonly type: "address";
74
+ }, {
75
+ readonly indexed: false;
76
+ readonly internalType: "uint256";
77
+ readonly name: "startTxId";
78
+ readonly type: "uint256";
79
+ }, {
80
+ readonly indexed: false;
81
+ readonly internalType: "uint256";
82
+ readonly name: "endTxId";
83
+ readonly type: "uint256";
84
+ }, {
85
+ readonly indexed: false;
86
+ readonly internalType: "uint256";
87
+ readonly name: "fee";
88
+ readonly type: "uint256";
89
+ }];
90
+ readonly name: "BatchTransfer";
91
+ readonly type: "event";
92
+ }, {
93
+ readonly anonymous: false;
94
+ readonly inputs: readonly [{
95
+ readonly indexed: true;
96
+ readonly internalType: "address";
97
+ readonly name: "cToken";
98
+ readonly type: "address";
99
+ }, {
100
+ readonly indexed: true;
101
+ readonly internalType: "address";
102
+ readonly name: "sender";
103
+ readonly type: "address";
104
+ }, {
105
+ readonly indexed: false;
106
+ readonly internalType: "uint256";
107
+ readonly name: "originalTxId";
108
+ readonly type: "uint256";
109
+ }, {
110
+ readonly indexed: false;
111
+ readonly internalType: "uint256";
112
+ readonly name: "retryTxId";
113
+ readonly type: "uint256";
114
+ }];
115
+ readonly name: "RetryTransfer";
116
+ readonly type: "event";
117
+ }, {
118
+ readonly inputs: readonly [];
119
+ readonly name: "adminProvider";
120
+ readonly outputs: readonly [{
121
+ readonly internalType: "contract AdminProvider";
122
+ readonly name: "";
123
+ readonly type: "address";
124
+ }];
125
+ readonly stateMutability: "view";
126
+ readonly type: "function";
127
+ }, {
128
+ readonly inputs: readonly [{
129
+ readonly internalType: "contract RegulatedERC7984Upgradeable";
130
+ readonly name: "cToken";
131
+ readonly type: "address";
132
+ }, {
133
+ readonly internalType: "address";
134
+ readonly name: "from";
135
+ readonly type: "address";
136
+ }, {
137
+ readonly components: readonly [{
138
+ readonly internalType: "address";
139
+ readonly name: "to";
140
+ readonly type: "address";
141
+ }, {
142
+ readonly internalType: "externalEuint64";
143
+ readonly name: "encryptedAmount";
144
+ readonly type: "bytes32";
145
+ }, {
146
+ readonly internalType: "bytes";
147
+ readonly name: "inputProof";
148
+ readonly type: "bytes";
149
+ }, {
150
+ readonly internalType: "uint256";
151
+ readonly name: "retryFor";
152
+ readonly type: "uint256";
153
+ }];
154
+ readonly internalType: "struct ERC7984TransferBatcher.ConfidentialTransferInput[]";
155
+ readonly name: "transfers";
156
+ readonly type: "tuple[]";
157
+ }];
158
+ readonly name: "confidentialBatchTransfer";
159
+ readonly outputs: readonly [];
160
+ readonly stateMutability: "payable";
161
+ readonly type: "function";
162
+ }, {
163
+ readonly inputs: readonly [];
164
+ readonly name: "confidentialProtocolId";
165
+ readonly outputs: readonly [{
166
+ readonly internalType: "uint256";
167
+ readonly name: "";
168
+ readonly type: "uint256";
169
+ }];
170
+ readonly stateMutability: "view";
171
+ readonly type: "function";
172
+ }, {
173
+ readonly inputs: readonly [{
174
+ readonly internalType: "address";
175
+ readonly name: "cToken";
176
+ readonly type: "address";
177
+ }, {
178
+ readonly internalType: "uint256";
179
+ readonly name: "txId";
180
+ readonly type: "uint256";
181
+ }];
182
+ readonly name: "txIdToSender";
183
+ readonly outputs: readonly [{
184
+ readonly internalType: "address";
185
+ readonly name: "sender";
186
+ readonly type: "address";
187
+ }];
188
+ readonly stateMutability: "view";
189
+ readonly type: "function";
190
+ }];
191
+ readonly functionName: "confidentialBatchTransfer";
192
+ readonly args: readonly [`0x${string}`, `0x${string}`, BatchTransferData[]];
193
+ readonly value: bigint;
194
+ readonly gas: 5000000n;
195
+ };
196
+
197
+ export { type BatchTransferData as B, confidentialBatchTransferContract as c };
@@ -0,0 +1,58 @@
1
+ import { WalletClient, PublicClient, EIP1193Provider } from 'viem';
2
+ import { E as EIP712TypedData, H as Hex } from '../relayer-sdk.types-CgHZ6qZn.js';
3
+ import { G as GenericSigner, C as ContractCallConfig, T as TransactionReceipt, S as SignerLifecycleCallbacks } from '../token.types-CUTkehsp.js';
4
+ export { R as RawLog } from '../token.types-CUTkehsp.js';
5
+ import { Address } from '@zama-fhe/relayer-sdk/bundle';
6
+ import { B as BatchTransferData } from '../transfer-batcher-CNtrNMz6.js';
7
+
8
+ /**
9
+ * Configuration for {@link ViemSigner}.
10
+ *
11
+ * The optional `ethereum` field is needed for `subscribe()` (EIP-1193
12
+ * `accountsChanged` / `disconnect` events). It cannot be auto-extracted from
13
+ * `walletClient` because viem's `custom(ethereum)` transport captures the
14
+ * provider in a closure and does **not** expose `on` / `removeListener` on
15
+ * `walletClient.transport`.
16
+ *
17
+ * If you omit `ethereum`, `subscribe()` returns a no-op. For automatic
18
+ * wallet lifecycle handling, consider using `WagmiSigner` instead.
19
+ */
20
+ interface ViemSignerConfig {
21
+ walletClient: WalletClient;
22
+ publicClient: PublicClient;
23
+ ethereum?: EIP1193Provider;
24
+ }
25
+ /**
26
+ * GenericSigner backed by viem.
27
+ *
28
+ * @param config - {@link ViemSignerConfig} with walletClient and publicClient
29
+ */
30
+ declare class ViemSigner implements GenericSigner {
31
+ private readonly walletClient;
32
+ private readonly publicClient;
33
+ private readonly ethereum?;
34
+ constructor(config: ViemSignerConfig);
35
+ getChainId(): Promise<number>;
36
+ getAddress(): Promise<Address>;
37
+ signTypedData(typedData: EIP712TypedData): Promise<Hex>;
38
+ writeContract<C extends ContractCallConfig = ContractCallConfig>(config: C): Promise<Hex>;
39
+ readContract<T, C extends ContractCallConfig = ContractCallConfig>(config: C): Promise<T>;
40
+ waitForTransactionReceipt(hash: Hex): Promise<TransactionReceipt>;
41
+ subscribe(callbacks: SignerLifecycleCallbacks): () => void;
42
+ }
43
+
44
+ declare function readConfidentialBalanceOfContract(client: PublicClient, tokenAddress: Address, userAddress: Address): Promise<`0x${string}`>;
45
+ declare function readWrapperForTokenContract(client: PublicClient, coordinator: Address, tokenAddress: Address): Promise<`0x${string}`>;
46
+ declare function readUnderlyingTokenContract(client: PublicClient, wrapperAddress: Address): Promise<`0x${string}`>;
47
+ declare function readWrapperExistsContract(client: PublicClient, coordinator: Address, tokenAddress: Address): Promise<boolean>;
48
+ declare function readSupportsInterfaceContract(client: PublicClient, tokenAddress: Address, interfaceId: Address): Promise<boolean>;
49
+ declare function writeConfidentialTransferContract(client: WalletClient, tokenAddress: Address, to: Address, handle: Uint8Array, inputProof: Uint8Array): Promise<`0x${string}`>;
50
+ declare function writeConfidentialBatchTransferContract(client: WalletClient, batcherAddress: Address, tokenAddress: Address, fromAddress: Address, batchTransferData: BatchTransferData[], fees: bigint): Promise<`0x${string}`>;
51
+ declare function writeUnwrapContract(client: WalletClient, encryptedErc20: Address, from: Address, to: Address, encryptedAmount: Uint8Array, inputProof: Uint8Array): Promise<`0x${string}`>;
52
+ declare function writeUnwrapFromBalanceContract(client: WalletClient, encryptedErc20: Address, from: Address, to: Address, encryptedBalance: Address): Promise<`0x${string}`>;
53
+ declare function writeFinalizeUnwrapContract(client: WalletClient, wrapper: Address, burntAmount: Address, burntAmountCleartext: bigint, decryptionProof: Address): Promise<`0x${string}`>;
54
+ declare function writeSetOperatorContract(client: WalletClient, tokenAddress: Address, spender: Address, timestamp?: number): Promise<`0x${string}`>;
55
+ declare function writeWrapContract(client: WalletClient, wrapperAddress: Address, to: Address, amount: bigint): Promise<`0x${string}`>;
56
+ declare function writeWrapETHContract(client: WalletClient, wrapperAddress: Address, to: Address, amount: bigint, value: bigint): Promise<`0x${string}`>;
57
+
58
+ export { BatchTransferData, ContractCallConfig, EIP712TypedData, GenericSigner, Hex, SignerLifecycleCallbacks, TransactionReceipt, ViemSigner, type ViemSignerConfig, readConfidentialBalanceOfContract, readSupportsInterfaceContract, readUnderlyingTokenContract, readWrapperExistsContract, readWrapperForTokenContract, writeConfidentialBatchTransferContract, writeConfidentialTransferContract, writeFinalizeUnwrapContract, writeSetOperatorContract, writeUnwrapContract, writeUnwrapFromBalanceContract, writeWrapContract, writeWrapETHContract };