paj_ramp 1.2.6 → 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.
@@ -1,17 +1,17 @@
1
1
  type AllRateResponseType = {
2
2
  onRampRate: {
3
- baseCurrency: 'USD';
4
- targetCurrency: 'NGN';
5
- isActive: true;
6
- rate: 1510;
7
- type: 'onRamp';
3
+ baseCurrency: string;
4
+ targetCurrency: string;
5
+ isActive: boolean;
6
+ rate: number;
7
+ type: string;
8
8
  };
9
9
  offRampRate: {
10
- baseCurrency: 'USD';
11
- targetCurrency: 'NGN';
12
- isActive: true;
13
- rate: 1525;
14
- type: 'offRamp';
10
+ baseCurrency: string;
11
+ targetCurrency: string;
12
+ isActive: boolean;
13
+ rate: number;
14
+ type: string;
15
15
  };
16
16
  };
17
17
  type RateByAmountType = {
@@ -28,11 +28,11 @@ type RateByAmountType = {
28
28
  };
29
29
  };
30
30
  type RateByRateTypeType = {
31
- baseCurrency: 'USD';
32
- targetCurrency: 'NGN';
31
+ baseCurrency: string;
32
+ targetCurrency: string;
33
33
  isActive: true;
34
- rate: 1525;
35
- type: 'offRamp';
34
+ rate: number;
35
+ type: string;
36
36
  };
37
37
  type TokenValueType = {
38
38
  amount: number;
@@ -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 const getRate: (param: number | RateType, mint_token?: string) => Promise<AllRateResponseType | RateByAmountType | RateByRateTypeType | TokenValueType | undefined>;
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
- export declare const createOrder: (options: CreateOrderType) => Promise<CreateOrderType>;
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 "../../utils/api.js";
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("/pub/onramp", {
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("Error creating order:", err);
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 "./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";
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 "./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";
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';
@@ -2,18 +2,18 @@ import { get } from '../../utils/api.js';
2
2
 
3
3
  type AllRateResponseType = {
4
4
  onRampRate: {
5
- baseCurrency: 'USD';
6
- targetCurrency: 'NGN';
7
- isActive: true;
8
- rate: 1510;
9
- type: 'onRamp';
5
+ baseCurrency: string;
6
+ targetCurrency: string;
7
+ isActive: boolean;
8
+ rate: number;
9
+ type: string;
10
10
  };
11
11
  offRampRate: {
12
- baseCurrency: 'USD';
13
- targetCurrency: 'NGN';
14
- isActive: true;
15
- rate: 1525;
16
- type: 'offRamp';
12
+ baseCurrency: string;
13
+ targetCurrency: string;
14
+ isActive: boolean;
15
+ rate: number;
16
+ type: string;
17
17
  };
18
18
  };
19
19
 
@@ -32,11 +32,11 @@ type RateByAmountType = {
32
32
  };
33
33
 
34
34
  type RateByRateTypeType = {
35
- baseCurrency: 'USD';
36
- targetCurrency: 'NGN';
35
+ baseCurrency: string;
36
+ targetCurrency: string;
37
37
  isActive: true;
38
- rate: 1525;
39
- type: 'offRamp';
38
+ rate: number;
39
+ type: string;
40
40
  };
41
41
 
42
42
  type TokenValueType = {
@@ -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 const getRate = async (
65
- param: number | RateType,
66
- mint_token?: string
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
@@ -120,7 +124,6 @@ export const getRateByAmount = async (url: string, amount: number) => {
120
124
  }
121
125
  };
122
126
 
123
-
124
127
  /**
125
128
  * The function `getRateByRateType` fetches a rate based on a specified rate type from a given URL.
126
129
  * @param {string} url - The `url` parameter is a string representing the base URL used to fetch data.
@@ -1,4 +1,4 @@
1
- import { post } from "../../utils/api.js";
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 } = options;
22
+ const { fiatAmount, currency, recipient, mint, chain, webhookURL, token } =
23
+ options;
15
24
  try {
16
- return await post<CreateOrderType>(
17
- "/pub/onramp",
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("Error creating order:", err);
40
+ console.error('Error creating order:', err);
32
41
  throw err;
33
42
  }
34
43
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paj_ramp",
3
- "version": "1.2.6",
3
+ "version": "1.2.8",
4
4
  "description": "paj offramp/onramp service",
5
5
  "main": "dist/sdk.js",
6
6
  "types": "dist/sdk.d.ts",
@@ -15,7 +15,10 @@
15
15
  "url": "git+https://github.com/paj-cash/paj_ramp.git"
16
16
  },
17
17
  "keywords": [
18
- "PAJ"
18
+ "PAJ",
19
+ "paj",
20
+ "paj_ramp",
21
+ "Paj"
19
22
  ],
20
23
  "author": "Ebube",
21
24
  "license": "ISC",
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 "./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";
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';