@empereur-rouge/pms-sdk 0.3.2 → 0.3.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 +14 -1
- package/dist/index.cjs +15 -0
- package/dist/index.d.cts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +15 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -171,6 +171,16 @@ console.log(imported.address); // même adresse que ci-dessus
|
|
|
171
171
|
|
|
172
172
|
#### Méthodes de Lecture
|
|
173
173
|
|
|
174
|
+
```typescript
|
|
175
|
+
// Lister les ledgers actifs (avec block_count par ledger)
|
|
176
|
+
const ledgers: LedgerInfo[] = await client.listLedgers();
|
|
177
|
+
// Réponse:
|
|
178
|
+
// [
|
|
179
|
+
// { id: "main", network_id: "mainnet", prefix: "", protocol_version: 1, block_count: 12345 },
|
|
180
|
+
// { id: "gaming", network_id: "gaming-net", prefix: "gam_", protocol_version: 1, block_count: 678 }
|
|
181
|
+
// ]
|
|
182
|
+
```
|
|
183
|
+
|
|
174
184
|
```typescript
|
|
175
185
|
// Récupérer les tips du DAG (blocs les plus récents)
|
|
176
186
|
const tips: string[] = await client.getTips();
|
|
@@ -455,10 +465,13 @@ import type {
|
|
|
455
465
|
// Blocs & Transactions (lecture)
|
|
456
466
|
Block,
|
|
457
467
|
Utxo,
|
|
458
|
-
|
|
468
|
+
|
|
459
469
|
// Historique
|
|
460
470
|
WalletHistoryResp,
|
|
461
471
|
HistoryItem,
|
|
472
|
+
|
|
473
|
+
// Ledger
|
|
474
|
+
LedgerInfo,
|
|
462
475
|
} from "@empereur-rouge/pms-sdk";
|
|
463
476
|
|
|
464
477
|
// Types bas niveau (API avancée)
|
package/dist/index.cjs
CHANGED
|
@@ -374,6 +374,21 @@ var PmsClient = class {
|
|
|
374
374
|
async getCoordinatorInfo() {
|
|
375
375
|
return this.fetch("/v1/coordinator/info");
|
|
376
376
|
}
|
|
377
|
+
/**
|
|
378
|
+
* Liste tous les ledgers actifs avec leur nombre de blocs.
|
|
379
|
+
*
|
|
380
|
+
* @example
|
|
381
|
+
* ```typescript
|
|
382
|
+
* const ledgers = await client.listLedgers();
|
|
383
|
+
* for (const l of ledgers) {
|
|
384
|
+
* console.log(`${l.id}: ${l.block_count} blocks`);
|
|
385
|
+
* }
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
async listLedgers() {
|
|
389
|
+
const res = await this.fetch("/v1/ledgers");
|
|
390
|
+
return res.ledgers ?? [];
|
|
391
|
+
}
|
|
377
392
|
/**
|
|
378
393
|
* Récupère un bloc par son ID.
|
|
379
394
|
*/
|
package/dist/index.d.cts
CHANGED
|
@@ -484,6 +484,19 @@ interface BalanceInfo {
|
|
|
484
484
|
/** Liste des UTXOs */
|
|
485
485
|
utxos: Utxo[];
|
|
486
486
|
}
|
|
487
|
+
/** Info sur un ledger actif */
|
|
488
|
+
interface LedgerInfo {
|
|
489
|
+
/** Identifiant unique du ledger */
|
|
490
|
+
id: string;
|
|
491
|
+
/** Network ID du ledger */
|
|
492
|
+
network_id: string;
|
|
493
|
+
/** Préfixe de stockage */
|
|
494
|
+
prefix: string;
|
|
495
|
+
/** Version du protocole */
|
|
496
|
+
protocol_version: number;
|
|
497
|
+
/** Nombre de blocs dans le DAG */
|
|
498
|
+
block_count: number;
|
|
499
|
+
}
|
|
487
500
|
/** Configuration du client PMS */
|
|
488
501
|
interface PmsClientConfig {
|
|
489
502
|
/** URL du nœud principal (ex: "https://node.pms.network") */
|
|
@@ -560,6 +573,8 @@ interface ActivityItem {
|
|
|
560
573
|
asset_id?: string;
|
|
561
574
|
/** Adresse de la contrepartie */
|
|
562
575
|
counterparty?: string;
|
|
576
|
+
/** Ledger ID d'origine (absent en mode single-ledger "main") */
|
|
577
|
+
ledger_id?: string;
|
|
563
578
|
/** Payload brut pour détails complets */
|
|
564
579
|
payload: any;
|
|
565
580
|
}
|
|
@@ -671,6 +686,18 @@ declare class PmsClient {
|
|
|
671
686
|
* Récupère les informations publiques du coordinateur (clés).
|
|
672
687
|
*/
|
|
673
688
|
getCoordinatorInfo(): Promise<CoordinatorInfoResponse>;
|
|
689
|
+
/**
|
|
690
|
+
* Liste tous les ledgers actifs avec leur nombre de blocs.
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```typescript
|
|
694
|
+
* const ledgers = await client.listLedgers();
|
|
695
|
+
* for (const l of ledgers) {
|
|
696
|
+
* console.log(`${l.id}: ${l.block_count} blocks`);
|
|
697
|
+
* }
|
|
698
|
+
* ```
|
|
699
|
+
*/
|
|
700
|
+
listLedgers(): Promise<LedgerInfo[]>;
|
|
674
701
|
/**
|
|
675
702
|
* Récupère un bloc par son ID.
|
|
676
703
|
*/
|
|
@@ -1043,4 +1070,4 @@ declare function formatAmount(sats: bigint): string;
|
|
|
1043
1070
|
*/
|
|
1044
1071
|
declare function decryptPayload(encrypted: EncryptedPayload, recipientPrivateKeyHex: string): string;
|
|
1045
1072
|
|
|
1046
|
-
export { type ActivityDirection, type ActivityItem, type ActivityOptions, type ActivityResp, type ActivityType, type BalanceInfo, type Block, type BurnNftResponse, type CoordinatorInfoResponse, type CubeAttributes, type HistoryItem, type MintCubeResponse, type NftMetadata, type NftResponse, PmsClient, type PmsClientConfig, PmsWallet, type PrepareTxRequest, type PrepareTxResponse, type RuntimeConfig, type StreamActivityOptions, type SubmitResponse, type SupplyInfo, type TokenMetadata, type Utxo, type UtxoDetail, type WalletHistoryResp, type WalletResponse, decryptPayload, formatAmount, fromHex, isValidMnemonic, parseAmount, toHex };
|
|
1073
|
+
export { type ActivityDirection, type ActivityItem, type ActivityOptions, type ActivityResp, type ActivityType, type BalanceInfo, type Block, type BurnNftResponse, type CoordinatorInfoResponse, type CubeAttributes, type HistoryItem, type LedgerInfo, type MintCubeResponse, type NftMetadata, type NftResponse, PmsClient, type PmsClientConfig, PmsWallet, type PrepareTxRequest, type PrepareTxResponse, type RuntimeConfig, type StreamActivityOptions, type SubmitResponse, type SupplyInfo, type TokenMetadata, type Utxo, type UtxoDetail, type WalletHistoryResp, type WalletResponse, decryptPayload, formatAmount, fromHex, isValidMnemonic, parseAmount, toHex };
|
package/dist/index.d.ts
CHANGED
|
@@ -484,6 +484,19 @@ interface BalanceInfo {
|
|
|
484
484
|
/** Liste des UTXOs */
|
|
485
485
|
utxos: Utxo[];
|
|
486
486
|
}
|
|
487
|
+
/** Info sur un ledger actif */
|
|
488
|
+
interface LedgerInfo {
|
|
489
|
+
/** Identifiant unique du ledger */
|
|
490
|
+
id: string;
|
|
491
|
+
/** Network ID du ledger */
|
|
492
|
+
network_id: string;
|
|
493
|
+
/** Préfixe de stockage */
|
|
494
|
+
prefix: string;
|
|
495
|
+
/** Version du protocole */
|
|
496
|
+
protocol_version: number;
|
|
497
|
+
/** Nombre de blocs dans le DAG */
|
|
498
|
+
block_count: number;
|
|
499
|
+
}
|
|
487
500
|
/** Configuration du client PMS */
|
|
488
501
|
interface PmsClientConfig {
|
|
489
502
|
/** URL du nœud principal (ex: "https://node.pms.network") */
|
|
@@ -560,6 +573,8 @@ interface ActivityItem {
|
|
|
560
573
|
asset_id?: string;
|
|
561
574
|
/** Adresse de la contrepartie */
|
|
562
575
|
counterparty?: string;
|
|
576
|
+
/** Ledger ID d'origine (absent en mode single-ledger "main") */
|
|
577
|
+
ledger_id?: string;
|
|
563
578
|
/** Payload brut pour détails complets */
|
|
564
579
|
payload: any;
|
|
565
580
|
}
|
|
@@ -671,6 +686,18 @@ declare class PmsClient {
|
|
|
671
686
|
* Récupère les informations publiques du coordinateur (clés).
|
|
672
687
|
*/
|
|
673
688
|
getCoordinatorInfo(): Promise<CoordinatorInfoResponse>;
|
|
689
|
+
/**
|
|
690
|
+
* Liste tous les ledgers actifs avec leur nombre de blocs.
|
|
691
|
+
*
|
|
692
|
+
* @example
|
|
693
|
+
* ```typescript
|
|
694
|
+
* const ledgers = await client.listLedgers();
|
|
695
|
+
* for (const l of ledgers) {
|
|
696
|
+
* console.log(`${l.id}: ${l.block_count} blocks`);
|
|
697
|
+
* }
|
|
698
|
+
* ```
|
|
699
|
+
*/
|
|
700
|
+
listLedgers(): Promise<LedgerInfo[]>;
|
|
674
701
|
/**
|
|
675
702
|
* Récupère un bloc par son ID.
|
|
676
703
|
*/
|
|
@@ -1043,4 +1070,4 @@ declare function formatAmount(sats: bigint): string;
|
|
|
1043
1070
|
*/
|
|
1044
1071
|
declare function decryptPayload(encrypted: EncryptedPayload, recipientPrivateKeyHex: string): string;
|
|
1045
1072
|
|
|
1046
|
-
export { type ActivityDirection, type ActivityItem, type ActivityOptions, type ActivityResp, type ActivityType, type BalanceInfo, type Block, type BurnNftResponse, type CoordinatorInfoResponse, type CubeAttributes, type HistoryItem, type MintCubeResponse, type NftMetadata, type NftResponse, PmsClient, type PmsClientConfig, PmsWallet, type PrepareTxRequest, type PrepareTxResponse, type RuntimeConfig, type StreamActivityOptions, type SubmitResponse, type SupplyInfo, type TokenMetadata, type Utxo, type UtxoDetail, type WalletHistoryResp, type WalletResponse, decryptPayload, formatAmount, fromHex, isValidMnemonic, parseAmount, toHex };
|
|
1073
|
+
export { type ActivityDirection, type ActivityItem, type ActivityOptions, type ActivityResp, type ActivityType, type BalanceInfo, type Block, type BurnNftResponse, type CoordinatorInfoResponse, type CubeAttributes, type HistoryItem, type LedgerInfo, type MintCubeResponse, type NftMetadata, type NftResponse, PmsClient, type PmsClientConfig, PmsWallet, type PrepareTxRequest, type PrepareTxResponse, type RuntimeConfig, type StreamActivityOptions, type SubmitResponse, type SupplyInfo, type TokenMetadata, type Utxo, type UtxoDetail, type WalletHistoryResp, type WalletResponse, decryptPayload, formatAmount, fromHex, isValidMnemonic, parseAmount, toHex };
|
package/dist/index.js
CHANGED
|
@@ -341,6 +341,21 @@ var PmsClient = class {
|
|
|
341
341
|
async getCoordinatorInfo() {
|
|
342
342
|
return this.fetch("/v1/coordinator/info");
|
|
343
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* Liste tous les ledgers actifs avec leur nombre de blocs.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* ```typescript
|
|
349
|
+
* const ledgers = await client.listLedgers();
|
|
350
|
+
* for (const l of ledgers) {
|
|
351
|
+
* console.log(`${l.id}: ${l.block_count} blocks`);
|
|
352
|
+
* }
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
async listLedgers() {
|
|
356
|
+
const res = await this.fetch("/v1/ledgers");
|
|
357
|
+
return res.ledgers ?? [];
|
|
358
|
+
}
|
|
344
359
|
/**
|
|
345
360
|
* Récupère un bloc par son ID.
|
|
346
361
|
*/
|
package/package.json
CHANGED