@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.cjs.js
CHANGED
|
@@ -3990,8 +3990,10 @@ class Connection {
|
|
|
3990
3990
|
*/
|
|
3991
3991
|
|
|
3992
3992
|
|
|
3993
|
-
async getConfirmedBlock(slot) {
|
|
3994
|
-
const
|
|
3993
|
+
async getConfirmedBlock(slot, commitment) {
|
|
3994
|
+
const args = this._buildArgsAtLeastConfirmed([slot], commitment);
|
|
3995
|
+
|
|
3996
|
+
const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);
|
|
3995
3997
|
const res = superstruct.create(unsafeRes, GetConfirmedBlockRpcResult);
|
|
3996
3998
|
|
|
3997
3999
|
if ('error' in res) {
|
|
@@ -4011,11 +4013,13 @@ class Connection {
|
|
|
4011
4013
|
*/
|
|
4012
4014
|
|
|
4013
4015
|
|
|
4014
|
-
async getConfirmedBlockSignatures(slot) {
|
|
4015
|
-
const
|
|
4016
|
+
async getConfirmedBlockSignatures(slot, commitment) {
|
|
4017
|
+
const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, {
|
|
4016
4018
|
transactionDetails: 'signatures',
|
|
4017
4019
|
rewards: false
|
|
4018
|
-
}
|
|
4020
|
+
});
|
|
4021
|
+
|
|
4022
|
+
const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);
|
|
4019
4023
|
const res = superstruct.create(unsafeRes, GetConfirmedBlockSignaturesRpcResult);
|
|
4020
4024
|
|
|
4021
4025
|
if ('error' in res) {
|
|
@@ -4035,8 +4039,10 @@ class Connection {
|
|
|
4035
4039
|
*/
|
|
4036
4040
|
|
|
4037
4041
|
|
|
4038
|
-
async getConfirmedTransaction(signature) {
|
|
4039
|
-
const
|
|
4042
|
+
async getConfirmedTransaction(signature, commitment) {
|
|
4043
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment);
|
|
4044
|
+
|
|
4045
|
+
const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
|
|
4040
4046
|
const res = superstruct.create(unsafeRes, GetConfirmedTransactionRpcResult);
|
|
4041
4047
|
|
|
4042
4048
|
if ('error' in res) {
|
|
@@ -4050,8 +4056,10 @@ class Connection {
|
|
|
4050
4056
|
*/
|
|
4051
4057
|
|
|
4052
4058
|
|
|
4053
|
-
async getParsedConfirmedTransaction(signature) {
|
|
4054
|
-
const
|
|
4059
|
+
async getParsedConfirmedTransaction(signature, commitment) {
|
|
4060
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
|
|
4061
|
+
|
|
4062
|
+
const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
|
|
4055
4063
|
const res = superstruct.create(unsafeRes, GetParsedConfirmedTransactionRpcResult);
|
|
4056
4064
|
|
|
4057
4065
|
if ('error' in res) {
|
|
@@ -4065,11 +4073,13 @@ class Connection {
|
|
|
4065
4073
|
*/
|
|
4066
4074
|
|
|
4067
4075
|
|
|
4068
|
-
async getParsedConfirmedTransactions(signatures) {
|
|
4076
|
+
async getParsedConfirmedTransactions(signatures, commitment) {
|
|
4069
4077
|
const batch = signatures.map(signature => {
|
|
4078
|
+
const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
|
|
4079
|
+
|
|
4070
4080
|
return {
|
|
4071
4081
|
methodName: 'getConfirmedTransaction',
|
|
4072
|
-
args
|
|
4082
|
+
args
|
|
4073
4083
|
};
|
|
4074
4084
|
});
|
|
4075
4085
|
const unsafeRes = await this._rpcBatchRequest(batch);
|
|
@@ -4107,7 +4117,7 @@ class Connection {
|
|
|
4107
4117
|
}
|
|
4108
4118
|
|
|
4109
4119
|
try {
|
|
4110
|
-
const block = await this.getConfirmedBlockSignatures(startSlot);
|
|
4120
|
+
const block = await this.getConfirmedBlockSignatures(startSlot, 'finalized');
|
|
4111
4121
|
|
|
4112
4122
|
if (block.signatures.length > 0) {
|
|
4113
4123
|
options.until = block.signatures[block.signatures.length - 1].toString();
|
|
@@ -4158,8 +4168,10 @@ class Connection {
|
|
|
4158
4168
|
*/
|
|
4159
4169
|
|
|
4160
4170
|
|
|
4161
|
-
async getConfirmedSignaturesForAddress2(address, options) {
|
|
4162
|
-
const
|
|
4171
|
+
async getConfirmedSignaturesForAddress2(address, options, commitment) {
|
|
4172
|
+
const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options);
|
|
4173
|
+
|
|
4174
|
+
const unsafeRes = await this._rpcRequest('getConfirmedSignaturesForAddress2', args);
|
|
4163
4175
|
const res = superstruct.create(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);
|
|
4164
4176
|
|
|
4165
4177
|
if ('error' in res) {
|
|
@@ -4869,6 +4881,20 @@ class Connection {
|
|
|
4869
4881
|
*/
|
|
4870
4882
|
|
|
4871
4883
|
|
|
4884
|
+
_buildArgsAtLeastConfirmed(args, override, encoding, extra) {
|
|
4885
|
+
const commitment = override || this._commitment;
|
|
4886
|
+
|
|
4887
|
+
if (commitment && !['confirmed', 'finalized'].includes(commitment)) {
|
|
4888
|
+
throw new Error('Using Connection with default commitment: `' + this._commitment + '`, but method requires at least `confirmed`');
|
|
4889
|
+
}
|
|
4890
|
+
|
|
4891
|
+
return this._buildArgs(args, override, encoding, extra);
|
|
4892
|
+
}
|
|
4893
|
+
/**
|
|
4894
|
+
* @internal
|
|
4895
|
+
*/
|
|
4896
|
+
|
|
4897
|
+
|
|
4872
4898
|
_wsOnSignatureNotification(notification) {
|
|
4873
4899
|
const res = superstruct.create(notification, SignatureNotificationResult);
|
|
4874
4900
|
|