@empereur-rouge/pms-sdk 0.3.0 → 0.3.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 +38 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -132,6 +132,43 @@ const client = new PmsClient({
|
|
|
132
132
|
> [!IMPORTANT]
|
|
133
133
|
> La clé API est **obligatoire**. Obtenez-la depuis votre dashboard PMS ou auprès de l'administrateur du réseau.
|
|
134
134
|
|
|
135
|
+
#### Wallet (Custodial — Server-Side)
|
|
136
|
+
|
|
137
|
+
Ces méthodes créent/restaurent des wallets **côté serveur**. L'adresse retournée est au format Bech32 (ex: `8e1a...`).
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
// Créer un nouveau wallet (serveur génère les clés)
|
|
141
|
+
const wallet = await client.createWallet();
|
|
142
|
+
// Réponse (WalletResponse):
|
|
143
|
+
// {
|
|
144
|
+
// address: "8e1ahpltzjauwev6lf0jql...",
|
|
145
|
+
// private_key_b64: "2lM0rVdFXX...",
|
|
146
|
+
// private_key_hex: "da5334ad57455d74...",
|
|
147
|
+
// public_key_hex: "04593037fa9d4f6ea2...",
|
|
148
|
+
// x25519_pub_hex: "266bcd33ab2d20d2...",
|
|
149
|
+
// mnemonic_words: ["gain", "space", "color", ...]
|
|
150
|
+
// }
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
```typescript
|
|
154
|
+
// Restaurer un wallet depuis un mnemonic (24 mots BIP39)
|
|
155
|
+
const restored = await client.restoreFromMnemonic(
|
|
156
|
+
"gain space color filter buzz bind side before sauce twist slam history chief patch desk chunk way oblige output turtle purchase scare token rapid"
|
|
157
|
+
);
|
|
158
|
+
console.log(restored.address); // "8e1ahpltzjauwev6lf0jql..."
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
// Restaurer un wallet depuis une clé privée hex
|
|
163
|
+
const imported = await client.restoreFromPrivateKey(
|
|
164
|
+
"da5334ad57455d74e5150e4eb06398ce9cf27762b6f29eac7f82f178bee07406"
|
|
165
|
+
);
|
|
166
|
+
console.log(imported.address); // même adresse que ci-dessus
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
> [!NOTE]
|
|
170
|
+
> Le mnemonic et la clé privée produisent **exactement la même adresse** — la dérivation est déterministe.
|
|
171
|
+
|
|
135
172
|
#### Méthodes de Lecture
|
|
136
173
|
|
|
137
174
|
```typescript
|
|
@@ -407,6 +444,7 @@ import type {
|
|
|
407
444
|
SubmitResponse,
|
|
408
445
|
BalanceInfo,
|
|
409
446
|
SupplyInfo,
|
|
447
|
+
WalletResponse,
|
|
410
448
|
|
|
411
449
|
// NFT
|
|
412
450
|
NftMetadata,
|
package/package.json
CHANGED