@solana/web3.js 1.4.1 → 1.5.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.esm.js +40 -14
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +40 -14
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +17 -1
- package/lib/index.esm.js +40 -14
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +40 -14
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +1 -1
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +23 -6
- package/package.json +3 -3
- package/src/connection.ts +74 -15
package/lib/index.browser.esm.js
CHANGED
|
@@ -5888,8 +5888,10 @@ class Connection {
|
|
|
5888
5888
|
*/
|
|
5889
5889
|
|
|
5890
5890
|
|
|
5891
|
-
async getConfirmedBlock(slot) {
|
|
5892
|
-
const
|
|
5891
|
+
async getConfirmedBlock(slot, commitment) {
|
|
5892
|
+
const args = this._buildArgsAtLeastConfirmed([slot], commitment);
|
|
5893
|
+
|
|
5894
|
+
const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);
|
|
5893
5895
|
const res = create(unsafeRes, GetConfirmedBlockRpcResult);
|
|
5894
5896
|
|
|
5895
5897
|
if ('error' in res) {
|
|
@@ -5909,11 +5911,13 @@ class Connection {
|
|
|
5909
5911
|
*/
|
|
5910
5912
|
|
|
5911
5913
|
|
|
5912
|
-
async getConfirmedBlockSignatures(slot) {
|
|
5913
|
-
const
|
|
5914
|
+
async getConfirmedBlockSignatures(slot, commitment) {
|
|
5915
|
+
const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, {
|
|
5914
5916
|
transactionDetails: 'signatures',
|
|
5915
5917
|
rewards: false
|
|
5916
|
-
}
|
|
5918
|
+
});
|
|
5919
|
+
|
|
5920
|
+
const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);
|
|
5917
5921
|
const res = create(unsafeRes, GetConfirmedBlockSignaturesRpcResult);
|
|
5918
5922
|
|
|
5919
5923
|
if ('error' in res) {
|
|
@@ -5933,8 +5937,10 @@ class Connection {
|
|
|
5933
5937
|
*/
|
|
5934
5938
|
|
|
5935
5939
|
|
|
5936
|
-
async getConfirmedTransaction(signature) {
|
|
5937
|
-
const
|
|
5940
|
+
async getConfirmedTransaction(signature, commitment) {
|
|
5941
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment);
|
|
5942
|
+
|
|
5943
|
+
const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
|
|
5938
5944
|
const res = create(unsafeRes, GetConfirmedTransactionRpcResult);
|
|
5939
5945
|
|
|
5940
5946
|
if ('error' in res) {
|
|
@@ -5948,8 +5954,10 @@ class Connection {
|
|
|
5948
5954
|
*/
|
|
5949
5955
|
|
|
5950
5956
|
|
|
5951
|
-
async getParsedConfirmedTransaction(signature) {
|
|
5952
|
-
const
|
|
5957
|
+
async getParsedConfirmedTransaction(signature, commitment) {
|
|
5958
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
|
|
5959
|
+
|
|
5960
|
+
const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
|
|
5953
5961
|
const res = create(unsafeRes, GetParsedConfirmedTransactionRpcResult);
|
|
5954
5962
|
|
|
5955
5963
|
if ('error' in res) {
|
|
@@ -5963,11 +5971,13 @@ class Connection {
|
|
|
5963
5971
|
*/
|
|
5964
5972
|
|
|
5965
5973
|
|
|
5966
|
-
async getParsedConfirmedTransactions(signatures) {
|
|
5974
|
+
async getParsedConfirmedTransactions(signatures, commitment) {
|
|
5967
5975
|
const batch = signatures.map(signature => {
|
|
5976
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
|
|
5977
|
+
|
|
5968
5978
|
return {
|
|
5969
5979
|
methodName: 'getConfirmedTransaction',
|
|
5970
|
-
args
|
|
5980
|
+
args
|
|
5971
5981
|
};
|
|
5972
5982
|
});
|
|
5973
5983
|
const unsafeRes = await this._rpcBatchRequest(batch);
|
|
@@ -6005,7 +6015,7 @@ class Connection {
|
|
|
6005
6015
|
}
|
|
6006
6016
|
|
|
6007
6017
|
try {
|
|
6008
|
-
const block = await this.getConfirmedBlockSignatures(startSlot);
|
|
6018
|
+
const block = await this.getConfirmedBlockSignatures(startSlot, 'finalized');
|
|
6009
6019
|
|
|
6010
6020
|
if (block.signatures.length > 0) {
|
|
6011
6021
|
options.until = block.signatures[block.signatures.length - 1].toString();
|
|
@@ -6056,8 +6066,10 @@ class Connection {
|
|
|
6056
6066
|
*/
|
|
6057
6067
|
|
|
6058
6068
|
|
|
6059
|
-
async getConfirmedSignaturesForAddress2(address, options) {
|
|
6060
|
-
const
|
|
6069
|
+
async getConfirmedSignaturesForAddress2(address, options, commitment) {
|
|
6070
|
+
const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options);
|
|
6071
|
+
|
|
6072
|
+
const unsafeRes = await this._rpcRequest('getConfirmedSignaturesForAddress2', args);
|
|
6061
6073
|
const res = create(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);
|
|
6062
6074
|
|
|
6063
6075
|
if ('error' in res) {
|
|
@@ -6767,6 +6779,20 @@ class Connection {
|
|
|
6767
6779
|
*/
|
|
6768
6780
|
|
|
6769
6781
|
|
|
6782
|
+
_buildArgsAtLeastConfirmed(args, override, encoding, extra) {
|
|
6783
|
+
const commitment = override || this._commitment;
|
|
6784
|
+
|
|
6785
|
+
if (commitment && !['confirmed', 'finalized'].includes(commitment)) {
|
|
6786
|
+
throw new Error('Using Connection with default commitment: `' + this._commitment + '`, but method requires at least `confirmed`');
|
|
6787
|
+
}
|
|
6788
|
+
|
|
6789
|
+
return this._buildArgs(args, override, encoding, extra);
|
|
6790
|
+
}
|
|
6791
|
+
/**
|
|
6792
|
+
* @internal
|
|
6793
|
+
*/
|
|
6794
|
+
|
|
6795
|
+
|
|
6770
6796
|
_wsOnSignatureNotification(notification) {
|
|
6771
6797
|
const res = create(notification, SignatureNotificationResult);
|
|
6772
6798
|
|