@paymechain/sdk 1.0.0 → 1.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.
- package/README.md +40 -100
- package/dist/example.d.ts +2 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +36 -0
- package/dist/example.js.map +1 -0
- package/dist/models/index.d.ts +24 -12
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +0 -8
- package/dist/models/index.js.map +1 -1
- package/dist/payme-client.d.ts +1 -18
- package/dist/payme-client.d.ts.map +1 -1
- package/dist/payme-client.js +6 -39
- package/dist/payme-client.js.map +1 -1
- package/dist/services/account.service.d.ts +22 -6
- package/dist/services/account.service.d.ts.map +1 -1
- package/dist/services/account.service.js +22 -13
- package/dist/services/account.service.js.map +1 -1
- package/dist/services/base.service.d.ts +5 -7
- package/dist/services/base.service.d.ts.map +1 -1
- package/dist/services/base.service.js +21 -28
- package/dist/services/base.service.js.map +1 -1
- package/dist/services/block.service.d.ts +8 -6
- package/dist/services/block.service.d.ts.map +1 -1
- package/dist/services/block.service.js +9 -7
- package/dist/services/block.service.js.map +1 -1
- package/dist/services/explorer.service.d.ts +14 -2
- package/dist/services/explorer.service.d.ts.map +1 -1
- package/dist/services/explorer.service.js +16 -4
- package/dist/services/explorer.service.js.map +1 -1
- package/dist/services/index.d.ts +0 -3
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +0 -3
- package/dist/services/index.js.map +1 -1
- package/dist/services/light-client.service.d.ts +14 -2
- package/dist/services/light-client.service.d.ts.map +1 -1
- package/dist/services/light-client.service.js +16 -4
- package/dist/services/light-client.service.js.map +1 -1
- package/dist/services/staking.service.d.ts +17 -4
- package/dist/services/staking.service.d.ts.map +1 -1
- package/dist/services/staking.service.js +21 -4
- package/dist/services/staking.service.js.map +1 -1
- package/dist/services/statistics.service.d.ts +5 -1
- package/dist/services/statistics.service.d.ts.map +1 -1
- package/dist/services/statistics.service.js +6 -2
- package/dist/services/statistics.service.js.map +1 -1
- package/dist/services/token.service.d.ts +11 -2
- package/dist/services/token.service.d.ts.map +1 -1
- package/dist/services/token.service.js +13 -4
- package/dist/services/token.service.js.map +1 -1
- package/dist/services/transaction.service.d.ts +14 -3
- package/dist/services/transaction.service.d.ts.map +1 -1
- package/dist/services/transaction.service.js +14 -4
- package/dist/services/transaction.service.js.map +1 -1
- package/dist/services/validator.service.d.ts +7 -5
- package/dist/services/validator.service.d.ts.map +1 -1
- package/dist/services/validator.service.js +9 -7
- package/dist/services/validator.service.js.map +1 -1
- package/dist/services/wallet.service.d.ts +35 -5
- package/dist/services/wallet.service.d.ts.map +1 -1
- package/dist/services/wallet.service.js +40 -9
- package/dist/services/wallet.service.js.map +1 -1
- package/package.json +2 -4
|
@@ -6,17 +6,19 @@ class ValidatorService {
|
|
|
6
6
|
this.baseService = baseService;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* Gets a list of all active validators in the network.
|
|
10
|
+
* @returns Array of ValidatorModel
|
|
10
11
|
*/
|
|
11
|
-
async getAllValidators(
|
|
12
|
-
return this.baseService.get(`/api/
|
|
12
|
+
async getAllValidators() {
|
|
13
|
+
return this.baseService.get(`/api/validator`);
|
|
13
14
|
}
|
|
14
15
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param address
|
|
16
|
+
* Gets the details of a specific validator by its address.
|
|
17
|
+
* @param address The address of the validator.
|
|
18
|
+
* @returns ValidatorModel
|
|
17
19
|
*/
|
|
18
|
-
async
|
|
19
|
-
return this.baseService.get(`/api/
|
|
20
|
+
async getValidatorByAddress(address) {
|
|
21
|
+
return this.baseService.get(`/api/validator/${address}`);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
exports.ValidatorService = ValidatorService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.service.js","sourceRoot":"","sources":["../../src/services/validator.service.ts"],"names":[],"mappings":";;;AAIA,MAAa,gBAAgB;IAC3B,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD
|
|
1
|
+
{"version":3,"file":"validator.service.js","sourceRoot":"","sources":["../../src/services/validator.service.ts"],"names":[],"mappings":";;;AAIA,MAAa,gBAAgB;IAC3B,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD;;;OAGG;IACH,KAAK,CAAC,gBAAgB;QACpB,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAmB,gBAAgB,CAAC,CAAC;IAClE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,qBAAqB,CAAC,OAAe;QACzC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAiB,kBAAkB,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;CACF;AAnBD,4CAmBC"}
|
|
@@ -1,11 +1,41 @@
|
|
|
1
1
|
import { BaseService } from './base.service';
|
|
2
|
-
import { CreateWalletViewModel,
|
|
2
|
+
import { CreateWalletViewModel, DeriveAddressViewModel, // Corrected return type for deriveAddress
|
|
3
|
+
SendTransactionRequest, SubmitTransactionResponse, WalletAccountBalanceViewModel, // Assuming this is the return type for SendTransaction from the gateway
|
|
4
|
+
WalletTransactionHistoryViewModel } from '../models';
|
|
3
5
|
export declare class WalletService {
|
|
4
6
|
private baseService;
|
|
5
7
|
constructor(baseService: BaseService);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new wallet.
|
|
10
|
+
* @returns CreateWalletViewModel
|
|
11
|
+
*/
|
|
12
|
+
createWallet(): Promise<CreateWalletViewModel>;
|
|
13
|
+
/**
|
|
14
|
+
* Derives an address from a mnemonic phrase and index.
|
|
15
|
+
* @param mnemonic The mnemonic phrase.
|
|
16
|
+
* @param index The derivation index.
|
|
17
|
+
* @returns DeriveAddressViewModel
|
|
18
|
+
*/
|
|
19
|
+
deriveAddress(mnemonic: string, index: number): Promise<DeriveAddressViewModel>;
|
|
20
|
+
/**
|
|
21
|
+
* Gets the balance for a specific wallet address.
|
|
22
|
+
* @param address The wallet address.
|
|
23
|
+
* @returns Array of WalletAccountBalanceViewModel
|
|
24
|
+
*/
|
|
25
|
+
getWalletBalance(address: string): Promise<WalletAccountBalanceViewModel[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Gets the transaction history for a specific wallet address and token ID.
|
|
28
|
+
* Note: This method is currently in AccountService in the .NET gateway, but logically belongs here.
|
|
29
|
+
* @param address The wallet address.
|
|
30
|
+
* @param tokenId The token identifier.
|
|
31
|
+
* @returns Array of WalletTransactionHistoryViewModel
|
|
32
|
+
*/
|
|
33
|
+
getWalletHistory(address: string, tokenId: string): Promise<WalletTransactionHistoryViewModel[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Sends a transaction from the wallet.
|
|
36
|
+
* @param request The send transaction request object.
|
|
37
|
+
* @returns SubmitTransactionResponse
|
|
38
|
+
*/
|
|
39
|
+
sendTransaction(request: SendTransactionRequest): Promise<SubmitTransactionResponse>;
|
|
10
40
|
}
|
|
11
41
|
//# sourceMappingURL=wallet.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.service.d.ts","sourceRoot":"","sources":["../../src/services/wallet.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACH,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"wallet.service.d.ts","sourceRoot":"","sources":["../../src/services/wallet.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACH,qBAAqB,EACrB,sBAAsB,EAAE,0CAA0C;AAClE,sBAAsB,EACtB,yBAAyB,EAAE,6BAA6B,EAAE,wEAAwE;AAClI,iCAAiC,EACpC,MAAM,WAAW,CAAC;AAEnB,qBAAa,aAAa;IACZ,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAE5C;;;OAGG;IACG,YAAY,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAIpD;;;;;OAKG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAKrF;;;;OAIG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,6BAA6B,EAAE,CAAC;IAIjF;;;;;;OAMG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,iCAAiC,EAAE,CAAC;IAKtG;;;;OAIG;IACG,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAG3F"}
|
|
@@ -5,18 +5,49 @@ class WalletService {
|
|
|
5
5
|
constructor(baseService) {
|
|
6
6
|
this.baseService = baseService;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new wallet.
|
|
10
|
+
* @returns CreateWalletViewModel
|
|
11
|
+
*/
|
|
12
|
+
async createWallet() {
|
|
13
|
+
return this.baseService.post('/api/wallet/create');
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Derives an address from a mnemonic phrase and index.
|
|
17
|
+
* @param mnemonic The mnemonic phrase.
|
|
18
|
+
* @param index The derivation index.
|
|
19
|
+
* @returns DeriveAddressViewModel
|
|
20
|
+
*/
|
|
21
|
+
async deriveAddress(mnemonic, index) {
|
|
22
|
+
const params = { mnemonic, index };
|
|
23
|
+
return this.baseService.get('/api/wallet/derive-address', params);
|
|
14
24
|
}
|
|
15
|
-
|
|
16
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Gets the balance for a specific wallet address.
|
|
27
|
+
* @param address The wallet address.
|
|
28
|
+
* @returns Array of WalletAccountBalanceViewModel
|
|
29
|
+
*/
|
|
30
|
+
async getWalletBalance(address) {
|
|
31
|
+
return this.baseService.get(`/api/wallet/${address}/balance`);
|
|
17
32
|
}
|
|
18
|
-
|
|
19
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Gets the transaction history for a specific wallet address and token ID.
|
|
35
|
+
* Note: This method is currently in AccountService in the .NET gateway, but logically belongs here.
|
|
36
|
+
* @param address The wallet address.
|
|
37
|
+
* @param tokenId The token identifier.
|
|
38
|
+
* @returns Array of WalletTransactionHistoryViewModel
|
|
39
|
+
*/
|
|
40
|
+
async getWalletHistory(address, tokenId) {
|
|
41
|
+
const params = { tokenId }; // Address is part of the path
|
|
42
|
+
return this.baseService.get(`/api/wallet/${address}/history/${tokenId}`, params);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sends a transaction from the wallet.
|
|
46
|
+
* @param request The send transaction request object.
|
|
47
|
+
* @returns SubmitTransactionResponse
|
|
48
|
+
*/
|
|
49
|
+
async sendTransaction(request) {
|
|
50
|
+
return this.baseService.post('/api/wallet/send-transaction', request);
|
|
20
51
|
}
|
|
21
52
|
}
|
|
22
53
|
exports.WalletService = WalletService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.service.js","sourceRoot":"","sources":["../../src/services/wallet.service.ts"],"names":[],"mappings":";;;AASA,MAAa,aAAa;IACxB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD,KAAK,CAAC,YAAY
|
|
1
|
+
{"version":3,"file":"wallet.service.js","sourceRoot":"","sources":["../../src/services/wallet.service.ts"],"names":[],"mappings":";;;AASA,MAAa,aAAa;IACxB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD;;;OAGG;IACH,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAAwB,oBAAoB,CAAC,CAAC;IAC5E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,aAAa,CAAC,QAAgB,EAAE,KAAa;QACjD,MAAM,MAAM,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAyB,4BAA4B,EAAE,MAAM,CAAC,CAAC;IAC5F,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAe;QACpC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAkC,eAAe,OAAO,UAAU,CAAC,CAAC;IACjG,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CAAC,OAAe,EAAE,OAAe;QACrD,MAAM,MAAM,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,8BAA8B;QAC1D,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAsC,eAAe,OAAO,YAAY,OAAO,EAAE,EAAE,MAAM,CAAC,CAAC;IACxH,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CAAC,OAA+B;QACnD,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAA4B,8BAA8B,EAAE,OAAO,CAAC,CAAC;IACnG,CAAC;CACF;AAnDD,sCAmDC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paymechain/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Official TypeScript SDK for the PaymeChain blockchain. Provides a resilient, framework-agnostic client for interacting with network nodes, managing accounts, submitting transactions, and subscribing to real-time events.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,9 +35,7 @@
|
|
|
35
35
|
"access": "public"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"
|
|
39
|
-
"axios": "^1.6.2",
|
|
40
|
-
"events": "^3.3.0"
|
|
38
|
+
"axios": "^1.6.2"
|
|
41
39
|
},
|
|
42
40
|
"devDependencies": {
|
|
43
41
|
"@types/node": "^20.10.4",
|