@solana/web3.js 1.30.1 → 1.30.2

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.
@@ -1,4 +1,3 @@
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 } from 'buffer';
@@ -1718,8 +1717,7 @@ class Struct {
1718
1717
  class Enum extends Struct {
1719
1718
  constructor(properties) {
1720
1719
  super(properties);
1721
-
1722
- _defineProperty(this, "enum", '');
1720
+ this.enum = '';
1723
1721
 
1724
1722
  if (Object.keys(properties).length !== 1) {
1725
1723
  throw new Error('Enum can only take single value');
@@ -1759,8 +1757,7 @@ class PublicKey extends Struct {
1759
1757
  */
1760
1758
  constructor(value) {
1761
1759
  super({});
1762
-
1763
- _defineProperty(this, "_bn", void 0);
1760
+ this._bn = void 0;
1764
1761
 
1765
1762
  if (isPublicKeyData(value)) {
1766
1763
  this._bn = value._bn;
@@ -1770,7 +1767,7 @@ class PublicKey extends Struct {
1770
1767
  const decoded = bs58.decode(value);
1771
1768
 
1772
1769
  if (decoded.length != 32) {
1773
- throw new Error("Invalid public key input");
1770
+ throw new Error(`Invalid public key input`);
1774
1771
  }
1775
1772
 
1776
1773
  this._bn = new BN(decoded);
@@ -1779,7 +1776,7 @@ class PublicKey extends Struct {
1779
1776
  }
1780
1777
 
1781
1778
  if (this._bn.byteLength() > 32) {
1782
- throw new Error("Invalid public key input");
1779
+ throw new Error(`Invalid public key input`);
1783
1780
  }
1784
1781
  }
1785
1782
  }
@@ -1859,7 +1856,7 @@ class PublicKey extends Struct {
1859
1856
  let buffer = Buffer.alloc(0);
1860
1857
  seeds.forEach(function (seed) {
1861
1858
  if (seed.length > MAX_SEED_LENGTH) {
1862
- throw new TypeError("Max seed length exceeded");
1859
+ throw new TypeError(`Max seed length exceeded`);
1863
1860
  }
1864
1861
 
1865
1862
  buffer = Buffer.concat([buffer, toBuffer(seed)]);
@@ -1869,7 +1866,7 @@ class PublicKey extends Struct {
1869
1866
  let publicKeyBytes = new BN(hash, 16).toArray(undefined, 32);
1870
1867
 
1871
1868
  if (is_on_curve(publicKeyBytes)) {
1872
- throw new Error("Invalid seeds, address must fall off the curve");
1869
+ throw new Error(`Invalid seeds, address must fall off the curve`);
1873
1870
  }
1874
1871
 
1875
1872
  return new PublicKey(publicKeyBytes);
@@ -1903,7 +1900,7 @@ class PublicKey extends Struct {
1903
1900
  return [address, nonce];
1904
1901
  }
1905
1902
 
1906
- throw new Error("Unable to find a viable program address nonce");
1903
+ throw new Error(`Unable to find a viable program address nonce`);
1907
1904
  }
1908
1905
  /**
1909
1906
  * Check that a pubkey is on the ed25519 curve.
@@ -1915,9 +1912,7 @@ class PublicKey extends Struct {
1915
1912
  }
1916
1913
 
1917
1914
  }
1918
-
1919
- _defineProperty(PublicKey, "default", new PublicKey('11111111111111111111111111111111'));
1920
-
1915
+ PublicKey.default = new PublicKey('11111111111111111111111111111111');
1921
1916
  SOLANA_SCHEMA.set(PublicKey, {
1922
1917
  kind: 'struct',
1923
1918
  fields: [['_bn', 'u256']]
@@ -1990,7 +1985,7 @@ class Account {
1990
1985
  * @param secretKey Secret key for the account
1991
1986
  */
1992
1987
  constructor(secretKey) {
1993
- _defineProperty(this, "_keypair", void 0);
1988
+ this._keypair = void 0;
1994
1989
 
1995
1990
  if (secretKey) {
1996
1991
  this._keypair = nacl.sign.keyPair.fromSecretKey(toBuffer(secretKey));
@@ -2126,16 +2121,11 @@ const PUBKEY_LENGTH = 32;
2126
2121
 
2127
2122
  class Message {
2128
2123
  constructor(args) {
2129
- _defineProperty(this, "header", void 0);
2130
-
2131
- _defineProperty(this, "accountKeys", void 0);
2132
-
2133
- _defineProperty(this, "recentBlockhash", void 0);
2134
-
2135
- _defineProperty(this, "instructions", void 0);
2136
-
2137
- _defineProperty(this, "indexToProgramIds", new Map());
2138
-
2124
+ this.header = void 0;
2125
+ this.accountKeys = void 0;
2126
+ this.recentBlockhash = void 0;
2127
+ this.instructions = void 0;
2128
+ this.indexToProgramIds = new Map();
2139
2129
  this.header = args.header;
2140
2130
  this.accountKeys = args.accountKeys.map(account => new PublicKey(account));
2141
2131
  this.recentBlockhash = args.recentBlockhash;
@@ -2309,12 +2299,9 @@ class TransactionInstruction {
2309
2299
  * Program input
2310
2300
  */
2311
2301
  constructor(opts) {
2312
- _defineProperty(this, "keys", void 0);
2313
-
2314
- _defineProperty(this, "programId", void 0);
2315
-
2316
- _defineProperty(this, "data", Buffer.alloc(0));
2317
-
2302
+ this.keys = void 0;
2303
+ this.programId = void 0;
2304
+ this.data = Buffer.alloc(0);
2318
2305
  this.programId = opts.programId;
2319
2306
  this.keys = opts.keys;
2320
2307
 
@@ -2356,16 +2343,11 @@ class Transaction {
2356
2343
  * Construct an empty Transaction
2357
2344
  */
2358
2345
  constructor(opts) {
2359
- _defineProperty(this, "signatures", []);
2360
-
2361
- _defineProperty(this, "feePayer", void 0);
2362
-
2363
- _defineProperty(this, "instructions", []);
2364
-
2365
- _defineProperty(this, "recentBlockhash", void 0);
2366
-
2367
- _defineProperty(this, "nonceInfo", void 0);
2368
-
2346
+ this.signatures = [];
2347
+ this.feePayer = void 0;
2348
+ this.instructions = [];
2349
+ this.recentBlockhash = void 0;
2350
+ this.nonceInfo = void 0;
2369
2351
  opts && Object.assign(this, opts);
2370
2352
  }
2371
2353
  /**
@@ -2429,7 +2411,7 @@ class Transaction {
2429
2411
 
2430
2412
  for (let i = 0; i < this.instructions.length; i++) {
2431
2413
  if (this.instructions[i].programId === undefined) {
2432
- throw new Error("Transaction instruction index ".concat(i, " has undefined program id"));
2414
+ throw new Error(`Transaction instruction index ${i} has undefined program id`);
2433
2415
  }
2434
2416
  }
2435
2417
 
@@ -2504,7 +2486,7 @@ class Transaction {
2504
2486
  console.warn('Transaction references a signature that is unnecessary, ' + 'only the fee payer and instruction signer accounts should sign a transaction. ' + 'This behavior is deprecated and will throw an error in the next major version release.');
2505
2487
  }
2506
2488
  } else {
2507
- throw new Error("unknown signer: ".concat(signature.publicKey.toString()));
2489
+ throw new Error(`unknown signer: ${signature.publicKey.toString()}`);
2508
2490
  }
2509
2491
  }
2510
2492
 
@@ -2739,7 +2721,7 @@ class Transaction {
2739
2721
  const index = this.signatures.findIndex(sigpair => pubkey.equals(sigpair.publicKey));
2740
2722
 
2741
2723
  if (index < 0) {
2742
- throw new Error("unknown signer: ".concat(pubkey.toString()));
2724
+ throw new Error(`unknown signer: ${pubkey.toString()}`);
2743
2725
  }
2744
2726
 
2745
2727
  this.signatures[index].signature = Buffer.from(signature);
@@ -2815,12 +2797,12 @@ class Transaction {
2815
2797
  signature
2816
2798
  }, index) => {
2817
2799
  if (signature !== null) {
2818
- assert(signature.length === 64, "signature has invalid length");
2800
+ assert(signature.length === 64, `signature has invalid length`);
2819
2801
  Buffer.from(signature).copy(wireTransaction, signatureCount.length + index * 64);
2820
2802
  }
2821
2803
  });
2822
2804
  signData.copy(wireTransaction, signatureCount.length + signatures.length * 64);
2823
- assert(wireTransaction.length <= PACKET_DATA_SIZE, "Transaction too large: ".concat(wireTransaction.length, " > ").concat(PACKET_DATA_SIZE));
2805
+ assert(wireTransaction.length <= PACKET_DATA_SIZE, `Transaction too large: ${wireTransaction.length} > ${PACKET_DATA_SIZE}`);
2824
2806
  return wireTransaction;
2825
2807
  }
2826
2808
  /**
@@ -2939,7 +2921,7 @@ async function sendAndConfirmTransaction(connection, transaction, signers, optio
2939
2921
  const status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
2940
2922
 
2941
2923
  if (status.err) {
2942
- throw new Error("Transaction ".concat(signature, " failed (").concat(JSON.stringify(status), ")"));
2924
+ throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);
2943
2925
  }
2944
2926
 
2945
2927
  return signature;
@@ -2982,7 +2964,7 @@ function decodeData(type, buffer) {
2982
2964
  }
2983
2965
 
2984
2966
  if (data.instruction !== type.index) {
2985
- throw new Error("invalid instruction; instruction index mismatch ".concat(data.instruction, " != ").concat(type.index));
2967
+ throw new Error(`invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`);
2986
2968
  }
2987
2969
 
2988
2970
  return data;
@@ -3016,12 +2998,9 @@ class NonceAccount {
3016
2998
  * @internal
3017
2999
  */
3018
3000
  constructor(args) {
3019
- _defineProperty(this, "authorizedPubkey", void 0);
3020
-
3021
- _defineProperty(this, "nonce", void 0);
3022
-
3023
- _defineProperty(this, "feeCalculator", void 0);
3024
-
3001
+ this.authorizedPubkey = void 0;
3002
+ this.nonce = void 0;
3003
+ this.feeCalculator = void 0;
3025
3004
  this.authorizedPubkey = args.authorizedPubkey;
3026
3005
  this.nonce = args.nonce;
3027
3006
  this.feeCalculator = args.feeCalculator;
@@ -3322,7 +3301,7 @@ class SystemInstruction {
3322
3301
 
3323
3302
  static checkKeyLength(keys, expectedLength) {
3324
3303
  if (keys.length < expectedLength) {
3325
- throw new Error("invalid instruction; found ".concat(keys.length, " keys, expected at least ").concat(expectedLength));
3304
+ throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);
3326
3305
  }
3327
3306
  }
3328
3307
 
@@ -3754,8 +3733,7 @@ class SystemProgram {
3754
3733
  }
3755
3734
 
3756
3735
  }
3757
-
3758
- _defineProperty(SystemProgram, "programId", new PublicKey('11111111111111111111111111111111'));
3736
+ SystemProgram.programId = new PublicKey('11111111111111111111111111111111');
3759
3737
 
3760
3738
  // rest of the Transaction fields
3761
3739
  //
@@ -3924,8 +3902,7 @@ class Loader {
3924
3902
  }
3925
3903
 
3926
3904
  }
3927
-
3928
- _defineProperty(Loader, "chunkSize", CHUNK_SIZE);
3905
+ Loader.chunkSize = CHUNK_SIZE;
3929
3906
 
3930
3907
  const BPF_LOADER_PROGRAM_ID = new PublicKey('BPFLoader2111111111111111111111111111111111');
3931
3908
  /**
@@ -4564,16 +4541,11 @@ class EpochSchedule {
4564
4541
 
4565
4542
  /** The first slot of `firstNormalEpoch` */
4566
4543
  constructor(slotsPerEpoch, leaderScheduleSlotOffset, warmup, firstNormalEpoch, firstNormalSlot) {
4567
- _defineProperty(this, "slotsPerEpoch", void 0);
4568
-
4569
- _defineProperty(this, "leaderScheduleSlotOffset", void 0);
4570
-
4571
- _defineProperty(this, "warmup", void 0);
4572
-
4573
- _defineProperty(this, "firstNormalEpoch", void 0);
4574
-
4575
- _defineProperty(this, "firstNormalSlot", void 0);
4576
-
4544
+ this.slotsPerEpoch = void 0;
4545
+ this.leaderScheduleSlotOffset = void 0;
4546
+ this.warmup = void 0;
4547
+ this.firstNormalEpoch = void 0;
4548
+ this.firstNormalSlot = void 0;
4577
4549
  this.slotsPerEpoch = slotsPerEpoch;
4578
4550
  this.leaderScheduleSlotOffset = leaderScheduleSlotOffset;
4579
4551
  this.warmup = warmup;
@@ -4625,9 +4597,7 @@ class EpochSchedule {
4625
4597
  class SendTransactionError extends Error {
4626
4598
  constructor(message, logs) {
4627
4599
  super(message);
4628
-
4629
- _defineProperty(this, "logs", void 0);
4630
-
4600
+ this.logs = void 0;
4631
4601
  this.logs = logs;
4632
4602
  }
4633
4603
 
@@ -4906,7 +4876,7 @@ function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRet
4906
4876
  break;
4907
4877
  }
4908
4878
 
4909
- console.log("Server responded with ".concat(res.status, " ").concat(res.statusText, ". Retrying after ").concat(waitTime, "ms delay..."));
4879
+ console.log(`Server responded with ${res.status} ${res.statusText}. Retrying after ${waitTime}ms delay...`);
4910
4880
  await sleep(waitTime);
4911
4881
  waitTime *= 2;
4912
4882
  }
@@ -4916,7 +4886,7 @@ function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRet
4916
4886
  if (res.ok) {
4917
4887
  callback(null, text);
4918
4888
  } else {
4919
- callback(new Error("".concat(res.status, " ").concat(res.statusText, ": ").concat(text)));
4889
+ callback(new Error(`${res.status} ${res.statusText}: ${text}`));
4920
4890
  }
4921
4891
  } catch (err) {
4922
4892
  if (err instanceof Error) callback(err);
@@ -5581,67 +5551,39 @@ class Connection {
5581
5551
  * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object
5582
5552
  */
5583
5553
  constructor(endpoint, commitmentOrConfig) {
5584
- _defineProperty(this, "_commitment", void 0);
5585
-
5586
- _defineProperty(this, "_confirmTransactionInitialTimeout", void 0);
5587
-
5588
- _defineProperty(this, "_rpcEndpoint", void 0);
5589
-
5590
- _defineProperty(this, "_rpcWsEndpoint", void 0);
5591
-
5592
- _defineProperty(this, "_rpcClient", void 0);
5593
-
5594
- _defineProperty(this, "_rpcRequest", void 0);
5595
-
5596
- _defineProperty(this, "_rpcBatchRequest", void 0);
5597
-
5598
- _defineProperty(this, "_rpcWebSocket", void 0);
5599
-
5600
- _defineProperty(this, "_rpcWebSocketConnected", false);
5601
-
5602
- _defineProperty(this, "_rpcWebSocketHeartbeat", null);
5603
-
5604
- _defineProperty(this, "_rpcWebSocketIdleTimeout", null);
5605
-
5606
- _defineProperty(this, "_disableBlockhashCaching", false);
5607
-
5608
- _defineProperty(this, "_pollingBlockhash", false);
5609
-
5610
- _defineProperty(this, "_blockhashInfo", {
5554
+ this._commitment = void 0;
5555
+ this._confirmTransactionInitialTimeout = void 0;
5556
+ this._rpcEndpoint = void 0;
5557
+ this._rpcWsEndpoint = void 0;
5558
+ this._rpcClient = void 0;
5559
+ this._rpcRequest = void 0;
5560
+ this._rpcBatchRequest = void 0;
5561
+ this._rpcWebSocket = void 0;
5562
+ this._rpcWebSocketConnected = false;
5563
+ this._rpcWebSocketHeartbeat = null;
5564
+ this._rpcWebSocketIdleTimeout = null;
5565
+ this._disableBlockhashCaching = false;
5566
+ this._pollingBlockhash = false;
5567
+ this._blockhashInfo = {
5611
5568
  recentBlockhash: null,
5612
5569
  lastFetch: 0,
5613
5570
  transactionSignatures: [],
5614
5571
  simulatedSignatures: []
5615
- });
5616
-
5617
- _defineProperty(this, "_accountChangeSubscriptionCounter", 0);
5618
-
5619
- _defineProperty(this, "_accountChangeSubscriptions", {});
5620
-
5621
- _defineProperty(this, "_programAccountChangeSubscriptionCounter", 0);
5622
-
5623
- _defineProperty(this, "_programAccountChangeSubscriptions", {});
5624
-
5625
- _defineProperty(this, "_rootSubscriptionCounter", 0);
5626
-
5627
- _defineProperty(this, "_rootSubscriptions", {});
5628
-
5629
- _defineProperty(this, "_signatureSubscriptionCounter", 0);
5630
-
5631
- _defineProperty(this, "_signatureSubscriptions", {});
5632
-
5633
- _defineProperty(this, "_slotSubscriptionCounter", 0);
5634
-
5635
- _defineProperty(this, "_slotSubscriptions", {});
5636
-
5637
- _defineProperty(this, "_logsSubscriptionCounter", 0);
5638
-
5639
- _defineProperty(this, "_logsSubscriptions", {});
5640
-
5641
- _defineProperty(this, "_slotUpdateSubscriptionCounter", 0);
5642
-
5643
- _defineProperty(this, "_slotUpdateSubscriptions", {});
5644
-
5572
+ };
5573
+ this._accountChangeSubscriptionCounter = 0;
5574
+ this._accountChangeSubscriptions = {};
5575
+ this._programAccountChangeSubscriptionCounter = 0;
5576
+ this._programAccountChangeSubscriptions = {};
5577
+ this._rootSubscriptionCounter = 0;
5578
+ this._rootSubscriptions = {};
5579
+ this._signatureSubscriptionCounter = 0;
5580
+ this._signatureSubscriptions = {};
5581
+ this._slotSubscriptionCounter = 0;
5582
+ this._slotSubscriptions = {};
5583
+ this._logsSubscriptionCounter = 0;
5584
+ this._logsSubscriptions = {};
5585
+ this._slotUpdateSubscriptionCounter = 0;
5586
+ this._slotUpdateSubscriptions = {};
5645
5587
  let url = new URL(endpoint);
5646
5588
  const useHttps = url.protocol === 'https:';
5647
5589
  let wsEndpoint;
@@ -6015,7 +5957,7 @@ class Connection {
6015
5957
  const res = create(unsafeRes, jsonRpcResult(StakeActivationResult));
6016
5958
 
6017
5959
  if ('error' in res) {
6018
- throw new Error("failed to get Stake Activation ".concat(publicKey.toBase58(), ": ").concat(res.error.message));
5960
+ throw new Error(`failed to get Stake Activation ${publicKey.toBase58()}: ${res.error.message}`);
6019
5961
  }
6020
5962
 
6021
5963
  return res.result;
@@ -6151,7 +6093,7 @@ class Connection {
6151
6093
 
6152
6094
  if (response === null) {
6153
6095
  const duration = (Date.now() - start) / 1000;
6154
- throw new Error("Transaction was not confirmed in ".concat(duration.toFixed(2), " seconds. It is unknown if it succeeded or failed. Check signature ").concat(signature, " using the Solana Explorer or CLI tools."));
6096
+ throw new Error(`Transaction was not confirmed in ${duration.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${signature} using the Solana Explorer or CLI tools.`);
6155
6097
  }
6156
6098
 
6157
6099
  return response;
@@ -6925,7 +6867,7 @@ class Connection {
6925
6867
  await sleep(MS_PER_SLOT / 2);
6926
6868
  }
6927
6869
 
6928
- throw new Error("Unable to obtain a new blockhash after ".concat(Date.now() - startTime, "ms"));
6870
+ throw new Error(`Unable to obtain a new blockhash after ${Date.now() - startTime}ms`);
6929
6871
  } finally {
6930
6872
  this._pollingBlockhash = false;
6931
6873
  }
@@ -7182,7 +7124,7 @@ class Connection {
7182
7124
  }
7183
7125
 
7184
7126
  if (err instanceof Error) {
7185
- console.error("".concat(rpcMethod, " error for argument"), rpcArgs, err.message);
7127
+ console.error(`${rpcMethod} error for argument`, rpcArgs, err.message);
7186
7128
  }
7187
7129
  }
7188
7130
  }
@@ -7202,7 +7144,7 @@ class Connection {
7202
7144
  await this._rpcWebSocket.call(rpcMethod, [unsubscribeId]);
7203
7145
  } catch (err) {
7204
7146
  if (err instanceof Error) {
7205
- console.error("".concat(rpcMethod, " error:"), err.message);
7147
+ console.error(`${rpcMethod} error:`, err.message);
7206
7148
  }
7207
7149
  }
7208
7150
  }
@@ -7367,7 +7309,7 @@ class Connection {
7367
7309
 
7368
7310
  this._updateSubscriptions();
7369
7311
  } else {
7370
- throw new Error("Unknown account change id: ".concat(id));
7312
+ throw new Error(`Unknown account change id: ${id}`);
7371
7313
  }
7372
7314
  }
7373
7315
  /**
@@ -7433,7 +7375,7 @@ class Connection {
7433
7375
 
7434
7376
  this._updateSubscriptions();
7435
7377
  } else {
7436
- throw new Error("Unknown program account change id: ".concat(id));
7378
+ throw new Error(`Unknown program account change id: ${id}`);
7437
7379
  }
7438
7380
  }
7439
7381
  /**
@@ -7463,7 +7405,7 @@ class Connection {
7463
7405
 
7464
7406
  async removeOnLogsListener(id) {
7465
7407
  if (!this._logsSubscriptions[id]) {
7466
- throw new Error("Unknown logs id: ".concat(id));
7408
+ throw new Error(`Unknown logs id: ${id}`);
7467
7409
  }
7468
7410
 
7469
7411
  const subInfo = this._logsSubscriptions[id];
@@ -7539,7 +7481,7 @@ class Connection {
7539
7481
 
7540
7482
  this._updateSubscriptions();
7541
7483
  } else {
7542
- throw new Error("Unknown slot change id: ".concat(id));
7484
+ throw new Error(`Unknown slot change id: ${id}`);
7543
7485
  }
7544
7486
  }
7545
7487
  /**
@@ -7592,7 +7534,7 @@ class Connection {
7592
7534
 
7593
7535
  this._updateSubscriptions();
7594
7536
  } else {
7595
- throw new Error("Unknown slot update id: ".concat(id));
7537
+ throw new Error(`Unknown slot update id: ${id}`);
7596
7538
  }
7597
7539
  }
7598
7540
 
@@ -7733,7 +7675,7 @@ class Connection {
7733
7675
 
7734
7676
  this._updateSubscriptions();
7735
7677
  } else {
7736
- throw new Error("Unknown signature result id: ".concat(id));
7678
+ throw new Error(`Unknown signature result id: ${id}`);
7737
7679
  }
7738
7680
  }
7739
7681
  /**
@@ -7785,7 +7727,7 @@ class Connection {
7785
7727
 
7786
7728
  this._updateSubscriptions();
7787
7729
  } else {
7788
- throw new Error("Unknown root change id: ".concat(id));
7730
+ throw new Error(`Unknown root change id: ${id}`);
7789
7731
  }
7790
7732
  }
7791
7733
 
@@ -7806,7 +7748,7 @@ class Keypair {
7806
7748
  * @param keypair ed25519 keypair
7807
7749
  */
7808
7750
  constructor(keypair) {
7809
- _defineProperty(this, "_keypair", void 0);
7751
+ this._keypair = void 0;
7810
7752
 
7811
7753
  if (keypair) {
7812
7754
  this._keypair = keypair;
@@ -7910,8 +7852,8 @@ class Ed25519Program {
7910
7852
  signature,
7911
7853
  instructionIndex
7912
7854
  } = params;
7913
- assert(publicKey.length === PUBLIC_KEY_BYTES$1, "Public Key must be ".concat(PUBLIC_KEY_BYTES$1, " bytes but received ").concat(publicKey.length, " bytes"));
7914
- assert(signature.length === SIGNATURE_BYTES, "Signature must be ".concat(SIGNATURE_BYTES, " bytes but received ").concat(signature.length, " bytes"));
7855
+ assert(publicKey.length === PUBLIC_KEY_BYTES$1, `Public Key must be ${PUBLIC_KEY_BYTES$1} bytes but received ${publicKey.length} bytes`);
7856
+ assert(signature.length === SIGNATURE_BYTES, `Signature must be ${SIGNATURE_BYTES} bytes but received ${signature.length} bytes`);
7915
7857
  const publicKeyOffset = ED25519_INSTRUCTION_LAYOUT.span;
7916
7858
  const signatureOffset = publicKeyOffset + publicKey.length;
7917
7859
  const messageDataOffset = signatureOffset + signature.length;
@@ -7949,7 +7891,7 @@ class Ed25519Program {
7949
7891
  message,
7950
7892
  instructionIndex
7951
7893
  } = params;
7952
- assert(privateKey.length === PRIVATE_KEY_BYTES$1, "Private key must be ".concat(PRIVATE_KEY_BYTES$1, " bytes but received ").concat(privateKey.length, " bytes"));
7894
+ assert(privateKey.length === PRIVATE_KEY_BYTES$1, `Private key must be ${PRIVATE_KEY_BYTES$1} bytes but received ${privateKey.length} bytes`);
7953
7895
 
7954
7896
  try {
7955
7897
  const keypair = Keypair.fromSecretKey(privateKey);
@@ -7962,13 +7904,12 @@ class Ed25519Program {
7962
7904
  instructionIndex
7963
7905
  });
7964
7906
  } catch (error) {
7965
- throw new Error("Error creating instruction; ".concat(error));
7907
+ throw new Error(`Error creating instruction; ${error}`);
7966
7908
  }
7967
7909
  }
7968
7910
 
7969
7911
  }
7970
-
7971
- _defineProperty(Ed25519Program, "programId", new PublicKey('Ed25519SigVerify111111111111111111111111111'));
7912
+ Ed25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');
7972
7913
 
7973
7914
  /**
7974
7915
  * Address of the stake config account which configures the rate
@@ -7991,10 +7932,8 @@ class Authorized {
7991
7932
  * @param withdrawer the withdraw authority
7992
7933
  */
7993
7934
  constructor(staker, withdrawer) {
7994
- _defineProperty(this, "staker", void 0);
7995
-
7996
- _defineProperty(this, "withdrawer", void 0);
7997
-
7935
+ this.staker = void 0;
7936
+ this.withdrawer = void 0;
7998
7937
  this.staker = staker;
7999
7938
  this.withdrawer = withdrawer;
8000
7939
  }
@@ -8015,12 +7954,9 @@ class Lockup {
8015
7954
  * Create a new Lockup object
8016
7955
  */
8017
7956
  constructor(unixTimestamp, epoch, custodian) {
8018
- _defineProperty(this, "unixTimestamp", void 0);
8019
-
8020
- _defineProperty(this, "epoch", void 0);
8021
-
8022
- _defineProperty(this, "custodian", void 0);
8023
-
7957
+ this.unixTimestamp = void 0;
7958
+ this.epoch = void 0;
7959
+ this.custodian = void 0;
8024
7960
  this.unixTimestamp = unixTimestamp;
8025
7961
  this.epoch = epoch;
8026
7962
  this.custodian = custodian;
@@ -8035,7 +7971,7 @@ class Lockup {
8035
7971
  * Create stake account transaction params
8036
7972
  */
8037
7973
 
8038
- _defineProperty(Lockup, "default", new Lockup(0, 0, PublicKey.default));
7974
+ Lockup.default = new Lockup(0, 0, PublicKey.default);
8039
7975
 
8040
7976
  /**
8041
7977
  * Stake Instruction class
@@ -8248,7 +8184,7 @@ class StakeInstruction {
8248
8184
 
8249
8185
  static checkKeyLength(keys, expectedLength) {
8250
8186
  if (keys.length < expectedLength) {
8251
- throw new Error("invalid instruction; found ".concat(keys.length, " keys, expected at least ").concat(expectedLength));
8187
+ throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);
8252
8188
  }
8253
8189
  }
8254
8190
 
@@ -8723,10 +8659,8 @@ class StakeProgram {
8723
8659
  }
8724
8660
 
8725
8661
  }
8726
-
8727
- _defineProperty(StakeProgram, "programId", new PublicKey('Stake11111111111111111111111111111111111111'));
8728
-
8729
- _defineProperty(StakeProgram, "space", 200);
8662
+ StakeProgram.programId = new PublicKey('Stake11111111111111111111111111111111111111');
8663
+ StakeProgram.space = 200;
8730
8664
 
8731
8665
  const {
8732
8666
  publicKeyCreate,
@@ -8756,12 +8690,12 @@ class Secp256k1Program {
8756
8690
  * @param {Buffer} publicKey a 64 byte secp256k1 public key buffer
8757
8691
  */
8758
8692
  static publicKeyToEthAddress(publicKey) {
8759
- assert(publicKey.length === PUBLIC_KEY_BYTES, "Public key must be ".concat(PUBLIC_KEY_BYTES, " bytes but received ").concat(publicKey.length, " bytes"));
8693
+ assert(publicKey.length === PUBLIC_KEY_BYTES, `Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey.length} bytes`);
8760
8694
 
8761
8695
  try {
8762
8696
  return Buffer.from(keccak_256.update(toBuffer(publicKey)).digest()).slice(-ETHEREUM_ADDRESS_BYTES);
8763
8697
  } catch (error) {
8764
- throw new Error("Error constructing Ethereum address: ".concat(error));
8698
+ throw new Error(`Error constructing Ethereum address: ${error}`);
8765
8699
  }
8766
8700
  }
8767
8701
  /**
@@ -8812,7 +8746,7 @@ class Secp256k1Program {
8812
8746
  ethAddress = rawAddress;
8813
8747
  }
8814
8748
 
8815
- assert(ethAddress.length === ETHEREUM_ADDRESS_BYTES, "Address must be ".concat(ETHEREUM_ADDRESS_BYTES, " bytes but received ").concat(ethAddress.length, " bytes"));
8749
+ assert(ethAddress.length === ETHEREUM_ADDRESS_BYTES, `Address must be ${ETHEREUM_ADDRESS_BYTES} bytes but received ${ethAddress.length} bytes`);
8816
8750
  const dataStart = 1 + SIGNATURE_OFFSETS_SERIALIZED_SIZE;
8817
8751
  const ethAddressOffset = dataStart;
8818
8752
  const signatureOffset = dataStart + ethAddress.length;
@@ -8851,7 +8785,7 @@ class Secp256k1Program {
8851
8785
  message,
8852
8786
  instructionIndex
8853
8787
  } = params;
8854
- assert(pkey.length === PRIVATE_KEY_BYTES, "Private key must be ".concat(PRIVATE_KEY_BYTES, " bytes but received ").concat(pkey.length, " bytes"));
8788
+ assert(pkey.length === PRIVATE_KEY_BYTES, `Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`);
8855
8789
 
8856
8790
  try {
8857
8791
  const privateKey = toBuffer(pkey);
@@ -8870,13 +8804,12 @@ class Secp256k1Program {
8870
8804
  instructionIndex
8871
8805
  });
8872
8806
  } catch (error) {
8873
- throw new Error("Error creating instruction; ".concat(error));
8807
+ throw new Error(`Error creating instruction; ${error}`);
8874
8808
  }
8875
8809
  }
8876
8810
 
8877
8811
  }
8878
-
8879
- _defineProperty(Secp256k1Program, "programId", new PublicKey('KeccakSecp256k11111111111111111111111111111'));
8812
+ Secp256k1Program.programId = new PublicKey('KeccakSecp256k11111111111111111111111111111');
8880
8813
 
8881
8814
  const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');
8882
8815
  /**
@@ -8909,10 +8842,8 @@ class ValidatorInfo {
8909
8842
  * @param info validator information
8910
8843
  */
8911
8844
  constructor(key, info) {
8912
- _defineProperty(this, "key", void 0);
8913
-
8914
- _defineProperty(this, "info", void 0);
8915
-
8845
+ this.key = void 0;
8846
+ this.info = void 0;
8916
8847
  this.key = key;
8917
8848
  this.info = info;
8918
8849
  }
@@ -8976,26 +8907,16 @@ class VoteAccount {
8976
8907
  * @internal
8977
8908
  */
8978
8909
  constructor(args) {
8979
- _defineProperty(this, "nodePubkey", void 0);
8980
-
8981
- _defineProperty(this, "authorizedVoterPubkey", void 0);
8982
-
8983
- _defineProperty(this, "authorizedWithdrawerPubkey", void 0);
8984
-
8985
- _defineProperty(this, "commission", void 0);
8986
-
8987
- _defineProperty(this, "votes", void 0);
8988
-
8989
- _defineProperty(this, "rootSlot", void 0);
8990
-
8991
- _defineProperty(this, "epoch", void 0);
8992
-
8993
- _defineProperty(this, "credits", void 0);
8994
-
8995
- _defineProperty(this, "lastEpochCredits", void 0);
8996
-
8997
- _defineProperty(this, "epochCredits", void 0);
8998
-
8910
+ this.nodePubkey = void 0;
8911
+ this.authorizedVoterPubkey = void 0;
8912
+ this.authorizedWithdrawerPubkey = void 0;
8913
+ this.commission = void 0;
8914
+ this.votes = void 0;
8915
+ this.rootSlot = void 0;
8916
+ this.epoch = void 0;
8917
+ this.credits = void 0;
8918
+ this.lastEpochCredits = void 0;
8919
+ this.epochCredits = void 0;
8999
8920
  this.nodePubkey = args.nodePubkey;
9000
8921
  this.authorizedVoterPubkey = args.authorizedVoterPubkey;
9001
8922
  this.authorizedWithdrawerPubkey = args.authorizedWithdrawerPubkey;
@@ -9058,7 +8979,7 @@ async function sendAndConfirmRawTransaction(connection, rawTransaction, options)
9058
8979
  const status = (await connection.confirmTransaction(signature, options && options.commitment)).value;
9059
8980
 
9060
8981
  if (status.err) {
9061
- throw new Error("Raw transaction ".concat(signature, " failed (").concat(JSON.stringify(status), ")"));
8982
+ throw new Error(`Raw transaction ${signature} failed (${JSON.stringify(status)})`);
9062
8983
  }
9063
8984
 
9064
8985
  return signature;
@@ -9090,7 +9011,7 @@ function clusterApiUrl(cluster, tls) {
9090
9011
  const url = endpoint[key][cluster];
9091
9012
 
9092
9013
  if (!url) {
9093
- throw new Error("Unknown ".concat(key, " cluster: ").concat(cluster));
9014
+ throw new Error(`Unknown ${key} cluster: ${cluster}`);
9094
9015
  }
9095
9016
 
9096
9017
  return url;