@rhea-finance/zcash-wallet-adapter 0.1.1

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 (79) hide show
  1. package/README.md +463 -0
  2. package/dist/aggregation/index.d.ts +84 -0
  3. package/dist/aggregation/index.d.ts.map +1 -0
  4. package/dist/aggregation/index.js +202 -0
  5. package/dist/aggregation/index.js.map +1 -0
  6. package/dist/core/BaseWalletAdapter.d.ts +42 -0
  7. package/dist/core/BaseWalletAdapter.d.ts.map +1 -0
  8. package/dist/core/BaseWalletAdapter.js +94 -0
  9. package/dist/core/BaseWalletAdapter.js.map +1 -0
  10. package/dist/core/WalletStore.d.ts +35 -0
  11. package/dist/core/WalletStore.d.ts.map +1 -0
  12. package/dist/core/WalletStore.js +165 -0
  13. package/dist/core/WalletStore.js.map +1 -0
  14. package/dist/core/detectInjectedProvider.d.ts +12 -0
  15. package/dist/core/detectInjectedProvider.d.ts.map +1 -0
  16. package/dist/core/detectInjectedProvider.js +27 -0
  17. package/dist/core/detectInjectedProvider.js.map +1 -0
  18. package/dist/core/emitter.d.ts +11 -0
  19. package/dist/core/emitter.d.ts.map +1 -0
  20. package/dist/core/emitter.js +27 -0
  21. package/dist/core/emitter.js.map +1 -0
  22. package/dist/core/errors.d.ts +42 -0
  23. package/dist/core/errors.d.ts.map +1 -0
  24. package/dist/core/errors.js +89 -0
  25. package/dist/core/errors.js.map +1 -0
  26. package/dist/core/index.d.ts +7 -0
  27. package/dist/core/index.d.ts.map +1 -0
  28. package/dist/core/index.js +7 -0
  29. package/dist/core/index.js.map +1 -0
  30. package/dist/core/types.d.ts +162 -0
  31. package/dist/core/types.d.ts.map +1 -0
  32. package/dist/core/types.js +8 -0
  33. package/dist/core/types.js.map +1 -0
  34. package/dist/index.d.ts +5 -0
  35. package/dist/index.d.ts.map +1 -0
  36. package/dist/index.js +5 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/lending/index.d.ts +86 -0
  39. package/dist/lending/index.d.ts.map +1 -0
  40. package/dist/lending/index.js +114 -0
  41. package/dist/lending/index.js.map +1 -0
  42. package/dist/perps/index.d.ts +7 -0
  43. package/dist/perps/index.d.ts.map +1 -0
  44. package/dist/perps/index.js +7 -0
  45. package/dist/perps/index.js.map +1 -0
  46. package/dist/react/WalletProvider.d.ts +16 -0
  47. package/dist/react/WalletProvider.d.ts.map +1 -0
  48. package/dist/react/WalletProvider.js +46 -0
  49. package/dist/react/WalletProvider.js.map +1 -0
  50. package/dist/react/index.d.ts +2 -0
  51. package/dist/react/index.d.ts.map +1 -0
  52. package/dist/react/index.js +2 -0
  53. package/dist/react/index.js.map +1 -0
  54. package/dist/ui/WalletProvider.d.ts +29 -0
  55. package/dist/ui/WalletProvider.d.ts.map +1 -0
  56. package/dist/ui/WalletProvider.js +17 -0
  57. package/dist/ui/WalletProvider.js.map +1 -0
  58. package/dist/ui/WalletSelector.d.ts +66 -0
  59. package/dist/ui/WalletSelector.d.ts.map +1 -0
  60. package/dist/ui/WalletSelector.js +121 -0
  61. package/dist/ui/WalletSelector.js.map +1 -0
  62. package/dist/ui/index.d.ts +4 -0
  63. package/dist/ui/index.d.ts.map +1 -0
  64. package/dist/ui/index.js +4 -0
  65. package/dist/ui/index.js.map +1 -0
  66. package/dist/wallets/noir-wallet/NoirZcashWalletAdapter.d.ts +52 -0
  67. package/dist/wallets/noir-wallet/NoirZcashWalletAdapter.d.ts.map +1 -0
  68. package/dist/wallets/noir-wallet/NoirZcashWalletAdapter.js +312 -0
  69. package/dist/wallets/noir-wallet/NoirZcashWalletAdapter.js.map +1 -0
  70. package/dist/wallets/noir-wallet/index.d.ts +3 -0
  71. package/dist/wallets/noir-wallet/index.d.ts.map +1 -0
  72. package/dist/wallets/noir-wallet/index.js +3 -0
  73. package/dist/wallets/noir-wallet/index.js.map +1 -0
  74. package/dist/wallets/noir-wallet/provider.d.ts +33 -0
  75. package/dist/wallets/noir-wallet/provider.d.ts.map +1 -0
  76. package/dist/wallets/noir-wallet/provider.js +21 -0
  77. package/dist/wallets/noir-wallet/provider.js.map +1 -0
  78. package/package.json +74 -0
  79. package/styles.css +411 -0
package/README.md ADDED
@@ -0,0 +1,463 @@
1
+ # Noir Zcash Wallet Adapter
2
+
3
+ A browser wallet adapter built specifically for **Zcash**. The project follows a layered internal architecture consisting of a core interface, wallet-specific implementations, framework bindings, and an optional wallet-selection UI. All layers are distributed as one `@noir-wallet/adapter` package. The current wallet implementation integrates with the `window.noirwallet.zcash` provider injected by Noir Wallet.
4
+
5
+ This implementation does not reuse NEAR, EVM, or Solana transaction models:
6
+
7
+ - Each account retains both its Zcash `transparent` and `shielded` addresses.
8
+ - The adapter's primary `address` points to the shielded address by default, preventing applications from accidentally treating a t-address as private.
9
+ - ZEC amounts are represented as decimal strings to avoid JavaScript floating-point precision issues.
10
+ - Transactions are sent through `zcash_sendTransaction`, allowing the wallet to handle UTXO selection, fee calculation, shielded proof generation, authorization, and broadcasting.
11
+ - The current Noir provider does not expose PCZT signing. Calling `signTransaction()` therefore throws `WalletMethodNotSupportedError` instead of pretending that Zcash uses a NEAR- or EVM-style serialized transaction flow.
12
+ - Message signing uses the secp256k1 key associated with a Zcash transparent address and supports Noir's `current`, `derived`, and `legacy_index0` signing modes.
13
+
14
+ ## Internal structure
15
+
16
+ ```text
17
+ src/
18
+ ├── core/ # Types, errors, events, base adapter, and WalletStore
19
+ ├── wallets/noir-wallet/ # Noir Wallet Zcash provider implementation
20
+ ├── react/ # WalletProvider and useWallet
21
+ ├── ui/ # Wallet-selection button and modal only
22
+ ├── aggregation/ # RHEA aggregation SDK and Noir Zcash bridge
23
+ ├── lending/ # RHEA lending SDK and Noir Zcash bridge
24
+ └── perps/ # RHEA perpetuals SDK
25
+ ```
26
+
27
+ These directories are implementation layers, not separate npm packages. Applications install a single dependency:
28
+
29
+ ```bash
30
+ pnpm add @noir-wallet/adapter
31
+ ```
32
+
33
+ To develop and verify this repository:
34
+
35
+ ```bash
36
+ pnpm install
37
+ pnpm typecheck
38
+ pnpm test
39
+ pnpm build
40
+ ```
41
+
42
+ ## TypeScript usage
43
+
44
+ ```ts
45
+ import {
46
+ NoirZcashWalletAdapter,
47
+ WalletStore,
48
+ } from '@noir-wallet/adapter';
49
+
50
+ const store = new WalletStore();
51
+ const noir = new NoirZcashWalletAdapter({
52
+ network: 'mainnet',
53
+ });
54
+
55
+ store.registerAdapter(noir);
56
+
57
+ // Call this after the user clicks Connect. Noir Wallet will display an
58
+ // authorization prompt.
59
+ await store.connect(noir.name);
60
+
61
+ console.log(noir.shieldedAddress);
62
+ console.log(noir.transparentAddress);
63
+
64
+ const balance = await noir.getBalance();
65
+ console.log(balance.shielded, balance.available);
66
+
67
+ const signature = await noir.signMessage('example.com wants you to sign in', {
68
+ // Derived signing is recommended for identity flows because it reduces
69
+ // public linkage to the user's primary t-address.
70
+ signingMode: 'derived',
71
+ });
72
+
73
+ const txid = await noir.signAndSendTransaction({
74
+ to: 'u1...',
75
+ amount: '0.1',
76
+ memo: 'private memo',
77
+ fundingSource: 'shielded',
78
+ });
79
+ ```
80
+
81
+ A previously authorized connection can be restored silently after a page reload. The silent flow only calls `zcash_getAccounts` and never opens an approval prompt:
82
+
83
+ ```ts
84
+ await store.autoConnect();
85
+ ```
86
+
87
+ ## RHEA cross-chain SDK entries
88
+
89
+ The adapter depends on the unified `@rhea-finance/crosschain-sdk` package and
90
+ re-exports all three SDKs from isolated entry points:
91
+
92
+ | Adapter import | Unified SDK entry | Purpose |
93
+ | --- | --- | --- |
94
+ | `@noir-wallet/adapter/aggregation` | `@rhea-finance/crosschain-sdk/aggregation` | Cross-chain swaps and the Noir Zcash executor |
95
+ | `@noir-wallet/adapter/lending` | `@rhea-finance/crosschain-sdk/lending` | Cross-chain lending and the Noir Zcash bridge |
96
+ | `@noir-wallet/adapter/perps` | `@rhea-finance/crosschain-sdk/perps` | Perpetual markets, accounts, funding, and trading |
97
+
98
+ Applications install only the adapter package:
99
+
100
+ ```bash
101
+ pnpm add @noir-wallet/adapter
102
+ ```
103
+
104
+ The root entry does not import or re-export these SDKs. Each integration is an
105
+ independent package subpath, and both packages declare their modules as free of
106
+ side effects. A bundler can therefore omit all three SDKs when none is used, or
107
+ include only the selected entry while tree-shaking its unused exports.
108
+
109
+ ## RHEA aggregation integration
110
+
111
+ The RHEA integration is available through an optional import path rather than
112
+ the default adapter entry point. The dedicated subpath exports the complete
113
+ aggregation SDK together with the Noir-specific bridge:
114
+
115
+ ```ts
116
+ import { NoirZcashWalletAdapter } from '@noir-wallet/adapter';
117
+ import {
118
+ createNoirSwapClient,
119
+ parseUnits,
120
+ type AssetRef,
121
+ } from '@noir-wallet/adapter/aggregation';
122
+
123
+ const noir = new NoirZcashWalletAdapter({ network: 'mainnet' });
124
+ await noir.connect();
125
+
126
+ const client = createNoirSwapClient({
127
+ baseUrl: 'https://api.rhea.finance',
128
+ wallet: noir,
129
+ });
130
+
131
+ // Use the exact asset identifiers returned by RHEA's token metadata API.
132
+ declare const zec: AssetRef;
133
+ declare const destinationAsset: AssetRef;
134
+ declare const destinationAddress: string;
135
+
136
+ const quote = await client.quote({
137
+ fromChain: 'zcash',
138
+ toChain: destinationAsset.chain,
139
+ tokenIn: zec,
140
+ tokenOut: destinationAsset,
141
+ amountIn: parseUnits('0.1', zec.decimals ?? 8),
142
+ slippageBps: 50,
143
+ sender: noir.transparentAddress!,
144
+ recipient: destinationAddress,
145
+ });
146
+
147
+ const result = await client.swap({
148
+ quote,
149
+ waitFor: 'submitted',
150
+ });
151
+
152
+ console.log(result.txHash);
153
+ ```
154
+
155
+ The bridge converts RHEA's base-unit ZEC amount into the decimal string
156
+ expected by Noir Wallet and funds the deposit from the shielded balance by
157
+ default. Pass `zcash: { fundingSource: 'transparent' }` to
158
+ `createNoirSwapClient()` only when that privacy trade-off is intentional.
159
+
160
+ `waitFor: 'submitted'` works with the current Noir provider. To use
161
+ `'source-confirmed'` or `'completed'`, supply a confirmation implementation:
162
+
163
+ ```ts
164
+ const client = createNoirSwapClient({
165
+ baseUrl: 'https://api.rhea.finance',
166
+ wallet: noir,
167
+ zcash: {
168
+ waitForTransaction: async (txHash, { signal }) => {
169
+ const receipt = await waitForZcashReceipt(txHash, signal);
170
+ return {
171
+ status: receipt.confirmed ? 'confirmed' : 'failed',
172
+ raw: receipt,
173
+ };
174
+ },
175
+ },
176
+ });
177
+ ```
178
+
179
+ RHEA's Zcash executor sends to the transparent deposit address returned by its
180
+ build API, so that address must start with a valid mainnet `t1`/`t3` prefix or
181
+ testnet `tm`/`t2` prefix. This restriction applies to the cross-chain deposit
182
+ step only; normal Noir wallet transfers may still use supported Unified or
183
+ shielded recipients.
184
+
185
+ `@noir-wallet/adapter` does not re-export this bridge from its root entry.
186
+ Bundlers do not include it unless the application imports
187
+ `@noir-wallet/adapter/aggregation`.
188
+
189
+ ## RHEA cross-chain lending integration
190
+
191
+ The dedicated lending subpath exports the complete lending SDK and connects its
192
+ Zcash flows to Noir Wallet:
193
+
194
+ ```ts
195
+ import { NoirZcashWalletAdapter } from '@noir-wallet/adapter';
196
+ import {
197
+ createNoirCrossChainLendingBridge,
198
+ } from '@noir-wallet/adapter/lending';
199
+
200
+ const noir = new NoirZcashWalletAdapter({ network: 'mainnet' });
201
+ await noir.connect();
202
+
203
+ const lending = createNoirCrossChainLendingBridge(noir);
204
+
205
+ // The derived Noir public key is used as the Zcash MCA identity.
206
+ const mcaId = await lending.getMcaByWallet();
207
+
208
+ // Legacy RHEA Zcash MCA creation flow: request a deposit address and submit
209
+ // the ZEC transfer through Noir Wallet.
210
+ const deposit = await lending.createMcaDeposit({
211
+ accountManagerId: 'multica.near',
212
+ amount: '0.1',
213
+ });
214
+
215
+ console.log(deposit.txHash);
216
+
217
+ const status = await lending.getZcashDepositStatus(
218
+ deposit.depositAddress,
219
+ );
220
+ console.log(status?.mca_id, status?.status);
221
+ ```
222
+
223
+ Deposit transfers use the shielded balance by default. To make the funding
224
+ source explicit:
225
+
226
+ ```ts
227
+ const lending = createNoirCrossChainLendingBridge(noir, {
228
+ fundingSource: 'transparent',
229
+ });
230
+ ```
231
+
232
+ The bridge also exposes the complete RHEA SDK for lending views, quote
233
+ preparation, health-factor calculations, MCA operations, and relayer flows:
234
+
235
+ ```ts
236
+ const sdk = await lending.loadSdk();
237
+ const account = await sdk.batchViews(mcaId ?? undefined);
238
+ const assets = await sdk.getAssetsDetail();
239
+ ```
240
+
241
+ `loadSdk()` uses the unified package's isolated lending entry. Importing the
242
+ adapter root, aggregation entry, or perps entry does not load lending code.
243
+
244
+ RHEA's Zcash deposit endpoints require a transparent address. The bridge
245
+ validates mainnet `t1`/`t3` and testnet `tm`/`t2` addresses before asking Noir
246
+ Wallet to send funds. It does not apply this restriction to ordinary wallet
247
+ transfers.
248
+
249
+ ## RHEA perpetuals integration
250
+
251
+ The perps subpath re-exports the complete RHEA perpetuals SDK without adding it
252
+ to the adapter root or either of the other SDK entries:
253
+
254
+ ```ts
255
+ import { PerpsClient } from '@noir-wallet/adapter/perps';
256
+
257
+ const perps = new PerpsClient();
258
+
259
+ try {
260
+ const markets = await perps.markets.list();
261
+ console.log(markets);
262
+ } finally {
263
+ perps.destroy();
264
+ }
265
+ ```
266
+
267
+ Import this entry only in applications that use perpetual markets. If it is not
268
+ imported, the perps SDK is excluded from the application bundle.
269
+
270
+ ## Ready-to-use wallet selector
271
+
272
+ The UI package is intentionally limited to wallet selection. It displays wallet names, icons, and installation status, then connects the selected wallet. It does not render accounts, addresses, balances, copy actions, or a disconnect panel.
273
+
274
+ ```tsx
275
+ import {
276
+ NoirZcashWalletAdapter,
277
+ WalletProvider,
278
+ } from '@noir-wallet/adapter';
279
+ import '@noir-wallet/adapter/styles.css';
280
+
281
+ const adapters = [new NoirZcashWalletAdapter({ network: 'mainnet' })];
282
+
283
+ export function App() {
284
+ return (
285
+ <WalletProvider adapters={adapters} autoConnect>
286
+ <AppContent />
287
+ </WalletProvider>
288
+ );
289
+ }
290
+ ```
291
+
292
+ The UI-ready `WalletProvider` renders `WalletSelector` automatically. The application does not need to import or mount the selector separately. By default, selecting a wallet calls `store.connect(walletName)`.
293
+
294
+ The selector uses the light theme by default:
295
+
296
+ ```tsx
297
+ <WalletProvider adapters={adapters}>
298
+ <AppContent />
299
+ </WalletProvider>
300
+ ```
301
+
302
+ Set `theme="dark"` to use the dark theme:
303
+
304
+ ```tsx
305
+ <WalletProvider adapters={adapters} theme="dark">
306
+ <AppContent />
307
+ </WalletProvider>
308
+ ```
309
+
310
+ The same `theme: 'light' | 'dark'` option is available on
311
+ `WalletSelector`, `WalletSelectorButton`, and `WalletSelectorModal` when they
312
+ are rendered separately. The theme is explicit and does not change
313
+ automatically with the operating-system color scheme.
314
+
315
+ Pass `walletSelectorProps` to customize the built-in selector:
316
+
317
+ ```tsx
318
+ <WalletProvider
319
+ adapters={adapters}
320
+ walletSelectorProps={{
321
+ labels: {
322
+ selectWallet: 'Connect wallet',
323
+ dialogTitle: 'Choose a wallet',
324
+ },
325
+ }}
326
+ >
327
+ <AppContent />
328
+ </WalletProvider>
329
+ ```
330
+
331
+ The built-in selector can be disabled when a page does not need wallet-selection UI:
332
+
333
+ ```tsx
334
+ <WalletProvider adapters={adapters} showWalletSelector={false}>
335
+ <AppContent />
336
+ </WalletProvider>
337
+ ```
338
+
339
+ CSS variables can be customized:
340
+
341
+ ```css
342
+ :root {
343
+ --nzwa-accent: #f4b728;
344
+ --nzwa-radius: 24px;
345
+ }
346
+
347
+ [data-nzwa-theme='light'] {
348
+ --nzwa-surface: #ffffff;
349
+ --nzwa-text: #18181a;
350
+ }
351
+ ```
352
+
353
+ `WalletSelector`, `WalletSelectorButton`, and `WalletSelectorModal` remain available as separate exports for applications that need full control over selector placement or modal state.
354
+
355
+ ## Headless React state bindings
356
+
357
+ Use the `@noir-wallet/adapter/react` subpath when the application needs state management without any built-in UI. This is a subpath of the same installed package, not another dependency.
358
+
359
+ ```tsx
360
+ import { NoirZcashWalletAdapter } from '@noir-wallet/adapter';
361
+ import {
362
+ WalletProvider,
363
+ useWallet,
364
+ } from '@noir-wallet/adapter/react';
365
+
366
+ const adapters = [new NoirZcashWalletAdapter({ network: 'mainnet' })];
367
+
368
+ export function App() {
369
+ return (
370
+ <WalletProvider adapters={adapters} autoConnect>
371
+ <WalletPanel />
372
+ </WalletProvider>
373
+ );
374
+ }
375
+
376
+ function WalletPanel() {
377
+ const {
378
+ adapters,
379
+ isConnected,
380
+ shieldedAddress,
381
+ transparentAddress,
382
+ connect,
383
+ disconnect,
384
+ signAndSendTransaction,
385
+ } = useWallet();
386
+
387
+ if (!isConnected) {
388
+ return (
389
+ <button onClick={() => connect(adapters[0]!.name)}>
390
+ Connect Noir Wallet
391
+ </button>
392
+ );
393
+ }
394
+
395
+ return (
396
+ <section>
397
+ <div>Shielded: {shieldedAddress}</div>
398
+ <div>Transparent: {transparentAddress}</div>
399
+ <button onClick={() => disconnect()}>Disconnect</button>
400
+ <button
401
+ onClick={() =>
402
+ signAndSendTransaction({
403
+ to: 'u1...',
404
+ amount: '0.01',
405
+ fundingSource: 'shielded',
406
+ })
407
+ }
408
+ >
409
+ Send ZEC
410
+ </button>
411
+ </section>
412
+ );
413
+ }
414
+ ```
415
+
416
+ Keep the `adapters` array reference stable by defining it outside the component or creating it with `useMemo`. Passing a new array on every render causes React to treat it as a new set of wallets and register the adapters again.
417
+
418
+ ## Events
419
+
420
+ Every adapter exposes the following events:
421
+
422
+ - `connect`
423
+ - `disconnect`
424
+ - `accountChanged`
425
+ - `chainChanged`
426
+ - `error`
427
+ - `readyStateChanged`
428
+
429
+ ```ts
430
+ noir.on('accountChanged', ({ shielded, transparent, accounts }) => {
431
+ // accounts contains every Zcash wallet/account authorized by the user.
432
+ });
433
+ ```
434
+
435
+ Transaction and signing failures emit `error` without clearing the active connection. The adapter only enters the disconnected state after an explicit provider `disconnect` event, an `accountsChanged` event carrying `null`, or an application call to `disconnect()`.
436
+
437
+ ## Zcash-specific considerations
438
+
439
+ 1. The wallet provides the `shielded` value. It may be a Unified Address or another shielded address format supported by the wallet. Applications should not infer receiver capabilities from the string prefix alone.
440
+ 2. A memo is limited to 512 UTF-8 bytes, and only a shielded recipient can receive a private memo.
441
+ 3. `fundingSource: 'transparent'` reveals and may link the selected UTXOs. Privacy-first applications should use `shielded`.
442
+ 4. `available` is more accurate for a maximum payment than subtracting a fixed fee from the balance. Use `getMaxTransfer()` for an exact send-max estimate.
443
+ 5. Mainnet and testnet are distributed as separate wallet builds. The adapter's `network` option controls application state and validation; it does not ask the wallet to switch networks.
444
+
445
+ ## Provider RPC mapping
446
+
447
+ | Adapter API | Noir Zcash RPC |
448
+ | --- | --- |
449
+ | `connect()` | `zcash_requestAccounts` |
450
+ | `connect({ silent: true })` / `getAccounts()` | `zcash_getAccounts` |
451
+ | `getAddresses()` | `zcash_getAddresses` |
452
+ | `getBalance()` | `zcash_getBalance` |
453
+ | `getMaxTransfer()` | `zcash_getMaxTransfer` |
454
+ | `getPublicKey()` | `zcash_getPublicKey` |
455
+ | `signMessage()` | `zcash_signMessage` |
456
+ | `signAndSendTransaction()` | `zcash_sendTransaction` |
457
+ | `shieldFunds()` | `zcash_shieldFunds` |
458
+ | `getTransactionHistory()` | `zcash_getTransactionHistory` |
459
+ | `disconnect()` | Provider `disconnect()` / `zcash_disconnect` |
460
+
461
+ ## Security recommendations
462
+
463
+ Authentication messages should be generated and verified by the server. At minimum, include the domain, intended action, nonce, issued-at time, and expiration time. Never ask users to sign ambiguous text, and never send shielded addresses, authorized account lists, or balances to analytics services.
@@ -0,0 +1,84 @@
1
+ export * from '@rhea-finance/crosschain-sdk/aggregation';
2
+ import { SwapClient, type ChainExecutor, type ChainRef, type MessageSignOptions, type SwapClientConfig, type TransactionConfirmation } from '@rhea-finance/crosschain-sdk/aggregation';
3
+ import { type ZcashChainId, type ZcashFundingSource, type ZcashPublicKey, type ZcashSendTransactionRequest, type ZcashSignMessageOptions, type ZcashSignMessageResult, type ZcashSigningMode } from '../core/index.js';
4
+ export interface RheaZcashWalletAdapter {
5
+ getChain(): ChainRef | Promise<ChainRef>;
6
+ isAddress(address: string): boolean;
7
+ sendTransfer(input: {
8
+ amount: string;
9
+ depositAddress: string;
10
+ decimals?: number;
11
+ signal?: AbortSignal;
12
+ }): Promise<{
13
+ txHash: string;
14
+ raw?: unknown;
15
+ }>;
16
+ waitForTransaction(txHash: string, options: {
17
+ signal?: AbortSignal;
18
+ }): Promise<TransactionConfirmation>;
19
+ isUserRejection?(error: unknown): boolean;
20
+ getIdentityKey?(): string | Promise<string>;
21
+ signMessage?(message: string, options?: MessageSignOptions): Promise<string>;
22
+ }
23
+ export interface NoirZcashSwapWallet {
24
+ readonly chainId: ZcashChainId;
25
+ readonly isConnected: boolean;
26
+ signAndSendTransaction(transaction: ZcashSendTransactionRequest): Promise<string>;
27
+ getPublicKey(options?: ZcashSignMessageOptions): Promise<ZcashPublicKey | null>;
28
+ signMessage(message: string | Uint8Array, options?: ZcashSignMessageOptions): Promise<ZcashSignMessageResult>;
29
+ }
30
+ export type WaitForZcashTransaction = (txHash: string, options: {
31
+ signal?: AbortSignal;
32
+ }) => Promise<TransactionConfirmation>;
33
+ export interface NoirZcashExecutorOptions {
34
+ /**
35
+ * Source balance used to fund the RHEA deposit transfer.
36
+ *
37
+ * @default "shielded"
38
+ */
39
+ fundingSource?: ZcashFundingSource;
40
+ /**
41
+ * ZEC base-unit precision used when the RHEA build omits decimals.
42
+ *
43
+ * @default 8
44
+ */
45
+ decimals?: number;
46
+ /**
47
+ * Identity mode used by optional MCA signer flows.
48
+ *
49
+ * @default "derived"
50
+ */
51
+ signingMode?: ZcashSigningMode;
52
+ /**
53
+ * Override transparent deposit-address validation when the wallet supports a
54
+ * network-specific format not covered by the default validator.
55
+ */
56
+ isDepositAddress?: (address: string, chainId: ZcashChainId) => boolean;
57
+ /**
58
+ * Optional confirmation implementation. It is only needed for
59
+ * `waitFor: "source-confirmed"` or flows that request source confirmation.
60
+ * Submitted-mode swaps work without it.
61
+ */
62
+ waitForTransaction?: WaitForZcashTransaction;
63
+ }
64
+ export interface CreateNoirSwapClientOptions extends Omit<SwapClientConfig, 'executors'> {
65
+ wallet: NoirZcashSwapWallet;
66
+ zcash?: NoirZcashExecutorOptions;
67
+ /**
68
+ * Additional executors for destination/source chains used by the same
69
+ * SwapClient. The Noir Zcash executor is appended automatically.
70
+ */
71
+ executors?: readonly ChainExecutor[];
72
+ }
73
+ /**
74
+ * Adapts Noir's Zcash wallet API to the executor contract required by the
75
+ * optional RHEA Cross-Chain DEX SDK.
76
+ */
77
+ export declare function createRheaZcashWalletAdapter(wallet: NoirZcashSwapWallet, options?: NoirZcashExecutorOptions): RheaZcashWalletAdapter;
78
+ export declare function createNoirZcashExecutor(wallet: NoirZcashSwapWallet, options?: NoirZcashExecutorOptions): ChainExecutor<'zcash-transfer'>;
79
+ /**
80
+ * Creates a RHEA SwapClient with a Noir-backed Zcash executor.
81
+ */
82
+ export declare function createNoirSwapClient({ wallet, zcash, executors, ...config }: CreateNoirSwapClientOptions): SwapClient;
83
+ export declare function isTransparentZcashAddress(address: string, chainId: ZcashChainId): boolean;
84
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/aggregation/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC;AAEzD,OAAO,EACL,UAAU,EAOV,KAAK,aAAa,EAClB,KAAK,QAAQ,EAEb,KAAK,kBAAkB,EAGvB,KAAK,gBAAgB,EAGrB,KAAK,uBAAuB,EAC7B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAM1B,MAAM,WAAW,sBAAsB;IACrC,QAAQ,IAAI,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,SAAS,CAAC,OAAO,EAAE,MAAM,GA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