@rialo/ts-cdk 0.1.1 → 0.1.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 +22 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,14 +28,14 @@ const isValid = keypair.verify(message, signature);
|
|
|
28
28
|
### Connect to the blockchain
|
|
29
29
|
|
|
30
30
|
```typescript
|
|
31
|
-
import { createRialoClient,
|
|
31
|
+
import { createRialoClient, RIALO_DEVNET_CHAIN } from "@rialo/ts-cdk";
|
|
32
32
|
|
|
33
|
-
const client = createRialoClient(
|
|
33
|
+
const client = createRialoClient({ chain: RIALO_DEVNET_CHAIN });
|
|
34
34
|
|
|
35
35
|
// Query blockchain
|
|
36
36
|
const balance = await client.getBalance(keypair.publicKey);
|
|
37
37
|
const height = await client.getBlockHeight();
|
|
38
|
-
const
|
|
38
|
+
const chainId = client.getChainIdentifier();
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
### Build and send a transaction
|
|
@@ -92,7 +92,7 @@ const restoredKeypair = await restored.toKeypair();
|
|
|
92
92
|
Ed25519 cryptographic primitives for key management and signing.
|
|
93
93
|
|
|
94
94
|
```typescript
|
|
95
|
-
import { Keypair, PublicKey, Signature
|
|
95
|
+
import { Keypair, PublicKey, Signature } from "@rialo/ts-cdk";
|
|
96
96
|
|
|
97
97
|
// Generate random keypair
|
|
98
98
|
const keypair = Keypair.generate();
|
|
@@ -160,18 +160,31 @@ const bytes = signed.serialize();
|
|
|
160
160
|
Communicate with Rialo blockchain nodes.
|
|
161
161
|
|
|
162
162
|
```typescript
|
|
163
|
-
import {
|
|
163
|
+
import {
|
|
164
|
+
createRialoClient,
|
|
165
|
+
getDefaultRialoClientConfig,
|
|
166
|
+
RIALO_DEVNET_CHAIN,
|
|
167
|
+
RIALO_MAINNET_CHAIN
|
|
168
|
+
} from "@rialo/ts-cdk";
|
|
164
169
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
// Using preset chain configurations
|
|
171
|
+
const client = createRialoClient({ chain: RIALO_DEVNET_CHAIN });
|
|
172
|
+
|
|
173
|
+
// Using getDefaultRialoClientConfig helper
|
|
174
|
+
const config = getDefaultRialoClientConfig('mainnet');
|
|
175
|
+
const mainnetClient = createRialoClient({
|
|
176
|
+
...config,
|
|
177
|
+
transport: {
|
|
178
|
+
timeout: 30000,
|
|
179
|
+
maxRetries: 3,
|
|
180
|
+
}
|
|
168
181
|
});
|
|
169
182
|
|
|
170
183
|
// Query methods
|
|
171
184
|
const balance = await client.getBalance(publicKey);
|
|
172
185
|
const accountInfo = await client.getAccountInfo(publicKey);
|
|
173
186
|
const blockHeight = await client.getBlockHeight();
|
|
174
|
-
const
|
|
187
|
+
const chainId = client.getChainIdentifier();
|
|
175
188
|
const txInfo = await client.getTransaction(signature);
|
|
176
189
|
|
|
177
190
|
// Send transactions
|
|
@@ -295,7 +308,6 @@ import {
|
|
|
295
308
|
PUBLIC_KEY_LENGTH, // 32
|
|
296
309
|
SECRET_KEY_LENGTH, // 32
|
|
297
310
|
SIGNATURE_LENGTH, // 64
|
|
298
|
-
BLOCKHASH_LENGTH, // 32
|
|
299
311
|
} from "@rialo/ts-cdk";
|
|
300
312
|
```
|
|
301
313
|
|