monei-sdk 1.0.2 → 1.0.3
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 +3 -0
- package/dist/services/BillService.d.ts +5 -2
- package/dist/services/BillService.js +11 -2
- package/dist/services/ExchangeService.d.ts +4 -4
- package/dist/services/ExchangeService.js +6 -6
- package/dist/services/SecuritiesService.d.ts +5 -0
- package/dist/services/SecuritiesService.js +9 -0
- package/dist/types/agent.d.ts +16 -0
- package/dist/types/bills.d.ts +41 -1
- package/dist/types/exchange.d.ts +1 -1
- package/dist/types/security.d.ts +0 -0
- package/dist/types/security.js +1 -0
- package/dist/types/transaction.d.ts +26 -14
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -125,6 +125,9 @@ console.log(`Signature: ${transferResult.data.signature}`);
|
|
|
125
125
|
### 4. Bill Payments
|
|
126
126
|
|
|
127
127
|
```typescript
|
|
128
|
+
// Get Available Electricity Billers
|
|
129
|
+
const electricityBillersResult = await sdk.bills.getElectricityBiller();
|
|
130
|
+
|
|
128
131
|
// Buy airtime
|
|
129
132
|
const airtimeResult = await sdk.bills.buyAirtime({
|
|
130
133
|
phoneNumber: "08012345678",
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { MoneiClient } from '../client/MoneiClient';
|
|
2
|
-
import { BillCategory, BillerItemsResponseDto, ValidateBillDto, AirtimePurchaseDto, DataPurchaseDto, ElectricityPaymentDto, CableTvPaymentDto, BillPaymentResponseDto,
|
|
2
|
+
import { BillCategory, BillerItemsResponseDto, ValidateBillDto, AirtimePurchaseDto, DataPurchaseDto, ElectricityPaymentDto, CableTvPaymentDto, BillPaymentResponseDto, ElectricityBillerResponseDto, PaginatedBillResponseDto, BillResponseDto } from '../types';
|
|
3
3
|
export declare class BillService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: MoneiClient);
|
|
6
6
|
getBillerItems(category: BillCategory, billerName: string): Promise<BillerItemsResponseDto>;
|
|
7
|
+
getElectricityBiller(): Promise<ElectricityBillerResponseDto>;
|
|
7
8
|
validateBill(validateData: ValidateBillDto): Promise<any>;
|
|
8
9
|
buyAirtime(airtimeData: AirtimePurchaseDto): Promise<BillPaymentResponseDto>;
|
|
9
10
|
buyMobileData(dataData: DataPurchaseDto): Promise<BillPaymentResponseDto>;
|
|
10
11
|
buyElectricity(electricityData: ElectricityPaymentDto): Promise<BillPaymentResponseDto>;
|
|
11
12
|
subscribeCableTv(cableData: CableTvPaymentDto): Promise<BillPaymentResponseDto>;
|
|
12
|
-
|
|
13
|
+
getBills(): Promise<PaginatedBillResponseDto[]>;
|
|
14
|
+
getBillByReference(reference: string): Promise<BillResponseDto[]>;
|
|
15
|
+
generateReceipt(transactionId: string): Promise<any>;
|
|
13
16
|
}
|
|
@@ -8,6 +8,9 @@ class BillService {
|
|
|
8
8
|
async getBillerItems(category, billerName) {
|
|
9
9
|
return this.client.get(`/api/v1/bills/get-biller-items/${category}/${billerName}`);
|
|
10
10
|
}
|
|
11
|
+
async getElectricityBiller() {
|
|
12
|
+
return this.client.get('/api/v1/bills/billers/electricity');
|
|
13
|
+
}
|
|
11
14
|
async validateBill(validateData) {
|
|
12
15
|
return this.client.post('/api/v1/bills/validate', validateData);
|
|
13
16
|
}
|
|
@@ -23,8 +26,14 @@ class BillService {
|
|
|
23
26
|
async subscribeCableTv(cableData) {
|
|
24
27
|
return this.client.post('/api/v1/bills/subscribe-cable-tv', cableData);
|
|
25
28
|
}
|
|
26
|
-
async
|
|
27
|
-
return this.client.get('/api/v1/bills
|
|
29
|
+
async getBills() {
|
|
30
|
+
return this.client.get('/api/v1/bills');
|
|
31
|
+
}
|
|
32
|
+
async getBillByReference(reference) {
|
|
33
|
+
return this.client.get(`/api/v1/bills/reference/${reference}`);
|
|
34
|
+
}
|
|
35
|
+
async generateReceipt(transactionId) {
|
|
36
|
+
return this.client.get(`/api/v1/bills/receipt/${transactionId}`);
|
|
28
37
|
}
|
|
29
38
|
}
|
|
30
39
|
exports.BillService = BillService;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { MoneiClient } from '../client/MoneiClient';
|
|
2
|
-
import { SwapNativeToTokenDto, SwapTokenToTokenDto, SwapTokenToNativeDto,
|
|
2
|
+
import { SwapNativeToTokenDto, SwapTokenToTokenDto, SwapTokenToNativeDto, PriceResponseDto, TxHashResponseDto, SwapSolToTokenDto, SwapResponseDto } from '../types';
|
|
3
3
|
export declare class ExchangeService {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: MoneiClient);
|
|
6
|
-
|
|
6
|
+
getNativeToTokenPrice(quoteData: SwapNativeToTokenDto): Promise<PriceResponseDto>;
|
|
7
7
|
swapNativeToToken(swapData: SwapNativeToTokenDto): Promise<TxHashResponseDto>;
|
|
8
|
-
|
|
8
|
+
getTokenToTokenPrice(quoteData: SwapTokenToTokenDto): Promise<PriceResponseDto>;
|
|
9
9
|
swapTokenToToken(swapData: SwapTokenToTokenDto): Promise<TxHashResponseDto>;
|
|
10
|
-
|
|
10
|
+
getTokenToNativePrice(quoteData: SwapTokenToNativeDto): Promise<PriceResponseDto>;
|
|
11
11
|
swapTokenToNative(swapData: SwapTokenToNativeDto): Promise<TxHashResponseDto>;
|
|
12
12
|
getSolanaQuote(inputMint: string, outputMint: string, amount: number): Promise<any>;
|
|
13
13
|
swapSolToToken(swapData: SwapSolToTokenDto): Promise<SwapResponseDto>;
|
|
@@ -6,20 +6,20 @@ class ExchangeService {
|
|
|
6
6
|
this.client = client;
|
|
7
7
|
}
|
|
8
8
|
// EVM Exchange
|
|
9
|
-
async
|
|
10
|
-
return this.client.post('/api/v1/evm-exchange/
|
|
9
|
+
async getNativeToTokenPrice(quoteData) {
|
|
10
|
+
return this.client.post('/api/v1/evm-exchange/price/native-to-token', quoteData);
|
|
11
11
|
}
|
|
12
12
|
async swapNativeToToken(swapData) {
|
|
13
13
|
return this.client.post('/api/v1/evm-exchange/native-to-token', swapData);
|
|
14
14
|
}
|
|
15
|
-
async
|
|
16
|
-
return this.client.post('/api/v1/evm-exchange/
|
|
15
|
+
async getTokenToTokenPrice(quoteData) {
|
|
16
|
+
return this.client.post('/api/v1/evm-exchange/price/token-to-token', quoteData);
|
|
17
17
|
}
|
|
18
18
|
async swapTokenToToken(swapData) {
|
|
19
19
|
return this.client.post('/api/v1/evm-exchange/token-to-token', swapData);
|
|
20
20
|
}
|
|
21
|
-
async
|
|
22
|
-
return this.client.post('/api/v1/evm-exchange/
|
|
21
|
+
async getTokenToNativePrice(quoteData) {
|
|
22
|
+
return this.client.post('/api/v1/evm-exchange/price/token-to-native', quoteData);
|
|
23
23
|
}
|
|
24
24
|
async swapTokenToNative(swapData) {
|
|
25
25
|
return this.client.post('/api/v1/evm-exchange/token-to-native', swapData);
|
package/dist/types/agent.d.ts
CHANGED
|
@@ -15,6 +15,22 @@ export interface ConversationMessagesResponseDto {
|
|
|
15
15
|
export interface CreateConversationDto {
|
|
16
16
|
id: string;
|
|
17
17
|
}
|
|
18
|
+
export interface initializeConversationDto {
|
|
19
|
+
statusCode: number;
|
|
20
|
+
message: string;
|
|
21
|
+
data: ConversationDto;
|
|
22
|
+
}
|
|
23
|
+
export interface ConversationDto {
|
|
24
|
+
id: string;
|
|
25
|
+
user?: {};
|
|
26
|
+
messages?: {};
|
|
27
|
+
title: string;
|
|
28
|
+
context?: string;
|
|
29
|
+
isPinned: boolean;
|
|
30
|
+
createdAt: string;
|
|
31
|
+
updatedAt: string;
|
|
32
|
+
deletedDate?: string;
|
|
33
|
+
}
|
|
18
34
|
export interface PinConversationDto {
|
|
19
35
|
pin: boolean;
|
|
20
36
|
}
|
package/dist/types/bills.d.ts
CHANGED
|
@@ -28,8 +28,19 @@ export interface BillerItemsResponseDto {
|
|
|
28
28
|
message: string;
|
|
29
29
|
data: BillerDto[];
|
|
30
30
|
}
|
|
31
|
+
export interface ElectricityBillerDto {
|
|
32
|
+
name: string;
|
|
33
|
+
code: string;
|
|
34
|
+
billerCode: string;
|
|
35
|
+
}
|
|
36
|
+
export interface ElectricityBillerResponseDto {
|
|
37
|
+
statusCode: number;
|
|
38
|
+
message: string;
|
|
39
|
+
data: ElectricityBillerDto[];
|
|
40
|
+
}
|
|
31
41
|
export interface ValidateBillDto {
|
|
32
|
-
itemCode
|
|
42
|
+
itemCode?: string;
|
|
43
|
+
billerCode: string;
|
|
33
44
|
customer: string;
|
|
34
45
|
}
|
|
35
46
|
export interface CreateBillScheduleDto {
|
|
@@ -116,3 +127,32 @@ export interface BillDto {
|
|
|
116
127
|
token?: string;
|
|
117
128
|
units?: string;
|
|
118
129
|
}
|
|
130
|
+
export interface BillResponseDto {
|
|
131
|
+
statusCode: 200;
|
|
132
|
+
message: string;
|
|
133
|
+
data: BillDto;
|
|
134
|
+
}
|
|
135
|
+
export interface PaginatedBillDto {
|
|
136
|
+
bills: BillDto[];
|
|
137
|
+
page: number;
|
|
138
|
+
total: number;
|
|
139
|
+
totalPages: number;
|
|
140
|
+
hasNext: boolean;
|
|
141
|
+
hasPrev: boolean;
|
|
142
|
+
}
|
|
143
|
+
export interface PaginatedBillResponseDto {
|
|
144
|
+
statusCode: number;
|
|
145
|
+
message: string;
|
|
146
|
+
data: PaginatedBillDto;
|
|
147
|
+
}
|
|
148
|
+
export interface BillDataDto {
|
|
149
|
+
type: false;
|
|
150
|
+
status: string;
|
|
151
|
+
billerName: string;
|
|
152
|
+
billerCode: string;
|
|
153
|
+
customer: string;
|
|
154
|
+
startDate: string;
|
|
155
|
+
endDate: string;
|
|
156
|
+
amount: number;
|
|
157
|
+
reference: string;
|
|
158
|
+
}
|
package/dist/types/exchange.d.ts
CHANGED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,35 +1,47 @@
|
|
|
1
1
|
export interface TransactionResponseDto {
|
|
2
2
|
id: string;
|
|
3
|
-
createdAt: string;
|
|
4
|
-
updatedAt: string;
|
|
5
|
-
deletedDate: string;
|
|
6
3
|
userId: string;
|
|
7
4
|
amount: number;
|
|
8
|
-
type:
|
|
9
|
-
status:
|
|
5
|
+
type: 'CREDIT' | 'DEBIT';
|
|
6
|
+
status: 'SUCCESS' | 'PENDING' | 'FAILED';
|
|
10
7
|
reference: string;
|
|
11
8
|
currency: string;
|
|
12
9
|
narration: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
updatedAt: string;
|
|
12
|
+
deletedDate: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface UserTransactionsDataDto {
|
|
15
|
+
transactions: TransactionResponseDto[];
|
|
16
|
+
pagination: PaginationDto;
|
|
13
17
|
}
|
|
14
18
|
export interface UserTransactionsResponseDto {
|
|
15
19
|
statusCode: number;
|
|
16
20
|
message: string;
|
|
17
|
-
data:
|
|
21
|
+
data: UserTransactionsDataDto;
|
|
18
22
|
}
|
|
19
23
|
export interface TransactionDto {
|
|
20
24
|
id: string;
|
|
21
|
-
createdAt: string;
|
|
22
|
-
updatedAt: string;
|
|
23
|
-
deletedDate: string;
|
|
24
|
-
user: any;
|
|
25
|
-
wallet: any;
|
|
26
|
-
subwallet: any;
|
|
27
25
|
amount: number;
|
|
28
|
-
type:
|
|
29
|
-
status:
|
|
26
|
+
type: 'CREDIT' | 'DEBIT';
|
|
27
|
+
status: 'SUCCESS' | 'PENDING' | 'FAILED';
|
|
30
28
|
currency: string;
|
|
31
29
|
reference: string;
|
|
32
30
|
fincraReference?: string;
|
|
33
31
|
narration: string;
|
|
32
|
+
user: any;
|
|
33
|
+
wallet: any;
|
|
34
|
+
subwallet: any;
|
|
34
35
|
metadata?: any;
|
|
36
|
+
createdAt: string;
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
deletedDate: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface PaginationDto {
|
|
41
|
+
page: number;
|
|
42
|
+
limit: number;
|
|
43
|
+
total: number;
|
|
44
|
+
totalPages: number;
|
|
45
|
+
hasNextPage: boolean;
|
|
46
|
+
hasPreviousPage: boolean;
|
|
35
47
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monei-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Node.js SDK for Monei API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"axios": "^1.13.2",
|
|
28
|
+
"dotenv": "^17.2.3",
|
|
28
29
|
"ts-node": "^10.9.2"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|