@paymechain/sdk 1.0.0 → 1.0.1
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 +23 -11
- 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
package/README.md
CHANGED
|
@@ -3,103 +3,46 @@
|
|
|
3
3
|
</p>
|
|
4
4
|
<h1 align="center">PaymeChain SDK for JavaScript / TypeScript</h1>
|
|
5
5
|
|
|
6
|
-
Este é o SDK oficial para interagir com a
|
|
6
|
+
Este é o SDK oficial para interagir com a API do Gateway da PaymeChain a partir de qualquer ambiente JavaScript (Node.js, navegadores, etc.).
|
|
7
7
|
|
|
8
|
-
O SDK é construído para ser
|
|
8
|
+
O SDK é construído para ser leve e agnóstico de framework, fornecendo uma maneira simples de consumir todos os endpoints RESTful expostos pelo `DE.Payme.Gateway.Api`.
|
|
9
9
|
|
|
10
10
|
## Funcionalidades
|
|
11
11
|
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
14
|
-
- **
|
|
15
|
-
- **
|
|
16
|
-
- **Eventos em Tempo Real:** Permite "ouvir" eventos da blockchain em tempo real (novos blocos, etc.) usando SignalR.
|
|
17
|
-
- **Universal:** Funciona tanto em ambientes Node.js quanto em navegadores modernos.
|
|
12
|
+
- **Leve e Agnóstico:** Sem dependências de Node.js ou de frameworks de frontend. Funciona em qualquer lugar.
|
|
13
|
+
- **API Completa:** Fornece acesso a todos os endpoints do Gateway, organizados por serviço.
|
|
14
|
+
- **Fácil de Usar:** Uma interface simples e intuitiva para interagir com a blockchain através do Gateway.
|
|
15
|
+
- **Baseado em Promises:** Todas as chamadas de API retornam Promises, facilitando o uso com `async/await`.
|
|
18
16
|
|
|
19
17
|
## Instalação
|
|
20
18
|
|
|
21
19
|
```bash
|
|
22
|
-
npm install
|
|
20
|
+
npm install @paymechain/sdk
|
|
23
21
|
```
|
|
24
|
-
*(Nota: Este comando assume que você está instalando a partir de um diretório local. Quando publicado, será `npm install paymesdk`)*.
|
|
25
22
|
|
|
26
23
|
## Como Usar
|
|
27
24
|
|
|
28
|
-
O uso do SDK é projetado para ser simples, com um passo de inicialização assíncrono obrigatório.
|
|
29
|
-
|
|
30
25
|
### 1. Importar e Configurar
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Primeiro, importe o `PaymeClient` e defina sua configuração. Você deve fornecer ou o `nodeRegistryUrl` (recomendado) ou uma lista de `seedNodes`.
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
Primeiro, importe o `PaymeClient` e crie uma instância, fornecendo a URL base do seu `DE.Payme.Gateway.Api`.
|
|
37
28
|
|
|
38
29
|
```typescript
|
|
30
|
+
import { PaymeClient } from '@paymechain/sdk'; // ou o caminho local, ex: './src'
|
|
39
31
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const config: PaymeClientConfig = {
|
|
45
|
-
// Recomendado: URL da API central que lista os validadores
|
|
46
|
-
nodeRegistryUrl: 'http://seu-registro-de-validadores.com',
|
|
47
|
-
// Opcional: Nós semente para o primeiro contato ou como fallback
|
|
48
|
-
seedNodes: ['http://node1.payme.com:5000', 'http://node2.payme.com:5000'],
|
|
49
|
-
// Opcional: Intervalo em segundos para checar a saúde dos nós (padrão: 60)
|
|
50
|
-
healthCheckIntervalSeconds: 90,
|
|
51
|
-
// Opcional: Estratégia para selecionar o melhor nó (padrão: LowestLatency)
|
|
52
|
-
nodeSelectionStrategy: NodeSelectionStrategy.LowestLatency,
|
|
53
|
-
validatorMode: 1
|
|
54
|
-
|
|
32
|
+
// A única configuração necessária é a URL do seu Gateway
|
|
33
|
+
const config = {
|
|
34
|
+
gatewayUrl: 'https://localhost:44397', // Altere para a URL do seu ambiente
|
|
55
35
|
};
|
|
56
36
|
|
|
57
37
|
// Crie uma instância do cliente
|
|
58
|
-
|
|
59
38
|
const paymeClient = new PaymeClient(config);
|
|
60
39
|
|
|
40
|
+
// O cliente está pronto para ser usado!
|
|
61
41
|
```
|
|
62
42
|
|
|
63
|
-
### 2.
|
|
64
|
-
|
|
65
|
-
Antes de usar o cliente, você **deve** chamar o método `initialize()`. Este método assíncrono busca o certificado de segurança, descobre os nós da rede e estabelece a primeira conexão.
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
async function main() {
|
|
69
|
-
try {
|
|
70
|
-
await paymeClient.initialize();
|
|
71
|
-
console.log("PaymeClient inicializado com sucesso!");
|
|
72
|
-
|
|
73
|
-
// Agora você pode usar o cliente.
|
|
74
|
-
await getStats();
|
|
75
|
-
|
|
76
|
-
// Configurar listeners de eventos em tempo real
|
|
77
|
-
setupRealtimeListeners();
|
|
78
|
-
|
|
79
|
-
} catch (error) {
|
|
80
|
-
console.error("Falha ao inicializar o PaymeClient:", error);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
main();
|
|
85
|
-
```
|
|
43
|
+
### 2. Usando os Serviços
|
|
86
44
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
Após a inicialização, todos os serviços estão disponíveis como propriedades do `paymeClient`.
|
|
90
|
-
|
|
91
|
-
**Exemplo: Buscar estatísticas da rede**
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
async function getStats() {
|
|
95
|
-
try {
|
|
96
|
-
const stats = await paymeClient.statistics.getNetworkStatistics();
|
|
97
|
-
console.log("Altura do Bloco:", stats.BlockHeight);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
console.error("Erro ao buscar estatísticas:", error);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
```
|
|
45
|
+
Após a instanciação, todos os serviços estão disponíveis como propriedades do `paymeClient`.
|
|
103
46
|
|
|
104
47
|
**Exemplo: Buscar informações de uma conta**
|
|
105
48
|
|
|
@@ -110,43 +53,40 @@ async function getAccountInfo(address: string) {
|
|
|
110
53
|
console.log("Endereço:", account.Address);
|
|
111
54
|
console.log("Sequência:", account.Sequence);
|
|
112
55
|
} catch (error) {
|
|
113
|
-
console.error(`Erro ao buscar conta ${address}:`, error);
|
|
56
|
+
console.error(`Erro ao buscar conta ${address}:`, error.message);
|
|
114
57
|
}
|
|
115
58
|
}
|
|
116
59
|
```
|
|
117
60
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
Você pode se inscrever para receber notificações em tempo real da blockchain.
|
|
61
|
+
**Exemplo: Criar uma nova carteira**
|
|
121
62
|
|
|
122
63
|
```typescript
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
console.log(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
console.log("Listeners de eventos em tempo real configurados.");
|
|
64
|
+
async function createNewWallet() {
|
|
65
|
+
try {
|
|
66
|
+
const newWallet = await paymeClient.wallet.createWallet();
|
|
67
|
+
console.log("Carteira Criada!");
|
|
68
|
+
console.log("Mnemonic:", newWallet.Mnemonic);
|
|
69
|
+
console.log("Endereço:", newWallet.Address);
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error("Erro ao criar carteira:", error.message);
|
|
72
|
+
}
|
|
135
73
|
}
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### 5. Encerrando o SDK
|
|
139
74
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
```typescript
|
|
143
|
-
// Em algum ponto do ciclo de vida da sua aplicação, ao encerrar:
|
|
144
|
-
await paymeClient.stop();
|
|
145
|
-
console.log("Serviços do PaymeSDK parados.");
|
|
75
|
+
// Exemplo de chamada
|
|
76
|
+
createNewWallet();
|
|
146
77
|
```
|
|
147
78
|
|
|
148
|
-
##
|
|
79
|
+
## Serviços Disponíveis
|
|
149
80
|
|
|
150
|
-
|
|
81
|
+
O `paymeClient` oferece acesso aos seguintes serviços, que correspondem diretamente aos controllers da API do Gateway:
|
|
151
82
|
|
|
152
|
-
|
|
83
|
+
- `paymeClient.account`
|
|
84
|
+
- `paymeClient.block`
|
|
85
|
+
- `paymeClient.explorer`
|
|
86
|
+
- `paymeClient.lightClient`
|
|
87
|
+
- `paymeClient.staking`
|
|
88
|
+
- `paymeClient.statistics`
|
|
89
|
+
- `paymeClient.token`
|
|
90
|
+
- `paymeClient.transaction`
|
|
91
|
+
- `paymeClient.validator`
|
|
92
|
+
- `paymeClient.wallet`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":""}
|
package/dist/example.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// PaymeSDK/src/example.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const payme_client_1 = require("./payme-client");
|
|
5
|
+
// Função principal assíncrona para rodar o exemplo
|
|
6
|
+
async function runExample() {
|
|
7
|
+
console.log('Iniciando exemplo de uso do PaymeSDK...');
|
|
8
|
+
// 1. Configurar o cliente com a URL do Gateway
|
|
9
|
+
// ATENÇÃO: Certifique-se de que a porta está correta para sua execução local do DE.Payme.Gateway.Api
|
|
10
|
+
const client = new payme_client_1.PaymeClient({
|
|
11
|
+
gatewayUrl: 'https://gateway.paymechain.com',
|
|
12
|
+
});
|
|
13
|
+
// 2. Definir um endereço de conta para o teste
|
|
14
|
+
const testAddress = '1Cixj9wDrzy4HwsmJ3VmCMP4axKGd3drnu'; // Usando um dos endereços dos seus arquivos de exemplo
|
|
15
|
+
try {
|
|
16
|
+
// 3. Chamar um método do SDK
|
|
17
|
+
console.log(`Buscando informações da conta para o endereço: ${testAddress}`);
|
|
18
|
+
// Supondo que o modelo retornado pelo SDK corresponda ao esperado.
|
|
19
|
+
// O tipo 'any' é usado para evitar erros de compilação se os modelos não estiverem perfeitamente alinhados.
|
|
20
|
+
const accountInfo = await client.account.getAccountInfo(testAddress);
|
|
21
|
+
// 4. Exibir o resultado
|
|
22
|
+
console.log('Informações da conta recebidas com sucesso:');
|
|
23
|
+
console.log(JSON.stringify(accountInfo, null, 2));
|
|
24
|
+
// Exemplo de como chamar outro método
|
|
25
|
+
// console.log(`\nBuscando saldo de PAYM para o endereço: ${testAddress}`);
|
|
26
|
+
// const balance = await client.account.getAccountBalance(testAddress, 'PAYM');
|
|
27
|
+
// console.log('Saldo recebido:');
|
|
28
|
+
// console.log(JSON.stringify(balance, null, 2));
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error('Ocorreu um erro ao chamar o SDK:', error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
// Executar a função de exemplo
|
|
35
|
+
runExample();
|
|
36
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","sourceRoot":"","sources":["../src/example.ts"],"names":[],"mappings":";AAAA,0BAA0B;;AAE1B,iDAA6C;AAE7C,mDAAmD;AACnD,KAAK,UAAU,UAAU;IACvB,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IAEvD,+CAA+C;IAC/C,qGAAqG;IACrG,MAAM,MAAM,GAAG,IAAI,0BAAW,CAAC;QAC7B,UAAU,EAAE,gCAAgC;KAC7C,CAAC,CAAC;IAEH,+CAA+C;IAC/C,MAAM,WAAW,GAAG,oCAAoC,CAAC,CAAC,uDAAuD;IAEjH,IAAI,CAAC;QACH,6BAA6B;QAC7B,OAAO,CAAC,GAAG,CAAC,kDAAkD,WAAW,EAAE,CAAC,CAAC;QAE7E,mEAAmE;QACnE,4GAA4G;QAC5G,MAAM,WAAW,GAAQ,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;QAE1E,wBAAwB;QACxB,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;QAC3D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAElD,sCAAsC;QACtC,2EAA2E;QAC3E,+EAA+E;QAC/E,kCAAkC;QAClC,iDAAiD;IAEnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,+BAA+B;AAC/B,UAAU,EAAE,CAAC"}
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface ICommandResult<T> {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
cod: number;
|
|
3
|
+
success: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
data: T | null;
|
|
6
6
|
}
|
|
7
7
|
export interface PagedResult<T> {
|
|
8
8
|
TotalItems: number;
|
|
@@ -11,11 +11,6 @@ export interface PagedResult<T> {
|
|
|
11
11
|
PageSize: number;
|
|
12
12
|
Items: T[];
|
|
13
13
|
}
|
|
14
|
-
export declare enum NodeSelectionStrategy {
|
|
15
|
-
LowestLatency = 0,
|
|
16
|
-
HighestBlockHeight = 1,
|
|
17
|
-
Random = 2
|
|
18
|
-
}
|
|
19
14
|
export interface AccountViewModel {
|
|
20
15
|
Id: string;
|
|
21
16
|
Address: string;
|
|
@@ -75,6 +70,18 @@ export interface UnbondingEntryViewModel {
|
|
|
75
70
|
Amount: number;
|
|
76
71
|
ReleaseBlockHeight: number;
|
|
77
72
|
}
|
|
73
|
+
export interface StakeViewModel {
|
|
74
|
+
ValidatorAddress: string;
|
|
75
|
+
Amount: number;
|
|
76
|
+
SenderAddress: string;
|
|
77
|
+
Signature: string;
|
|
78
|
+
}
|
|
79
|
+
export interface UnstakeViewModel {
|
|
80
|
+
ValidatorAddress: string;
|
|
81
|
+
Amount: number;
|
|
82
|
+
SenderAddress: string;
|
|
83
|
+
Signature: string;
|
|
84
|
+
}
|
|
78
85
|
export interface NetworkStatisticsModel {
|
|
79
86
|
BlockHeight: number;
|
|
80
87
|
TotalTransactions: number;
|
|
@@ -84,6 +91,7 @@ export interface NetworkStatisticsModel {
|
|
|
84
91
|
}
|
|
85
92
|
export interface TokenViewModel {
|
|
86
93
|
Id: string;
|
|
94
|
+
Name: string;
|
|
87
95
|
Code: string;
|
|
88
96
|
IssuerAddress: string;
|
|
89
97
|
IsActive: boolean;
|
|
@@ -99,6 +107,9 @@ export interface SubmitTransactionRequest {
|
|
|
99
107
|
Signature: string;
|
|
100
108
|
TransactionHash: string;
|
|
101
109
|
}
|
|
110
|
+
export interface SubmitTransactionResponse {
|
|
111
|
+
TransactionId: string;
|
|
112
|
+
}
|
|
102
113
|
export interface TransactionIdViewModel {
|
|
103
114
|
TransactionId: string;
|
|
104
115
|
}
|
|
@@ -124,9 +135,10 @@ export interface CreateWalletViewModel {
|
|
|
124
135
|
PublicKey: string;
|
|
125
136
|
Address: string;
|
|
126
137
|
}
|
|
127
|
-
export interface
|
|
138
|
+
export interface DeriveAddressViewModel {
|
|
128
139
|
Mnemonic: string;
|
|
129
|
-
|
|
140
|
+
PublicKey: string;
|
|
141
|
+
Address: string;
|
|
130
142
|
}
|
|
131
143
|
export interface WalletAccountBalanceViewModel {
|
|
132
144
|
TokenId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc,CAAC,CAAC;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAA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E,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,qBAAqB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,6BAA6B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iCAAiC;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/models/index.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// src/models/index.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.NodeSelectionStrategy = void 0;
|
|
5
|
-
// Enums
|
|
6
|
-
var NodeSelectionStrategy;
|
|
7
|
-
(function (NodeSelectionStrategy) {
|
|
8
|
-
NodeSelectionStrategy[NodeSelectionStrategy["LowestLatency"] = 0] = "LowestLatency";
|
|
9
|
-
NodeSelectionStrategy[NodeSelectionStrategy["HighestBlockHeight"] = 1] = "HighestBlockHeight";
|
|
10
|
-
NodeSelectionStrategy[NodeSelectionStrategy["Random"] = 2] = "Random";
|
|
11
|
-
})(NodeSelectionStrategy || (exports.NodeSelectionStrategy = NodeSelectionStrategy = {}));
|
|
12
4
|
//# sourceMappingURL=index.js.map
|
package/dist/models/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";AAAA,sBAAsB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/models/index.ts"],"names":[],"mappings":";AAAA,sBAAsB"}
|
package/dist/payme-client.d.ts
CHANGED
|
@@ -8,13 +8,8 @@ import { StatisticsService } from './services/statistics.service';
|
|
|
8
8
|
import { TokenService } from './services/token.service';
|
|
9
9
|
import { TransactionService } from './services/transaction.service';
|
|
10
10
|
import { ValidatorService } from './services/validator.service';
|
|
11
|
-
import { ISignalRClient } from './services/signalr.service';
|
|
12
|
-
import { NodeSelectionStrategy } from './models';
|
|
13
11
|
export interface PaymeClientConfig {
|
|
14
|
-
|
|
15
|
-
nodeRegistryUrl?: string;
|
|
16
|
-
healthCheckIntervalSeconds?: number;
|
|
17
|
-
nodeSelectionStrategy?: NodeSelectionStrategy;
|
|
12
|
+
gatewayUrl: string;
|
|
18
13
|
}
|
|
19
14
|
export declare class PaymeClient {
|
|
20
15
|
readonly wallet: WalletService;
|
|
@@ -27,18 +22,6 @@ export declare class PaymeClient {
|
|
|
27
22
|
readonly token: TokenService;
|
|
28
23
|
readonly transaction: TransactionService;
|
|
29
24
|
readonly validator: ValidatorService;
|
|
30
|
-
readonly signalR: ISignalRClient;
|
|
31
|
-
private readonly certificateManager;
|
|
32
|
-
private readonly nodeManager;
|
|
33
25
|
constructor(config: PaymeClientConfig);
|
|
34
|
-
/**
|
|
35
|
-
* Initializes the SDK by fetching the CA certificate and discovering healthy nodes.
|
|
36
|
-
* This must be called before making any API requests.
|
|
37
|
-
*/
|
|
38
|
-
initialize(): Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Stops all background activity, including node health checks and the SignalR connection.
|
|
41
|
-
*/
|
|
42
|
-
stop(): Promise<void>;
|
|
43
26
|
}
|
|
44
27
|
//# sourceMappingURL=payme-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payme-client.d.ts","sourceRoot":"","sources":["../src/payme-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"payme-client.d.ts","sourceRoot":"","sources":["../src/payme-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAGhE,MAAM,WAAW,iBAAiB;IAC9B,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,WAAW;IAEpB,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,OAAO,EAAE,cAAc,CAAC;IACxC,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,QAAQ,EAAE,eAAe,CAAC;IAC1C,SAAgB,WAAW,EAAE,kBAAkB,CAAC;IAChD,SAAgB,OAAO,EAAE,cAAc,CAAC;IACxC,SAAgB,UAAU,EAAE,iBAAiB,CAAC;IAC9C,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,WAAW,EAAE,kBAAkB,CAAC;IAChD,SAAgB,SAAS,EAAE,gBAAgB,CAAC;gBAEhC,MAAM,EAAE,iBAAiB;CAsBxC"}
|
package/dist/payme-client.js
CHANGED
|
@@ -13,21 +13,14 @@ const token_service_1 = require("./services/token.service");
|
|
|
13
13
|
const transaction_service_1 = require("./services/transaction.service");
|
|
14
14
|
const validator_service_1 = require("./services/validator.service");
|
|
15
15
|
const base_service_1 = require("./services/base.service");
|
|
16
|
-
const certificate_manager_service_1 = require("./services/certificate-manager.service");
|
|
17
|
-
const node_manager_service_1 = require("./services/node-manager.service");
|
|
18
|
-
const signalr_service_1 = require("./services/signalr.service");
|
|
19
16
|
class PaymeClient {
|
|
20
17
|
constructor(config) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
throw new Error("A configuração do PaymeClient deve fornecer 'nodeRegistryUrl' ou pelo menos um 'seedNode'.");
|
|
18
|
+
if (!config.gatewayUrl) {
|
|
19
|
+
throw new Error("A configuração do PaymeClient deve fornecer 'gatewayUrl'.");
|
|
24
20
|
}
|
|
25
|
-
//
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// 2. Instantiate the base service for API calls
|
|
29
|
-
const baseService = new base_service_1.BaseService(this.nodeManager);
|
|
30
|
-
// 3. Instantiate all public-facing API services
|
|
21
|
+
// Instantiate the base service for API calls, now using the gateway URL
|
|
22
|
+
const baseService = new base_service_1.BaseService(config.gatewayUrl);
|
|
23
|
+
// Instantiate all public-facing API services
|
|
31
24
|
this.wallet = new wallet_service_1.WalletService(baseService);
|
|
32
25
|
this.account = new account_service_1.AccountService(baseService);
|
|
33
26
|
this.block = new block_service_1.BlockService(baseService);
|
|
@@ -37,34 +30,8 @@ class PaymeClient {
|
|
|
37
30
|
this.statistics = new statistics_service_1.StatisticsService(baseService);
|
|
38
31
|
this.token = new token_service_1.TokenService(baseService);
|
|
39
32
|
this.transaction = new transaction_service_1.TransactionService(baseService);
|
|
40
|
-
// ValidatorService
|
|
33
|
+
// ValidatorService will now query gateway endpoints
|
|
41
34
|
this.validator = new validator_service_1.ValidatorService(baseService);
|
|
42
|
-
// 4. Instantiate the SignalR client
|
|
43
|
-
this.signalR = new signalr_service_1.SignalRClient(this.nodeManager);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Initializes the SDK by fetching the CA certificate and discovering healthy nodes.
|
|
47
|
-
* This must be called before making any API requests.
|
|
48
|
-
*/
|
|
49
|
-
async initialize() {
|
|
50
|
-
console.log("[PaymeClient] Initializing SDK...");
|
|
51
|
-
await this.certificateManager.initializeAsync();
|
|
52
|
-
await this.nodeManager.initializeAsync();
|
|
53
|
-
// Start SignalR connection after we have a healthy node
|
|
54
|
-
await this.signalR.start();
|
|
55
|
-
// Start periodic background checks
|
|
56
|
-
this.nodeManager.startPeriodicChecks();
|
|
57
|
-
console.log("[PaymeClient] SDK Initialized and periodic checks started.");
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Stops all background activity, including node health checks and the SignalR connection.
|
|
61
|
-
*/
|
|
62
|
-
async stop() {
|
|
63
|
-
console.log("[PaymeClient] Stopping SDK services...");
|
|
64
|
-
this.nodeManager.stopPeriodicChecks();
|
|
65
|
-
this.certificateManager.dispose();
|
|
66
|
-
await this.signalR.dispose();
|
|
67
|
-
console.log("[PaymeClient] SDK services stopped.");
|
|
68
35
|
}
|
|
69
36
|
}
|
|
70
37
|
exports.PaymeClient = PaymeClient;
|
package/dist/payme-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payme-client.js","sourceRoot":"","sources":["../src/payme-client.ts"],"names":[],"mappings":";;;AAAA,sBAAsB;AACtB,8DAA0D;AAC1D,gEAA4D;AAC5D,4DAAwD;AACxD,kEAA8D;AAC9D,0EAAqE;AACrE,gEAA4D;AAC5D,sEAAkE;AAClE,4DAAwD;AACxD,wEAAoE;AACpE,oEAAgE;AAChE,0DAAsD;
|
|
1
|
+
{"version":3,"file":"payme-client.js","sourceRoot":"","sources":["../src/payme-client.ts"],"names":[],"mappings":";;;AAAA,sBAAsB;AACtB,8DAA0D;AAC1D,gEAA4D;AAC5D,4DAAwD;AACxD,kEAA8D;AAC9D,0EAAqE;AACrE,gEAA4D;AAC5D,sEAAkE;AAClE,4DAAwD;AACxD,wEAAoE;AACpE,oEAAgE;AAChE,0DAAsD;AAMtD,MAAa,WAAW;IAapB,YAAY,MAAyB;QACjC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;QACjF,CAAC;QAED,wEAAwE;QACxE,MAAM,WAAW,GAAG,IAAI,0BAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEvD,6CAA6C;QAC7C,IAAI,CAAC,MAAM,GAAG,IAAI,8BAAa,CAAC,WAAW,CAAC,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,IAAI,gCAAc,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,4BAAY,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,IAAI,kCAAe,CAAC,WAAW,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,yCAAkB,CAAC,WAAW,CAAC,CAAC;QACvD,IAAI,CAAC,OAAO,GAAG,IAAI,gCAAc,CAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,IAAI,sCAAiB,CAAC,WAAW,CAAC,CAAC;QACrD,IAAI,CAAC,KAAK,GAAG,IAAI,4BAAY,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,IAAI,wCAAkB,CAAC,WAAW,CAAC,CAAC;QAEvD,oDAAoD;QACpD,IAAI,CAAC,SAAS,GAAG,IAAI,oCAAgB,CAAC,WAAW,CAAC,CAAC;IACvD,CAAC;CACJ;AAnCD,kCAmCC"}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { BaseService } from './base.service';
|
|
2
|
-
import { AccountViewModel,
|
|
2
|
+
import { AccountViewModel, // Assuming this maps to .NET's AccountInfo
|
|
3
|
+
BalanceLineViewModel, // Assuming this maps to .NET's BalanceLine
|
|
4
|
+
TransactionSummaryViewModel } from '../models';
|
|
3
5
|
export declare class AccountService {
|
|
4
6
|
private baseService;
|
|
5
7
|
constructor(baseService: BaseService);
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Gets account information for a specific address.
|
|
10
|
+
* @param address The account address.
|
|
11
|
+
* @returns AccountViewModel
|
|
12
|
+
*/
|
|
13
|
+
getAccountInfo(address: string): Promise<AccountViewModel>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the balance for a specific account and token.
|
|
16
|
+
* @param address The account address.
|
|
17
|
+
* @param tokenId The token identifier.
|
|
18
|
+
* @returns BalanceLineViewModel
|
|
19
|
+
*/
|
|
20
|
+
getAccountBalance(address: string, tokenId: string): Promise<BalanceLineViewModel>;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the transaction history for a specific account.
|
|
23
|
+
* @param address The account address.
|
|
24
|
+
* @returns Array of TransactionSummaryViewModel
|
|
25
|
+
*/
|
|
26
|
+
getAccountTransactions(address: string): Promise<TransactionSummaryViewModel[]>;
|
|
11
27
|
}
|
|
12
28
|
//# sourceMappingURL=account.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.service.d.ts","sourceRoot":"","sources":["../../src/services/account.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"account.service.d.ts","sourceRoot":"","sources":["../../src/services/account.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EACL,gBAAgB,EAAE,2CAA2C;AAC7D,oBAAoB,EAAE,2CAA2C;AACjE,2BAA2B,EAC5B,MAAM,WAAW,CAAC;AAEnB,qBAAa,cAAc;IACb,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,WAAW;IAE5C;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIhE;;;;;OAKG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIxF;;;;OAIG;IACG,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,EAAE,CAAC;CAGtF"}
|
|
@@ -5,21 +5,30 @@ class AccountService {
|
|
|
5
5
|
constructor(baseService) {
|
|
6
6
|
this.baseService = baseService;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Gets account information for a specific address.
|
|
10
|
+
* @param address The account address.
|
|
11
|
+
* @returns AccountViewModel
|
|
12
|
+
*/
|
|
13
|
+
async getAccountInfo(address) {
|
|
14
|
+
return this.baseService.get(`/api/account/${address}`);
|
|
10
15
|
}
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Gets the balance for a specific account and token.
|
|
18
|
+
* @param address The account address.
|
|
19
|
+
* @param tokenId The token identifier.
|
|
20
|
+
* @returns BalanceLineViewModel
|
|
21
|
+
*/
|
|
22
|
+
async getAccountBalance(address, tokenId) {
|
|
23
|
+
return this.baseService.get(`/api/account/${address}/balance/${tokenId}`);
|
|
13
24
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
// This endpoint is documented under the /wallet section in blockchain.md, but fits logically here too.
|
|
22
|
-
return this.baseService.get(`/api/wallet/${address}/balance`, {}, language);
|
|
25
|
+
/**
|
|
26
|
+
* Gets the transaction history for a specific account.
|
|
27
|
+
* @param address The account address.
|
|
28
|
+
* @returns Array of TransactionSummaryViewModel
|
|
29
|
+
*/
|
|
30
|
+
async getAccountTransactions(address) {
|
|
31
|
+
return this.baseService.get(`/api/account/${address}/transactions`);
|
|
23
32
|
}
|
|
24
33
|
}
|
|
25
34
|
exports.AccountService = AccountService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.service.js","sourceRoot":"","sources":["../../src/services/account.service.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"account.service.js","sourceRoot":"","sources":["../../src/services/account.service.ts"],"names":[],"mappings":";;;AAOA,MAAa,cAAc;IACzB,YAAoB,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAEhD;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAAC,OAAe;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAmB,gBAAgB,OAAO,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,iBAAiB,CAAC,OAAe,EAAE,OAAe;QACtD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAuB,gBAAgB,OAAO,YAAY,OAAO,EAAE,CAAC,CAAC;IAClG,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,sBAAsB,CAAC,OAAe;QAC1C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAgC,gBAAgB,OAAO,eAAe,CAAC,CAAC;IACrG,CAAC;CACF;AA9BD,wCA8BC"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { NodeManagerService } from './node-manager.service';
|
|
2
1
|
export declare class BaseService {
|
|
3
|
-
private
|
|
4
|
-
private
|
|
5
|
-
constructor(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
post<T>(path: string, body: any, params?: Record<string, any>, language?: string): Promise<T>;
|
|
2
|
+
private gatewayUrl;
|
|
3
|
+
private axiosInstance;
|
|
4
|
+
constructor(gatewayUrl: string);
|
|
5
|
+
get<T>(path: string, params?: Record<string, any>): Promise<T>;
|
|
6
|
+
post<T>(path: string, body?: any, params?: Record<string, any>): Promise<T>;
|
|
9
7
|
private handleResponse;
|
|
10
8
|
}
|
|
11
9
|
//# sourceMappingURL=base.service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.service.d.ts","sourceRoot":"","sources":["../../src/services/base.service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base.service.d.ts","sourceRoot":"","sources":["../../src/services/base.service.ts"],"names":[],"mappings":"AAIA,qBAAa,WAAW;IAIpB,OAAO,CAAC,UAAU;IAHpB,OAAO,CAAC,aAAa,CAAgB;gBAG3B,UAAU,EAAE,MAAM;IAiBf,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAM9D,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAKxF,OAAO,CAAC,cAAc;CAYvB"}
|