@rialo/ts-cdk 0.1.3 → 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 +27 -2
- package/dist/index.d.mts +325 -67
- package/dist/index.d.ts +325 -67
- package/dist/index.js +405 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +405 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -173,9 +173,21 @@ declare class HttpTransport {
|
|
|
173
173
|
*/
|
|
174
174
|
private makeRequest;
|
|
175
175
|
/**
|
|
176
|
-
* Handle HTTP error responses
|
|
176
|
+
* Handle HTTP error responses.
|
|
177
|
+
*
|
|
178
|
+
* Parses the response body to extract JSON-RPC error details when available,
|
|
179
|
+
* regardless of HTTP status code. Falls back to HTTP status-based error handling.
|
|
177
180
|
*/
|
|
178
181
|
private handleHttpError;
|
|
182
|
+
/**
|
|
183
|
+
* Parse error response body to extract message and RPC error code.
|
|
184
|
+
*
|
|
185
|
+
* Handles multiple formats:
|
|
186
|
+
* - JSON-RPC error: { error: { code, message, data? } }
|
|
187
|
+
* - Simple JSON: { message: "..." }
|
|
188
|
+
* - Non-JSON responses
|
|
189
|
+
*/
|
|
190
|
+
private parseErrorResponse;
|
|
179
191
|
/**
|
|
180
192
|
* Returns the configured RPC endpoint URL.
|
|
181
193
|
*/
|
|
@@ -203,11 +215,6 @@ interface RialoClientConfig {
|
|
|
203
215
|
* Can be a preset (RIALO_MAINNET) or a custom object.
|
|
204
216
|
*/
|
|
205
217
|
chain: ChainDefinition;
|
|
206
|
-
/**
|
|
207
|
-
* Optional: Override the RPC endpoint.
|
|
208
|
-
* Useful for using QuickNode/Ankr while keeping "Mainnet" identity.
|
|
209
|
-
*/
|
|
210
|
-
endpoint?: string;
|
|
211
218
|
transport?: HttpTransportConfig;
|
|
212
219
|
}
|
|
213
220
|
|
|
@@ -1253,6 +1260,11 @@ declare class BaseRpcClient {
|
|
|
1253
1260
|
* Validate JSON-RPC response structure
|
|
1254
1261
|
*/
|
|
1255
1262
|
private isValidJsonRpcResponse;
|
|
1263
|
+
/**
|
|
1264
|
+
* Generates the next request ID with Overflow Protection.
|
|
1265
|
+
* @returns The next request ID.
|
|
1266
|
+
*/
|
|
1267
|
+
private nextRequestId;
|
|
1256
1268
|
/**
|
|
1257
1269
|
* Returns the configured RPC endpoint URL.
|
|
1258
1270
|
*/
|
|
@@ -1284,21 +1296,8 @@ interface AccountInfo {
|
|
|
1284
1296
|
interface TransactionResponse {
|
|
1285
1297
|
/** Transaction signature */
|
|
1286
1298
|
signature: string;
|
|
1287
|
-
/**
|
|
1288
|
-
|
|
1289
|
-
/** Block time (Unix timestamp) */
|
|
1290
|
-
blockTime?: bigint;
|
|
1291
|
-
/** Error message if transaction failed */
|
|
1292
|
-
err?: string;
|
|
1293
|
-
}
|
|
1294
|
-
/**
|
|
1295
|
-
* Signature status.
|
|
1296
|
-
*/
|
|
1297
|
-
interface SignatureStatus {
|
|
1298
|
-
/** Slot in which the transaction was processed */
|
|
1299
|
-
slot: bigint;
|
|
1300
|
-
/** Number of confirmations */
|
|
1301
|
-
confirmations?: number;
|
|
1299
|
+
/** Block height */
|
|
1300
|
+
blockHeight?: bigint;
|
|
1302
1301
|
/** Error message if transaction failed */
|
|
1303
1302
|
err?: string;
|
|
1304
1303
|
}
|
|
@@ -1437,6 +1436,42 @@ interface GetTransactionsResponse {
|
|
|
1437
1436
|
/** Array of transaction data */
|
|
1438
1437
|
transactions: Array<Record<string, unknown>>;
|
|
1439
1438
|
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Signature status from the RPC.
|
|
1441
|
+
*/
|
|
1442
|
+
interface SignatureStatus {
|
|
1443
|
+
/** Slot in which the transaction was processed */
|
|
1444
|
+
slot: bigint;
|
|
1445
|
+
/** Whether the transaction has been executed */
|
|
1446
|
+
executed: boolean;
|
|
1447
|
+
/** Error message if transaction failed */
|
|
1448
|
+
err?: string;
|
|
1449
|
+
}
|
|
1450
|
+
/**
|
|
1451
|
+
* Options for confirming a transaction.
|
|
1452
|
+
*/
|
|
1453
|
+
interface ConfirmTransactionOptions {
|
|
1454
|
+
/** Maximum number of retry attempts (default: 30) */
|
|
1455
|
+
maxRetries?: number;
|
|
1456
|
+
/** Delay between retries in milliseconds (default: 1000) */
|
|
1457
|
+
retryDelay?: number;
|
|
1458
|
+
}
|
|
1459
|
+
/**
|
|
1460
|
+
* Options for sending and confirming a transaction.
|
|
1461
|
+
*/
|
|
1462
|
+
interface SendAndConfirmOptions extends SendTransactionOptions, ConfirmTransactionOptions {
|
|
1463
|
+
}
|
|
1464
|
+
/**
|
|
1465
|
+
* Result of a confirmed transaction.
|
|
1466
|
+
*/
|
|
1467
|
+
interface ConfirmedTransaction {
|
|
1468
|
+
/** Transaction signature */
|
|
1469
|
+
signature: string;
|
|
1470
|
+
/** Whether the transaction was executed */
|
|
1471
|
+
executed: boolean;
|
|
1472
|
+
/** Error message if transaction failed */
|
|
1473
|
+
err?: string;
|
|
1474
|
+
}
|
|
1440
1475
|
|
|
1441
1476
|
/**
|
|
1442
1477
|
* Main Rialo RPC client for blockchain interactions.
|
|
@@ -1477,6 +1512,10 @@ declare class RialoClient {
|
|
|
1477
1512
|
* Returns the chain identifier.
|
|
1478
1513
|
*/
|
|
1479
1514
|
getChainIdentifier(): IdentifierString;
|
|
1515
|
+
/**
|
|
1516
|
+
* Returns the chain configuration.
|
|
1517
|
+
*/
|
|
1518
|
+
getChainConfig(): ChainDefinition;
|
|
1480
1519
|
/**
|
|
1481
1520
|
* Retrieves the balance of an account in kelvins (smallest unit).
|
|
1482
1521
|
*/
|
|
@@ -1533,6 +1572,36 @@ declare class RialoClient {
|
|
|
1533
1572
|
* @returns Transaction signature
|
|
1534
1573
|
*/
|
|
1535
1574
|
requestAirdrop(pubkey: PublicKey, amount: bigint): Promise<string>;
|
|
1575
|
+
/**
|
|
1576
|
+
* Submits a signed transaction and waits for confirmation.
|
|
1577
|
+
*
|
|
1578
|
+
* @param transaction - Serialized signed transaction bytes
|
|
1579
|
+
* @param options - Transaction submission and confirmation options
|
|
1580
|
+
* @returns Confirmed transaction details
|
|
1581
|
+
* @throws {TransactionFailedError} If the transaction fails on-chain
|
|
1582
|
+
* @throws {TransactionConfirmationTimeoutError} If confirmation times out
|
|
1583
|
+
*
|
|
1584
|
+
* @example
|
|
1585
|
+
* ```typescript
|
|
1586
|
+
* const result = await client.sendAndConfirmTransaction(signedTx);
|
|
1587
|
+
* console.log(`Confirmed in slot ${result.slot}`);
|
|
1588
|
+
* ```
|
|
1589
|
+
*/
|
|
1590
|
+
sendAndConfirmTransaction(transaction: Uint8Array, options?: SendAndConfirmOptions): Promise<ConfirmedTransaction>;
|
|
1591
|
+
/**
|
|
1592
|
+
* Waits for a transaction to be confirmed.
|
|
1593
|
+
*
|
|
1594
|
+
* @param signature - Transaction signature to monitor
|
|
1595
|
+
* @param options - Confirmation options
|
|
1596
|
+
* @returns Confirmed transaction details
|
|
1597
|
+
*/
|
|
1598
|
+
confirmTransaction(signature: string, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
|
|
1599
|
+
/**
|
|
1600
|
+
* Requests an airdrop and waits for confirmation.
|
|
1601
|
+
*
|
|
1602
|
+
* **Note**: Only available on devnet and testnet.
|
|
1603
|
+
*/
|
|
1604
|
+
requestAirdropAndConfirm(pubkey: PublicKey, amount: bigint, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
|
|
1536
1605
|
}
|
|
1537
1606
|
|
|
1538
1607
|
/**
|
|
@@ -1546,35 +1615,142 @@ declare class RialoClient {
|
|
|
1546
1615
|
*/
|
|
1547
1616
|
declare class QueryRpcClient extends BaseRpcClient {
|
|
1548
1617
|
/**
|
|
1549
|
-
*
|
|
1618
|
+
* Retrieve the balance of an account in kelvins (smallest unit).
|
|
1619
|
+
*
|
|
1620
|
+
* @param pubkey - The public key of the account to query
|
|
1621
|
+
* @returns The account balance in kelvins
|
|
1622
|
+
*
|
|
1623
|
+
* @example
|
|
1624
|
+
* ```typescript
|
|
1625
|
+
* const balance = await client.getBalance(publicKey);
|
|
1626
|
+
* console.log(`Balance: ${balance} kelvins`);
|
|
1627
|
+
* ```
|
|
1550
1628
|
*/
|
|
1551
1629
|
getBalance(pubkey: PublicKey): Promise<bigint>;
|
|
1552
1630
|
/**
|
|
1553
|
-
*
|
|
1631
|
+
* Retrieve detailed information about an account.
|
|
1632
|
+
*
|
|
1633
|
+
* Returns account data including balance, owner program, stored data,
|
|
1634
|
+
* executable status, and rent epoch.
|
|
1635
|
+
*
|
|
1636
|
+
* @param pubkey - The public key of the account to query
|
|
1637
|
+
* @returns Account information, or null if the account does not exist
|
|
1638
|
+
*
|
|
1639
|
+
* @example
|
|
1640
|
+
* ```typescript
|
|
1641
|
+
* const info = await client.getAccountInfo(publicKey);
|
|
1642
|
+
* if (info) {
|
|
1643
|
+
* console.log(`Owner: ${info.owner}`);
|
|
1644
|
+
* console.log(`Balance: ${info.balance} kelvins`);
|
|
1645
|
+
* console.log(`Data length: ${info.data.length} bytes`);
|
|
1646
|
+
* }
|
|
1647
|
+
* ```
|
|
1554
1648
|
*/
|
|
1555
1649
|
getAccountInfo(pubkey: PublicKey): Promise<AccountInfo | null>;
|
|
1556
1650
|
/**
|
|
1557
|
-
*
|
|
1651
|
+
* Retrieve the current block height of the blockchain.
|
|
1652
|
+
*
|
|
1653
|
+
* The block height represents the number of blocks that have been
|
|
1654
|
+
* confirmed on the chain since genesis.
|
|
1655
|
+
*
|
|
1656
|
+
* @returns The current block height
|
|
1657
|
+
*
|
|
1658
|
+
* @example
|
|
1659
|
+
* ```typescript
|
|
1660
|
+
* const height = await client.getBlockHeight();
|
|
1661
|
+
* console.log(`Current block height: ${height}`);
|
|
1662
|
+
* ```
|
|
1558
1663
|
*/
|
|
1559
1664
|
getBlockHeight(): Promise<bigint>;
|
|
1560
1665
|
/**
|
|
1561
|
-
*
|
|
1666
|
+
* Retrieve detailed information about a confirmed transaction.
|
|
1667
|
+
*
|
|
1668
|
+
* Returns transaction metadata including the block height it was
|
|
1669
|
+
* confirmed in and any execution errors.
|
|
1670
|
+
*
|
|
1671
|
+
* @param signature - The transaction signature to query
|
|
1672
|
+
* @returns Transaction information, or null if the transaction is not found
|
|
1673
|
+
*
|
|
1674
|
+
* @example
|
|
1675
|
+
* ```typescript
|
|
1676
|
+
* const tx = await client.getTransaction(signature);
|
|
1677
|
+
* if (tx) {
|
|
1678
|
+
* console.log(`Confirmed in block: ${tx.blockHeight}`);
|
|
1679
|
+
* if (tx.err) {
|
|
1680
|
+
* console.log(`Transaction failed: ${tx.err}`);
|
|
1681
|
+
* }
|
|
1682
|
+
* }
|
|
1683
|
+
* ```
|
|
1562
1684
|
*/
|
|
1563
1685
|
getTransaction(signature: string): Promise<TransactionResponse | null>;
|
|
1564
1686
|
/**
|
|
1565
|
-
*
|
|
1687
|
+
* Retrieve the total number of transactions processed since genesis.
|
|
1688
|
+
*
|
|
1689
|
+
* @returns The total transaction count
|
|
1690
|
+
*
|
|
1691
|
+
* @example
|
|
1692
|
+
* ```typescript
|
|
1693
|
+
* const count = await client.getTransactionCount();
|
|
1694
|
+
* console.log(`Total transactions: ${count}`);
|
|
1695
|
+
* ```
|
|
1566
1696
|
*/
|
|
1567
1697
|
getTransactionCount(): Promise<bigint>;
|
|
1568
1698
|
/**
|
|
1569
|
-
*
|
|
1699
|
+
* Retrieve the status of multiple transaction signatures in a single request.
|
|
1700
|
+
*
|
|
1701
|
+
* Useful for batch-checking transaction confirmations. Returns null for
|
|
1702
|
+
* signatures that are not found or have expired from the status cache.
|
|
1703
|
+
*
|
|
1704
|
+
* @param signatures - Array of transaction signatures to query
|
|
1705
|
+
* @returns Array of signature statuses (null if signature not found)
|
|
1706
|
+
*
|
|
1707
|
+
* @example
|
|
1708
|
+
* ```typescript
|
|
1709
|
+
* const statuses = await client.getSignatureStatuses([sig1, sig2, sig3]);
|
|
1710
|
+
* statuses.forEach((status, i) => {
|
|
1711
|
+
* if (status) {
|
|
1712
|
+
* console.log(`${signatures[i]}: slot ${status.slot}, executed: ${status.executed}`);
|
|
1713
|
+
* } else {
|
|
1714
|
+
* console.log(`${signatures[i]}: not found`);
|
|
1715
|
+
* }
|
|
1716
|
+
* });
|
|
1717
|
+
* ```
|
|
1570
1718
|
*/
|
|
1571
1719
|
getSignatureStatuses(signatures: string[]): Promise<(SignatureStatus | null)[]>;
|
|
1572
1720
|
/**
|
|
1573
|
-
*
|
|
1721
|
+
* Retrieve information about the current epoch.
|
|
1722
|
+
*
|
|
1723
|
+
* Returns epoch metadata including the current epoch number, slot position
|
|
1724
|
+
* within the epoch, total slots per epoch, and current block height.
|
|
1725
|
+
*
|
|
1726
|
+
* @returns Current epoch information
|
|
1727
|
+
*
|
|
1728
|
+
* @example
|
|
1729
|
+
* ```typescript
|
|
1730
|
+
* const info = await client.getEpochInfo();
|
|
1731
|
+
* console.log(`Epoch: ${info.epoch}`);
|
|
1732
|
+
* console.log(`Slot ${info.slotIndex} of ${info.slotsInEpoch}`);
|
|
1733
|
+
* console.log(`Block height: ${info.blockHeight}`);
|
|
1734
|
+
* ```
|
|
1574
1735
|
*/
|
|
1575
1736
|
getEpochInfo(): Promise<EpochInfoResponse>;
|
|
1576
1737
|
/**
|
|
1577
|
-
*
|
|
1738
|
+
* Check the health status of the RPC node.
|
|
1739
|
+
*
|
|
1740
|
+
* Returns "ok" if the node is healthy. If the node is unhealthy,
|
|
1741
|
+
* returns an error message describing the issue.
|
|
1742
|
+
*
|
|
1743
|
+
* @returns "ok" if healthy, otherwise an error message
|
|
1744
|
+
*
|
|
1745
|
+
* @example
|
|
1746
|
+
* ```typescript
|
|
1747
|
+
* const health = await client.getHealth();
|
|
1748
|
+
* if (health === "ok") {
|
|
1749
|
+
* console.log("Node is healthy");
|
|
1750
|
+
* } else {
|
|
1751
|
+
* console.log(`Node unhealthy: ${health}`);
|
|
1752
|
+
* }
|
|
1753
|
+
* ```
|
|
1578
1754
|
*/
|
|
1579
1755
|
getHealth(): Promise<"ok" | string>;
|
|
1580
1756
|
}
|
|
@@ -1590,13 +1766,117 @@ declare class QueryRpcClient extends BaseRpcClient {
|
|
|
1590
1766
|
*/
|
|
1591
1767
|
declare class TransactionRpcClient extends BaseRpcClient {
|
|
1592
1768
|
/**
|
|
1593
|
-
* Submit a signed transaction to the blockchain
|
|
1769
|
+
* Submit a signed transaction to the blockchain.
|
|
1770
|
+
*
|
|
1771
|
+
* Sends the transaction to the network for processing. The transaction
|
|
1772
|
+
* must be fully signed before submission. Returns immediately with the
|
|
1773
|
+
* transaction signature - use {@link confirmTransaction} or
|
|
1774
|
+
* {@link sendAndConfirmTransaction} to wait for confirmation.
|
|
1775
|
+
*
|
|
1776
|
+
* @param transaction - Serialized signed transaction bytes
|
|
1777
|
+
* @param options - Transaction submission options
|
|
1778
|
+
* @returns Transaction signature (base58 encoded)
|
|
1779
|
+
*
|
|
1780
|
+
* @example
|
|
1781
|
+
* ```typescript
|
|
1782
|
+
* const signature = await client.sendTransaction(signedTx);
|
|
1783
|
+
* console.log(`Submitted: ${signature}`);
|
|
1784
|
+
*
|
|
1785
|
+
* // With options
|
|
1786
|
+
* const signature = await client.sendTransaction(signedTx, {
|
|
1787
|
+
* skipPreflight: true,
|
|
1788
|
+
* maxRetries: 3,
|
|
1789
|
+
* });
|
|
1790
|
+
* ```
|
|
1594
1791
|
*/
|
|
1595
1792
|
sendTransaction(transaction: Uint8Array, options?: SendTransactionOptions): Promise<string>;
|
|
1596
1793
|
/**
|
|
1597
|
-
*
|
|
1794
|
+
* Wait for a transaction to be confirmed.
|
|
1795
|
+
*
|
|
1796
|
+
* A transaction is considered confirmed when:
|
|
1797
|
+
* - It has been processed in a block (`blockHeight > 0`)
|
|
1798
|
+
*
|
|
1799
|
+
* @param signature - Transaction signature to monitor
|
|
1800
|
+
* @param options - Confirmation options
|
|
1801
|
+
* @returns Confirmed transaction details
|
|
1802
|
+
* @throws {TransactionFailedError} If the transaction fails on-chain
|
|
1803
|
+
* @throws {TransactionConfirmationTimeoutError} If confirmation times out
|
|
1804
|
+
*/
|
|
1805
|
+
confirmTransaction(signature: string, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
|
|
1806
|
+
/**
|
|
1807
|
+
* Submit a signed transaction and wait for confirmation.
|
|
1808
|
+
*
|
|
1809
|
+
* Polls the transaction status until it is confirmed (blockHeight > 0),
|
|
1810
|
+
* or until the maximum number of retries is reached.
|
|
1811
|
+
*
|
|
1812
|
+
* @param transaction - Serialized signed transaction bytes
|
|
1813
|
+
* @param options - Transaction submission and confirmation options
|
|
1814
|
+
* @returns Confirmed transaction details
|
|
1815
|
+
* @throws {TransactionFailedError} If the transaction fails on-chain
|
|
1816
|
+
* @throws {TransactionConfirmationTimeoutError} If confirmation times out
|
|
1817
|
+
*
|
|
1818
|
+
* @example
|
|
1819
|
+
* ```typescript
|
|
1820
|
+
* const result = await client.sendAndConfirmTransaction(signedTx);
|
|
1821
|
+
* console.log(`Confirmed in block ${result.blockHeight}, executed: ${result.executed}`);
|
|
1822
|
+
*
|
|
1823
|
+
* // With custom retry settings
|
|
1824
|
+
* const result = await client.sendAndConfirmTransaction(signedTx, {
|
|
1825
|
+
* maxRetries: 3,
|
|
1826
|
+
* retryDelay: 500,
|
|
1827
|
+
* });
|
|
1828
|
+
* ```
|
|
1829
|
+
*/
|
|
1830
|
+
sendAndConfirmTransaction(transaction: Uint8Array, options?: SendAndConfirmOptions): Promise<ConfirmedTransaction>;
|
|
1831
|
+
/**
|
|
1832
|
+
* Request an airdrop of tokens to an account.
|
|
1833
|
+
*
|
|
1834
|
+
* **Note**: Only available on devnet and testnet networks.
|
|
1835
|
+
*
|
|
1836
|
+
* Returns immediately with the airdrop transaction signature.
|
|
1837
|
+
* Use {@link requestAirdropAndConfirm} to wait for the airdrop to complete.
|
|
1838
|
+
*
|
|
1839
|
+
* @param pubkey - The public key of the account to receive tokens
|
|
1840
|
+
* @param amount - Amount to airdrop in kelvins (smallest unit)
|
|
1841
|
+
* @returns Airdrop transaction signature
|
|
1842
|
+
*
|
|
1843
|
+
* @example
|
|
1844
|
+
* ```typescript
|
|
1845
|
+
* const signature = await client.requestAirdrop(publicKey, 1_000_000_000n);
|
|
1846
|
+
* console.log(`Airdrop requested: ${signature}`);
|
|
1847
|
+
* ```
|
|
1598
1848
|
*/
|
|
1599
1849
|
requestAirdrop(pubkey: PublicKey, amount: bigint): Promise<string>;
|
|
1850
|
+
/**
|
|
1851
|
+
* Request an airdrop of tokens and wait for confirmation.
|
|
1852
|
+
*
|
|
1853
|
+
* **Note**: Only available on devnet and testnet networks.
|
|
1854
|
+
*
|
|
1855
|
+
* Combines {@link requestAirdrop} and {@link confirmTransaction} into
|
|
1856
|
+
* a single call for convenience.
|
|
1857
|
+
*
|
|
1858
|
+
* @param pubkey - The public key of the account to receive tokens
|
|
1859
|
+
* @param amount - Amount to airdrop in kelvins (smallest unit)
|
|
1860
|
+
* @param options - Confirmation options (max retries, retry delay)
|
|
1861
|
+
* @returns Confirmed transaction details
|
|
1862
|
+
* @throws {RpcError} If the airdrop transaction fails or confirmation times out
|
|
1863
|
+
*
|
|
1864
|
+
* @example
|
|
1865
|
+
* ```typescript
|
|
1866
|
+
* const result = await client.requestAirdropAndConfirm(publicKey, 1_000_000_000n);
|
|
1867
|
+
* if (result.executed) {
|
|
1868
|
+
* console.log("Airdrop confirmed!");
|
|
1869
|
+
* }
|
|
1870
|
+
* ```
|
|
1871
|
+
*/
|
|
1872
|
+
requestAirdropAndConfirm(pubkey: PublicKey, amount: bigint, options?: ConfirmTransactionOptions): Promise<ConfirmedTransaction>;
|
|
1873
|
+
private getTransaction;
|
|
1874
|
+
/**
|
|
1875
|
+
* Sleeps for a given number of milliseconds.
|
|
1876
|
+
* @param ms - The number of milliseconds to sleep.
|
|
1877
|
+
* @returns A promise that resolves when the sleep is complete.
|
|
1878
|
+
*/
|
|
1879
|
+
private sleep;
|
|
1600
1880
|
}
|
|
1601
1881
|
|
|
1602
1882
|
/**
|
|
@@ -1615,6 +1895,7 @@ declare enum RpcErrorCode {
|
|
|
1615
1895
|
INTERNAL_ERROR = "INTERNAL_ERROR",
|
|
1616
1896
|
TRANSACTION_REJECTED = "TRANSACTION_REJECTED",
|
|
1617
1897
|
INSUFFICIENT_FUNDS = "INSUFFICIENT_FUNDS",
|
|
1898
|
+
TRANSACTION_CONFIRMATION_TIMEOUT = "TRANSACTION_CONFIRMATION_TIMEOUT",
|
|
1618
1899
|
ACCOUNT_NOT_FOUND = "ACCOUNT_NOT_FOUND",
|
|
1619
1900
|
RATE_LIMIT_EXCEEDED = "RATE_LIMIT_EXCEEDED",
|
|
1620
1901
|
NODE_UNHEALTHY = "NODE_UNHEALTHY"
|
|
@@ -1657,40 +1938,11 @@ declare class RpcError extends Error {
|
|
|
1657
1938
|
};
|
|
1658
1939
|
}
|
|
1659
1940
|
|
|
1660
|
-
/**
|
|
1661
|
-
* RPC client module for communicating with Rialo blockchain nodes.
|
|
1662
|
-
*
|
|
1663
|
-
* Provides a high-level client interface with automatic retry logic,
|
|
1664
|
-
* connection management, and type-safe RPC methods.
|
|
1665
|
-
*
|
|
1666
|
-
* @example
|
|
1667
|
-
* ```typescript
|
|
1668
|
-
* import { createRialoClient, RIALO_DEVNET_CHAIN } from '@rialo/ts-cdk';
|
|
1669
|
-
*
|
|
1670
|
-
* // Create client with chain definition and custom transport config
|
|
1671
|
-
* const client = createRialoClient({
|
|
1672
|
-
* chain: RIALO_DEVNET_CHAIN,
|
|
1673
|
-
* transport: {
|
|
1674
|
-
* timeout: 30000,
|
|
1675
|
-
* maxRetries: 3,
|
|
1676
|
-
* }
|
|
1677
|
-
* });
|
|
1678
|
-
*
|
|
1679
|
-
* // Query blockchain state
|
|
1680
|
-
* const balance = await client.getBalance(publicKey);
|
|
1681
|
-
* const blockHeight = await client.getBlockHeight();
|
|
1682
|
-
*
|
|
1683
|
-
* // Send transactions
|
|
1684
|
-
* const signature = await client.sendTransaction(signedTx);
|
|
1685
|
-
* ```
|
|
1686
|
-
*/
|
|
1687
|
-
|
|
1688
1941
|
/**
|
|
1689
1942
|
* Creates an RPC client with automatic retry and timeout handling.
|
|
1690
1943
|
*
|
|
1691
1944
|
* @param config - Client configuration with chain definition and optional transport settings
|
|
1692
|
-
* @param config.chain - Chain definition (e.g., RIALO_DEVNET_CHAIN, RIALO_MAINNET_CHAIN)
|
|
1693
|
-
* @param config.endpoint - Optional RPC endpoint override (useful for custom RPC providers)
|
|
1945
|
+
* @param config.chain - Chain definition (e.g., RIALO_DEVNET_CHAIN, RIALO_MAINNET_CHAIN) or a custom chain with your own rpcUrl
|
|
1694
1946
|
* @param config.transport - Optional transport configuration (timeout, retries, headers)
|
|
1695
1947
|
* @returns Configured RialoClient instance
|
|
1696
1948
|
*
|
|
@@ -1705,10 +1957,13 @@ declare class RpcError extends Error {
|
|
|
1705
1957
|
* transport: { timeout: 30000, maxRetries: 5 }
|
|
1706
1958
|
* });
|
|
1707
1959
|
*
|
|
1708
|
-
* // With custom RPC
|
|
1960
|
+
* // With custom RPC URL
|
|
1709
1961
|
* const client = createRialoClient({
|
|
1710
|
-
* chain:
|
|
1711
|
-
*
|
|
1962
|
+
* chain: {
|
|
1963
|
+
* id: 'rialo:mainnet',
|
|
1964
|
+
* name: 'Mainnet',
|
|
1965
|
+
* rpcUrl: 'https://mainnet.custom-rpc.com:4101'
|
|
1966
|
+
* },
|
|
1712
1967
|
* });
|
|
1713
1968
|
* ```
|
|
1714
1969
|
*/
|
|
@@ -1736,11 +1991,14 @@ declare function createRialoClient(config: RialoClientConfig): RialoClient;
|
|
|
1736
1991
|
* transport: { timeout: 60000, maxRetries: 5 }
|
|
1737
1992
|
* });
|
|
1738
1993
|
*
|
|
1739
|
-
* // Use custom
|
|
1994
|
+
* // Use custom RPC URL while preserving network identity
|
|
1740
1995
|
* const config = getDefaultRialoClientConfig('mainnet');
|
|
1741
1996
|
* const client = createRialoClient({
|
|
1742
1997
|
* ...config,
|
|
1743
|
-
*
|
|
1998
|
+
* chain: {
|
|
1999
|
+
* ...config.chain,
|
|
2000
|
+
* rpcUrl: 'https://mainnet.custom-rpc.com:4101'
|
|
2001
|
+
* },
|
|
1744
2002
|
* });
|
|
1745
2003
|
* ```
|
|
1746
2004
|
*/
|
|
@@ -1790,4 +2048,4 @@ declare function getMainnetUrl(): string;
|
|
|
1790
2048
|
*/
|
|
1791
2049
|
declare function getLocalnetUrl(): string;
|
|
1792
2050
|
|
|
1793
|
-
export { type AccountInfo, type AccountMeta, AccountMetaTable, BASE_DERIVATION_PATH, BaseRpcClient, type ChainDefinition, type CompiledInstruction, CryptoError, CryptoErrorCode, DEFAULT_NUM_ACCOUNTS, type EpochInfoResponse, type GetConnectedFullNodesResponse, type GetFeeForMessageResponse, type GetHealthResponse, type GetSignaturesForAddressConfig, type GetSignaturesForAddressResponse, type GetSubscriptionsResponse, type GetTransactionsConfig, type GetTransactionsResponse, type GetTriggeredTransactionsResponse, type GetValidatorHealthResponse, type GetWorkflowLineageRequest, type GetWorkflowLineageResponse, HttpTransport, type HttpTransportConfig, type IdentifierString, type Instruction, type IsBlockhashValidResponse, KELVIN_PER_RLO, Keypair, KeypairSigner, Message, type MessageHeader, Mnemonic, type MnemonicStrength, type MultipleAccountsResponse, PUBLIC_KEY_LENGTH, PublicKey, QueryRpcClient, RIALO_DEVNET_CHAIN, RIALO_LOCALNET_CHAIN, RIALO_MAINNET_CHAIN, RIALO_TESTNET_CHAIN, RialoClient, type RialoClientConfig, RialoError, RialoErrorType, type RialoNetwork, RpcError, RpcErrorCode, type RpcErrorDetails$1 as RpcErrorDetails, SECRET_KEY_LENGTH, SIGNATURE_LENGTH, SYSTEM_PROGRAM_ID, type SendTransactionOptions, Signature, type SignatureStatus, type Signer, SystemInstruction, Transaction, TransactionBuilder, TransactionError, TransactionErrorCode, type TransactionResponse, TransactionRpcClient, URL_DEVNET, URL_LOCALNET, URL_MAINNET, URL_TESTNET, calculateBackoff, createAccount, createBorshInstruction, createRialoClient, encodeBorshData, fromBase64, getDefaultRialoClientConfig, getDevnetUrl, getLocalnetUrl, getMainnetUrl, getTestnetUrl, sleep, toBase64, transferInstruction };
|
|
2051
|
+
export { type AccountInfo, type AccountMeta, AccountMetaTable, BASE_DERIVATION_PATH, BaseRpcClient, type ChainDefinition, type CompiledInstruction, type ConfirmTransactionOptions, type ConfirmedTransaction, CryptoError, CryptoErrorCode, DEFAULT_NUM_ACCOUNTS, type EpochInfoResponse, type GetConnectedFullNodesResponse, type GetFeeForMessageResponse, type GetHealthResponse, type GetSignaturesForAddressConfig, type GetSignaturesForAddressResponse, type GetSubscriptionsResponse, type GetTransactionsConfig, type GetTransactionsResponse, type GetTriggeredTransactionsResponse, type GetValidatorHealthResponse, type GetWorkflowLineageRequest, type GetWorkflowLineageResponse, HttpTransport, type HttpTransportConfig, type IdentifierString, type Instruction, type IsBlockhashValidResponse, KELVIN_PER_RLO, Keypair, KeypairSigner, Message, type MessageHeader, Mnemonic, type MnemonicStrength, type MultipleAccountsResponse, PUBLIC_KEY_LENGTH, PublicKey, QueryRpcClient, RIALO_DEVNET_CHAIN, RIALO_LOCALNET_CHAIN, RIALO_MAINNET_CHAIN, RIALO_TESTNET_CHAIN, RialoClient, type RialoClientConfig, RialoError, RialoErrorType, type RialoNetwork, RpcError, RpcErrorCode, type RpcErrorDetails$1 as RpcErrorDetails, SECRET_KEY_LENGTH, SIGNATURE_LENGTH, SYSTEM_PROGRAM_ID, type SendAndConfirmOptions, type SendTransactionOptions, Signature, type SignatureStatus, type Signer, SystemInstruction, Transaction, TransactionBuilder, TransactionError, TransactionErrorCode, type TransactionResponse, TransactionRpcClient, URL_DEVNET, URL_LOCALNET, URL_MAINNET, URL_TESTNET, calculateBackoff, createAccount, createBorshInstruction, createRialoClient, encodeBorshData, fromBase64, getDefaultRialoClientConfig, getDevnetUrl, getLocalnetUrl, getMainnetUrl, getTestnetUrl, sleep, toBase64, transferInstruction };
|