@solana/web3.js 1.7.2 → 1.8.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 +20 -79
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +21 -84
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +7 -0
- package/lib/index.esm.js +20 -83
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +27191 -27247
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +23 -23
- package/lib/index.iife.min.js.map +1 -1
- package/module.flow.js +7 -0
- package/package.json +1 -1
- package/src/connection.ts +19 -0
package/lib/index.browser.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
1
|
import * as nacl from 'tweetnacl';
|
|
3
2
|
import nacl__default from 'tweetnacl';
|
|
4
3
|
import { Buffer, isBuffer } from 'buffer';
|
|
4
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
5
5
|
import BN from 'bn.js';
|
|
6
6
|
import bs58 from 'bs58';
|
|
7
7
|
import { sha256 } from 'crypto-hash';
|
|
@@ -40,8 +40,6 @@ class PublicKey {
|
|
|
40
40
|
* @param value ed25519 public key as buffer or base-58 encoded string
|
|
41
41
|
*/
|
|
42
42
|
constructor(value) {
|
|
43
|
-
_defineProperty(this, "_bn", void 0);
|
|
44
|
-
|
|
45
43
|
if (typeof value === 'string') {
|
|
46
44
|
// assume base 58 encoding by default
|
|
47
45
|
const decoded = bs58.decode(value);
|
|
@@ -249,8 +247,6 @@ class Account {
|
|
|
249
247
|
* @param secretKey Secret key for the account
|
|
250
248
|
*/
|
|
251
249
|
constructor(secretKey) {
|
|
252
|
-
_defineProperty(this, "_keypair", void 0);
|
|
253
|
-
|
|
254
250
|
if (secretKey) {
|
|
255
251
|
this._keypair = nacl.sign.keyPair.fromSecretKey(toBuffer(secretKey));
|
|
256
252
|
} else {
|
|
@@ -1309,14 +1305,6 @@ const PUBKEY_LENGTH = 32;
|
|
|
1309
1305
|
|
|
1310
1306
|
class Message {
|
|
1311
1307
|
constructor(args) {
|
|
1312
|
-
_defineProperty(this, "header", void 0);
|
|
1313
|
-
|
|
1314
|
-
_defineProperty(this, "accountKeys", void 0);
|
|
1315
|
-
|
|
1316
|
-
_defineProperty(this, "recentBlockhash", void 0);
|
|
1317
|
-
|
|
1318
|
-
_defineProperty(this, "instructions", void 0);
|
|
1319
|
-
|
|
1320
1308
|
this.header = args.header;
|
|
1321
1309
|
this.accountKeys = args.accountKeys.map(account => new PublicKey(account));
|
|
1322
1310
|
this.recentBlockhash = args.recentBlockhash;
|
|
@@ -1467,10 +1455,6 @@ class TransactionInstruction {
|
|
|
1467
1455
|
* Program input
|
|
1468
1456
|
*/
|
|
1469
1457
|
constructor(opts) {
|
|
1470
|
-
_defineProperty(this, "keys", void 0);
|
|
1471
|
-
|
|
1472
|
-
_defineProperty(this, "programId", void 0);
|
|
1473
|
-
|
|
1474
1458
|
_defineProperty(this, "data", Buffer.alloc(0));
|
|
1475
1459
|
|
|
1476
1460
|
this.programId = opts.programId;
|
|
@@ -1516,14 +1500,8 @@ class Transaction {
|
|
|
1516
1500
|
constructor(opts) {
|
|
1517
1501
|
_defineProperty(this, "signatures", []);
|
|
1518
1502
|
|
|
1519
|
-
_defineProperty(this, "feePayer", void 0);
|
|
1520
|
-
|
|
1521
1503
|
_defineProperty(this, "instructions", []);
|
|
1522
1504
|
|
|
1523
|
-
_defineProperty(this, "recentBlockhash", void 0);
|
|
1524
|
-
|
|
1525
|
-
_defineProperty(this, "nonceInfo", void 0);
|
|
1526
|
-
|
|
1527
1505
|
opts && Object.assign(this, opts);
|
|
1528
1506
|
}
|
|
1529
1507
|
/**
|
|
@@ -2174,12 +2152,6 @@ class NonceAccount {
|
|
|
2174
2152
|
* @internal
|
|
2175
2153
|
*/
|
|
2176
2154
|
constructor(args) {
|
|
2177
|
-
_defineProperty(this, "authorizedPubkey", void 0);
|
|
2178
|
-
|
|
2179
|
-
_defineProperty(this, "nonce", void 0);
|
|
2180
|
-
|
|
2181
|
-
_defineProperty(this, "feeCalculator", void 0);
|
|
2182
|
-
|
|
2183
2155
|
this.authorizedPubkey = args.authorizedPubkey;
|
|
2184
2156
|
this.nonce = args.nonce;
|
|
2185
2157
|
this.feeCalculator = args.feeCalculator;
|
|
@@ -5078,8 +5050,6 @@ class Connection {
|
|
|
5078
5050
|
|
|
5079
5051
|
/** @internal */
|
|
5080
5052
|
|
|
5081
|
-
/** @internal */
|
|
5082
|
-
|
|
5083
5053
|
/**
|
|
5084
5054
|
* Establish a JSON RPC connection
|
|
5085
5055
|
*
|
|
@@ -5087,18 +5057,6 @@ class Connection {
|
|
|
5087
5057
|
* @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
|
|
5088
5058
|
*/
|
|
5089
5059
|
constructor(endpoint, commitmentOrConfig) {
|
|
5090
|
-
_defineProperty(this, "_commitment", void 0);
|
|
5091
|
-
|
|
5092
|
-
_defineProperty(this, "_rpcEndpoint", void 0);
|
|
5093
|
-
|
|
5094
|
-
_defineProperty(this, "_rpcClient", void 0);
|
|
5095
|
-
|
|
5096
|
-
_defineProperty(this, "_rpcRequest", void 0);
|
|
5097
|
-
|
|
5098
|
-
_defineProperty(this, "_rpcBatchRequest", void 0);
|
|
5099
|
-
|
|
5100
|
-
_defineProperty(this, "_rpcWebSocket", void 0);
|
|
5101
|
-
|
|
5102
5060
|
_defineProperty(this, "_rpcWebSocketConnected", false);
|
|
5103
5061
|
|
|
5104
5062
|
_defineProperty(this, "_rpcWebSocketHeartbeat", null);
|
|
@@ -5109,8 +5067,6 @@ class Connection {
|
|
|
5109
5067
|
|
|
5110
5068
|
_defineProperty(this, "_pollingBlockhash", false);
|
|
5111
5069
|
|
|
5112
|
-
_defineProperty(this, "_blockhashInfo", void 0);
|
|
5113
|
-
|
|
5114
5070
|
_defineProperty(this, "_accountChangeSubscriptionCounter", 0);
|
|
5115
5071
|
|
|
5116
5072
|
_defineProperty(this, "_accountChangeSubscriptions", {});
|
|
@@ -5692,6 +5648,25 @@ class Connection {
|
|
|
5692
5648
|
|
|
5693
5649
|
return res.result;
|
|
5694
5650
|
}
|
|
5651
|
+
/**
|
|
5652
|
+
* Fetch `limit` number of slot leaders starting from `startSlot`
|
|
5653
|
+
*
|
|
5654
|
+
* @param startSlot fetch slot leaders starting from this slot
|
|
5655
|
+
* @param limit number of slot leaders to return
|
|
5656
|
+
*/
|
|
5657
|
+
|
|
5658
|
+
|
|
5659
|
+
async getSlotLeaders(startSlot, limit) {
|
|
5660
|
+
const args = [startSlot, limit];
|
|
5661
|
+
const unsafeRes = await this._rpcRequest('getSlotLeaders', args);
|
|
5662
|
+
const res = create(unsafeRes, jsonRpcResult(array(PublicKeyFromString)));
|
|
5663
|
+
|
|
5664
|
+
if ('error' in res) {
|
|
5665
|
+
throw new Error('failed to get slot leaders: ' + res.error.message);
|
|
5666
|
+
}
|
|
5667
|
+
|
|
5668
|
+
return res.result;
|
|
5669
|
+
}
|
|
5695
5670
|
/**
|
|
5696
5671
|
* Fetch the current status of a signature
|
|
5697
5672
|
*/
|
|
@@ -7042,10 +7017,6 @@ class Authorized {
|
|
|
7042
7017
|
* @param withdrawer the withdraw authority
|
|
7043
7018
|
*/
|
|
7044
7019
|
constructor(staker, withdrawer) {
|
|
7045
|
-
_defineProperty(this, "staker", void 0);
|
|
7046
|
-
|
|
7047
|
-
_defineProperty(this, "withdrawer", void 0);
|
|
7048
|
-
|
|
7049
7020
|
this.staker = staker;
|
|
7050
7021
|
this.withdrawer = withdrawer;
|
|
7051
7022
|
}
|
|
@@ -7066,12 +7037,6 @@ class Lockup {
|
|
|
7066
7037
|
* Create a new Lockup object
|
|
7067
7038
|
*/
|
|
7068
7039
|
constructor(unixTimestamp, epoch, custodian) {
|
|
7069
|
-
_defineProperty(this, "unixTimestamp", void 0);
|
|
7070
|
-
|
|
7071
|
-
_defineProperty(this, "epoch", void 0);
|
|
7072
|
-
|
|
7073
|
-
_defineProperty(this, "custodian", void 0);
|
|
7074
|
-
|
|
7075
7040
|
this.unixTimestamp = unixTimestamp;
|
|
7076
7041
|
this.epoch = epoch;
|
|
7077
7042
|
this.custodian = custodian;
|
|
@@ -7897,10 +7862,6 @@ class ValidatorInfo {
|
|
|
7897
7862
|
* @param info validator information
|
|
7898
7863
|
*/
|
|
7899
7864
|
constructor(key, info) {
|
|
7900
|
-
_defineProperty(this, "key", void 0);
|
|
7901
|
-
|
|
7902
|
-
_defineProperty(this, "info", void 0);
|
|
7903
|
-
|
|
7904
7865
|
this.key = key;
|
|
7905
7866
|
this.info = info;
|
|
7906
7867
|
}
|
|
@@ -7962,26 +7923,6 @@ class VoteAccount {
|
|
|
7962
7923
|
* @internal
|
|
7963
7924
|
*/
|
|
7964
7925
|
constructor(args) {
|
|
7965
|
-
_defineProperty(this, "nodePubkey", void 0);
|
|
7966
|
-
|
|
7967
|
-
_defineProperty(this, "authorizedVoterPubkey", void 0);
|
|
7968
|
-
|
|
7969
|
-
_defineProperty(this, "authorizedWithdrawerPubkey", void 0);
|
|
7970
|
-
|
|
7971
|
-
_defineProperty(this, "commission", void 0);
|
|
7972
|
-
|
|
7973
|
-
_defineProperty(this, "votes", void 0);
|
|
7974
|
-
|
|
7975
|
-
_defineProperty(this, "rootSlot", void 0);
|
|
7976
|
-
|
|
7977
|
-
_defineProperty(this, "epoch", void 0);
|
|
7978
|
-
|
|
7979
|
-
_defineProperty(this, "credits", void 0);
|
|
7980
|
-
|
|
7981
|
-
_defineProperty(this, "lastEpochCredits", void 0);
|
|
7982
|
-
|
|
7983
|
-
_defineProperty(this, "epochCredits", void 0);
|
|
7984
|
-
|
|
7985
7926
|
this.nodePubkey = args.nodePubkey;
|
|
7986
7927
|
this.authorizedVoterPubkey = args.authorizedVoterPubkey;
|
|
7987
7928
|
this.authorizedWithdrawerPubkey = args.authorizedWithdrawerPubkey;
|