paj_ramp 1.2.7 → 1.2.8
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/lib/off_ramp/getRate.d.ts +4 -1
- package/dist/lib/off_ramp/getRate.js +2 -13
- package/dist/lib/on_ramp/createOrder.d.ts +8 -1
- package/dist/lib/on_ramp/createOrder.js +4 -4
- package/dist/sdk.d.ts +4 -5
- package/dist/sdk.js +5 -5
- package/lib/off_ramp/getRate.ts +9 -5
- package/lib/on_ramp/createOrder.ts +15 -6
- package/package.json +1 -1
- package/sdk.ts +6 -7
|
@@ -54,7 +54,10 @@ export declare enum RateType {
|
|
|
54
54
|
* @returns The `getRate` function returns different values based on the conditions inside the
|
|
55
55
|
* function:
|
|
56
56
|
*/
|
|
57
|
-
export declare
|
|
57
|
+
export declare function getRate(): Promise<AllRateResponseType>;
|
|
58
|
+
export declare function getRate(param: number, mint_token: string): Promise<TokenValueType>;
|
|
59
|
+
export declare function getRate(param: number): Promise<RateByAmountType>;
|
|
60
|
+
export declare function getRate(param: RateType): Promise<RateByRateTypeType>;
|
|
58
61
|
/**
|
|
59
62
|
* The function `getAllRate` fetches all rates from a specified URL and handles any errors that occur
|
|
60
63
|
* during the process.
|
|
@@ -4,18 +4,7 @@ export var RateType;
|
|
|
4
4
|
RateType["onRamp"] = "onRamp";
|
|
5
5
|
RateType["offRamp"] = "offRamp";
|
|
6
6
|
})(RateType || (RateType = {}));
|
|
7
|
-
|
|
8
|
-
* The function `getRate` in TypeScript is an asynchronous function that retrieves rate information
|
|
9
|
-
* based on different parameters such as amount, rate type, and mint token.
|
|
10
|
-
* @param {number | RateType} param - The `param` parameter in the `getRate` function can be either a
|
|
11
|
-
* number or a `RateType`.
|
|
12
|
-
* @param {string} [mint_token] - The `mint_token` parameter is an optional string parameter that
|
|
13
|
-
* represents a token used for minting. It is used in the `getRate` function to calculate the rate
|
|
14
|
-
* based on the specified token value.
|
|
15
|
-
* @returns The `getRate` function returns different values based on the conditions inside the
|
|
16
|
-
* function:
|
|
17
|
-
*/
|
|
18
|
-
export const getRate = async (param, mint_token) => {
|
|
7
|
+
export async function getRate(param, mint_token) {
|
|
19
8
|
try {
|
|
20
9
|
const url = '/pub/rate';
|
|
21
10
|
if (!param) {
|
|
@@ -34,7 +23,7 @@ export const getRate = async (param, mint_token) => {
|
|
|
34
23
|
console.error('Error fetching Rate:', err);
|
|
35
24
|
throw err;
|
|
36
25
|
}
|
|
37
|
-
}
|
|
26
|
+
}
|
|
38
27
|
/**
|
|
39
28
|
* The function `getAllRate` fetches all rates from a specified URL and handles any errors that occur
|
|
40
29
|
* during the process.
|
|
@@ -7,5 +7,12 @@ type CreateOrderType = {
|
|
|
7
7
|
webhookURL: string;
|
|
8
8
|
token?: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type CreateOrderResponseType = {
|
|
11
|
+
id: string;
|
|
12
|
+
accountNumber: string;
|
|
13
|
+
accountName: string;
|
|
14
|
+
amount: number;
|
|
15
|
+
bank: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const createOrder: (options: CreateOrderType) => Promise<CreateOrderResponseType>;
|
|
11
18
|
export {};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { post } from
|
|
1
|
+
import { post } from '../../utils/api.js';
|
|
2
2
|
export const createOrder = async (options) => {
|
|
3
3
|
const { fiatAmount, currency, recipient, mint, chain, webhookURL, token } = options;
|
|
4
4
|
try {
|
|
5
|
-
return await post(
|
|
5
|
+
return await post('/pub/onramp', {
|
|
6
6
|
fiatAmount,
|
|
7
7
|
currency,
|
|
8
8
|
recipient,
|
|
9
9
|
mint,
|
|
10
10
|
chain,
|
|
11
|
-
webhookURL
|
|
11
|
+
webhookURL,
|
|
12
12
|
}, {
|
|
13
13
|
Authorization: `Bearer ${token}`,
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
catch (err) {
|
|
17
|
-
console.error(
|
|
17
|
+
console.error('Error creating order:', err);
|
|
18
18
|
throw err;
|
|
19
19
|
}
|
|
20
20
|
};
|
package/dist/sdk.d.ts
CHANGED
|
@@ -2,11 +2,10 @@ export declare const initializeSDK: (env: "staging" | "production") => void;
|
|
|
2
2
|
export { getRate } from './lib/off_ramp/getRate.js';
|
|
3
3
|
export { initiate } from './lib/off_ramp/initiate.js';
|
|
4
4
|
export { verify } from './lib/off_ramp/verify.js';
|
|
5
|
-
export { getBanks } from
|
|
6
|
-
export { resolveBankAccount } from
|
|
7
|
-
export { addBankAccount } from
|
|
8
|
-
export { getBankAccounts } from
|
|
5
|
+
export { getBanks } from './lib/off_ramp/getBanks.js';
|
|
6
|
+
export { resolveBankAccount } from './lib/off_ramp/resolveBankAccount.js';
|
|
7
|
+
export { addBankAccount } from './lib/off_ramp/addBankAccount.js';
|
|
8
|
+
export { getBankAccounts } from './lib/off_ramp/getBankAccounts.js';
|
|
9
9
|
export { offRampCreateOrder } from './lib/direct_off_ramp/directCreateOrder.js';
|
|
10
10
|
export { createOrder } from './lib/on_ramp/createOrder.js';
|
|
11
|
-
export { observeOrder } from './lib/on_ramp/observeOrder.js';
|
|
12
11
|
export { RateType } from './lib/off_ramp/getRate.js';
|
package/dist/sdk.js
CHANGED
|
@@ -17,10 +17,10 @@ export { getRate } from './lib/off_ramp/getRate.js';
|
|
|
17
17
|
export { initiate } from './lib/off_ramp/initiate.js';
|
|
18
18
|
export { verify } from './lib/off_ramp/verify.js';
|
|
19
19
|
// // Banking Operations
|
|
20
|
-
export { getBanks } from
|
|
21
|
-
export { resolveBankAccount } from
|
|
22
|
-
export { addBankAccount } from
|
|
23
|
-
export { getBankAccounts } from
|
|
20
|
+
export { getBanks } from './lib/off_ramp/getBanks.js';
|
|
21
|
+
export { resolveBankAccount } from './lib/off_ramp/resolveBankAccount.js';
|
|
22
|
+
export { addBankAccount } from './lib/off_ramp/addBankAccount.js';
|
|
23
|
+
export { getBankAccounts } from './lib/off_ramp/getBankAccounts.js';
|
|
24
24
|
// Wallet Operations
|
|
25
25
|
// export { getWallet } from './lib/off_ramp/getWallet.js';
|
|
26
26
|
// export { addWallet } from './lib/off_ramp/addWallet.js';
|
|
@@ -31,6 +31,6 @@ export { offRampCreateOrder } from './lib/direct_off_ramp/directCreateOrder.js';
|
|
|
31
31
|
// Create Order
|
|
32
32
|
export { createOrder } from './lib/on_ramp/createOrder.js';
|
|
33
33
|
// Observe Order Socket.IO
|
|
34
|
-
export { observeOrder } from './lib/on_ramp/observeOrder.js';
|
|
34
|
+
// export { observeOrder } from './lib/on_ramp/observeOrder.js';
|
|
35
35
|
// Types
|
|
36
36
|
export { RateType } from './lib/off_ramp/getRate.js';
|
package/lib/off_ramp/getRate.ts
CHANGED
|
@@ -61,10 +61,14 @@ export enum RateType {
|
|
|
61
61
|
* @returns The `getRate` function returns different values based on the conditions inside the
|
|
62
62
|
* function:
|
|
63
63
|
*/
|
|
64
|
-
export
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
export function getRate(): Promise<AllRateResponseType>;
|
|
65
|
+
export function getRate(
|
|
66
|
+
param: number,
|
|
67
|
+
mint_token: string
|
|
68
|
+
): Promise<TokenValueType>;
|
|
69
|
+
export function getRate(param: number): Promise<RateByAmountType>;
|
|
70
|
+
export function getRate(param: RateType): Promise<RateByRateTypeType>;
|
|
71
|
+
export async function getRate(param?: number | RateType, mint_token?: string) {
|
|
68
72
|
try {
|
|
69
73
|
const url = '/pub/rate';
|
|
70
74
|
|
|
@@ -80,7 +84,7 @@ export const getRate = async (
|
|
|
80
84
|
console.error('Error fetching Rate:', err);
|
|
81
85
|
throw err;
|
|
82
86
|
}
|
|
83
|
-
}
|
|
87
|
+
}
|
|
84
88
|
|
|
85
89
|
/**
|
|
86
90
|
* The function `getAllRate` fetches all rates from a specified URL and handles any errors that occur
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { post } from
|
|
1
|
+
import { post } from '../../utils/api.js';
|
|
2
2
|
|
|
3
3
|
type CreateOrderType = {
|
|
4
4
|
fiatAmount: number;
|
|
@@ -10,25 +10,34 @@ type CreateOrderType = {
|
|
|
10
10
|
token?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
type CreateOrderResponseType = {
|
|
14
|
+
id: string;
|
|
15
|
+
accountNumber: string;
|
|
16
|
+
accountName: string;
|
|
17
|
+
amount: number;
|
|
18
|
+
bank: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
13
21
|
export const createOrder = async (options: CreateOrderType) => {
|
|
14
|
-
const { fiatAmount, currency, recipient, mint, chain, webhookURL, token } =
|
|
22
|
+
const { fiatAmount, currency, recipient, mint, chain, webhookURL, token } =
|
|
23
|
+
options;
|
|
15
24
|
try {
|
|
16
|
-
return await post<
|
|
17
|
-
|
|
25
|
+
return await post<CreateOrderResponseType>(
|
|
26
|
+
'/pub/onramp',
|
|
18
27
|
{
|
|
19
28
|
fiatAmount,
|
|
20
29
|
currency,
|
|
21
30
|
recipient,
|
|
22
31
|
mint,
|
|
23
32
|
chain,
|
|
24
|
-
webhookURL
|
|
33
|
+
webhookURL,
|
|
25
34
|
},
|
|
26
35
|
{
|
|
27
36
|
Authorization: `Bearer ${token}`,
|
|
28
37
|
}
|
|
29
38
|
);
|
|
30
39
|
} catch (err) {
|
|
31
|
-
console.error(
|
|
40
|
+
console.error('Error creating order:', err);
|
|
32
41
|
throw err;
|
|
33
42
|
}
|
|
34
43
|
};
|
package/package.json
CHANGED
package/sdk.ts
CHANGED
|
@@ -22,10 +22,10 @@ export { initiate } from './lib/off_ramp/initiate.js';
|
|
|
22
22
|
export { verify } from './lib/off_ramp/verify.js';
|
|
23
23
|
|
|
24
24
|
// // Banking Operations
|
|
25
|
-
export { getBanks } from
|
|
26
|
-
export { resolveBankAccount } from
|
|
27
|
-
export { addBankAccount } from
|
|
28
|
-
export { getBankAccounts } from
|
|
25
|
+
export { getBanks } from './lib/off_ramp/getBanks.js';
|
|
26
|
+
export { resolveBankAccount } from './lib/off_ramp/resolveBankAccount.js';
|
|
27
|
+
export { addBankAccount } from './lib/off_ramp/addBankAccount.js';
|
|
28
|
+
export { getBankAccounts } from './lib/off_ramp/getBankAccounts.js';
|
|
29
29
|
|
|
30
30
|
// Wallet Operations
|
|
31
31
|
// export { getWallet } from './lib/off_ramp/getWallet.js';
|
|
@@ -35,14 +35,13 @@ export { getBankAccounts } from "./lib/off_ramp/getBankAccounts.js";
|
|
|
35
35
|
// DIRECT OFF RAMP
|
|
36
36
|
export { offRampCreateOrder } from './lib/direct_off_ramp/directCreateOrder.js';
|
|
37
37
|
|
|
38
|
-
|
|
39
38
|
// ON RAMP
|
|
40
39
|
|
|
41
40
|
// Create Order
|
|
42
41
|
export { createOrder } from './lib/on_ramp/createOrder.js';
|
|
43
42
|
|
|
44
43
|
// Observe Order Socket.IO
|
|
45
|
-
export { observeOrder } from './lib/on_ramp/observeOrder.js';
|
|
44
|
+
// export { observeOrder } from './lib/on_ramp/observeOrder.js';
|
|
46
45
|
|
|
47
46
|
// Types
|
|
48
|
-
export { RateType } from './lib/off_ramp/getRate.js';
|
|
47
|
+
export { RateType } from './lib/off_ramp/getRate.js';
|