@coin-voyage/shared 0.0.1 → 0.0.2

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 (97) hide show
  1. package/dist/api/config.d.ts +1 -0
  2. package/dist/api/config.js +3 -0
  3. package/dist/api/config.js.map +1 -0
  4. package/dist/api/fetcher.d.ts +7 -0
  5. package/{src/api/fetcher.ts → dist/api/fetcher.js} +10 -17
  6. package/dist/api/fetcher.js.map +1 -0
  7. package/dist/api/index.d.ts +3 -0
  8. package/dist/api/index.js +4 -0
  9. package/dist/api/index.js.map +1 -0
  10. package/{src/api/pay-order.ts → dist/api/pay-order.d.ts} +114 -230
  11. package/dist/api/pay-order.js +238 -0
  12. package/dist/api/pay-order.js.map +1 -0
  13. package/dist/common/assert.d.ts +3 -0
  14. package/dist/common/assert.js +14 -0
  15. package/dist/common/assert.js.map +1 -0
  16. package/dist/common/chainExplorer.d.ts +2 -0
  17. package/dist/common/chainExplorer.js +26 -0
  18. package/dist/common/chainExplorer.js.map +1 -0
  19. package/dist/common/chains.d.ts +31 -0
  20. package/dist/common/chains.js +121 -0
  21. package/dist/common/chains.js.map +1 -0
  22. package/dist/common/currencies.d.ts +14 -0
  23. package/dist/common/currencies.js +31 -0
  24. package/dist/common/currencies.js.map +1 -0
  25. package/dist/common/debug.d.ts +1 -0
  26. package/dist/common/debug.js +11 -0
  27. package/dist/common/debug.js.map +1 -0
  28. package/dist/common/format.d.ts +1 -0
  29. package/dist/common/format.js +4 -0
  30. package/dist/common/format.js.map +1 -0
  31. package/dist/common/i18n/index.d.ts +6 -0
  32. package/dist/common/i18n/index.js +12 -0
  33. package/dist/common/i18n/index.js.map +1 -0
  34. package/dist/common/i18n/languages/en.d.ts +18 -0
  35. package/dist/common/i18n/languages/en.js +21 -0
  36. package/dist/common/i18n/languages/en.js.map +1 -0
  37. package/dist/common/i18n/languages/es.d.ts +2 -0
  38. package/dist/common/i18n/languages/es.js +21 -0
  39. package/dist/common/i18n/languages/es.js.map +1 -0
  40. package/dist/common/index.d.ts +12 -0
  41. package/dist/common/index.js +13 -0
  42. package/dist/common/index.js.map +1 -0
  43. package/dist/common/model.d.ts +22 -0
  44. package/dist/common/model.js +17 -0
  45. package/dist/common/model.js.map +1 -0
  46. package/{src/common/organization.ts → dist/common/organization.d.ts} +1 -2
  47. package/dist/common/organization.js +2 -0
  48. package/dist/common/organization.js.map +1 -0
  49. package/dist/common/pay.d.ts +284 -0
  50. package/dist/common/pay.js +82 -0
  51. package/dist/common/pay.js.map +1 -0
  52. package/dist/common/retryBackoff.d.ts +1 -0
  53. package/dist/common/retryBackoff.js +22 -0
  54. package/dist/common/retryBackoff.js.map +1 -0
  55. package/dist/common/time.d.ts +11 -0
  56. package/dist/common/time.js +62 -0
  57. package/dist/common/time.js.map +1 -0
  58. package/dist/hooks/index.js +2 -0
  59. package/dist/hooks/index.js.map +1 -0
  60. package/dist/hooks/use-is-mobile.d.ts +1 -0
  61. package/dist/hooks/use-is-mobile.js +14 -0
  62. package/dist/hooks/use-is-mobile.js.map +1 -0
  63. package/dist/utils/account.d.ts +1 -0
  64. package/dist/utils/account.js +4 -0
  65. package/dist/utils/account.js.map +1 -0
  66. package/dist/utils/browser.d.ts +6 -0
  67. package/dist/utils/browser.js +22 -0
  68. package/dist/utils/browser.js.map +1 -0
  69. package/dist/utils/index.d.ts +3 -0
  70. package/dist/utils/index.js +4 -0
  71. package/dist/utils/index.js.map +1 -0
  72. package/dist/utils/plurar.d.ts +1 -0
  73. package/dist/utils/plurar.js +7 -0
  74. package/dist/utils/plurar.js.map +1 -0
  75. package/package.json +6 -6
  76. package/src/api/config.ts +0 -2
  77. package/src/api/index.ts +0 -3
  78. package/src/common/assert.ts +0 -21
  79. package/src/common/chainExplorer.ts +0 -27
  80. package/src/common/chains.ts +0 -130
  81. package/src/common/currencies.ts +0 -42
  82. package/src/common/debug.ts +0 -11
  83. package/src/common/format.ts +0 -3
  84. package/src/common/i18n/index.ts +0 -18
  85. package/src/common/i18n/languages/en.ts +0 -38
  86. package/src/common/i18n/languages/es.ts +0 -38
  87. package/src/common/index.ts +0 -12
  88. package/src/common/model.ts +0 -43
  89. package/src/common/pay.ts +0 -194
  90. package/src/common/retryBackoff.ts +0 -24
  91. package/src/common/time.ts +0 -78
  92. package/src/hooks/use-is-mobile.ts +0 -16
  93. package/src/utils/account.ts +0 -3
  94. package/src/utils/browser.ts +0 -24
  95. package/src/utils/index.ts +0 -3
  96. package/src/utils/plurar.ts +0 -5
  97. /package/{src/hooks/index.ts → dist/hooks/index.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export declare const API_URL = "https://dev-api.coinvoyage.io";
@@ -0,0 +1,3 @@
1
+ export const API_URL = "https://dev-api.coinvoyage.io";
2
+ // export const API_URL = "http://localhost:8000"
3
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/api/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,+BAA+B,CAAA;AACtD,iDAAiD"}
@@ -0,0 +1,7 @@
1
+ type FetchApiOptions = {
2
+ path: string;
3
+ options?: RequestInit;
4
+ throwOnFailure?: boolean;
5
+ };
6
+ export declare function fetchApi<T>(opts: FetchApiOptions): Promise<T | undefined>;
7
+ export {};
@@ -1,12 +1,5 @@
1
1
  import { API_URL } from "./config";
2
-
3
- type FetchApiOptions = {
4
- path: string;
5
- options?: RequestInit;
6
- throwOnFailure?: boolean;
7
- }
8
-
9
- export async function fetchApi<T>(opts: FetchApiOptions): Promise<T | undefined> {
2
+ export async function fetchApi(opts) {
10
3
  try {
11
4
  const response = await fetch(`${API_URL}/${opts.path}`, {
12
5
  ...opts.options,
@@ -18,21 +11,21 @@ export async function fetchApi<T>(opts: FetchApiOptions): Promise<T | undefined>
18
11
  });
19
12
  if (!response.ok) {
20
13
  const text = await response.text();
21
- console.error(
22
- JSON.stringify({
23
- path: opts.path,
24
- status: response.status,
25
- statusText: response.statusText,
26
- details: text
27
- })
28
- );
14
+ console.error(JSON.stringify({
15
+ path: opts.path,
16
+ status: response.status,
17
+ statusText: response.statusText,
18
+ details: text
19
+ }));
29
20
  return;
30
21
  }
31
22
  return await response.json();
32
- } catch (error: any) {
23
+ }
24
+ catch (error) {
33
25
  console.error(`path: ${opts.path}, message: ${error.message}`);
34
26
  if (opts.throwOnFailure) {
35
27
  throw error;
36
28
  }
37
29
  }
38
30
  }
31
+ //# sourceMappingURL=fetcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.js","sourceRoot":"","sources":["../../src/api/fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAQnC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAI,IAAqB;IACnD,IAAI,CAAC;QACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE;YACpD,GAAG,IAAI,CAAC,OAAO;YACf,OAAO,EAAE;gBACL,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO;gBACxB,cAAc,EAAE,kBAAkB;gBAClC,iBAAiB,EAAE,mBAAmB;aACzC;SACJ,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,OAAO,CAAC,KAAK,CACT,IAAI,CAAC,SAAS,CAAC;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;gBAC/B,OAAO,EAAE,IAAI;aAChB,CAAC,CACL,CAAC;YACF,OAAO;QACX,CAAC;QACD,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IACjC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,SAAS,IAAI,CAAC,IAAI,cAAc,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC/D,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./config";
2
+ export * from "./fetcher";
3
+ export * from "./pay-order";
@@ -0,0 +1,4 @@
1
+ export * from "./config";
2
+ export * from "./fetcher";
3
+ export * from "./pay-order";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA"}
@@ -1,67 +1,53 @@
1
- import { z } from "zod";
2
- import { ChainId, ChainType, CurrencyAmount, CurrencyBase, CurrencyWithAmount, CurrencyWithBalance, PayOrder, PayOrderMetadata, PayOrderMode, PayOrderStatus, zDepositPayOrder, zPayOrderMetadata } from "../common/index";
3
- import { fetchApi } from "./fetcher";
4
-
1
+ import { ChainId, ChainType, CurrencyAmount, CurrencyBase, CurrencyWithAmount, CurrencyWithBalance, PayOrder, PayOrderMetadata, PayOrderStatus } from "../common/index";
5
2
  /**
6
3
  * Fetches a PayOrder by its ID.
7
- *
4
+ *
8
5
  * Retrieves a PayOrder object from the API using the provided payOrderId.
9
6
  * This function requires an API key for authentication.
10
- *
7
+ *
11
8
  * @param {string} payOrderId - The unique identifier of the PayOrder.
12
9
  * @param {string} apiKey - The API key required for authentication.
13
10
  * @returns {Promise<PayOrder | undefined>} - The PayOrder object if the request is successful.
14
- *
11
+ *
15
12
  * @example
16
13
  * const apiKey = 'yourApiKey';
17
14
  * const payOrder = await getPayOrder('123456', apiKey);
18
15
  */
19
- export async function getPayOrder(payOrderId: string, apiKey: string): Promise<PayOrder | undefined> {
20
- return fetchApi<PayOrder>({
21
- path: `pay-orders/${payOrderId}`,
22
- options: {
23
- headers: {
24
- "X-API-KEY": apiKey
25
- }
26
- }
27
- })
28
- }
29
-
16
+ export declare function getPayOrder(payOrderId: string, apiKey: string): Promise<PayOrder | undefined>;
30
17
  /** PayOrder parameters. The payOrder is created only after user taps pay. */
31
18
  export interface DepositPayOrderParams {
32
- /**
33
- * Metadata to attach to the payOrder.
34
- */
35
- metadata?: PayOrderMetadata
36
- /**
37
- * Value in USD received from the Deposit.
38
- */
39
- destination_value_usd?: number
40
- /**
41
- * Desired output token + chain.
42
- */
43
- destination_currency: CurrencyBase
44
- /**
45
- * Output amount to deposit.
46
- */
47
- destination_amount?: string
48
- /**
49
- * Receiving address for the deposit.
50
- */
51
- receiving_address: string
19
+ /**
20
+ * Metadata to attach to the payOrder.
21
+ */
22
+ metadata?: PayOrderMetadata;
23
+ /**
24
+ * Value in USD received from the Deposit.
25
+ */
26
+ destination_value_usd?: number;
27
+ /**
28
+ * Desired output token + chain.
29
+ */
30
+ destination_currency: CurrencyBase;
31
+ /**
32
+ * Output amount to deposit.
33
+ */
34
+ destination_amount?: string;
35
+ /**
36
+ * Receiving address for the deposit.
37
+ */
38
+ receiving_address: string;
52
39
  }
53
-
54
40
  /**
55
41
  * Creates a `DEPOSIT` type PayOrder.
56
- *
42
+ *
57
43
  * Generates a PayOrder of type `DEPOSIT` with the provided parameters.
58
44
  * This function ensures the request parameters are valid using a schema validation.
59
- *
45
+ *
60
46
  * @param {DepositPayOrderParams} createOrderParams - Parameters required to create a deposit PayOrder.
61
47
  * @param {string} apiKey - The API key required for authentication.
62
48
  * @param {boolean} [throwOnFailure] - Whether to throw an error if the request fails.
63
49
  * @returns {Promise<PayOrder | undefined>} - The PayOrder object if the request is successful.
64
- *
50
+ *
65
51
  * @example
66
52
  * const apiKey = 'yourApiKey';
67
53
  * const depositOrderParams = {
@@ -71,76 +57,54 @@ export interface DepositPayOrderParams {
71
57
  * };
72
58
  * const depositPayOrder = await createDepositPayOrder(depositOrderParams, apiKey);
73
59
  */
74
- export async function createDepositPayOrder(createOrderParams: DepositPayOrderParams, apiKey: string, throwOnFailure?: boolean): Promise<PayOrder | undefined> {
75
- const result = zDepositPayOrder.safeParse(createOrderParams);
76
- if (!result.success) {
77
- return
78
- }
79
-
80
- return fetchApi<PayOrder>({
81
- path: `pay-orders`, options: {
82
- method: "POST",
83
- body: JSON.stringify({
84
- mode: PayOrderMode.DEPOSIT,
85
- ...createOrderParams
86
- }),
87
- headers: {
88
- "X-API-KEY": apiKey
89
- }
90
- },
91
- throwOnFailure: throwOnFailure
92
- })
93
- }
94
-
60
+ export declare function createDepositPayOrder(createOrderParams: DepositPayOrderParams, apiKey: string, throwOnFailure?: boolean): Promise<PayOrder | undefined>;
95
61
  export type SalePayOrderParams = {
96
- /**
97
- * Metadata to attach to the payOrder.
98
- */
99
- metadata?: PayOrderMetadata
100
- /**
101
- * Expected value in USD to be received from the Sale.
102
- */
103
- destination_value_usd: number
104
- /**
105
- * Expected token on what chain to receive the value from the Sale.
106
- */
107
- destination_currency?: CurrencyBase
108
- /**
109
- * Expected receiving address to receive the value from the Sale.
110
- */
111
- receiving_address?: string
62
+ /**
63
+ * Metadata to attach to the payOrder.
64
+ */
65
+ metadata?: PayOrderMetadata;
66
+ /**
67
+ * Expected value in USD to be received from the Sale.
68
+ */
69
+ destination_value_usd: number;
70
+ /**
71
+ * Expected token on what chain to receive the value from the Sale.
72
+ */
73
+ destination_currency?: CurrencyBase;
74
+ /**
75
+ * Expected receiving address to receive the value from the Sale.
76
+ */
77
+ receiving_address?: string;
112
78
  } | {
113
- /**
114
- * Metadata to attach to the payOrder.
115
- */
116
- metadata?: PayOrderMetadata
117
- /**
118
- * Expected token on what chain to receive the value from the Sale.
119
- */
120
- destination_currency: CurrencyBase
121
- /**
122
- * Expected amount to be received from the Sale.
123
- */
124
- destination_amount: string
125
- /**
126
- * Expected receiving address to receive the value from the Sale.
127
- */
128
- receiving_address?: string
129
- }
130
-
131
-
79
+ /**
80
+ * Metadata to attach to the payOrder.
81
+ */
82
+ metadata?: PayOrderMetadata;
83
+ /**
84
+ * Expected token on what chain to receive the value from the Sale.
85
+ */
86
+ destination_currency: CurrencyBase;
87
+ /**
88
+ * Expected amount to be received from the Sale.
89
+ */
90
+ destination_amount: string;
91
+ /**
92
+ * Expected receiving address to receive the value from the Sale.
93
+ */
94
+ receiving_address?: string;
95
+ };
132
96
  /**
133
97
  * Generates a `sale` type PayOrder.
134
- *
98
+ *
135
99
  * Creates a `sale` type PayOrder with a fixed valueOut `destination_value_usd`.
136
100
  * This function should be executed
137
- *
138
- * and a SHA-512 hash signature of the concatenated API key, secret, and timestamp.
139
- *
101
+ *
102
+ * and a SHA-512 hash signature of the concatenated API key, secret, and timestamp.
103
+ *
140
104
  * @param {SalePayOrderParams} payOrderParams - destination_value_usd and metadata for this payOrder.
141
105
  * @param {string} signature - signature generated by the `generateAuthorizationSignature` function.
142
106
  * @returns {PayOrder | undefined} - A PayOrder object if the request was successful.
143
- *
107
+ *
144
108
  * @example
145
109
  * const apiKey = 'yourApiKey';
146
110
  * const apiSecret = 'yourApiSecret';
@@ -161,49 +125,23 @@ export type SalePayOrderParams = {
161
125
  * ]
162
126
  * }}, authSignature)
163
127
  */
164
- export async function createSalePayOrder(createOrderParams: SalePayOrderParams, signature: string): Promise<PayOrder | undefined> {
165
- try {
166
- if (createOrderParams?.metadata) {
167
- zPayOrderMetadata.parse(createOrderParams.metadata);
168
- }
169
- return fetchApi<PayOrder>({
170
- path: `pay-orders`, options: {
171
- method: "POST",
172
- body: JSON.stringify({
173
- mode: PayOrderMode.SALE,
174
- ...createOrderParams
175
- }),
176
- headers: {
177
- "Authorization": signature
178
- }
179
- }
180
- })
181
- }
182
- catch (err) {
183
- if (err instanceof z.ZodError) {
184
- throw new Error(err.errors.map(e => e.message).join(", "))
185
- }
186
- throw err
187
- }
188
- }
189
-
128
+ export declare function createSalePayOrder(createOrderParams: SalePayOrderParams, signature: string): Promise<PayOrder | undefined>;
190
129
  export type PayOrderQuoteParams = {
191
- wallet_address: string
192
- chain_type: ChainType,
193
- chain_id?: ChainId
194
- }
195
-
130
+ wallet_address: string;
131
+ chain_type: ChainType;
132
+ chain_id?: ChainId;
133
+ };
196
134
  /**
197
135
  * Generates a PayOrder Quote.
198
- *
136
+ *
199
137
  * Creates a PayOrder Quote for an existing PayOrder by providing wallet information and chain details.
200
138
  * This function requires an API key for authentication.
201
- *
139
+ *
202
140
  * @param {string} orderId - The unique identifier of the PayOrder for which the quote is requested.
203
141
  * @param {PayOrderQuoteParams} quoteParams - Contains `wallet_address`, `chain_type`, chain_id`.
204
142
  * @param {string} apiKey - The API key for authorization.
205
143
  * @returns {CurrencyWithBalance[] | undefined} - An array of PayTokens if the request was successful.
206
- *
144
+ *
207
145
  * @example
208
146
  * const orderId = 'existingOrderId';
209
147
  * const apiKey = 'yourApiKey';
@@ -212,66 +150,48 @@ export type PayOrderQuoteParams = {
212
150
  * chain_type: ChainType.EVM,
213
151
  * chain_id: 1 // Ethereum Mainnet
214
152
  * };
215
- *
153
+ *
216
154
  * const payOrderQuote = await payOrderQuote(orderId, quoteParams, apiKey);
217
155
 
218
156
  */
219
- export async function payOrderQuote(orderId: string, quoteParams: PayOrderQuoteParams, apiKey: string): Promise<CurrencyWithBalance[] | undefined> {
220
- return fetchApi<CurrencyWithBalance[]>({
221
- path: `pay-orders/${orderId}/quote`, options: {
222
- method: "POST",
223
- body: JSON.stringify({
224
- ...quoteParams
225
- }),
226
- headers: {
227
- "X-API-KEY": apiKey
228
- },
229
- }
230
- })
231
- }
232
-
233
-
157
+ export declare function payOrderQuote(orderId: string, quoteParams: PayOrderQuoteParams, apiKey: string): Promise<CurrencyWithBalance[] | undefined>;
234
158
  export type PaymentDetailsParams = {
235
- payOrderId: string
236
- outTokenAddress?: string
237
- outChainId: ChainId
238
- refundAddress: string
239
- apiKey: string
240
- }
241
-
159
+ payOrderId: string;
160
+ outTokenAddress?: string;
161
+ outChainId: ChainId;
162
+ refundAddress: string;
163
+ apiKey: string;
164
+ };
242
165
  export type PaymentDetails = {
243
- payorder_id: string
244
- status: PayOrderStatus
245
- expires_at: Date
246
-
247
- refund_address: string
248
- deposit_address: string
249
- receiving_address?: string
250
-
251
- source_currency: CurrencyWithAmount
252
- source_amount: CurrencyAmount
253
- destination_currency?: CurrencyWithAmount
254
- destination_amount?: CurrencyAmount
255
- }
256
-
166
+ payorder_id: string;
167
+ status: PayOrderStatus;
168
+ expires_at: Date;
169
+ refund_address: string;
170
+ deposit_address: string;
171
+ receiving_address?: string;
172
+ source_currency: CurrencyWithAmount;
173
+ source_amount: CurrencyAmount;
174
+ destination_currency?: CurrencyWithAmount;
175
+ destination_amount?: CurrencyAmount;
176
+ };
257
177
  /**
258
178
  * Retrieves payment details for a specific PayOrder.
259
- *
260
- * This function fetches payment details associated with a specific PayOrder ID.
261
- * It allows specifying the token and blockchain network (via `outTokenAddress` and `outChainId`)
179
+ *
180
+ * This function fetches payment details associated with a specific PayOrder ID.
181
+ * It allows specifying the token and blockchain network (via `outTokenAddress` and `outChainId`)
262
182
  * to retrieve source currency information, as well as a refund address for the transaction.
263
- *
183
+ *
264
184
  * The request is authenticated using the provided API key in the headers.
265
- *
185
+ *
266
186
  * @param {PaymentDetailsParams} params - Parameters to retrieve the payment details.
267
187
  * @param {string} params.payOrderId - The unique identifier of the PayOrder for which payment details are fetched.
268
188
  * @param {string} [params.outTokenAddress] - (Optional) The token address of the source currency.
269
189
  * @param {ChainId} params.outChainId - The blockchain network ID where the token resides.
270
190
  * @param {string} params.refundAddress - The address where funds will be refunded in case of a failed transaction.
271
191
  * @param {string} params.apiKey - The API key used to authenticate the request.
272
- *
192
+ *
273
193
  * @returns {Promise<PaymentDetails | undefined>} - The payment details object if the request is successful.
274
- *
194
+ *
275
195
  * @example
276
196
  * const paymentDetails = await payOrderPaymentDetails({
277
197
  * payOrderId: '12345',
@@ -280,70 +200,34 @@ export type PaymentDetails = {
280
200
  * refundAddress: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd',
281
201
  * apiKey: 'yourApiKey'
282
202
  * });
283
- *
203
+ *
284
204
  * console.log(paymentDetails);
285
205
  */
286
- export async function payOrderPaymentDetails({
287
- payOrderId,
288
- outTokenAddress,
289
- outChainId,
290
- refundAddress,
291
- apiKey
292
- }: PaymentDetailsParams): Promise<PaymentDetails | undefined> {
293
- return fetchApi<PaymentDetails>({
294
- path: `pay-orders/${payOrderId}/payment-details`, options: {
295
- method: "POST",
296
- body: JSON.stringify({
297
- source_currency: {
298
- address: outTokenAddress,
299
- chain_id: outChainId
300
- },
301
- refund_address: refundAddress
302
- }),
303
- headers: {
304
- "X-API-KEY": apiKey
305
- },
306
- }
307
- })
308
- }
309
-
206
+ export declare function payOrderPaymentDetails({ payOrderId, outTokenAddress, outChainId, refundAddress, apiKey }: PaymentDetailsParams): Promise<PaymentDetails | undefined>;
310
207
  /**
311
208
  * Processes a PayOrder transaction.
312
- *
313
- * This function triggers the processing of a PayOrder by providing the transaction hash
209
+ *
210
+ * This function triggers the processing of a PayOrder by providing the transaction hash
314
211
  * that represents the payment on the blockchain. The request is authenticated using an API key.
315
- *
212
+ *
316
213
  * @param {Object} params - Parameters required to process the PayOrder.
317
214
  * @param {string} params.payOrderId - The unique identifier of the PayOrder to be processed.
318
215
  * @param {string} params.sourceTransactionHash - The transaction hash representing the payment on the blockchain.
319
216
  * @param {string} params.apiKey - The API key used to authenticate the request.
320
- *
217
+ *
321
218
  * @returns {Promise<void>}
322
- *
219
+ *
323
220
  * @example
324
221
  * const processedPayment = await processPayOrder({
325
222
  * payOrderId: '12345',
326
223
  * sourceTransactionHash: '0xabcdefabcdefabcdefabcdefabcdefabcdefabcd',
327
224
  * apiKey: 'yourApiKey'
328
225
  * });
329
- *
226
+ *
330
227
  * console.log(processedPayment);
331
228
  */
332
- export async function processPayOrder({
333
- payOrderId,
334
- sourceTransactionHash,
335
- apiKey
336
- }: {
337
- payOrderId: string
338
- sourceTransactionHash: string
339
- apiKey: string
340
- }): Promise<void> {
341
- return fetchApi<void>({
342
- path: `pay-orders/${payOrderId}/process?tx_hash=${sourceTransactionHash}`, options: {
343
- method: "GET",
344
- headers: {
345
- "X-API-KEY": apiKey
346
- },
347
- }
348
- })
349
- }
229
+ export declare function processPayOrder({ payOrderId, sourceTransactionHash, apiKey }: {
230
+ payOrderId: string;
231
+ sourceTransactionHash: string;
232
+ apiKey: string;
233
+ }): Promise<void>;