@rialo/ts-cdk 0.1.2 → 0.1.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 CHANGED
@@ -185,13 +185,37 @@ const balance = await client.getBalance(publicKey);
185
185
  const accountInfo = await client.getAccountInfo(publicKey);
186
186
  const blockHeight = await client.getBlockHeight();
187
187
  const chainId = client.getChainIdentifier();
188
+
189
+ // Get transaction info (returns blockHeight and optional error)
188
190
  const txInfo = await client.getTransaction(signature);
191
+ if (txInfo) {
192
+ console.log(`Confirmed in block: ${txInfo.blockHeight}`);
193
+ if (txInfo.err) {
194
+ console.log(`Transaction failed: ${txInfo.err}`);
195
+ }
196
+ }
189
197
 
190
198
  // Send transactions
191
199
  const signature = await client.sendTransaction(serializedTx);
192
200
 
193
- // Devnet only - request airdrop
194
- await client.requestAirdrop(publicKey, BigInt(1_000_000_000));
201
+ // Send and wait for confirmation
202
+ const result = await client.sendAndConfirmTransaction(serializedTx);
203
+ console.log(`Executed: ${result.executed}`);
204
+
205
+ // Confirm an existing transaction
206
+ const confirmed = await client.confirmTransaction(signature, {
207
+ maxRetries: 10,
208
+ retryDelay: 200,
209
+ });
210
+
211
+ // Devnet/testnet only - request airdrop
212
+ const airdropSig = await client.requestAirdrop(publicKey, 1_000_000_000n);
213
+
214
+ // Request airdrop and wait for confirmation
215
+ const airdropResult = await client.requestAirdropAndConfirm(
216
+ publicKey,
217
+ 1_000_000_000n
218
+ );
195
219
  ```
196
220
 
197
221
  ### Signers
@@ -321,6 +345,7 @@ The `examples/` directory contains complete working examples:
321
345
  - `05-alice-bob-transaction.ts` - Complete transfer workflow with RPC
322
346
 
323
347
  Run examples:
348
+
324
349
  ```bash
325
350
  pnpm tsx examples/01-basic-operations.ts
326
351
  ```