@unlink-xyz/react 0.1.3-canary.ffa8bc4 → 0.1.5

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode } from 'react';
3
- import { BrowserWalletOptions, Environment, UnlinkWallet, AccountInfo, Account, NoteRecord, HistoryStatus, TransferResult, TransferPlanResult, DepositRelayResult, WithdrawalInput, WithdrawResult, WithdrawPlanResult, SimpleAdapterExecuteParams, AdapterExecuteResult, RelayState, HistoryEntry } from '@unlink-xyz/core';
4
- export { Account, AccountInfo, AdapterExecuteResult, AdapterExecutionCall, Chain, HistoryEntry, InputTokenSpec, NoteRecord, ParsedZkAddress, ReshieldInput, SimpleAdapterExecuteParams, TransferPlanResult, TransferResult, TxStatusChangedEvent, UnlinkWallet, WalletSDKEvent, WithdrawPlanResult, WithdrawResult, computeBalances, decodeAddress, encodeAddress, formatAmount, normalizeAddress, parseAmount, parseZkAddress, randomHex, shortenHex } from '@unlink-xyz/core';
3
+ import { BrowserWalletOptions, Environment, UnlinkWallet, AccountInfo, Account, NoteRecord, HistoryStatus, TransferResult, TransferPlanResult, DepositRelayResult, WithdrawalInput, WithdrawResult, WithdrawPlanResult, RelayState, HistoryEntry } from '@unlink-xyz/core';
4
+ export { Account, AccountInfo, Chain, HistoryEntry, NoteRecord, ParsedZkAddress, TransferPlanResult, TransferResult, TxStatusChangedEvent, UnlinkWallet, WalletSDKEvent, WithdrawPlanResult, WithdrawResult, computeBalances, decodeAddress, encodeAddress, formatAmount, normalizeAddress, parseAmount, parseZkAddress, randomHex, shortenHex } from '@unlink-xyz/core';
5
5
 
6
6
  /**
7
7
  * Wallet note with value as bigint for convenience.
@@ -181,10 +181,6 @@ type UnlinkActions = {
181
181
  planWithdraw(params: WithdrawInput[]): Promise<WithdrawPlanResult>;
182
182
  /** Execute a pre-built withdrawal plan */
183
183
  executeWithdraw(plans: WithdrawPlanResult): Promise<WithdrawResult>;
184
- /**
185
- * Execute an atomic private adapter flow (unshield -> calls -> reshield).
186
- */
187
- executeAdapter(params: SimpleAdapterExecuteParams): Promise<AdapterExecuteResult>;
188
184
  /** Refresh notes and balances */
189
185
  refresh(): Promise<void>;
190
186
  /** Force full resync from chain */
@@ -273,7 +269,7 @@ type UnlinkErrorCode = "UNKNOWN" | "SDK_NOT_INITIALIZED" | "NETWORK_ERROR" | "VA
273
269
  /**
274
270
  * Operations that can trigger an error in the Unlink context.
275
271
  */
276
- type UnlinkErrorOperation = "init" | "createWallet" | "importWallet" | "clearWallet" | "createAccount" | "switchAccount" | "send" | "executeTransfer" | "requestDeposit" | "requestWithdraw" | "executeAdapter" | "executeWithdraw" | "refresh" | "forceResync";
272
+ type UnlinkErrorOperation = "init" | "createWallet" | "importWallet" | "clearWallet" | "createAccount" | "switchAccount" | "send" | "executeTransfer" | "requestDeposit" | "requestWithdraw" | "executeWithdraw" | "refresh" | "forceResync";
277
273
  /**
278
274
  * Structured error type for the Unlink context.
279
275
  */
@@ -553,34 +549,4 @@ declare function useTransfer(): UseOperationMutationResult<TransferInput[], Tran
553
549
  */
554
550
  declare function useWithdraw(): UseOperationMutationResult<WithdrawInput[], WithdrawResult>;
555
551
 
556
- /**
557
- * Hook for executing private DeFi adapter operations with loading/error state.
558
- *
559
- * Performs atomic unshield → DeFi call(s) → reshield flows through an adapter contract.
560
- *
561
- * @example
562
- * ```tsx
563
- * function SwapButton() {
564
- * const { mutate: executeAdapter, isPending, error } = useAdapter();
565
- *
566
- * const handleSwap = async () => {
567
- * const result = await executeAdapter({
568
- * adapterAddress: "0x...",
569
- * inputs: [{ token: "0x...", amount: 1000n }],
570
- * calls: [approveCall, swapCall],
571
- * reshields: [{ token: "0x...", minAmount: 500n }],
572
- * });
573
- * console.log("Relay ID:", result.relayId);
574
- * };
575
- *
576
- * return (
577
- * <button onClick={handleSwap} disabled={isPending}>
578
- * {isPending ? "Executing..." : "Swap"}
579
- * </button>
580
- * );
581
- * }
582
- * ```
583
- */
584
- declare function useAdapter(): UseOperationMutationResult<SimpleAdapterExecuteParams, AdapterExecuteResult>;
585
-
586
- export { CONFIRMATION_POLL_INTERVAL_MS, DEFAULT_CONFIRMATION_TIMEOUT_MS, type DepositInput, type PendingDepositJob, type PendingTransferJob, type PendingWithdrawJob, TERMINAL_TX_STATES, TimeoutError, TransactionFailedError, type TransferInput, type TxState, type TxStatus, type UnlinkActions, type UnlinkConfig, type UnlinkContextValue, type UnlinkError, type UnlinkErrorCode, type UnlinkErrorOperation, UnlinkProvider, type UnlinkProviderProps, type UnlinkState, type UseOperationMutationResult, type UseTxStatusResult, type UseUnlinkBalanceResult, type UseUnlinkHistoryOptions, type UseUnlinkHistoryResult, type WaitForConfirmationOptions, type WalletNote, type WithdrawInput, useAdapter, useDeposit, useOperationMutation, useTransfer, useTxStatus, useUnlink, useUnlinkBalance, useUnlinkBalances, useUnlinkHistory, useWithdraw };
552
+ export { CONFIRMATION_POLL_INTERVAL_MS, DEFAULT_CONFIRMATION_TIMEOUT_MS, type DepositInput, type PendingDepositJob, type PendingTransferJob, type PendingWithdrawJob, TERMINAL_TX_STATES, TimeoutError, TransactionFailedError, type TransferInput, type TxState, type TxStatus, type UnlinkActions, type UnlinkConfig, type UnlinkContextValue, type UnlinkError, type UnlinkErrorCode, type UnlinkErrorOperation, UnlinkProvider, type UnlinkProviderProps, type UnlinkState, type UseOperationMutationResult, type UseTxStatusResult, type UseUnlinkBalanceResult, type UseUnlinkHistoryOptions, type UseUnlinkHistoryResult, type WaitForConfirmationOptions, type WalletNote, type WithdrawInput, useDeposit, useOperationMutation, useTransfer, useTxStatus, useUnlink, useUnlinkBalance, useUnlinkBalances, useUnlinkHistory, useWithdraw };
package/dist/index.js CHANGED
@@ -57475,36 +57475,6 @@ function UnlinkProvider({
57475
57475
  },
57476
57476
  []
57477
57477
  );
57478
- const executeAdapter = useCallback(
57479
- async (params) => {
57480
- const wallet = walletRef.current;
57481
- if (!wallet) throw new Error("SDK not initialized");
57482
- setState((prev2) => ({
57483
- ...prev2,
57484
- busy: true,
57485
- status: "Executing adapter..."
57486
- }));
57487
- try {
57488
- const result = await wallet.adapter.execute(params);
57489
- setState((prev2) => ({
57490
- ...prev2,
57491
- busy: false,
57492
- status: "Adapter execution submitted",
57493
- error: null
57494
- }));
57495
- return result;
57496
- } catch (err) {
57497
- setState((prev2) => ({
57498
- ...prev2,
57499
- busy: false,
57500
- status: `Error: ${err instanceof Error ? err.message : "Unknown"}`,
57501
- error: createUnlinkError(err, "executeAdapter")
57502
- }));
57503
- throw err;
57504
- }
57505
- },
57506
- []
57507
- );
57508
57478
  const planWithdraw = useCallback(
57509
57479
  async (params) => {
57510
57480
  const wallet = walletRef.current;
@@ -57678,8 +57648,6 @@ function UnlinkProvider({
57678
57648
  requestDeposit,
57679
57649
  // Withdraw actions
57680
57650
  requestWithdraw,
57681
- // Adapter actions
57682
- executeAdapter,
57683
57651
  planWithdraw,
57684
57652
  executeWithdraw,
57685
57653
  // Sync actions
@@ -57705,7 +57673,6 @@ function UnlinkProvider({
57705
57673
  executeTransfer,
57706
57674
  requestDeposit,
57707
57675
  requestWithdraw,
57708
- executeAdapter,
57709
57676
  planWithdraw,
57710
57677
  executeWithdraw,
57711
57678
  refresh,
@@ -57943,17 +57910,6 @@ function useWithdraw() {
57943
57910
  );
57944
57911
  return useOperationMutation(op);
57945
57912
  }
57946
-
57947
- // src/useAdapter.ts
57948
- import { useCallback as useCallback8 } from "react";
57949
- function useAdapter() {
57950
- const { executeAdapter } = useUnlink();
57951
- const op = useCallback8(
57952
- (params) => executeAdapter(params),
57953
- [executeAdapter]
57954
- );
57955
- return useOperationMutation(op);
57956
- }
57957
57913
  export {
57958
57914
  CONFIRMATION_POLL_INTERVAL_MS,
57959
57915
  DEFAULT_CONFIRMATION_TIMEOUT_MS,
@@ -57970,7 +57926,6 @@ export {
57970
57926
  parseZkAddress,
57971
57927
  randomHex,
57972
57928
  shortenHex,
57973
- useAdapter,
57974
57929
  useDeposit,
57975
57930
  useOperationMutation,
57976
57931
  useTransfer,