@usdctofiat/offramp 0.1.5 → 0.2.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.
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-AGP66RQ5.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,15 @@ 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 endpoint = (0, import_sdk4.defaultIndexerEndpoint)("PRODUCTION");
595
+ const client = new import_sdk4.IndexerClient(endpoint);
596
+ indexerClient = new import_sdk4.IndexerDepositService(client);
597
+ }
598
+ return indexerClient;
599
+ }
593
600
  function toBigInt(value) {
594
601
  try {
595
602
  return BigInt(value || "0");
@@ -609,7 +616,7 @@ function resolveMethodNames(hashes) {
609
616
  const names = /* @__PURE__ */ new Set();
610
617
  for (const { paymentMethodHash } of hashes) {
611
618
  const normalized = paymentMethodHash.toLowerCase();
612
- for (const platform of ["venmo", "cashapp", "chime", "revolut", "wise", "mercadopago", "zelle", "paypal", "monzo", "n26"]) {
619
+ for (const platform of PLATFORMS) {
613
620
  const platformHashes = getPaymentMethodHashes(platform);
614
621
  if (platformHashes.some((h) => h.toLowerCase() === normalized)) {
615
622
  names.add(getPlatformConfig(platform).name);
@@ -619,63 +626,87 @@ function resolveMethodNames(hashes) {
619
626
  }
620
627
  return Array.from(names);
621
628
  }
629
+ function mapDeposit(d) {
630
+ const delegationState = (0, import_sdk4.classifyDelegationState)(
631
+ d.rateManagerId ?? void 0,
632
+ d.rateManagerAddress ?? void 0,
633
+ DELEGATE_RATE_MANAGER_ID,
634
+ RATE_MANAGER_REGISTRY_ADDRESS
635
+ );
636
+ return {
637
+ depositId: d.depositId,
638
+ compositeId: d.id,
639
+ txHash: d.txHash,
640
+ status: resolveStatus(d),
641
+ remainingUsdc: toUsdc(d.remainingDeposits),
642
+ outstandingUsdc: toUsdc(d.outstandingIntentAmount),
643
+ totalTakenUsdc: toUsdc(d.totalAmountTaken),
644
+ fulfilledIntents: d.fulfilledIntents ?? 0,
645
+ paymentMethods: resolveMethodNames(d.paymentMethods),
646
+ currencies: d.currencies.map((c) => {
647
+ const info = (0, import_sdk4.getCurrencyInfoFromHash)(c.currencyCode);
648
+ return info?.currencyCode ?? c.currencyCode;
649
+ }),
650
+ rateSource: d.currencies[0]?.rateSource || "unknown",
651
+ delegated: delegationState === "delegated_here",
652
+ escrowAddress: d.escrowAddress
653
+ };
654
+ }
655
+ function extractTxHash(result) {
656
+ if (typeof result === "string") return result;
657
+ if (result && typeof result === "object" && "hash" in result) return result.hash;
658
+ if (result && typeof result === "object" && "transactionHash" in result) return result.transactionHash;
659
+ throw new Error("Unexpected transaction result format");
660
+ }
622
661
  var Offramp = class {
623
662
  /**
624
663
  * Create an offramp deposit: approve USDC, register payee, create deposit,
625
664
  * confirm on-chain, and delegate to the vault. All in one call.
665
+ *
666
+ * @param walletClient - viem WalletClient with an account
667
+ * @param params - Deposit parameters (amount, platform, currency, identifier)
668
+ * @param onProgress - Optional callback for step-by-step progress updates
626
669
  */
627
670
  async createDeposit(walletClient, params, onProgress) {
628
671
  return createOfframpDeposit(walletClient, params, onProgress);
629
672
  }
630
673
  /**
631
- * Fetch deposits for a wallet address. Returns active, empty, and closed deposits
632
- * sorted by status (active first) then recency.
674
+ * Fetch all deposits for a wallet address. Read-only, no wallet needed.
675
+ * Returns active, empty, and closed deposits sorted by status then recency.
633
676
  */
634
677
  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(
678
+ const service = getIndexerService();
679
+ const raw = await service.fetchDepositsWithRelations(
640
680
  { depositor: walletAddress },
641
681
  { limit: 100 }
642
682
  );
643
683
  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) => {
684
+ return (raw || []).map(mapDeposit).sort((a, b) => {
669
685
  const diff = statusOrder[a.status] - statusOrder[b.status];
670
686
  if (diff !== 0) return diff;
671
687
  return Number(BigInt(b.depositId) - BigInt(a.depositId));
672
688
  });
673
689
  }
674
690
  /**
675
- * Delegate an existing deposit to the vault. Use this to:
691
+ * Find a deposit by its transaction hash. Useful for recovering from
692
+ * CONFIRMATION_FAILED errors where you have a txHash but no depositId.
693
+ *
694
+ * @param walletAddress - The depositor's wallet address
695
+ * @param txHash - The transaction hash from createDeposit
696
+ */
697
+ async getDepositByTxHash(walletAddress, txHash) {
698
+ const deposits = await this.getDeposits(walletAddress);
699
+ const normalized = txHash.toLowerCase();
700
+ return deposits.find((d) => d.txHash?.toLowerCase() === normalized) ?? null;
701
+ }
702
+ /**
703
+ * Delegate an existing deposit to the Delegate vault. Use this to:
676
704
  * - Retry after a DELEGATION_FAILED error
677
705
  * - Delegate a deposit created outside the SDK
678
706
  * - Delegate a deposit created via usdctofiat.xyz
707
+ *
708
+ * @param walletClient - viem WalletClient with the deposit owner's account
709
+ * @param depositId - The numeric deposit ID (not the composite escrow_id format)
679
710
  */
680
711
  async delegateDeposit(walletClient, depositId, escrowAddress) {
681
712
  const client = createSdkClient(walletClient);
@@ -686,10 +717,13 @@ var Offramp = class {
686
717
  escrowAddress: escrowAddress || ESCROW_ADDRESS,
687
718
  txOverrides: { referrer: [REFERRER] }
688
719
  });
689
- return typeof result === "string" ? result : result.hash;
720
+ return extractTxHash(result);
690
721
  }
691
722
  /**
692
- * Withdraw and close a deposit, returning remaining USDC to the wallet.
723
+ * Withdraw remaining USDC and close a deposit.
724
+ *
725
+ * @param walletClient - viem WalletClient with the deposit owner's account
726
+ * @param depositId - The numeric deposit ID (not the composite escrow_id format)
693
727
  */
694
728
  async withdrawDeposit(walletClient, depositId, escrowAddress) {
695
729
  const client = createSdkClient(walletClient);
@@ -698,9 +732,9 @@ var Offramp = class {
698
732
  escrowAddress: escrowAddress || ESCROW_ADDRESS,
699
733
  txOverrides: { referrer: [REFERRER] }
700
734
  });
701
- return typeof result === "string" ? result : result.hash;
735
+ return extractTxHash(result);
702
736
  }
703
- /** List available payment platforms and their supported currencies. */
737
+ /** List available payment platforms with currencies, labels, and format requirements. */
704
738
  getPlatforms() {
705
739
  return getPlatforms();
706
740
  }
@@ -708,7 +742,10 @@ var Offramp = class {
708
742
  getCurrencies(platform) {
709
743
  return getCurrencies(platform);
710
744
  }
711
- /** Get currency metadata (symbol, name, country code) for a currency code. */
745
+ /**
746
+ * Get currency metadata for UI rendering.
747
+ * @returns Symbol (€), full name (Euro), and country code (eu), or null if unsupported.
748
+ */
712
749
  getCurrencyInfo(code) {
713
750
  const info = import_sdk4.currencyInfo[code];
714
751
  if (!info) return null;
@@ -725,7 +762,10 @@ var Offramp = class {
725
762
  return this.getCurrencyInfo(code);
726
763
  }).filter(Boolean);
727
764
  }
728
- /** Validate a payment identifier for a platform without creating a deposit. */
765
+ /**
766
+ * Validate and normalize a payment identifier for a platform.
767
+ * Strips leading @/$ characters, validates format (email, IBAN, etc).
768
+ */
729
769
  validateIdentifier(platform, identifier) {
730
770
  return validateIdentifier(platform, identifier);
731
771
  }
@@ -756,7 +796,7 @@ function useOfframp() {
756
796
  }, []);
757
797
  const createDeposit = (0, import_react.useCallback)(
758
798
  async (walletClient, params) => {
759
- if (lockRef.current) throw new Error("Deposit already in progress");
799
+ if (lockRef.current) throw new OfframpError("Deposit already in progress", "VALIDATION");
760
800
  lockRef.current = true;
761
801
  setIsLoading(true);
762
802
  setError(null);
@@ -773,8 +813,8 @@ function useOfframp() {
773
813
  setTxHash(result.txHash);
774
814
  return result;
775
815
  } catch (err) {
776
- const message = err instanceof Error ? err.message : "Offramp failed";
777
- setError(message);
816
+ const offrampError = err instanceof OfframpError ? err : new OfframpError(err instanceof Error ? err.message : "Offramp failed", "DEPOSIT_FAILED");
817
+ setError(offrampError);
778
818
  throw err;
779
819
  } finally {
780
820
  setIsLoading(false);
@@ -783,21 +823,7 @@ function useOfframp() {
783
823
  },
784
824
  []
785
825
  );
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
- );
826
+ const o = getOfframp();
801
827
  return {
802
828
  step,
803
829
  txHash,
@@ -805,14 +831,15 @@ function useOfframp() {
805
831
  error,
806
832
  isLoading,
807
833
  createDeposit,
808
- getDeposits,
809
- delegateDeposit,
810
- withdrawDeposit,
834
+ getDeposits: (0, import_react.useCallback)((addr) => o.getDeposits(addr), [o]),
835
+ getDepositByTxHash: (0, import_react.useCallback)((addr, hash) => o.getDepositByTxHash(addr, hash), [o]),
836
+ delegateDeposit: (0, import_react.useCallback)((wc, id, esc) => o.delegateDeposit(wc, id, esc), [o]),
837
+ withdrawDeposit: (0, import_react.useCallback)((wc, id, esc) => o.withdrawDeposit(wc, id, esc), [o]),
811
838
  reset,
812
839
  getPlatforms,
813
840
  getCurrencies,
814
- getCurrencyInfo: (code) => getOfframp().getCurrencyInfo(code),
815
- getAllCurrencies: () => getOfframp().getAllCurrencies(),
841
+ getCurrencyInfo: (0, import_react.useCallback)((code) => o.getCurrencyInfo(code), [o]),
842
+ getAllCurrencies: (0, import_react.useCallback)(() => o.getAllCurrencies(), [o]),
816
843
  validateIdentifier
817
844
  };
818
845
  }