paj_ramp 1.2.2 → 1.2.4

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/README.md CHANGED
@@ -1,421 +1,495 @@
1
- # PAJ Ramp SDK
2
-
3
- A comprehensive SDK for PAJ Ramp onramp and offramp operations with real-time transaction updates using Socket.IO.
4
-
5
- ## Features
6
-
7
- - **Onramp Operations**: Create orders and observe real-time updates
8
- - **Offramp Operations**: Complete offramp workflow with bank account management
9
- - **Real-time Updates**: Socket.IO integration for live transaction status updates
10
- - **TypeScript Support**: Full TypeScript definitions included
11
- - **Functional API**: Clean functional approach for better composability
12
-
13
- ## Installation
14
-
15
- ```bash
16
- npm install paj-ramp
17
- ```
18
-
19
- ```bash
20
- yarn add paj-ramp
21
- ```
22
-
23
- ---
24
-
25
- ## Initialize SDK (select environment: "staging" | "production")
26
-
27
- ```typescript
28
- import { initializeSDK } from "paj_ramp";
29
-
30
- // Selects the environment you want to work with
31
- initializeSDK("staging"); // or production
32
- ```
33
-
34
- ---
35
-
36
- # Onramp SDK (Real-time Order Observation)
37
-
38
- ## Quick Start
39
-
40
- ### Real-time Order Observation
41
-
42
- The SDK provides Socket.IO functionality to observe onramp orders in real-time:
43
-
44
- ```typescript
45
- import {
46
- observeOrder,
47
- createOrderObserver,
48
- createOnRampSocket,
49
- } from "paj-ramp";
50
-
51
- // Using observeOrder function
52
- const observer = observeOrder({
53
- orderId: "your_order_id",
54
- onOrderUpdate: (data) => {
55
- console.log("Order update:", data);
56
- // Handle status changes: pending, processing, completed, failed, cancelled
57
- },
58
- onError: (error) => {
59
- console.error("Socket error:", error);
60
- },
61
- });
62
-
63
- await observer.connect();
64
- ```
65
-
66
- ### Order Update Data Structure
67
-
68
- ```typescript
69
- interface OnRampOrderUpdate {
70
- id: string;
71
- fiatAmount: string;
72
- currency: string;
73
- recipient: string; // wallet address
74
- mint: string; // token address
75
- chain: Chain; // enum: 'solana', 'ethereum', 'polygon'
76
- status: OnRampStatus; // enum: 'pending', 'processing', 'completed', 'failed', 'cancelled'
77
- }
78
- ```
79
-
80
- ### Socket Events
81
-
82
- The SDK listens for these Socket.IO events:
83
-
84
- - **ORDER_UPDATE**: Real-time order status updates
85
- - **ERROR**: Error messages from the server
86
-
87
- ## API Reference
88
-
89
- ### observeOrder(options)
90
-
91
- Creates an order observer.
92
-
93
- **Parameters:**
94
-
95
- - `options.orderId` (string, required): The order ID to observe
96
- - `options.onOrderUpdate` (function, optional): Callback for order updates
97
- - `options.onError` (function, optional): Callback for errors
98
- - `options.onConnect` (function, optional): Callback when connected
99
- - `options.onDisconnect` (function, optional): Callback when disconnected
100
- - `options.onConnectionStatusChange` (function, optional): Callback for connection status changes
101
-
102
- **Returns:**
103
-
104
- - `socket`: The Socket.IO instance
105
- - `isConnected()`: Function to check connection status
106
- - `connect()`: Function to connect to the socket
107
- - `disconnect()`: Function to disconnect from the socket
108
-
109
- **Example:**
110
-
111
- ```typescript
112
- import { observeOrder } from "paj-ramp";
113
-
114
- const observer = observeOrder({
115
- orderId: "your_order_id",
116
- onOrderUpdate: (data) => console.log(data),
117
- });
118
-
119
- // Connect manually
120
- await observer.connect();
121
-
122
- // Check connection status
123
- console.log("Connected:", observer.isConnected());
124
-
125
- // Disconnect manually: you could use setTimeout to keep the socket alive for a certain amount of time before you disconnect
126
- observer.disconnect();
127
- ```
128
-
129
- ## Error Handling
130
-
131
- The SDK provides comprehensive error handling:
132
-
133
- ```typescript
134
- const observer = observeOrder({
135
- orderId: "your_order_id",
136
- onError: (error) => {
137
- // Handle connection errors, order not found, etc.
138
- console.error("Socket error:", error);
139
- },
140
- });
141
- ```
142
-
143
- Common error messages:
144
-
145
- - `"Order not found: {orderId}"`
146
- - `"Connection failed"`
147
- - `"Socket timeout"`
148
-
149
- ### createOrder(orderData)
150
-
151
- Creates a new onramp order.
152
-
153
- **Parameters:**
154
-
155
- - `orderData` (object, required): Order creation data
156
- - `orderData.fiatAmount` (number, required): Order amount
157
- - `orderData.currency` (string, required): Currency code (e.g., 'USD', 'NGN')
158
- - `orderData.recipient` (string, required): Wallet address to receive tokens
159
- - `orderData.mint` (string, required): Token mint address
160
- - `orderData.chain` (Chain, required): Blockchain network ('solana', 'ethereum', 'polygon')
161
- - `orderData.token` (string, required): Verification token
162
-
163
- **Returns:**
164
-
165
- - `id` (string): Unique order identifier
166
- - `accountNumber` (string): Bank account number for payment
167
- - `accountName` (string): Bank account holder name
168
- - `fiatAmount` (number): Order amount in fiat currency
169
- - `bank` (string): Bank name
170
-
171
- **Example:**
172
-
173
- ```typescript
174
- import { createOrder } from "paj-ramp";
175
-
176
- const order = await createOrder({
177
- fiatAmount: 10000,
178
- currency: "NGN",
179
- recipient: "wallet_address_here",
180
- mint: "token_mint_address_here",
181
- chain: "SOLANA",
182
- token: "token_from_verification",
183
- });
184
- // Response: { id: string, accountNumber: string, accountName: string, fiatAmount: number, bank: string }
185
- ```
186
-
187
- ### Usage Example
188
-
189
- ```typescript
190
- import { observeOrder } from "paj-ramp";
191
-
192
- async function example(orderId) {
193
- console.log("Observe Order");
194
-
195
- const observer = observeOrder({
196
- orderId,
197
- onOrderUpdate: (data) => {
198
- console.log("Order update received:", data);
199
- console.log("Status:", data.status);
200
- console.log("Amount:", data.amount);
201
- console.log("Currency:", data.currency);
202
- },
203
- onError: (error) => {
204
- console.error("Socket error:", error);
205
- },
206
- onConnect: () => {
207
- console.log("Connected to order socket");
208
- },
209
- onDisconnect: () => {
210
- console.log("Disconnected from order socket");
211
- },
212
- onConnectionStatusChange: (connected) => {
213
- console.log(
214
- "Connection status changed:",
215
- connected ? "Connected" : "Disconnected"
216
- );
217
- },
218
- });
219
-
220
- try {
221
- await observer.connect();
222
- console.log("Successfully connected to order observer");
223
-
224
- // Keep the connection alive for 1 minute
225
- setTimeout(() => {
226
- console.log("Disconnecting after 1 minute...");
227
- observer.disconnect();
228
- }, 1 * 60 * 1000);
229
- } catch (error) {
230
- console.error("Failed to connect:", error);
231
- }
232
- }
233
-
234
- const order = await createOrder({
235
- fiatAmount: 10000,
236
- currency: "NGN",
237
- recipient: "your_wallet_address",
238
- mint: "your_token_mint_address",
239
- chain: "SOLANA",
240
- token: token_from_verification,
241
- });
242
-
243
- await example(order.id);
244
- // Response: { id: string, fiatAmount: string, currency: string, , recipient: string, mint: string, chain: Chain, amount: number, status: OnRampStatus }
245
- ```
246
-
247
- ---
248
-
249
- # Offramp SDK
250
-
251
- ## Overview
252
-
253
- The Offramp SDK provides a set of functions to help users convert Solana-based digital assets to fiat and transfer the resulting funds to traditional bank accounts. It includes session management, rate queries, bank account management, and wallet operations.
254
-
255
- ## Usage Examples
256
-
257
- ### Get TX Pool Address
258
-
259
- ```typescript
260
- import { getTXPoolAddress } from "paj-ramp";
261
-
262
- const txpooladdress = await getTXPoolAddress();
263
- // Response: { address: string }
264
- ```
265
-
266
- ### Get Rate
267
-
268
- ```typescript
269
- import { getRate } from "paj-ramp";
270
-
271
- const rate = await getRate();
272
- // Response: { baseCurrency: string, targetCurrency: string, rate: number }
273
- ```
274
-
275
- ### Get Rate with Amount
276
-
277
- ```typescript
278
- import { getRate } from "paj-ramp";
279
-
280
- const rate = await getRate(50000);
281
- // Response:
282
- // {
283
- // rate: { baseCurrency: string, targetCurrency: string, rate: number },
284
- // amounts: { userTax: number, merchantTax: number, amountUSD: number, userAmountFiat: number }
285
- // }
286
- ```
287
-
288
- ### Initiate Session
289
-
290
- ```typescript
291
- import { initiate } from "paj-ramp";
292
-
293
- const initialized = await initiate("your_email@gmail.com");
294
- // Response: { email: string }
295
- ```
296
-
297
- ### Verify Session
298
-
299
- ```typescript
300
- import { verify } from "paj-ramp";
301
-
302
- const verified = await verify(
303
- "your_email@gmail.com",
304
- "otp",
305
- "device signature"
306
- );
307
- // Response: { email: string, isActive: string, expiresAt: string, token: string }
308
- ```
309
-
310
- ### Get Banks
311
-
312
- ```typescript
313
- import { getBanks } from "paj-ramp";
314
-
315
- const banks = await getBanks();
316
- // Response: [ { id: string, name: string, country: string } ]
317
- ```
318
-
319
- ### Resolve Bank Account
320
-
321
- ```typescript
322
- import { resolveBankAccount } from "paj-ramp";
323
-
324
- const resolvedBankAccount = await resolveBankAccount(
325
- "bank id",
326
- "account number"
327
- );
328
- // Response: { accountName: string, accountNumber: string, bank: { id: string, name: string, code: string, country: string } }
329
- ```
330
-
331
- ### Add Bank Account
332
-
333
- ```typescript
334
- import { addBankAccount } from "paj-ramp";
335
-
336
- const addedBankAccount = await addBankAccount(
337
- "token",
338
- "bank id",
339
- "account number"
340
- );
341
- // Response: { id: string, accountName: string, accountNumber: string, bank: string }
342
- ```
343
-
344
- ### Get Bank Accounts
345
-
346
- ```typescript
347
- import { getBankAccounts } from "paj-ramp";
348
-
349
- const accounts = await getBankAccounts("token");
350
- // Response: [ { id: string, accountName: string, accountNumber: string, bank: string } ]
351
- ```
352
-
353
- ### Get Wallet Info
354
-
355
- ```typescript
356
- import { getWallet } from "paj-ramp";
357
-
358
- const wallet = await getWallet("wallet public key");
359
- // Response: { id: string, publicKey: string, bankAccount: { id: string, accountName: string, accountNumber: string, bank: string } }
360
- ```
361
-
362
- ### Add Wallet
363
-
364
- ```typescript
365
- import { addWallet } from "paj-ramp";
366
-
367
- // To create wallet.json file with an array of 64 numbers
368
- // npm install @solana/web3.js then run this code
369
- import { Keypair } from "@solana/web3.js";
370
- import fs from "fs";
371
-
372
- const keypair = Keypair.generate();
373
- const secretKey = Array.from(keypair.secretKey);
374
-
375
- fs.writeFileSync("wallet.json", JSON.stringify(secretKey));
376
- console.log("✅ wallets.json generated successfully");
377
-
378
- // To get secret key
379
- import * as fs from "fs";
380
- import { fileURLToPath } from "url";
381
- import { dirname, resolve } from "path";
382
-
383
- const __filename = fileURLToPath(import.meta.url);
384
- const __dirname = dirname(__filename);
385
-
386
- // wallet.json that you created with an array of 64 numbers
387
- const walletPath = resolve(__dirname, "./wallet.json");
388
- const secretKeyRaw = fs.readFileSync(walletPath, "utf8");
389
- const secretKeyArray = JSON.parse(secretKeyRaw);
390
-
391
- if (!Array.isArray(secretKeyArray) || secretKeyArray.length !== 64) {
392
- throw new Error("Invalid secret key: must be an array of 64 numbers.");
393
- }
394
-
395
- const secretKey = Uint8Array.from(secretKeyArray);
396
-
397
- const addedWallet = await addWallet("token", "bank account id", secretKey);
398
- // Response: { id: string, publicKey: string, bankAccount: { id: string, accountName: string, accountNumber: string, bank: string } }
399
- ```
400
-
401
- ### Switch Bank Account on Wallet
402
-
403
- ```typescript
404
- import { switchWalletBankAccount } from "paj-ramp";
405
-
406
- const switchedWallet = await switchWalletBankAccount(
407
- "token",
408
- "bank account id to switch to",
409
- "wallet id",
410
- "secret key"
411
- );
412
- // Response: { id: string, publicKey: string, bankAccount: { id: string, accountName: string, accountNumber: string, bank: string } }
413
- ```
414
-
415
- ## License
416
-
417
- MIT
418
-
419
- ## 🧑‍💻 Author
420
-
421
- Gospel Chidiebube Chukwu
1
+ # PAJ Ramp SDK
2
+
3
+ A comprehensive SDK for PAJ Ramp onramp and offramp operations with real-time transaction updates using Socket.IO.
4
+
5
+ ## Features
6
+
7
+ - **Onramp Operations**: Create orders and observe real-time updates
8
+ - **Offramp Operations**: Complete offramp workflow with bank account management
9
+ - **Real-time Updates**: Socket.IO integration for live transaction status updates
10
+ - **TypeScript Support**: Full TypeScript definitions included
11
+ - **Functional API**: Clean functional approach for better composability
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install paj_ramp
17
+ ```
18
+
19
+ ```bash
20
+ yarn add paj_ramp
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Initialize SDK (select environment: "staging" | "production")
26
+
27
+ ```typescript
28
+ import { initializeSDK } from 'paj_ramp';
29
+
30
+ // Selects the environment you want to work with
31
+ initializeSDK('staging'); // or production
32
+ ```
33
+
34
+ ---
35
+
36
+ # Onramp SDK (Real-time Order Observation)
37
+
38
+ ## Quick Start
39
+
40
+ ### Real-time Order Observation
41
+
42
+ The SDK provides Socket.IO functionality to observe onramp orders in real-time:
43
+
44
+ ```typescript
45
+ import { observeOrder } from 'paj_ramp';
46
+
47
+ // Using observeOrder function
48
+ const observer = observeOrder({
49
+ orderId: 'your_order_id',
50
+ onOrderUpdate: data => {
51
+ console.log('Order update:', data);
52
+ // Handle status changes: pending, processing, completed, failed, cancelled
53
+ },
54
+ onError: error => {
55
+ console.error('Socket error:', error);
56
+ },
57
+ });
58
+
59
+ await observer.connect();
60
+ ```
61
+
62
+ ### Order Update Data Structure
63
+
64
+ ```typescript
65
+ interface OnRampOrderUpdate {
66
+ id: string;
67
+ fiatAmount: string;
68
+ currency: string;
69
+ recipient: string; // wallet address
70
+ mint: string; // token address
71
+ chain: Chain; // enum: 'solana', 'ethereum', 'polygon'
72
+ status: OnRampStatus; // enum: 'pending', 'processing', 'completed', 'failed', 'cancelled'
73
+ }
74
+ ```
75
+
76
+ ### Socket Events
77
+
78
+ The SDK listens for these Socket.IO events:
79
+
80
+ - **ORDER_UPDATE**: Real-time order status updates
81
+ - **ERROR**: Error messages from the server
82
+
83
+ ## API Reference
84
+
85
+ ### observeOrder(options)
86
+
87
+ Creates an order observer.
88
+
89
+ **Parameters:**
90
+
91
+ - `options.orderId` (string, required): The order ID to observe
92
+ - `options.onOrderUpdate` (function, optional): Callback for order updates
93
+ - `options.onError` (function, optional): Callback for errors
94
+ - `options.onConnect` (function, optional): Callback when connected
95
+ - `options.onDisconnect` (function, optional): Callback when disconnected
96
+ - `options.onConnectionStatusChange` (function, optional): Callback for connection status changes
97
+
98
+ **Returns:**
99
+
100
+ - `socket`: The Socket.IO instance
101
+ - `isConnected()`: Function to check connection status
102
+ - `connect()`: Function to connect to the socket
103
+ - `disconnect()`: Function to disconnect from the socket
104
+
105
+ **Example:**
106
+
107
+ ```typescript
108
+ import { observeOrder } from 'paj_ramp';
109
+
110
+ const observer = observeOrder({
111
+ orderId: 'your_order_id',
112
+ onOrderUpdate: data => console.log(data),
113
+ });
114
+
115
+ // Connect manually
116
+ await observer.connect();
117
+
118
+ // Check connection status
119
+ console.log('Connected:', observer.isConnected());
120
+
121
+ // Disconnect manually: you could use setTimeout to keep the socket alive for a certain amount of time before you disconnect
122
+ observer.disconnect();
123
+ ```
124
+
125
+ ## Error Handling
126
+
127
+ The SDK provides comprehensive error handling:
128
+
129
+ ```typescript
130
+ const observer = observeOrder({
131
+ orderId: 'your_order_id',
132
+ onError: error => {
133
+ // Handle connection errors, order not found, etc.
134
+ console.error('Socket error:', error);
135
+ },
136
+ });
137
+ ```
138
+
139
+ Common error messages:
140
+
141
+ - `"Order not found: {orderId}"`
142
+ - `"Connection failed"`
143
+ - `"Socket timeout"`
144
+
145
+ ### createOrder(orderData)
146
+
147
+ Creates a new onramp order.
148
+
149
+ **Parameters:**
150
+
151
+ - `orderData` (object, required): Order creation data
152
+ - `orderData.fiatAmount` (number, required): Order amount
153
+ - `orderData.currency` (string, required): Currency code (e.g., 'USD', 'NGN')
154
+ - `orderData.recipient` (string, required): Wallet address to receive tokens
155
+ - `orderData.mint` (string, required): Token mint address
156
+ - `orderData.chain` (Chain, required): Blockchain network ('solana', 'ethereum', 'polygon')
157
+ - `orderData.token` (string, required): Verification token
158
+
159
+ **Returns:**
160
+
161
+ - `id` (string): Unique order identifier
162
+ - `accountNumber` (string): Bank account number for payment
163
+ - `accountName` (string): Bank account holder name
164
+ - `fiatAmount` (number): Order amount in fiat currency
165
+ - `bank` (string): Bank name
166
+
167
+ **Example:**
168
+
169
+ ```typescript
170
+ import { createOrder } from 'paj_ramp';
171
+
172
+ const order = await createOrder({
173
+ fiatAmount: 10000,
174
+ currency: 'NGN',
175
+ recipient: 'wallet_address_here',
176
+ mint: 'token_mint_address_here',
177
+ chain: 'SOLANA',
178
+ webhookURL: 'webhook_url',
179
+ token: 'token_from_verification',
180
+ });
181
+ // Response: { id: string, accountNumber: string, accountName: string, fiatAmount: number, bank: string }
182
+ ```
183
+
184
+ ### Usage Example
185
+
186
+ ```typescript
187
+ import { observeOrder, createOrder } from 'paj_ramp';
188
+
189
+ async function example(orderId) {
190
+ console.log('Observe Order');
191
+
192
+ const observer = observeOrder({
193
+ orderId,
194
+ onOrderUpdate: data => {
195
+ console.log('Order update received:', data);
196
+ console.log('Status:', data.status);
197
+ console.log('Amount:', data.amount);
198
+ console.log('Currency:', data.currency);
199
+ },
200
+ onError: error => {
201
+ console.error('Socket error:', error);
202
+ },
203
+ onConnect: () => {
204
+ console.log('Connected to order socket');
205
+ },
206
+ onDisconnect: () => {
207
+ console.log('Disconnected from order socket');
208
+ },
209
+ onConnectionStatusChange: connected => {
210
+ console.log(
211
+ 'Connection status changed:',
212
+ connected ? 'Connected' : 'Disconnected'
213
+ );
214
+ },
215
+ });
216
+
217
+ try {
218
+ await observer.connect();
219
+ console.log('Successfully connected to order observer');
220
+
221
+ // Keep the connection alive for 1 minute
222
+ setTimeout(() => {
223
+ console.log('Disconnecting after 1 minute...');
224
+ observer.disconnect();
225
+ }, 1 * 60 * 1000);
226
+ } catch (error) {
227
+ console.error('Failed to connect:', error);
228
+ }
229
+ }
230
+
231
+ const order = await createOrder({
232
+ fiatAmount: 10000,
233
+ currency: 'NGN',
234
+ recipient: 'your_wallet_address',
235
+ mint: 'your_token_mint_address',
236
+ chain: 'SOLANA',
237
+ webhookURL: 'webhook_url',
238
+ token: token_from_verification,
239
+ });
240
+
241
+ await example(order.id);
242
+ // Response: { id: string, fiatAmount: string, currency: string, , recipient: string, mint: string, chain: Chain, amount: number, status: OnRampStatus }
243
+ ```
244
+
245
+ ---
246
+
247
+ # Offramp SDK
248
+
249
+ ## Overview
250
+
251
+ The Offramp SDK provides a set of functions to help users convert Solana-based digital assets to fiat and transfer the resulting funds to traditional bank accounts. It includes session management, rate queries, bank account management, and wallet operations.
252
+
253
+ ## Usage Examples
254
+
255
+ <!-- ### Get TX Pool Address
256
+
257
+ ```typescript
258
+ import { getTXPoolAddress } from "paj_ramp";
259
+
260
+ const txpooladdress = await getTXPoolAddress();
261
+ // Response: { address: string }
262
+ ``` -->
263
+
264
+ ### Get Rate
265
+
266
+ ```typescript
267
+ import { getRate } from 'paj_ramp';
268
+
269
+ const rate = await getRate();
270
+ /*
271
+ Response:
272
+ {
273
+ "onRampRate": {
274
+ "baseCurrency": "USD",
275
+ "targetCurrency": "NGN",
276
+ "isActive": true,
277
+ "rate": 1510,
278
+ "type": "onRamp"
279
+ },
280
+ "offRampRate": {
281
+ "baseCurrency": "USD",
282
+ "targetCurrency": "NGN",
283
+ "isActive": true,
284
+ "rate": 1525,
285
+ "type": "offRamp"
286
+ }
287
+ }*/
288
+ ```
289
+
290
+ ### Get Rate by Amount
291
+
292
+ ```typescript
293
+ import { getRate } from 'paj_ramp';
294
+
295
+ const rate = await getRate(50000);
296
+ /*
297
+ Response:
298
+ {
299
+ rate: {
300
+ baseCurrency: string,
301
+ targetCurrency: string,
302
+ rate: number
303
+ },
304
+ amounts: {
305
+ userTax": number,
306
+ merchantTax": number,
307
+ amountUSD": number,
308
+ userAmountFiat": number
309
+ }
310
+ }*/
311
+ ```
312
+
313
+ ### Get Rate by Rate Type
314
+
315
+ ```typescript
316
+ import { getRate, RateType } from 'paj_ramp';
317
+
318
+ const rate = await getRate(RateType.offRamp); // or RateType.onRamp
319
+
320
+ /*
321
+ Response:
322
+ "offRampRate": {
323
+ "baseCurrency": "USD",
324
+ "targetCurrency": "NGN",
325
+ "isActive": true,
326
+ "rate": 1525,
327
+ "type": "offRamp"
328
+ }*/
329
+ ```
330
+
331
+ ### Initiate Session
332
+
333
+ ```typescript
334
+ import { initiate } from 'paj_ramp';
335
+
336
+ const initiated = await initiate('your_email@gmail.com', 'business_api_key');
337
+ // Response: { email: string }
338
+ ```
339
+
340
+ ### Verify Session
341
+
342
+ ```typescript
343
+ import { verify } from 'paj_ramp';
344
+
345
+ const verified = await verify(
346
+ 'your_email@gmail.com',
347
+ 'otp',
348
+ {
349
+ uuid: string,
350
+ device: string,
351
+ //optionL ↓↓↓↓↓
352
+ os: string, //IOS
353
+ browser: string, //chrome
354
+ ip: string,
355
+ },
356
+ 'business_api_key'
357
+ );
358
+ // Response: { email: string, isActive: string, expiresAt: string, token: string }
359
+ ```
360
+
361
+ ### Get Banks
362
+
363
+ ```typescript
364
+ import { getBanks } from 'paj_ramp';
365
+
366
+ const banks = await getBanks('token');
367
+ // Response: [ { id: string, name: string, country: string } ]
368
+ ```
369
+
370
+ ### Resolve Bank Account
371
+
372
+ ```typescript
373
+ import { resolveBankAccount } from 'paj_ramp';
374
+
375
+ const resolvedBankAccount = await resolveBankAccount(
376
+ 'token',
377
+ 'bank_id',
378
+ 'account_number'
379
+ );
380
+ // Response: { accountName: string, accountNumber: string, bank: { id: string, name: string, code: string, country: string } }
381
+ ```
382
+
383
+ ### Add Bank Account
384
+
385
+ ```typescript
386
+ import { addBankAccount } from 'paj_ramp';
387
+
388
+ const addedBankAccount = await addBankAccount(
389
+ 'token',
390
+ 'bank_id',
391
+ 'account_number'
392
+ );
393
+ // Response: { id: string, accountName: string, accountNumber: string, bank: string }
394
+ ```
395
+
396
+ ### Get Bank Accounts
397
+
398
+ ```typescript
399
+ import { getBankAccounts } from 'paj_ramp';
400
+
401
+ const accounts = await getBankAccounts('token');
402
+ // Response: [ { id: string, accountName: string, accountNumber: string, bank: string } ]
403
+ ```
404
+
405
+ # Offramp 2 (Direct Offramp)
406
+
407
+ ## Usage Examples
408
+
409
+ ### Create Order
410
+
411
+ ```typescript
412
+ import { offRampCreateOrder } from 'paj_ramp';
413
+
414
+ const createOrder = await offRampCreateOrder(
415
+ 'token',
416
+ 'bank_id',
417
+ 'account_number',
418
+ 'NGN', // Currency
419
+ 10000, // amount
420
+ 'token_mint_address'
421
+ 'webhook_url'
422
+ );
423
+ // Response: { id: string, address: string, signature?: string, mint: string, currency: Currency, amount: number, usdcAmount: number, fiatAmount: number, sender: string, receipiant: string, rate: number, status: TransactionStatus, transactionType: TransactionType }
424
+ ```
425
+
426
+ <!--
427
+ ### Get Wallet Info
428
+
429
+ ```typescript
430
+ import { getWallet } from 'paj_ramp';
431
+
432
+ const wallet = await getWallet('wallet public key');
433
+ // Response: { id: string, publicKey: string, bankAccount: { id: string, accountName: string, accountNumber: string, bank: string } }
434
+ ``` -->
435
+ <!--
436
+ ### Add Wallet
437
+
438
+ ```typescript
439
+ import { addWallet } from 'paj_ramp';
440
+
441
+ // To create wallet.json file with an array of 64 numbers
442
+ // npm install @solana/web3.js then run this code
443
+ import { Keypair } from '@solana/web3.js';
444
+ import fs from 'fs';
445
+
446
+ const keypair = Keypair.generate();
447
+ const secretKey = Array.from(keypair.secretKey);
448
+
449
+ fs.writeFileSync('wallet.json', JSON.stringify(secretKey));
450
+ console.log('✅ wallets.json generated successfully');
451
+
452
+ // To get secret key
453
+ import * as fs from 'fs';
454
+ import { fileURLToPath } from 'url';
455
+ import { dirname, resolve } from 'path';
456
+
457
+ const __filename = fileURLToPath(import.meta.url);
458
+ const __dirname = dirname(__filename);
459
+
460
+ // wallet.json that you created with an array of 64 numbers
461
+ const walletPath = resolve(__dirname, './wallet.json');
462
+ const secretKeyRaw = fs.readFileSync(walletPath, 'utf8');
463
+ const secretKeyArray = JSON.parse(secretKeyRaw);
464
+
465
+ if (!Array.isArray(secretKeyArray) || secretKeyArray.length !== 64) {
466
+ throw new Error('Invalid secret key: must be an array of 64 numbers.');
467
+ }
468
+
469
+ const secretKey = Uint8Array.from(secretKeyArray);
470
+
471
+ const addedWallet = await addWallet('token', 'bank account id', secretKey);
472
+ // Response: { id: string, publicKey: string, bankAccount: { id: string, accountName: string, accountNumber: string, bank: string } }
473
+ ``` -->
474
+ <!--
475
+ ### Switch Bank Account on Wallet
476
+
477
+ ```typescript
478
+ import { switchWalletBankAccount } from 'paj_ramp';
479
+
480
+ const switchedWallet = await switchWalletBankAccount(
481
+ 'token',
482
+ 'bank account id to switch to',
483
+ 'wallet id',
484
+ 'secret key'
485
+ );
486
+ // Response: { id: string, publicKey: string, bankAccount: { id: string, accountName: string, accountNumber: string, bank: string } }
487
+ ``` -->
488
+
489
+ ## License
490
+
491
+ MIT
492
+
493
+ ## 🧑‍💻 Author
494
+
495
+ Gospel Chidiebube Chukwu