@solana/web3.js 1.45.0 → 1.47.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/lib/index.browser.cjs.js +248 -127
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +247 -128
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +248 -127
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +178 -18
- package/lib/index.esm.js +247 -128
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +248 -127
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +1 -1
- package/src/connection.ts +371 -173
- package/src/errors.ts +41 -0
- package/src/util/send-and-confirm-raw-transaction.ts +1 -0
- package/src/util/send-and-confirm-transaction.ts +1 -0
package/lib/index.d.ts
CHANGED
|
@@ -580,6 +580,8 @@ declare module '@solana/web3.js' {
|
|
|
580
580
|
preflightCommitment?: Commitment;
|
|
581
581
|
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
|
582
582
|
maxRetries?: number;
|
|
583
|
+
/** The minimum slot that the request can be evaluated at */
|
|
584
|
+
minContextSlot?: number;
|
|
583
585
|
};
|
|
584
586
|
/**
|
|
585
587
|
* Options for confirming transactions
|
|
@@ -593,6 +595,8 @@ declare module '@solana/web3.js' {
|
|
|
593
595
|
preflightCommitment?: Commitment;
|
|
594
596
|
/** Maximum number of times for the RPC node to retry sending the transaction to the leader. */
|
|
595
597
|
maxRetries?: number;
|
|
598
|
+
/** The minimum slot that the request can be evaluated at */
|
|
599
|
+
minContextSlot?: number;
|
|
596
600
|
};
|
|
597
601
|
/**
|
|
598
602
|
* Options for getConfirmedSignaturesForAddress2
|
|
@@ -621,6 +625,8 @@ declare module '@solana/web3.js' {
|
|
|
621
625
|
until?: TransactionSignature;
|
|
622
626
|
/** Maximum transaction signatures to return (between 1 and 1,000, default: 1,000). */
|
|
623
627
|
limit?: number;
|
|
628
|
+
/** The minimum slot that the request can be evaluated at */
|
|
629
|
+
minContextSlot?: number;
|
|
624
630
|
};
|
|
625
631
|
/**
|
|
626
632
|
* RPC Response with extra contextual information
|
|
@@ -675,6 +681,80 @@ declare module '@solana/web3.js' {
|
|
|
675
681
|
* </pre>
|
|
676
682
|
*/
|
|
677
683
|
export type LargestAccountsFilter = 'circulating' | 'nonCirculating';
|
|
684
|
+
/**
|
|
685
|
+
* Configuration object for changing `getAccountInfo` query behavior
|
|
686
|
+
*/
|
|
687
|
+
export type GetAccountInfoConfig = {
|
|
688
|
+
/** The level of commitment desired */
|
|
689
|
+
commitment?: Commitment;
|
|
690
|
+
/** The minimum slot that the request can be evaluated at */
|
|
691
|
+
minContextSlot?: number;
|
|
692
|
+
};
|
|
693
|
+
/**
|
|
694
|
+
* Configuration object for changing `getBalance` query behavior
|
|
695
|
+
*/
|
|
696
|
+
export type GetBalanceConfig = {
|
|
697
|
+
/** The level of commitment desired */
|
|
698
|
+
commitment?: Commitment;
|
|
699
|
+
/** The minimum slot that the request can be evaluated at */
|
|
700
|
+
minContextSlot?: number;
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
703
|
+
* Configuration object for changing `getBlockHeight` query behavior
|
|
704
|
+
*/
|
|
705
|
+
export type GetBlockHeightConfig = {
|
|
706
|
+
/** The level of commitment desired */
|
|
707
|
+
commitment?: Commitment;
|
|
708
|
+
/** The minimum slot that the request can be evaluated at */
|
|
709
|
+
minContextSlot?: number;
|
|
710
|
+
};
|
|
711
|
+
/**
|
|
712
|
+
* Configuration object for changing `getEpochInfo` query behavior
|
|
713
|
+
*/
|
|
714
|
+
export type GetEpochInfoConfig = {
|
|
715
|
+
/** The level of commitment desired */
|
|
716
|
+
commitment?: Commitment;
|
|
717
|
+
/** The minimum slot that the request can be evaluated at */
|
|
718
|
+
minContextSlot?: number;
|
|
719
|
+
};
|
|
720
|
+
/**
|
|
721
|
+
* Configuration object for changing `getInflationReward` query behavior
|
|
722
|
+
*/
|
|
723
|
+
export type GetInflationRewardConfig = {
|
|
724
|
+
/** The level of commitment desired */
|
|
725
|
+
commitment?: Commitment;
|
|
726
|
+
/** An epoch for which the reward occurs. If omitted, the previous epoch will be used */
|
|
727
|
+
epoch?: number;
|
|
728
|
+
/** The minimum slot that the request can be evaluated at */
|
|
729
|
+
minContextSlot?: number;
|
|
730
|
+
};
|
|
731
|
+
/**
|
|
732
|
+
* Configuration object for changing `getLatestBlockhash` query behavior
|
|
733
|
+
*/
|
|
734
|
+
export type GetLatestBlockhashConfig = {
|
|
735
|
+
/** The level of commitment desired */
|
|
736
|
+
commitment?: Commitment;
|
|
737
|
+
/** The minimum slot that the request can be evaluated at */
|
|
738
|
+
minContextSlot?: number;
|
|
739
|
+
};
|
|
740
|
+
/**
|
|
741
|
+
* Configuration object for changing `getSlot` query behavior
|
|
742
|
+
*/
|
|
743
|
+
export type GetSlotConfig = {
|
|
744
|
+
/** The level of commitment desired */
|
|
745
|
+
commitment?: Commitment;
|
|
746
|
+
/** The minimum slot that the request can be evaluated at */
|
|
747
|
+
minContextSlot?: number;
|
|
748
|
+
};
|
|
749
|
+
/**
|
|
750
|
+
* Configuration object for changing `getSlotLeader` query behavior
|
|
751
|
+
*/
|
|
752
|
+
export type GetSlotLeaderConfig = {
|
|
753
|
+
/** The level of commitment desired */
|
|
754
|
+
commitment?: Commitment;
|
|
755
|
+
/** The minimum slot that the request can be evaluated at */
|
|
756
|
+
minContextSlot?: number;
|
|
757
|
+
};
|
|
678
758
|
/**
|
|
679
759
|
* Configuration object for changing `getLargestAccounts` query behavior
|
|
680
760
|
*/
|
|
@@ -1277,6 +1357,8 @@ declare module '@solana/web3.js' {
|
|
|
1277
1357
|
dataSlice?: DataSlice;
|
|
1278
1358
|
/** Optional array of filters to apply to accounts */
|
|
1279
1359
|
filters?: GetProgramAccountsFilter[];
|
|
1360
|
+
/** The minimum slot that the request can be evaluated at */
|
|
1361
|
+
minContextSlot?: number;
|
|
1280
1362
|
};
|
|
1281
1363
|
/**
|
|
1282
1364
|
* Configuration object for getParsedProgramAccounts
|
|
@@ -1286,6 +1368,8 @@ declare module '@solana/web3.js' {
|
|
|
1286
1368
|
commitment?: Commitment;
|
|
1287
1369
|
/** Optional array of filters to apply to accounts */
|
|
1288
1370
|
filters?: GetProgramAccountsFilter[];
|
|
1371
|
+
/** The minimum slot that the request can be evaluated at */
|
|
1372
|
+
minContextSlot?: number;
|
|
1289
1373
|
};
|
|
1290
1374
|
/**
|
|
1291
1375
|
* Configuration object for getMultipleAccounts
|
|
@@ -1293,8 +1377,37 @@ declare module '@solana/web3.js' {
|
|
|
1293
1377
|
export type GetMultipleAccountsConfig = {
|
|
1294
1378
|
/** Optional commitment level */
|
|
1295
1379
|
commitment?: Commitment;
|
|
1296
|
-
/**
|
|
1297
|
-
|
|
1380
|
+
/** The minimum slot that the request can be evaluated at */
|
|
1381
|
+
minContextSlot?: number;
|
|
1382
|
+
};
|
|
1383
|
+
/**
|
|
1384
|
+
* Configuration object for `getStakeActivation`
|
|
1385
|
+
*/
|
|
1386
|
+
export type GetStakeActivationConfig = {
|
|
1387
|
+
/** Optional commitment level */
|
|
1388
|
+
commitment?: Commitment;
|
|
1389
|
+
/** Epoch for which to calculate activation details. If parameter not provided, defaults to current epoch */
|
|
1390
|
+
epoch?: number;
|
|
1391
|
+
/** The minimum slot that the request can be evaluated at */
|
|
1392
|
+
minContextSlot?: number;
|
|
1393
|
+
};
|
|
1394
|
+
/**
|
|
1395
|
+
* Configuration object for `getStakeActivation`
|
|
1396
|
+
*/
|
|
1397
|
+
export type GetTokenAccountsByOwnerConfig = {
|
|
1398
|
+
/** Optional commitment level */
|
|
1399
|
+
commitment?: Commitment;
|
|
1400
|
+
/** The minimum slot that the request can be evaluated at */
|
|
1401
|
+
minContextSlot?: number;
|
|
1402
|
+
};
|
|
1403
|
+
/**
|
|
1404
|
+
* Configuration object for `getStakeActivation`
|
|
1405
|
+
*/
|
|
1406
|
+
export type GetTransactionCountConfig = {
|
|
1407
|
+
/** Optional commitment level */
|
|
1408
|
+
commitment?: Commitment;
|
|
1409
|
+
/** The minimum slot that the request can be evaluated at */
|
|
1410
|
+
minContextSlot?: number;
|
|
1298
1411
|
};
|
|
1299
1412
|
/**
|
|
1300
1413
|
* Information describing an account
|
|
@@ -1510,12 +1623,15 @@ declare module '@solana/web3.js' {
|
|
|
1510
1623
|
*/
|
|
1511
1624
|
getBalanceAndContext(
|
|
1512
1625
|
publicKey: PublicKey,
|
|
1513
|
-
|
|
1626
|
+
commitmentOrConfig?: Commitment | GetBalanceConfig,
|
|
1514
1627
|
): Promise<RpcResponseAndContext<number>>;
|
|
1515
1628
|
/**
|
|
1516
1629
|
* Fetch the balance for the specified public key
|
|
1517
1630
|
*/
|
|
1518
|
-
getBalance(
|
|
1631
|
+
getBalance(
|
|
1632
|
+
publicKey: PublicKey,
|
|
1633
|
+
commitmentOrConfig?: Commitment | GetBalanceConfig,
|
|
1634
|
+
): Promise<number>;
|
|
1519
1635
|
/**
|
|
1520
1636
|
* Fetch the estimated production time of a block
|
|
1521
1637
|
*/
|
|
@@ -1557,7 +1673,7 @@ declare module '@solana/web3.js' {
|
|
|
1557
1673
|
getTokenAccountsByOwner(
|
|
1558
1674
|
ownerAddress: PublicKey,
|
|
1559
1675
|
filter: TokenAccountsFilter,
|
|
1560
|
-
|
|
1676
|
+
commitmentOrConfig?: Commitment | GetTokenAccountsByOwnerConfig,
|
|
1561
1677
|
): Promise<
|
|
1562
1678
|
RpcResponseAndContext<
|
|
1563
1679
|
Array<{
|
|
@@ -1602,7 +1718,7 @@ declare module '@solana/web3.js' {
|
|
|
1602
1718
|
*/
|
|
1603
1719
|
getAccountInfoAndContext(
|
|
1604
1720
|
publicKey: PublicKey,
|
|
1605
|
-
|
|
1721
|
+
commitmentOrConfig?: Commitment | GetAccountInfoConfig,
|
|
1606
1722
|
): Promise<RpcResponseAndContext<AccountInfo<Buffer> | null>>;
|
|
1607
1723
|
/**
|
|
1608
1724
|
* Fetch parsed account info for the specified public key
|
|
@@ -1618,28 +1734,28 @@ declare module '@solana/web3.js' {
|
|
|
1618
1734
|
*/
|
|
1619
1735
|
getAccountInfo(
|
|
1620
1736
|
publicKey: PublicKey,
|
|
1621
|
-
|
|
1737
|
+
commitmentOrConfig?: Commitment | GetAccountInfoConfig,
|
|
1622
1738
|
): Promise<AccountInfo<Buffer> | null>;
|
|
1623
1739
|
/**
|
|
1624
1740
|
* Fetch all the account info for multiple accounts specified by an array of public keys, return with context
|
|
1625
1741
|
*/
|
|
1626
1742
|
getMultipleAccountsInfoAndContext(
|
|
1627
1743
|
publicKeys: PublicKey[],
|
|
1628
|
-
|
|
1744
|
+
commitmentOrConfig?: Commitment | GetMultipleAccountsConfig,
|
|
1629
1745
|
): Promise<RpcResponseAndContext<(AccountInfo<Buffer> | null)[]>>;
|
|
1630
1746
|
/**
|
|
1631
1747
|
* Fetch all the account info for multiple accounts specified by an array of public keys
|
|
1632
1748
|
*/
|
|
1633
1749
|
getMultipleAccountsInfo(
|
|
1634
1750
|
publicKeys: PublicKey[],
|
|
1635
|
-
|
|
1751
|
+
commitmentOrConfig?: Commitment | GetMultipleAccountsConfig,
|
|
1636
1752
|
): Promise<(AccountInfo<Buffer> | null)[]>;
|
|
1637
1753
|
/**
|
|
1638
1754
|
* Returns epoch activation information for a stake account that has been delegated
|
|
1639
1755
|
*/
|
|
1640
1756
|
getStakeActivation(
|
|
1641
1757
|
publicKey: PublicKey,
|
|
1642
|
-
|
|
1758
|
+
commitmentOrConfig?: Commitment | GetStakeActivationConfig,
|
|
1643
1759
|
epoch?: number,
|
|
1644
1760
|
): Promise<StakeActivationData>;
|
|
1645
1761
|
/**
|
|
@@ -1690,11 +1806,13 @@ declare module '@solana/web3.js' {
|
|
|
1690
1806
|
/**
|
|
1691
1807
|
* Fetch the current slot that the node is processing
|
|
1692
1808
|
*/
|
|
1693
|
-
getSlot(
|
|
1809
|
+
getSlot(commitmentOrConfig?: Commitment | GetSlotConfig): Promise<number>;
|
|
1694
1810
|
/**
|
|
1695
1811
|
* Fetch the current slot leader of the cluster
|
|
1696
1812
|
*/
|
|
1697
|
-
getSlotLeader(
|
|
1813
|
+
getSlotLeader(
|
|
1814
|
+
commitmentOrConfig?: Commitment | GetSlotLeaderConfig,
|
|
1815
|
+
): Promise<string>;
|
|
1698
1816
|
/**
|
|
1699
1817
|
* Fetch `limit` number of slot leaders starting from `startSlot`
|
|
1700
1818
|
*
|
|
@@ -1719,7 +1837,9 @@ declare module '@solana/web3.js' {
|
|
|
1719
1837
|
/**
|
|
1720
1838
|
* Fetch the current transaction count of the cluster
|
|
1721
1839
|
*/
|
|
1722
|
-
getTransactionCount(
|
|
1840
|
+
getTransactionCount(
|
|
1841
|
+
commitmentOrConfig?: Commitment | GetTransactionCountConfig,
|
|
1842
|
+
): Promise<number>;
|
|
1723
1843
|
/**
|
|
1724
1844
|
* Fetch the current total currency supply of the cluster in lamports
|
|
1725
1845
|
*
|
|
@@ -1736,12 +1856,14 @@ declare module '@solana/web3.js' {
|
|
|
1736
1856
|
getInflationReward(
|
|
1737
1857
|
addresses: PublicKey[],
|
|
1738
1858
|
epoch?: number,
|
|
1739
|
-
|
|
1859
|
+
commitmentOrConfig?: Commitment | GetInflationRewardConfig,
|
|
1740
1860
|
): Promise<(InflationReward | null)[]>;
|
|
1741
1861
|
/**
|
|
1742
1862
|
* Fetch the Epoch Info parameters
|
|
1743
1863
|
*/
|
|
1744
|
-
getEpochInfo(
|
|
1864
|
+
getEpochInfo(
|
|
1865
|
+
commitmentOrConfig?: Commitment | GetEpochInfoConfig,
|
|
1866
|
+
): Promise<EpochInfo>;
|
|
1745
1867
|
/**
|
|
1746
1868
|
* Fetch the Epoch Schedule parameters
|
|
1747
1869
|
*/
|
|
@@ -1807,14 +1929,14 @@ declare module '@solana/web3.js' {
|
|
|
1807
1929
|
* @return {Promise<BlockhashWithExpiryBlockHeight>}
|
|
1808
1930
|
*/
|
|
1809
1931
|
getLatestBlockhash(
|
|
1810
|
-
|
|
1932
|
+
commitmentOrConfig?: Commitment | GetLatestBlockhashConfig,
|
|
1811
1933
|
): Promise<BlockhashWithExpiryBlockHeight>;
|
|
1812
1934
|
/**
|
|
1813
1935
|
* Fetch the latest blockhash from the cluster
|
|
1814
1936
|
* @return {Promise<BlockhashWithExpiryBlockHeight>}
|
|
1815
1937
|
*/
|
|
1816
1938
|
getLatestBlockhashAndContext(
|
|
1817
|
-
|
|
1939
|
+
commitmentOrConfig?: Commitment | GetLatestBlockhashConfig,
|
|
1818
1940
|
): Promise<RpcResponseAndContext<BlockhashWithExpiryBlockHeight>>;
|
|
1819
1941
|
/**
|
|
1820
1942
|
* Fetch the node version
|
|
@@ -1833,7 +1955,9 @@ declare module '@solana/web3.js' {
|
|
|
1833
1955
|
commitment?: Finality;
|
|
1834
1956
|
},
|
|
1835
1957
|
): Promise<BlockResponse | null>;
|
|
1836
|
-
getBlockHeight(
|
|
1958
|
+
getBlockHeight(
|
|
1959
|
+
commitmentOrConfig?: Commitment | GetBlockHeightConfig,
|
|
1960
|
+
): Promise<number>;
|
|
1837
1961
|
getBlockProduction(
|
|
1838
1962
|
configOrCommitment?: GetBlockProductionConfig | Commitment,
|
|
1839
1963
|
): Promise<RpcResponseAndContext<BlockProduction>>;
|
|
@@ -3373,6 +3497,42 @@ declare module '@solana/web3.js' {
|
|
|
3373
3497
|
logs: string[] | undefined;
|
|
3374
3498
|
constructor(message: string, logs?: string[]);
|
|
3375
3499
|
}
|
|
3500
|
+
export const SolanaJSONRPCErrorCode: {
|
|
3501
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
|
|
3502
|
+
readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
|
|
3503
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
|
|
3504
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
|
|
3505
|
+
readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
|
|
3506
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
|
|
3507
|
+
readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
|
|
3508
|
+
readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
|
|
3509
|
+
readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
|
|
3510
|
+
readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
|
|
3511
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
|
|
3512
|
+
readonly JSON_RPC_SCAN_ERROR: -32012;
|
|
3513
|
+
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
|
|
3514
|
+
readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
|
|
3515
|
+
readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
|
|
3516
|
+
readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
|
|
3517
|
+
};
|
|
3518
|
+
export type SolanaJSONRPCErrorCodeEnum =
|
|
3519
|
+
typeof SolanaJSONRPCErrorCode[keyof typeof SolanaJSONRPCErrorCode];
|
|
3520
|
+
export class SolanaJSONRPCError extends Error {
|
|
3521
|
+
code: SolanaJSONRPCErrorCodeEnum | unknown;
|
|
3522
|
+
data?: any;
|
|
3523
|
+
constructor(
|
|
3524
|
+
{
|
|
3525
|
+
code,
|
|
3526
|
+
message,
|
|
3527
|
+
data,
|
|
3528
|
+
}: Readonly<{
|
|
3529
|
+
code: unknown;
|
|
3530
|
+
message: string;
|
|
3531
|
+
data?: any;
|
|
3532
|
+
}>,
|
|
3533
|
+
customMessage?: string,
|
|
3534
|
+
);
|
|
3535
|
+
}
|
|
3376
3536
|
|
|
3377
3537
|
/**
|
|
3378
3538
|
* Sign, send and confirm a transaction.
|