@solana/web3.js 1.87.6 → 1.89.0
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 +1 -1
- package/lib/index.browser.cjs.js +90 -31
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +90 -31
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +108 -1645
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +105 -1640
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +268 -607
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +7 -8
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +90 -31
- package/lib/index.native.js.map +1 -1
- package/package.json +29 -29
- package/src/connection.ts +4 -6
- package/src/programs/stake.ts +3 -3
- package/src/transaction/legacy.ts +37 -15
package/lib/index.native.js
CHANGED
|
@@ -1152,6 +1152,8 @@ const VersionedMessage = {
|
|
|
1152
1152
|
}
|
|
1153
1153
|
};
|
|
1154
1154
|
|
|
1155
|
+
/** @internal */
|
|
1156
|
+
|
|
1155
1157
|
/**
|
|
1156
1158
|
* Transaction signature as base-58 encoded string
|
|
1157
1159
|
*/
|
|
@@ -1241,20 +1243,25 @@ class TransactionInstruction {
|
|
|
1241
1243
|
// For backward compatibility; an unfortunate consequence of being
|
|
1242
1244
|
// forced to over-export types by the documentation generator.
|
|
1243
1245
|
// See https://github.com/solana-labs/solana/pull/25820
|
|
1246
|
+
|
|
1244
1247
|
/**
|
|
1245
1248
|
* Blockhash-based transactions have a lifetime that are defined by
|
|
1246
1249
|
* the blockhash they include. Any transaction whose blockhash is
|
|
1247
1250
|
* too old will be rejected.
|
|
1248
1251
|
*/
|
|
1252
|
+
|
|
1249
1253
|
/**
|
|
1250
1254
|
* Use these options to construct a durable nonce transaction.
|
|
1251
1255
|
*/
|
|
1256
|
+
|
|
1252
1257
|
/**
|
|
1253
1258
|
* Nonce information to be used to build an offline Transaction.
|
|
1254
1259
|
*/
|
|
1260
|
+
|
|
1255
1261
|
/**
|
|
1256
1262
|
* @internal
|
|
1257
1263
|
*/
|
|
1264
|
+
|
|
1258
1265
|
/**
|
|
1259
1266
|
* Transaction class
|
|
1260
1267
|
*/
|
|
@@ -1767,29 +1774,31 @@ class Transaction {
|
|
|
1767
1774
|
*
|
|
1768
1775
|
* @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
|
|
1769
1776
|
*/
|
|
1770
|
-
verifySignatures(requireAllSignatures) {
|
|
1771
|
-
|
|
1777
|
+
verifySignatures(requireAllSignatures = true) {
|
|
1778
|
+
const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
|
|
1779
|
+
return !signatureErrors;
|
|
1772
1780
|
}
|
|
1773
1781
|
|
|
1774
1782
|
/**
|
|
1775
1783
|
* @internal
|
|
1776
1784
|
*/
|
|
1777
|
-
|
|
1785
|
+
_getMessageSignednessErrors(message, requireAllSignatures) {
|
|
1786
|
+
const errors = {};
|
|
1778
1787
|
for (const {
|
|
1779
1788
|
signature,
|
|
1780
1789
|
publicKey
|
|
1781
1790
|
} of this.signatures) {
|
|
1782
1791
|
if (signature === null) {
|
|
1783
1792
|
if (requireAllSignatures) {
|
|
1784
|
-
|
|
1793
|
+
(errors.missing ||= []).push(publicKey);
|
|
1785
1794
|
}
|
|
1786
1795
|
} else {
|
|
1787
|
-
if (!verify(signature,
|
|
1788
|
-
|
|
1796
|
+
if (!verify(signature, message, publicKey.toBytes())) {
|
|
1797
|
+
(errors.invalid ||= []).push(publicKey);
|
|
1789
1798
|
}
|
|
1790
1799
|
}
|
|
1791
1800
|
}
|
|
1792
|
-
return
|
|
1801
|
+
return errors.invalid || errors.missing ? errors : undefined;
|
|
1793
1802
|
}
|
|
1794
1803
|
|
|
1795
1804
|
/**
|
|
@@ -1808,8 +1817,18 @@ class Transaction {
|
|
|
1808
1817
|
verifySignatures: true
|
|
1809
1818
|
}, config);
|
|
1810
1819
|
const signData = this.serializeMessage();
|
|
1811
|
-
if (verifySignatures
|
|
1812
|
-
|
|
1820
|
+
if (verifySignatures) {
|
|
1821
|
+
const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
|
|
1822
|
+
if (sigErrors) {
|
|
1823
|
+
let errorMessage = 'Signature verification failed.';
|
|
1824
|
+
if (sigErrors.invalid) {
|
|
1825
|
+
errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1826
|
+
}
|
|
1827
|
+
if (sigErrors.missing) {
|
|
1828
|
+
errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1829
|
+
}
|
|
1830
|
+
throw new Error(errorMessage);
|
|
1831
|
+
}
|
|
1813
1832
|
}
|
|
1814
1833
|
return this._serialize(signData);
|
|
1815
1834
|
}
|
|
@@ -3794,6 +3813,7 @@ function versionedMessageFromResponse(version, response) {
|
|
|
3794
3813
|
*/
|
|
3795
3814
|
|
|
3796
3815
|
// Deprecated as of v1.5.5
|
|
3816
|
+
|
|
3797
3817
|
/**
|
|
3798
3818
|
* A subset of Commitment levels, which are at least optimistically confirmed
|
|
3799
3819
|
* <pre>
|
|
@@ -3801,6 +3821,7 @@ function versionedMessageFromResponse(version, response) {
|
|
|
3801
3821
|
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
3802
3822
|
* </pre>
|
|
3803
3823
|
*/
|
|
3824
|
+
|
|
3804
3825
|
/**
|
|
3805
3826
|
* Filter for largest accounts query
|
|
3806
3827
|
* <pre>
|
|
@@ -3808,70 +3829,92 @@ function versionedMessageFromResponse(version, response) {
|
|
|
3808
3829
|
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
|
|
3809
3830
|
* </pre>
|
|
3810
3831
|
*/
|
|
3832
|
+
|
|
3811
3833
|
/**
|
|
3812
3834
|
* Configuration object for changing `getAccountInfo` query behavior
|
|
3813
3835
|
*/
|
|
3836
|
+
|
|
3814
3837
|
/**
|
|
3815
3838
|
* Configuration object for changing `getBalance` query behavior
|
|
3816
3839
|
*/
|
|
3840
|
+
|
|
3817
3841
|
/**
|
|
3818
3842
|
* Configuration object for changing `getBlock` query behavior
|
|
3819
3843
|
*/
|
|
3844
|
+
|
|
3820
3845
|
/**
|
|
3821
3846
|
* Configuration object for changing `getBlock` query behavior
|
|
3822
3847
|
*/
|
|
3848
|
+
|
|
3823
3849
|
/**
|
|
3824
3850
|
* Configuration object for changing `getStakeMinimumDelegation` query behavior
|
|
3825
3851
|
*/
|
|
3852
|
+
|
|
3826
3853
|
/**
|
|
3827
3854
|
* Configuration object for changing `getBlockHeight` query behavior
|
|
3828
3855
|
*/
|
|
3856
|
+
|
|
3829
3857
|
/**
|
|
3830
3858
|
* Configuration object for changing `getEpochInfo` query behavior
|
|
3831
3859
|
*/
|
|
3860
|
+
|
|
3832
3861
|
/**
|
|
3833
3862
|
* Configuration object for changing `getInflationReward` query behavior
|
|
3834
3863
|
*/
|
|
3864
|
+
|
|
3835
3865
|
/**
|
|
3836
3866
|
* Configuration object for changing `getLatestBlockhash` query behavior
|
|
3837
3867
|
*/
|
|
3868
|
+
|
|
3838
3869
|
/**
|
|
3839
3870
|
* Configuration object for changing `isBlockhashValid` query behavior
|
|
3840
3871
|
*/
|
|
3872
|
+
|
|
3841
3873
|
/**
|
|
3842
3874
|
* Configuration object for changing `getSlot` query behavior
|
|
3843
3875
|
*/
|
|
3876
|
+
|
|
3844
3877
|
/**
|
|
3845
3878
|
* Configuration object for changing `getSlotLeader` query behavior
|
|
3846
3879
|
*/
|
|
3880
|
+
|
|
3847
3881
|
/**
|
|
3848
3882
|
* Configuration object for changing `getTransaction` query behavior
|
|
3849
3883
|
*/
|
|
3884
|
+
|
|
3850
3885
|
/**
|
|
3851
3886
|
* Configuration object for changing `getTransaction` query behavior
|
|
3852
3887
|
*/
|
|
3888
|
+
|
|
3853
3889
|
/**
|
|
3854
3890
|
* Configuration object for changing `getLargestAccounts` query behavior
|
|
3855
3891
|
*/
|
|
3892
|
+
|
|
3856
3893
|
/**
|
|
3857
3894
|
* Configuration object for changing `getSupply` request behavior
|
|
3858
3895
|
*/
|
|
3896
|
+
|
|
3859
3897
|
/**
|
|
3860
3898
|
* Configuration object for changing query behavior
|
|
3861
3899
|
*/
|
|
3900
|
+
|
|
3862
3901
|
/**
|
|
3863
3902
|
* Information describing a cluster node
|
|
3864
3903
|
*/
|
|
3904
|
+
|
|
3865
3905
|
/**
|
|
3866
3906
|
* Information describing a vote account
|
|
3867
3907
|
*/
|
|
3908
|
+
|
|
3868
3909
|
/**
|
|
3869
3910
|
* A collection of cluster vote accounts
|
|
3870
3911
|
*/
|
|
3912
|
+
|
|
3871
3913
|
/**
|
|
3872
3914
|
* Network Inflation
|
|
3873
3915
|
* (see https://docs.solana.com/implemented-proposals/ed_overview)
|
|
3874
3916
|
*/
|
|
3917
|
+
|
|
3875
3918
|
const GetInflationGovernorResult = superstruct.type({
|
|
3876
3919
|
foundation: superstruct.number(),
|
|
3877
3920
|
foundationTerm: superstruct.number(),
|
|
@@ -5599,7 +5642,9 @@ class Connection {
|
|
|
5599
5642
|
return res.result;
|
|
5600
5643
|
}
|
|
5601
5644
|
|
|
5602
|
-
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
|
|
5645
|
+
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
|
|
5646
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5647
|
+
|
|
5603
5648
|
// eslint-disable-next-line no-dupe-class-members
|
|
5604
5649
|
async confirmTransaction(strategy, commitment) {
|
|
5605
5650
|
let rawSignature;
|
|
@@ -6394,21 +6439,28 @@ class Connection {
|
|
|
6394
6439
|
/**
|
|
6395
6440
|
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
6396
6441
|
* setting the `maxSupportedTransactionVersion` property.
|
|
6397
|
-
*/
|
|
6442
|
+
*/
|
|
6443
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6444
|
+
|
|
6398
6445
|
/**
|
|
6399
6446
|
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
6400
6447
|
* setting the `maxSupportedTransactionVersion` property.
|
|
6401
6448
|
*/
|
|
6402
6449
|
// eslint-disable-next-line no-dupe-class-members
|
|
6450
|
+
|
|
6403
6451
|
/**
|
|
6404
6452
|
* Fetch a processed block from the cluster.
|
|
6405
6453
|
*/
|
|
6406
6454
|
// eslint-disable-next-line no-dupe-class-members
|
|
6455
|
+
|
|
6407
6456
|
// eslint-disable-next-line no-dupe-class-members
|
|
6457
|
+
|
|
6408
6458
|
// eslint-disable-next-line no-dupe-class-members
|
|
6459
|
+
|
|
6409
6460
|
/**
|
|
6410
6461
|
* Fetch a processed block from the cluster.
|
|
6411
|
-
*/
|
|
6462
|
+
*/
|
|
6463
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6412
6464
|
async getBlock(slot, rawConfig) {
|
|
6413
6465
|
const {
|
|
6414
6466
|
commitment,
|
|
@@ -6547,10 +6599,13 @@ class Connection {
|
|
|
6547
6599
|
|
|
6548
6600
|
/**
|
|
6549
6601
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
6550
|
-
*/
|
|
6602
|
+
*/
|
|
6603
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6604
|
+
|
|
6551
6605
|
/**
|
|
6552
6606
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
6553
|
-
*/
|
|
6607
|
+
*/
|
|
6608
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6554
6609
|
async getTransaction(signature, rawConfig) {
|
|
6555
6610
|
const {
|
|
6556
6611
|
commitment,
|
|
@@ -6629,12 +6684,15 @@ class Connection {
|
|
|
6629
6684
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
6630
6685
|
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
6631
6686
|
* VersionedTransactionResponse}.
|
|
6632
|
-
*/
|
|
6687
|
+
*/
|
|
6688
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6689
|
+
|
|
6633
6690
|
/**
|
|
6634
6691
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
6635
6692
|
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
6636
6693
|
* VersionedTransactionResponse}.
|
|
6637
|
-
*/
|
|
6694
|
+
*/
|
|
6695
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6638
6696
|
async getTransactions(signatures, commitmentOrConfig) {
|
|
6639
6697
|
const {
|
|
6640
6698
|
commitment,
|
|
@@ -7060,10 +7118,13 @@ class Connection {
|
|
|
7060
7118
|
|
|
7061
7119
|
/**
|
|
7062
7120
|
* Simulate a transaction
|
|
7063
|
-
*/
|
|
7121
|
+
*/
|
|
7122
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7123
|
+
|
|
7064
7124
|
/**
|
|
7065
7125
|
* Simulate a transaction
|
|
7066
|
-
*/
|
|
7126
|
+
*/
|
|
7127
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7067
7128
|
async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {
|
|
7068
7129
|
if ('message' in transactionOrMessage) {
|
|
7069
7130
|
const versionedTx = transactionOrMessage;
|
|
@@ -7115,7 +7176,6 @@ class Connection {
|
|
|
7115
7176
|
if (!transaction.signature) {
|
|
7116
7177
|
throw new Error('!signature'); // should never happen
|
|
7117
7178
|
}
|
|
7118
|
-
|
|
7119
7179
|
const signature = transaction.signature.toString('base64');
|
|
7120
7180
|
if (!this._blockhashInfo.simulatedSignatures.includes(signature) && !this._blockhashInfo.transactionSignatures.includes(signature)) {
|
|
7121
7181
|
// The signature of this transaction has not been seen before with the
|
|
@@ -7176,10 +7236,13 @@ class Connection {
|
|
|
7176
7236
|
|
|
7177
7237
|
/**
|
|
7178
7238
|
* Send a signed transaction
|
|
7179
|
-
*/
|
|
7239
|
+
*/
|
|
7240
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7241
|
+
|
|
7180
7242
|
/**
|
|
7181
7243
|
* Sign and send a transaction
|
|
7182
|
-
*/
|
|
7244
|
+
*/
|
|
7245
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7183
7246
|
async sendTransaction(transaction, signersOrOptions, options) {
|
|
7184
7247
|
if ('version' in transaction) {
|
|
7185
7248
|
if (signersOrOptions && Array.isArray(signersOrOptions)) {
|
|
@@ -7204,7 +7267,6 @@ class Connection {
|
|
|
7204
7267
|
if (!transaction.signature) {
|
|
7205
7268
|
throw new Error('!signature'); // should never happen
|
|
7206
7269
|
}
|
|
7207
|
-
|
|
7208
7270
|
const signature = transaction.signature.toString('base64');
|
|
7209
7271
|
if (!this._blockhashInfo.transactionSignatures.includes(signature)) {
|
|
7210
7272
|
// The signature of this transaction has not been seen before with the
|
|
@@ -7588,7 +7650,6 @@ class Connection {
|
|
|
7588
7650
|
args) {
|
|
7589
7651
|
const clientSubscriptionId = this._nextClientSubscriptionId++;
|
|
7590
7652
|
const hash = fastStableStringify$1([subscriptionConfig.method, args], true /* isArrayProp */);
|
|
7591
|
-
|
|
7592
7653
|
const existingSubscription = this._subscriptionsByHash[hash];
|
|
7593
7654
|
if (existingSubscription === undefined) {
|
|
7594
7655
|
this._subscriptionsByHash[hash] = {
|
|
@@ -7671,7 +7732,6 @@ class Connection {
|
|
|
7671
7732
|
'base64' /* encoding */, filters ? {
|
|
7672
7733
|
filters: filters
|
|
7673
7734
|
} : undefined /* extra */);
|
|
7674
|
-
|
|
7675
7735
|
return this._makeSubscription({
|
|
7676
7736
|
callback,
|
|
7677
7737
|
method: 'programSubscribe',
|
|
@@ -7696,7 +7756,6 @@ class Connection {
|
|
|
7696
7756
|
mentions: [filter.toString()]
|
|
7697
7757
|
} : filter], commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
7698
7758
|
);
|
|
7699
|
-
|
|
7700
7759
|
return this._makeSubscription({
|
|
7701
7760
|
callback,
|
|
7702
7761
|
method: 'logsSubscribe',
|
|
@@ -7877,7 +7936,6 @@ class Connection {
|
|
|
7877
7936
|
onSignature(signature, callback, commitment) {
|
|
7878
7937
|
const args = this._buildArgs([signature], commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
7879
7938
|
);
|
|
7880
|
-
|
|
7881
7939
|
const clientSubscriptionId = this._makeSubscription({
|
|
7882
7940
|
callback: (notification, context) => {
|
|
7883
7941
|
if (notification.type === 'status') {
|
|
@@ -7916,7 +7974,6 @@ class Connection {
|
|
|
7916
7974
|
...options,
|
|
7917
7975
|
commitment: options && options.commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
7918
7976
|
};
|
|
7919
|
-
|
|
7920
7977
|
const args = this._buildArgs([signature], commitment, undefined /* encoding */, extra);
|
|
7921
7978
|
const clientSubscriptionId = this._makeSubscription({
|
|
7922
7979
|
callback: (notification, context) => {
|
|
@@ -9279,7 +9336,7 @@ class StakeProgram {
|
|
|
9279
9336
|
if (custodianPubkey) {
|
|
9280
9337
|
keys.push({
|
|
9281
9338
|
pubkey: custodianPubkey,
|
|
9282
|
-
isSigner:
|
|
9339
|
+
isSigner: true,
|
|
9283
9340
|
isWritable: false
|
|
9284
9341
|
});
|
|
9285
9342
|
}
|
|
@@ -9327,7 +9384,7 @@ class StakeProgram {
|
|
|
9327
9384
|
if (custodianPubkey) {
|
|
9328
9385
|
keys.push({
|
|
9329
9386
|
pubkey: custodianPubkey,
|
|
9330
|
-
isSigner:
|
|
9387
|
+
isSigner: true,
|
|
9331
9388
|
isWritable: false
|
|
9332
9389
|
});
|
|
9333
9390
|
}
|
|
@@ -9492,7 +9549,7 @@ class StakeProgram {
|
|
|
9492
9549
|
if (custodianPubkey) {
|
|
9493
9550
|
keys.push({
|
|
9494
9551
|
pubkey: custodianPubkey,
|
|
9495
|
-
isSigner:
|
|
9552
|
+
isSigner: true,
|
|
9496
9553
|
isWritable: false
|
|
9497
9554
|
});
|
|
9498
9555
|
}
|
|
@@ -10183,7 +10240,9 @@ function clusterApiUrl(cluster, tls) {
|
|
|
10183
10240
|
/**
|
|
10184
10241
|
* @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`
|
|
10185
10242
|
* is no longer supported and will be removed in a future version.
|
|
10186
|
-
*/
|
|
10243
|
+
*/
|
|
10244
|
+
// eslint-disable-next-line no-redeclare
|
|
10245
|
+
|
|
10187
10246
|
// eslint-disable-next-line no-redeclare
|
|
10188
10247
|
async function sendAndConfirmRawTransaction(connection, rawTransaction, confirmationStrategyOrConfirmOptions, maybeConfirmOptions) {
|
|
10189
10248
|
let confirmationStrategy;
|