@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.browser.esm.js
CHANGED
|
@@ -1124,6 +1124,8 @@ const VersionedMessage = {
|
|
|
1124
1124
|
}
|
|
1125
1125
|
};
|
|
1126
1126
|
|
|
1127
|
+
/** @internal */
|
|
1128
|
+
|
|
1127
1129
|
/**
|
|
1128
1130
|
* Transaction signature as base-58 encoded string
|
|
1129
1131
|
*/
|
|
@@ -1213,20 +1215,25 @@ class TransactionInstruction {
|
|
|
1213
1215
|
// For backward compatibility; an unfortunate consequence of being
|
|
1214
1216
|
// forced to over-export types by the documentation generator.
|
|
1215
1217
|
// See https://github.com/solana-labs/solana/pull/25820
|
|
1218
|
+
|
|
1216
1219
|
/**
|
|
1217
1220
|
* Blockhash-based transactions have a lifetime that are defined by
|
|
1218
1221
|
* the blockhash they include. Any transaction whose blockhash is
|
|
1219
1222
|
* too old will be rejected.
|
|
1220
1223
|
*/
|
|
1224
|
+
|
|
1221
1225
|
/**
|
|
1222
1226
|
* Use these options to construct a durable nonce transaction.
|
|
1223
1227
|
*/
|
|
1228
|
+
|
|
1224
1229
|
/**
|
|
1225
1230
|
* Nonce information to be used to build an offline Transaction.
|
|
1226
1231
|
*/
|
|
1232
|
+
|
|
1227
1233
|
/**
|
|
1228
1234
|
* @internal
|
|
1229
1235
|
*/
|
|
1236
|
+
|
|
1230
1237
|
/**
|
|
1231
1238
|
* Transaction class
|
|
1232
1239
|
*/
|
|
@@ -1739,29 +1746,31 @@ class Transaction {
|
|
|
1739
1746
|
*
|
|
1740
1747
|
* @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction
|
|
1741
1748
|
*/
|
|
1742
|
-
verifySignatures(requireAllSignatures) {
|
|
1743
|
-
|
|
1749
|
+
verifySignatures(requireAllSignatures = true) {
|
|
1750
|
+
const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);
|
|
1751
|
+
return !signatureErrors;
|
|
1744
1752
|
}
|
|
1745
1753
|
|
|
1746
1754
|
/**
|
|
1747
1755
|
* @internal
|
|
1748
1756
|
*/
|
|
1749
|
-
|
|
1757
|
+
_getMessageSignednessErrors(message, requireAllSignatures) {
|
|
1758
|
+
const errors = {};
|
|
1750
1759
|
for (const {
|
|
1751
1760
|
signature,
|
|
1752
1761
|
publicKey
|
|
1753
1762
|
} of this.signatures) {
|
|
1754
1763
|
if (signature === null) {
|
|
1755
1764
|
if (requireAllSignatures) {
|
|
1756
|
-
|
|
1765
|
+
(errors.missing ||= []).push(publicKey);
|
|
1757
1766
|
}
|
|
1758
1767
|
} else {
|
|
1759
|
-
if (!verify(signature,
|
|
1760
|
-
|
|
1768
|
+
if (!verify(signature, message, publicKey.toBytes())) {
|
|
1769
|
+
(errors.invalid ||= []).push(publicKey);
|
|
1761
1770
|
}
|
|
1762
1771
|
}
|
|
1763
1772
|
}
|
|
1764
|
-
return
|
|
1773
|
+
return errors.invalid || errors.missing ? errors : undefined;
|
|
1765
1774
|
}
|
|
1766
1775
|
|
|
1767
1776
|
/**
|
|
@@ -1780,8 +1789,18 @@ class Transaction {
|
|
|
1780
1789
|
verifySignatures: true
|
|
1781
1790
|
}, config);
|
|
1782
1791
|
const signData = this.serializeMessage();
|
|
1783
|
-
if (verifySignatures
|
|
1784
|
-
|
|
1792
|
+
if (verifySignatures) {
|
|
1793
|
+
const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);
|
|
1794
|
+
if (sigErrors) {
|
|
1795
|
+
let errorMessage = 'Signature verification failed.';
|
|
1796
|
+
if (sigErrors.invalid) {
|
|
1797
|
+
errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1798
|
+
}
|
|
1799
|
+
if (sigErrors.missing) {
|
|
1800
|
+
errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`;
|
|
1801
|
+
}
|
|
1802
|
+
throw new Error(errorMessage);
|
|
1803
|
+
}
|
|
1785
1804
|
}
|
|
1786
1805
|
return this._serialize(signData);
|
|
1787
1806
|
}
|
|
@@ -3766,6 +3785,7 @@ function versionedMessageFromResponse(version, response) {
|
|
|
3766
3785
|
*/
|
|
3767
3786
|
|
|
3768
3787
|
// Deprecated as of v1.5.5
|
|
3788
|
+
|
|
3769
3789
|
/**
|
|
3770
3790
|
* A subset of Commitment levels, which are at least optimistically confirmed
|
|
3771
3791
|
* <pre>
|
|
@@ -3773,6 +3793,7 @@ function versionedMessageFromResponse(version, response) {
|
|
|
3773
3793
|
* 'finalized': Query the most recent block which has been finalized by the cluster
|
|
3774
3794
|
* </pre>
|
|
3775
3795
|
*/
|
|
3796
|
+
|
|
3776
3797
|
/**
|
|
3777
3798
|
* Filter for largest accounts query
|
|
3778
3799
|
* <pre>
|
|
@@ -3780,70 +3801,92 @@ function versionedMessageFromResponse(version, response) {
|
|
|
3780
3801
|
* 'nonCirculating': Return the largest accounts that are not part of the circulating supply
|
|
3781
3802
|
* </pre>
|
|
3782
3803
|
*/
|
|
3804
|
+
|
|
3783
3805
|
/**
|
|
3784
3806
|
* Configuration object for changing `getAccountInfo` query behavior
|
|
3785
3807
|
*/
|
|
3808
|
+
|
|
3786
3809
|
/**
|
|
3787
3810
|
* Configuration object for changing `getBalance` query behavior
|
|
3788
3811
|
*/
|
|
3812
|
+
|
|
3789
3813
|
/**
|
|
3790
3814
|
* Configuration object for changing `getBlock` query behavior
|
|
3791
3815
|
*/
|
|
3816
|
+
|
|
3792
3817
|
/**
|
|
3793
3818
|
* Configuration object for changing `getBlock` query behavior
|
|
3794
3819
|
*/
|
|
3820
|
+
|
|
3795
3821
|
/**
|
|
3796
3822
|
* Configuration object for changing `getStakeMinimumDelegation` query behavior
|
|
3797
3823
|
*/
|
|
3824
|
+
|
|
3798
3825
|
/**
|
|
3799
3826
|
* Configuration object for changing `getBlockHeight` query behavior
|
|
3800
3827
|
*/
|
|
3828
|
+
|
|
3801
3829
|
/**
|
|
3802
3830
|
* Configuration object for changing `getEpochInfo` query behavior
|
|
3803
3831
|
*/
|
|
3832
|
+
|
|
3804
3833
|
/**
|
|
3805
3834
|
* Configuration object for changing `getInflationReward` query behavior
|
|
3806
3835
|
*/
|
|
3836
|
+
|
|
3807
3837
|
/**
|
|
3808
3838
|
* Configuration object for changing `getLatestBlockhash` query behavior
|
|
3809
3839
|
*/
|
|
3840
|
+
|
|
3810
3841
|
/**
|
|
3811
3842
|
* Configuration object for changing `isBlockhashValid` query behavior
|
|
3812
3843
|
*/
|
|
3844
|
+
|
|
3813
3845
|
/**
|
|
3814
3846
|
* Configuration object for changing `getSlot` query behavior
|
|
3815
3847
|
*/
|
|
3848
|
+
|
|
3816
3849
|
/**
|
|
3817
3850
|
* Configuration object for changing `getSlotLeader` query behavior
|
|
3818
3851
|
*/
|
|
3852
|
+
|
|
3819
3853
|
/**
|
|
3820
3854
|
* Configuration object for changing `getTransaction` query behavior
|
|
3821
3855
|
*/
|
|
3856
|
+
|
|
3822
3857
|
/**
|
|
3823
3858
|
* Configuration object for changing `getTransaction` query behavior
|
|
3824
3859
|
*/
|
|
3860
|
+
|
|
3825
3861
|
/**
|
|
3826
3862
|
* Configuration object for changing `getLargestAccounts` query behavior
|
|
3827
3863
|
*/
|
|
3864
|
+
|
|
3828
3865
|
/**
|
|
3829
3866
|
* Configuration object for changing `getSupply` request behavior
|
|
3830
3867
|
*/
|
|
3868
|
+
|
|
3831
3869
|
/**
|
|
3832
3870
|
* Configuration object for changing query behavior
|
|
3833
3871
|
*/
|
|
3872
|
+
|
|
3834
3873
|
/**
|
|
3835
3874
|
* Information describing a cluster node
|
|
3836
3875
|
*/
|
|
3876
|
+
|
|
3837
3877
|
/**
|
|
3838
3878
|
* Information describing a vote account
|
|
3839
3879
|
*/
|
|
3880
|
+
|
|
3840
3881
|
/**
|
|
3841
3882
|
* A collection of cluster vote accounts
|
|
3842
3883
|
*/
|
|
3884
|
+
|
|
3843
3885
|
/**
|
|
3844
3886
|
* Network Inflation
|
|
3845
3887
|
* (see https://docs.solana.com/implemented-proposals/ed_overview)
|
|
3846
3888
|
*/
|
|
3889
|
+
|
|
3847
3890
|
const GetInflationGovernorResult = type({
|
|
3848
3891
|
foundation: number(),
|
|
3849
3892
|
foundationTerm: number(),
|
|
@@ -5571,7 +5614,9 @@ class Connection {
|
|
|
5571
5614
|
return res.result;
|
|
5572
5615
|
}
|
|
5573
5616
|
|
|
5574
|
-
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
|
|
5617
|
+
/** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */
|
|
5618
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
5619
|
+
|
|
5575
5620
|
// eslint-disable-next-line no-dupe-class-members
|
|
5576
5621
|
async confirmTransaction(strategy, commitment) {
|
|
5577
5622
|
let rawSignature;
|
|
@@ -6366,21 +6411,28 @@ class Connection {
|
|
|
6366
6411
|
/**
|
|
6367
6412
|
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
6368
6413
|
* setting the `maxSupportedTransactionVersion` property.
|
|
6369
|
-
*/
|
|
6414
|
+
*/
|
|
6415
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6416
|
+
|
|
6370
6417
|
/**
|
|
6371
6418
|
* @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by
|
|
6372
6419
|
* setting the `maxSupportedTransactionVersion` property.
|
|
6373
6420
|
*/
|
|
6374
6421
|
// eslint-disable-next-line no-dupe-class-members
|
|
6422
|
+
|
|
6375
6423
|
/**
|
|
6376
6424
|
* Fetch a processed block from the cluster.
|
|
6377
6425
|
*/
|
|
6378
6426
|
// eslint-disable-next-line no-dupe-class-members
|
|
6427
|
+
|
|
6379
6428
|
// eslint-disable-next-line no-dupe-class-members
|
|
6429
|
+
|
|
6380
6430
|
// eslint-disable-next-line no-dupe-class-members
|
|
6431
|
+
|
|
6381
6432
|
/**
|
|
6382
6433
|
* Fetch a processed block from the cluster.
|
|
6383
|
-
*/
|
|
6434
|
+
*/
|
|
6435
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6384
6436
|
async getBlock(slot, rawConfig) {
|
|
6385
6437
|
const {
|
|
6386
6438
|
commitment,
|
|
@@ -6519,10 +6571,13 @@ class Connection {
|
|
|
6519
6571
|
|
|
6520
6572
|
/**
|
|
6521
6573
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
6522
|
-
*/
|
|
6574
|
+
*/
|
|
6575
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6576
|
+
|
|
6523
6577
|
/**
|
|
6524
6578
|
* Fetch a confirmed or finalized transaction from the cluster.
|
|
6525
|
-
*/
|
|
6579
|
+
*/
|
|
6580
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6526
6581
|
async getTransaction(signature, rawConfig) {
|
|
6527
6582
|
const {
|
|
6528
6583
|
commitment,
|
|
@@ -6601,12 +6656,15 @@ class Connection {
|
|
|
6601
6656
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
6602
6657
|
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
6603
6658
|
* VersionedTransactionResponse}.
|
|
6604
|
-
*/
|
|
6659
|
+
*/
|
|
6660
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6661
|
+
|
|
6605
6662
|
/**
|
|
6606
6663
|
* Fetch transaction details for a batch of confirmed transactions.
|
|
6607
6664
|
* Similar to {@link getParsedTransactions} but returns a {@link
|
|
6608
6665
|
* VersionedTransactionResponse}.
|
|
6609
|
-
*/
|
|
6666
|
+
*/
|
|
6667
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
6610
6668
|
async getTransactions(signatures, commitmentOrConfig) {
|
|
6611
6669
|
const {
|
|
6612
6670
|
commitment,
|
|
@@ -7032,10 +7090,13 @@ class Connection {
|
|
|
7032
7090
|
|
|
7033
7091
|
/**
|
|
7034
7092
|
* Simulate a transaction
|
|
7035
|
-
*/
|
|
7093
|
+
*/
|
|
7094
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7095
|
+
|
|
7036
7096
|
/**
|
|
7037
7097
|
* Simulate a transaction
|
|
7038
|
-
*/
|
|
7098
|
+
*/
|
|
7099
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7039
7100
|
async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {
|
|
7040
7101
|
if ('message' in transactionOrMessage) {
|
|
7041
7102
|
const versionedTx = transactionOrMessage;
|
|
@@ -7087,7 +7148,6 @@ class Connection {
|
|
|
7087
7148
|
if (!transaction.signature) {
|
|
7088
7149
|
throw new Error('!signature'); // should never happen
|
|
7089
7150
|
}
|
|
7090
|
-
|
|
7091
7151
|
const signature = transaction.signature.toString('base64');
|
|
7092
7152
|
if (!this._blockhashInfo.simulatedSignatures.includes(signature) && !this._blockhashInfo.transactionSignatures.includes(signature)) {
|
|
7093
7153
|
// The signature of this transaction has not been seen before with the
|
|
@@ -7148,10 +7208,13 @@ class Connection {
|
|
|
7148
7208
|
|
|
7149
7209
|
/**
|
|
7150
7210
|
* Send a signed transaction
|
|
7151
|
-
*/
|
|
7211
|
+
*/
|
|
7212
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7213
|
+
|
|
7152
7214
|
/**
|
|
7153
7215
|
* Sign and send a transaction
|
|
7154
|
-
*/
|
|
7216
|
+
*/
|
|
7217
|
+
// eslint-disable-next-line no-dupe-class-members
|
|
7155
7218
|
async sendTransaction(transaction, signersOrOptions, options) {
|
|
7156
7219
|
if ('version' in transaction) {
|
|
7157
7220
|
if (signersOrOptions && Array.isArray(signersOrOptions)) {
|
|
@@ -7176,7 +7239,6 @@ class Connection {
|
|
|
7176
7239
|
if (!transaction.signature) {
|
|
7177
7240
|
throw new Error('!signature'); // should never happen
|
|
7178
7241
|
}
|
|
7179
|
-
|
|
7180
7242
|
const signature = transaction.signature.toString('base64');
|
|
7181
7243
|
if (!this._blockhashInfo.transactionSignatures.includes(signature)) {
|
|
7182
7244
|
// The signature of this transaction has not been seen before with the
|
|
@@ -7560,7 +7622,6 @@ class Connection {
|
|
|
7560
7622
|
args) {
|
|
7561
7623
|
const clientSubscriptionId = this._nextClientSubscriptionId++;
|
|
7562
7624
|
const hash = fastStableStringify$1([subscriptionConfig.method, args], true /* isArrayProp */);
|
|
7563
|
-
|
|
7564
7625
|
const existingSubscription = this._subscriptionsByHash[hash];
|
|
7565
7626
|
if (existingSubscription === undefined) {
|
|
7566
7627
|
this._subscriptionsByHash[hash] = {
|
|
@@ -7643,7 +7704,6 @@ class Connection {
|
|
|
7643
7704
|
'base64' /* encoding */, filters ? {
|
|
7644
7705
|
filters: filters
|
|
7645
7706
|
} : undefined /* extra */);
|
|
7646
|
-
|
|
7647
7707
|
return this._makeSubscription({
|
|
7648
7708
|
callback,
|
|
7649
7709
|
method: 'programSubscribe',
|
|
@@ -7668,7 +7728,6 @@ class Connection {
|
|
|
7668
7728
|
mentions: [filter.toString()]
|
|
7669
7729
|
} : filter], commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
7670
7730
|
);
|
|
7671
|
-
|
|
7672
7731
|
return this._makeSubscription({
|
|
7673
7732
|
callback,
|
|
7674
7733
|
method: 'logsSubscribe',
|
|
@@ -7849,7 +7908,6 @@ class Connection {
|
|
|
7849
7908
|
onSignature(signature, callback, commitment) {
|
|
7850
7909
|
const args = this._buildArgs([signature], commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
7851
7910
|
);
|
|
7852
|
-
|
|
7853
7911
|
const clientSubscriptionId = this._makeSubscription({
|
|
7854
7912
|
callback: (notification, context) => {
|
|
7855
7913
|
if (notification.type === 'status') {
|
|
@@ -7888,7 +7946,6 @@ class Connection {
|
|
|
7888
7946
|
...options,
|
|
7889
7947
|
commitment: options && options.commitment || this._commitment || 'finalized' // Apply connection/server default.
|
|
7890
7948
|
};
|
|
7891
|
-
|
|
7892
7949
|
const args = this._buildArgs([signature], commitment, undefined /* encoding */, extra);
|
|
7893
7950
|
const clientSubscriptionId = this._makeSubscription({
|
|
7894
7951
|
callback: (notification, context) => {
|
|
@@ -9251,7 +9308,7 @@ class StakeProgram {
|
|
|
9251
9308
|
if (custodianPubkey) {
|
|
9252
9309
|
keys.push({
|
|
9253
9310
|
pubkey: custodianPubkey,
|
|
9254
|
-
isSigner:
|
|
9311
|
+
isSigner: true,
|
|
9255
9312
|
isWritable: false
|
|
9256
9313
|
});
|
|
9257
9314
|
}
|
|
@@ -9299,7 +9356,7 @@ class StakeProgram {
|
|
|
9299
9356
|
if (custodianPubkey) {
|
|
9300
9357
|
keys.push({
|
|
9301
9358
|
pubkey: custodianPubkey,
|
|
9302
|
-
isSigner:
|
|
9359
|
+
isSigner: true,
|
|
9303
9360
|
isWritable: false
|
|
9304
9361
|
});
|
|
9305
9362
|
}
|
|
@@ -9464,7 +9521,7 @@ class StakeProgram {
|
|
|
9464
9521
|
if (custodianPubkey) {
|
|
9465
9522
|
keys.push({
|
|
9466
9523
|
pubkey: custodianPubkey,
|
|
9467
|
-
isSigner:
|
|
9524
|
+
isSigner: true,
|
|
9468
9525
|
isWritable: false
|
|
9469
9526
|
});
|
|
9470
9527
|
}
|
|
@@ -10155,7 +10212,9 @@ function clusterApiUrl(cluster, tls) {
|
|
|
10155
10212
|
/**
|
|
10156
10213
|
* @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`
|
|
10157
10214
|
* is no longer supported and will be removed in a future version.
|
|
10158
|
-
*/
|
|
10215
|
+
*/
|
|
10216
|
+
// eslint-disable-next-line no-redeclare
|
|
10217
|
+
|
|
10159
10218
|
// eslint-disable-next-line no-redeclare
|
|
10160
10219
|
async function sendAndConfirmRawTransaction(connection, rawTransaction, confirmationStrategyOrConfirmOptions, maybeConfirmOptions) {
|
|
10161
10220
|
let confirmationStrategy;
|