@usdctofiat/offramp 0.1.5 → 0.2.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/index.d.cts CHANGED
@@ -1,38 +1,62 @@
1
1
  import { WalletClient } from 'viem';
2
- import { O as OfframpParams, a as OnProgress, b as OfframpResult, D as DepositInfo, P as PlatformInfo, c as Platform, C as CurrencyInfo, d as OfframpStep } from './types-DjkNvO-k.cjs';
3
- export { e as CURRENCIES, f as Currency, g as DepositStatus, h as OfframpProgress, i as PAYMENT_PLATFORMS, S as SUPPORTED_CURRENCIES } from './types-DjkNvO-k.cjs';
2
+ import { O as OfframpParams, a as OnProgress, b as OfframpResult, D as DepositInfo, P as PlatformInfo, c as Platform, C as CurrencyInfo } from './errors-DQqv1xfX.cjs';
3
+ export { d as CURRENCIES, e as Currency, f as DepositStatus, g as OfframpError, h as OfframpErrorCode, i as OfframpProgress, j as OfframpStep, k as PAYMENT_PLATFORMS, S as SUPPORTED_CURRENCIES } from './errors-DQqv1xfX.cjs';
4
4
 
5
5
  declare class Offramp {
6
6
  /**
7
7
  * Create an offramp deposit: approve USDC, register payee, create deposit,
8
8
  * confirm on-chain, and delegate to the vault. All in one call.
9
+ *
10
+ * @param walletClient - viem WalletClient with an account
11
+ * @param params - Deposit parameters (amount, platform, currency, identifier)
12
+ * @param onProgress - Optional callback for step-by-step progress updates
9
13
  */
10
14
  createDeposit(walletClient: WalletClient, params: OfframpParams, onProgress?: OnProgress): Promise<OfframpResult>;
11
15
  /**
12
- * Fetch deposits for a wallet address. Returns active, empty, and closed deposits
13
- * sorted by status (active first) then recency.
16
+ * Fetch all deposits for a wallet address. Read-only, no wallet needed.
17
+ * Returns active, empty, and closed deposits sorted by status then recency.
14
18
  */
15
19
  getDeposits(walletAddress: string): Promise<DepositInfo[]>;
16
20
  /**
17
- * Delegate an existing deposit to the vault. Use this to:
21
+ * Find a deposit by its transaction hash. Useful for recovering from
22
+ * CONFIRMATION_FAILED errors where you have a txHash but no depositId.
23
+ *
24
+ * @param walletAddress - The depositor's wallet address
25
+ * @param txHash - The transaction hash from createDeposit
26
+ */
27
+ getDepositByTxHash(walletAddress: string, txHash: string): Promise<DepositInfo | null>;
28
+ /**
29
+ * Delegate an existing deposit to the Delegate vault. Use this to:
18
30
  * - Retry after a DELEGATION_FAILED error
19
31
  * - Delegate a deposit created outside the SDK
20
32
  * - Delegate a deposit created via usdctofiat.xyz
33
+ *
34
+ * @param walletClient - viem WalletClient with the deposit owner's account
35
+ * @param depositId - The numeric deposit ID (not the composite escrow_id format)
21
36
  */
22
37
  delegateDeposit(walletClient: WalletClient, depositId: string, escrowAddress?: string): Promise<string>;
23
38
  /**
24
- * Withdraw and close a deposit, returning remaining USDC to the wallet.
39
+ * Withdraw remaining USDC and close a deposit.
40
+ *
41
+ * @param walletClient - viem WalletClient with the deposit owner's account
42
+ * @param depositId - The numeric deposit ID (not the composite escrow_id format)
25
43
  */
26
44
  withdrawDeposit(walletClient: WalletClient, depositId: string, escrowAddress?: string): Promise<string>;
27
- /** List available payment platforms and their supported currencies. */
45
+ /** List available payment platforms with currencies, labels, and format requirements. */
28
46
  getPlatforms(): PlatformInfo[];
29
47
  /** Get supported currencies for a specific platform. */
30
48
  getCurrencies(platform: Platform): string[];
31
- /** Get currency metadata (symbol, name, country code) for a currency code. */
49
+ /**
50
+ * Get currency metadata for UI rendering.
51
+ * @returns Symbol (€), full name (Euro), and country code (eu), or null if unsupported.
52
+ */
32
53
  getCurrencyInfo(code: string): CurrencyInfo | null;
33
54
  /** Get all supported currencies with metadata. */
34
55
  getAllCurrencies(): CurrencyInfo[];
35
- /** Validate a payment identifier for a platform without creating a deposit. */
56
+ /**
57
+ * Validate and normalize a payment identifier for a platform.
58
+ * Strips leading @/$ characters, validates format (email, IBAN, etc).
59
+ */
36
60
  validateIdentifier(platform: Platform, identifier: string): {
37
61
  valid: boolean;
38
62
  normalized: string;
@@ -40,17 +64,4 @@ declare class Offramp {
40
64
  };
41
65
  }
42
66
 
43
- type OfframpErrorCode = "VALIDATION" | "APPROVAL_FAILED" | "REGISTRATION_FAILED" | "DEPOSIT_FAILED" | "CONFIRMATION_FAILED" | "DELEGATION_FAILED" | "USER_CANCELLED" | "UNSUPPORTED";
44
- declare class OfframpError extends Error {
45
- readonly code: OfframpErrorCode;
46
- readonly step?: OfframpStep;
47
- readonly cause?: unknown;
48
- readonly txHash?: string;
49
- readonly depositId?: string;
50
- constructor(message: string, code: OfframpErrorCode, step?: OfframpStep, cause?: unknown, details?: {
51
- txHash?: string;
52
- depositId?: string;
53
- });
54
- }
55
-
56
- export { CurrencyInfo, DepositInfo, Offramp, OfframpError, type OfframpErrorCode, OfframpParams, OfframpResult, OfframpStep, OnProgress, Platform, PlatformInfo };
67
+ export { CurrencyInfo, DepositInfo, Offramp, OfframpParams, OfframpResult, OnProgress, Platform, PlatformInfo };
package/dist/index.d.ts CHANGED
@@ -1,38 +1,62 @@
1
1
  import { WalletClient } from 'viem';
2
- import { O as OfframpParams, a as OnProgress, b as OfframpResult, D as DepositInfo, P as PlatformInfo, c as Platform, C as CurrencyInfo, d as OfframpStep } from './types-DjkNvO-k.js';
3
- export { e as CURRENCIES, f as Currency, g as DepositStatus, h as OfframpProgress, i as PAYMENT_PLATFORMS, S as SUPPORTED_CURRENCIES } from './types-DjkNvO-k.js';
2
+ import { O as OfframpParams, a as OnProgress, b as OfframpResult, D as DepositInfo, P as PlatformInfo, c as Platform, C as CurrencyInfo } from './errors-DQqv1xfX.js';
3
+ export { d as CURRENCIES, e as Currency, f as DepositStatus, g as OfframpError, h as OfframpErrorCode, i as OfframpProgress, j as OfframpStep, k as PAYMENT_PLATFORMS, S as SUPPORTED_CURRENCIES } from './errors-DQqv1xfX.js';
4
4
 
5
5
  declare class Offramp {
6
6
  /**
7
7
  * Create an offramp deposit: approve USDC, register payee, create deposit,
8
8
  * confirm on-chain, and delegate to the vault. All in one call.
9
+ *
10
+ * @param walletClient - viem WalletClient with an account
11
+ * @param params - Deposit parameters (amount, platform, currency, identifier)
12
+ * @param onProgress - Optional callback for step-by-step progress updates
9
13
  */
10
14
  createDeposit(walletClient: WalletClient, params: OfframpParams, onProgress?: OnProgress): Promise<OfframpResult>;
11
15
  /**
12
- * Fetch deposits for a wallet address. Returns active, empty, and closed deposits
13
- * sorted by status (active first) then recency.
16
+ * Fetch all deposits for a wallet address. Read-only, no wallet needed.
17
+ * Returns active, empty, and closed deposits sorted by status then recency.
14
18
  */
15
19
  getDeposits(walletAddress: string): Promise<DepositInfo[]>;
16
20
  /**
17
- * Delegate an existing deposit to the vault. Use this to:
21
+ * Find a deposit by its transaction hash. Useful for recovering from
22
+ * CONFIRMATION_FAILED errors where you have a txHash but no depositId.
23
+ *
24
+ * @param walletAddress - The depositor's wallet address
25
+ * @param txHash - The transaction hash from createDeposit
26
+ */
27
+ getDepositByTxHash(walletAddress: string, txHash: string): Promise<DepositInfo | null>;
28
+ /**
29
+ * Delegate an existing deposit to the Delegate vault. Use this to:
18
30
  * - Retry after a DELEGATION_FAILED error
19
31
  * - Delegate a deposit created outside the SDK
20
32
  * - Delegate a deposit created via usdctofiat.xyz
33
+ *
34
+ * @param walletClient - viem WalletClient with the deposit owner's account
35
+ * @param depositId - The numeric deposit ID (not the composite escrow_id format)
21
36
  */
22
37
  delegateDeposit(walletClient: WalletClient, depositId: string, escrowAddress?: string): Promise<string>;
23
38
  /**
24
- * Withdraw and close a deposit, returning remaining USDC to the wallet.
39
+ * Withdraw remaining USDC and close a deposit.
40
+ *
41
+ * @param walletClient - viem WalletClient with the deposit owner's account
42
+ * @param depositId - The numeric deposit ID (not the composite escrow_id format)
25
43
  */
26
44
  withdrawDeposit(walletClient: WalletClient, depositId: string, escrowAddress?: string): Promise<string>;
27
- /** List available payment platforms and their supported currencies. */
45
+ /** List available payment platforms with currencies, labels, and format requirements. */
28
46
  getPlatforms(): PlatformInfo[];
29
47
  /** Get supported currencies for a specific platform. */
30
48
  getCurrencies(platform: Platform): string[];
31
- /** Get currency metadata (symbol, name, country code) for a currency code. */
49
+ /**
50
+ * Get currency metadata for UI rendering.
51
+ * @returns Symbol (€), full name (Euro), and country code (eu), or null if unsupported.
52
+ */
32
53
  getCurrencyInfo(code: string): CurrencyInfo | null;
33
54
  /** Get all supported currencies with metadata. */
34
55
  getAllCurrencies(): CurrencyInfo[];
35
- /** Validate a payment identifier for a platform without creating a deposit. */
56
+ /**
57
+ * Validate and normalize a payment identifier for a platform.
58
+ * Strips leading @/$ characters, validates format (email, IBAN, etc).
59
+ */
36
60
  validateIdentifier(platform: Platform, identifier: string): {
37
61
  valid: boolean;
38
62
  normalized: string;
@@ -40,17 +64,4 @@ declare class Offramp {
40
64
  };
41
65
  }
42
66
 
43
- type OfframpErrorCode = "VALIDATION" | "APPROVAL_FAILED" | "REGISTRATION_FAILED" | "DEPOSIT_FAILED" | "CONFIRMATION_FAILED" | "DELEGATION_FAILED" | "USER_CANCELLED" | "UNSUPPORTED";
44
- declare class OfframpError extends Error {
45
- readonly code: OfframpErrorCode;
46
- readonly step?: OfframpStep;
47
- readonly cause?: unknown;
48
- readonly txHash?: string;
49
- readonly depositId?: string;
50
- constructor(message: string, code: OfframpErrorCode, step?: OfframpStep, cause?: unknown, details?: {
51
- txHash?: string;
52
- depositId?: string;
53
- });
54
- }
55
-
56
- export { CurrencyInfo, DepositInfo, Offramp, OfframpError, type OfframpErrorCode, OfframpParams, OfframpResult, OfframpStep, OnProgress, Platform, PlatformInfo };
67
+ export { CurrencyInfo, DepositInfo, Offramp, OfframpParams, OfframpResult, OnProgress, Platform, PlatformInfo };
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  OfframpError,
5
5
  PAYMENT_PLATFORMS,
6
6
  SUPPORTED_CURRENCIES
7
- } from "./chunk-3WIEHXOV.js";
7
+ } from "./chunk-E4AJU3FA.js";
8
8
  export {
9
9
  CURRENCIES,
10
10
  Offramp,
package/dist/react.cjs CHANGED
@@ -31,6 +31,20 @@ var import_react = require("react");
31
31
  var import_viem2 = require("viem");
32
32
  var import_sdk4 = require("@zkp2p/sdk");
33
33
 
34
+ // src/types.ts
35
+ var PLATFORMS = [
36
+ "venmo",
37
+ "cashapp",
38
+ "chime",
39
+ "revolut",
40
+ "wise",
41
+ "mercadopago",
42
+ "zelle",
43
+ "paypal",
44
+ "monzo",
45
+ "n26"
46
+ ];
47
+
34
48
  // src/deposit.ts
35
49
  var import_viem = require("viem");
36
50
  var import_chains = require("viem/chains");
@@ -61,22 +75,6 @@ var PAYEE_REGISTRATION_TIMEOUT_MS = 8e3;
61
75
  // src/platforms.ts
62
76
  var import_sdk2 = require("@zkp2p/sdk");
63
77
  var import_zod = require("zod");
64
-
65
- // src/types.ts
66
- var PLATFORMS = [
67
- "venmo",
68
- "cashapp",
69
- "chime",
70
- "revolut",
71
- "wise",
72
- "mercadopago",
73
- "zelle",
74
- "paypal",
75
- "monzo",
76
- "n26"
77
- ];
78
-
79
- // src/platforms.ts
80
78
  var ZELLE_HASH_LOOKUP_NAMES = ["zelle", "zelle-bofa", "zelle-chase", "zelle-citi"];
81
79
  var PAYMENT_CATALOG = (0, import_sdk2.getPaymentMethodsCatalog)(BASE_CHAIN_ID, RUNTIME_ENV);
82
80
  var FALLBACK_CURRENCIES = {
@@ -590,6 +588,14 @@ async function createOfframpDeposit(walletClient, params, onProgress) {
590
588
  }
591
589
 
592
590
  // src/client.ts
591
+ var indexerClient = null;
592
+ function getIndexerService() {
593
+ if (!indexerClient) {
594
+ const client = new import_sdk4.IndexerClient(`${API_BASE_URL.replace(/\/+$/, "")}`);
595
+ indexerClient = new import_sdk4.IndexerDepositService(client);
596
+ }
597
+ return indexerClient;
598
+ }
593
599
  function toBigInt(value) {
594
600
  try {
595
601
  return BigInt(value || "0");
@@ -609,7 +615,7 @@ function resolveMethodNames(hashes) {
609
615
  const names = /* @__PURE__ */ new Set();
610
616
  for (const { paymentMethodHash } of hashes) {
611
617
  const normalized = paymentMethodHash.toLowerCase();
612
- for (const platform of ["venmo", "cashapp", "chime", "revolut", "wise", "mercadopago", "zelle", "paypal", "monzo", "n26"]) {
618
+ for (const platform of PLATFORMS) {
613
619
  const platformHashes = getPaymentMethodHashes(platform);
614
620
  if (platformHashes.some((h) => h.toLowerCase() === normalized)) {
615
621
  names.add(getPlatformConfig(platform).name);
@@ -619,63 +625,87 @@ function resolveMethodNames(hashes) {
619
625
  }
620
626
  return Array.from(names);
621
627
  }
628
+ function mapDeposit(d) {
629
+ const delegationState = (0, import_sdk4.classifyDelegationState)(
630
+ d.rateManagerId ?? void 0,
631
+ d.rateManagerAddress ?? void 0,
632
+ DELEGATE_RATE_MANAGER_ID,
633
+ RATE_MANAGER_REGISTRY_ADDRESS
634
+ );
635
+ return {
636
+ depositId: d.depositId,
637
+ compositeId: d.id,
638
+ txHash: d.txHash,
639
+ status: resolveStatus(d),
640
+ remainingUsdc: toUsdc(d.remainingDeposits),
641
+ outstandingUsdc: toUsdc(d.outstandingIntentAmount),
642
+ totalTakenUsdc: toUsdc(d.totalAmountTaken),
643
+ fulfilledIntents: d.fulfilledIntents ?? 0,
644
+ paymentMethods: resolveMethodNames(d.paymentMethods),
645
+ currencies: d.currencies.map((c) => {
646
+ const info = (0, import_sdk4.getCurrencyInfoFromHash)(c.currencyCode);
647
+ return info?.currencyCode ?? c.currencyCode;
648
+ }),
649
+ rateSource: d.currencies[0]?.rateSource || "unknown",
650
+ delegated: delegationState === "delegated_here",
651
+ escrowAddress: d.escrowAddress
652
+ };
653
+ }
654
+ function extractTxHash(result) {
655
+ if (typeof result === "string") return result;
656
+ if (result && typeof result === "object" && "hash" in result) return result.hash;
657
+ if (result && typeof result === "object" && "transactionHash" in result) return result.transactionHash;
658
+ throw new Error("Unexpected transaction result format");
659
+ }
622
660
  var Offramp = class {
623
661
  /**
624
662
  * Create an offramp deposit: approve USDC, register payee, create deposit,
625
663
  * confirm on-chain, and delegate to the vault. All in one call.
664
+ *
665
+ * @param walletClient - viem WalletClient with an account
666
+ * @param params - Deposit parameters (amount, platform, currency, identifier)
667
+ * @param onProgress - Optional callback for step-by-step progress updates
626
668
  */
627
669
  async createDeposit(walletClient, params, onProgress) {
628
670
  return createOfframpDeposit(walletClient, params, onProgress);
629
671
  }
630
672
  /**
631
- * Fetch deposits for a wallet address. Returns active, empty, and closed deposits
632
- * sorted by status (active first) then recency.
673
+ * Fetch all deposits for a wallet address. Read-only, no wallet needed.
674
+ * Returns active, empty, and closed deposits sorted by status then recency.
633
675
  */
634
676
  async getDeposits(walletAddress) {
635
- const client = createSdkClient(
636
- // Read-only client -- no wallet needed for indexer queries
637
- { account: void 0, chain: void 0, transport: void 0 }
638
- );
639
- const raw = await client.indexer.getDepositsWithRelations(
677
+ const service = getIndexerService();
678
+ const raw = await service.fetchDepositsWithRelations(
640
679
  { depositor: walletAddress },
641
680
  { limit: 100 }
642
681
  );
643
682
  const statusOrder = { active: 0, empty: 1, closed: 2 };
644
- return (raw || []).map((d) => {
645
- const delegationState = (0, import_sdk4.classifyDelegationState)(
646
- d.rateManagerId ?? void 0,
647
- d.rateManagerAddress ?? void 0,
648
- DELEGATE_RATE_MANAGER_ID,
649
- RATE_MANAGER_REGISTRY_ADDRESS
650
- );
651
- return {
652
- depositId: d.depositId,
653
- compositeId: d.id,
654
- status: resolveStatus(d),
655
- remainingUsdc: toUsdc(d.remainingDeposits),
656
- outstandingUsdc: toUsdc(d.outstandingIntentAmount),
657
- totalTakenUsdc: toUsdc(d.totalAmountTaken),
658
- fulfilledIntents: d.fulfilledIntents ?? 0,
659
- paymentMethods: resolveMethodNames(d.paymentMethods),
660
- currencies: d.currencies.map((c) => {
661
- const info = (0, import_sdk4.getCurrencyInfoFromHash)(c.currencyCode);
662
- return info?.currencyCode ?? c.currencyCode;
663
- }),
664
- rateSource: d.currencies[0]?.rateSource || "unknown",
665
- delegated: delegationState === "delegated_here",
666
- escrowAddress: d.escrowAddress
667
- };
668
- }).sort((a, b) => {
683
+ return (raw || []).map(mapDeposit).sort((a, b) => {
669
684
  const diff = statusOrder[a.status] - statusOrder[b.status];
670
685
  if (diff !== 0) return diff;
671
686
  return Number(BigInt(b.depositId) - BigInt(a.depositId));
672
687
  });
673
688
  }
674
689
  /**
675
- * Delegate an existing deposit to the vault. Use this to:
690
+ * Find a deposit by its transaction hash. Useful for recovering from
691
+ * CONFIRMATION_FAILED errors where you have a txHash but no depositId.
692
+ *
693
+ * @param walletAddress - The depositor's wallet address
694
+ * @param txHash - The transaction hash from createDeposit
695
+ */
696
+ async getDepositByTxHash(walletAddress, txHash) {
697
+ const deposits = await this.getDeposits(walletAddress);
698
+ const normalized = txHash.toLowerCase();
699
+ return deposits.find((d) => d.txHash?.toLowerCase() === normalized) ?? null;
700
+ }
701
+ /**
702
+ * Delegate an existing deposit to the Delegate vault. Use this to:
676
703
  * - Retry after a DELEGATION_FAILED error
677
704
  * - Delegate a deposit created outside the SDK
678
705
  * - Delegate a deposit created via usdctofiat.xyz
706
+ *
707
+ * @param walletClient - viem WalletClient with the deposit owner's account
708
+ * @param depositId - The numeric deposit ID (not the composite escrow_id format)
679
709
  */
680
710
  async delegateDeposit(walletClient, depositId, escrowAddress) {
681
711
  const client = createSdkClient(walletClient);
@@ -686,10 +716,13 @@ var Offramp = class {
686
716
  escrowAddress: escrowAddress || ESCROW_ADDRESS,
687
717
  txOverrides: { referrer: [REFERRER] }
688
718
  });
689
- return typeof result === "string" ? result : result.hash;
719
+ return extractTxHash(result);
690
720
  }
691
721
  /**
692
- * Withdraw and close a deposit, returning remaining USDC to the wallet.
722
+ * Withdraw remaining USDC and close a deposit.
723
+ *
724
+ * @param walletClient - viem WalletClient with the deposit owner's account
725
+ * @param depositId - The numeric deposit ID (not the composite escrow_id format)
693
726
  */
694
727
  async withdrawDeposit(walletClient, depositId, escrowAddress) {
695
728
  const client = createSdkClient(walletClient);
@@ -698,9 +731,9 @@ var Offramp = class {
698
731
  escrowAddress: escrowAddress || ESCROW_ADDRESS,
699
732
  txOverrides: { referrer: [REFERRER] }
700
733
  });
701
- return typeof result === "string" ? result : result.hash;
734
+ return extractTxHash(result);
702
735
  }
703
- /** List available payment platforms and their supported currencies. */
736
+ /** List available payment platforms with currencies, labels, and format requirements. */
704
737
  getPlatforms() {
705
738
  return getPlatforms();
706
739
  }
@@ -708,7 +741,10 @@ var Offramp = class {
708
741
  getCurrencies(platform) {
709
742
  return getCurrencies(platform);
710
743
  }
711
- /** Get currency metadata (symbol, name, country code) for a currency code. */
744
+ /**
745
+ * Get currency metadata for UI rendering.
746
+ * @returns Symbol (€), full name (Euro), and country code (eu), or null if unsupported.
747
+ */
712
748
  getCurrencyInfo(code) {
713
749
  const info = import_sdk4.currencyInfo[code];
714
750
  if (!info) return null;
@@ -725,7 +761,10 @@ var Offramp = class {
725
761
  return this.getCurrencyInfo(code);
726
762
  }).filter(Boolean);
727
763
  }
728
- /** Validate a payment identifier for a platform without creating a deposit. */
764
+ /**
765
+ * Validate and normalize a payment identifier for a platform.
766
+ * Strips leading @/$ characters, validates format (email, IBAN, etc).
767
+ */
729
768
  validateIdentifier(platform, identifier) {
730
769
  return validateIdentifier(platform, identifier);
731
770
  }
@@ -756,7 +795,7 @@ function useOfframp() {
756
795
  }, []);
757
796
  const createDeposit = (0, import_react.useCallback)(
758
797
  async (walletClient, params) => {
759
- if (lockRef.current) throw new Error("Deposit already in progress");
798
+ if (lockRef.current) throw new OfframpError("Deposit already in progress", "VALIDATION");
760
799
  lockRef.current = true;
761
800
  setIsLoading(true);
762
801
  setError(null);
@@ -773,8 +812,8 @@ function useOfframp() {
773
812
  setTxHash(result.txHash);
774
813
  return result;
775
814
  } catch (err) {
776
- const message = err instanceof Error ? err.message : "Offramp failed";
777
- setError(message);
815
+ const offrampError = err instanceof OfframpError ? err : new OfframpError(err instanceof Error ? err.message : "Offramp failed", "DEPOSIT_FAILED");
816
+ setError(offrampError);
778
817
  throw err;
779
818
  } finally {
780
819
  setIsLoading(false);
@@ -783,21 +822,7 @@ function useOfframp() {
783
822
  },
784
823
  []
785
824
  );
786
- const getDeposits = (0, import_react.useCallback)(async (walletAddress) => {
787
- return getOfframp().getDeposits(walletAddress);
788
- }, []);
789
- const delegateDeposit = (0, import_react.useCallback)(
790
- async (walletClient, id, escrowAddress) => {
791
- return getOfframp().delegateDeposit(walletClient, id, escrowAddress);
792
- },
793
- []
794
- );
795
- const withdrawDeposit = (0, import_react.useCallback)(
796
- async (walletClient, id, escrowAddress) => {
797
- return getOfframp().withdrawDeposit(walletClient, id, escrowAddress);
798
- },
799
- []
800
- );
825
+ const o = getOfframp();
801
826
  return {
802
827
  step,
803
828
  txHash,
@@ -805,14 +830,15 @@ function useOfframp() {
805
830
  error,
806
831
  isLoading,
807
832
  createDeposit,
808
- getDeposits,
809
- delegateDeposit,
810
- withdrawDeposit,
833
+ getDeposits: (0, import_react.useCallback)((addr) => o.getDeposits(addr), [o]),
834
+ getDepositByTxHash: (0, import_react.useCallback)((addr, hash) => o.getDepositByTxHash(addr, hash), [o]),
835
+ delegateDeposit: (0, import_react.useCallback)((wc, id, esc) => o.delegateDeposit(wc, id, esc), [o]),
836
+ withdrawDeposit: (0, import_react.useCallback)((wc, id, esc) => o.withdrawDeposit(wc, id, esc), [o]),
811
837
  reset,
812
838
  getPlatforms,
813
839
  getCurrencies,
814
- getCurrencyInfo: (code) => getOfframp().getCurrencyInfo(code),
815
- getAllCurrencies: () => getOfframp().getAllCurrencies(),
840
+ getCurrencyInfo: (0, import_react.useCallback)((code) => o.getCurrencyInfo(code), [o]),
841
+ getAllCurrencies: (0, import_react.useCallback)(() => o.getAllCurrencies(), [o]),
816
842
  validateIdentifier
817
843
  };
818
844
  }