@solana/web3.js 1.35.0 → 1.37.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/lib/index.d.ts CHANGED
@@ -456,6 +456,10 @@ declare module '@solana/web3.js' {
456
456
  * Get a buffer of the Transaction data that need to be covered by signatures
457
457
  */
458
458
  serializeMessage(): Buffer;
459
+ /**
460
+ * Get the estimated fee associated with a transaction
461
+ */
462
+ getEstimatedFee(connection: Connection): Promise<number>;
459
463
  /**
460
464
  * Specify the public keys which will be used to sign the Transaction.
461
465
  * The first signer will be used as the transaction fee payer account.
@@ -754,7 +758,7 @@ declare module '@solana/web3.js' {
754
758
  export type SimulatedTransactionResponse = {
755
759
  err: TransactionError | string | null;
756
760
  logs: Array<string> | null;
757
- accounts?: SimulatedTransactionAccountInfo[] | null;
761
+ accounts?: (SimulatedTransactionAccountInfo | null)[] | null;
758
762
  unitsConsumed?: number;
759
763
  };
760
764
  export type ParsedInnerInstruction = {
@@ -998,6 +1002,33 @@ declare module '@solana/web3.js' {
998
1002
  /** The unix timestamp of when the block was processed */
999
1003
  blockTime: number | null;
1000
1004
  };
1005
+ /**
1006
+ * recent block production information
1007
+ */
1008
+ export type BlockProduction = Readonly<{
1009
+ /** a dictionary of validator identities, as base-58 encoded strings. Value is a two element array containing the number of leader slots and the number of blocks produced */
1010
+ byIdentity: Readonly<Record<string, ReadonlyArray<number>>>;
1011
+ /** Block production slot range */
1012
+ range: Readonly<{
1013
+ /** first slot of the block production information (inclusive) */
1014
+ firstSlot: number;
1015
+ /** last slot of block production information (inclusive) */
1016
+ lastSlot: number;
1017
+ }>;
1018
+ }>;
1019
+ export type GetBlockProductionConfig = {
1020
+ /** Optional commitment level */
1021
+ commitment?: Commitment;
1022
+ /** Slot range to return block production for. If parameter not provided, defaults to current epoch. */
1023
+ range?: {
1024
+ /** first slot to return block production information for (inclusive) */
1025
+ firstSlot: number;
1026
+ /** last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot */
1027
+ lastSlot?: number;
1028
+ };
1029
+ /** Only return results for this validator identity (base-58 encoded) */
1030
+ identity?: string;
1031
+ };
1001
1032
  /**
1002
1033
  * A performance sample
1003
1034
  */
@@ -1389,7 +1420,7 @@ declare module '@solana/web3.js' {
1389
1420
  httpHeaders?: HttpHeaders;
1390
1421
  /** Optional fetch middleware callback */
1391
1422
  fetchMiddleware?: FetchMiddleware;
1392
- /** Optional Disable retring calls when server responds with HTTP 429 (Too Many Requests) */
1423
+ /** Optional Disable retrying calls when server responds with HTTP 429 (Too Many Requests) */
1393
1424
  disableRetryOnRateLimit?: boolean;
1394
1425
  /** time to allow for the server to initially process a transaction (in milliseconds) */
1395
1426
  confirmTransactionInitialTimeout?: number;
@@ -1412,6 +1443,10 @@ declare module '@solana/web3.js' {
1412
1443
  * The default commitment used for requests
1413
1444
  */
1414
1445
  get commitment(): Commitment | undefined;
1446
+ /**
1447
+ * The RPC endpoint
1448
+ */
1449
+ get rpcEndpoint(): string;
1415
1450
  /**
1416
1451
  * Fetch the balance for the specified public key, return with context
1417
1452
  */
@@ -1527,13 +1562,20 @@ declare module '@solana/web3.js' {
1527
1562
  publicKey: PublicKey,
1528
1563
  commitment?: Commitment,
1529
1564
  ): Promise<AccountInfo<Buffer> | null>;
1565
+ /**
1566
+ * Fetch all the account info for multiple accounts specified by an array of public keys, return with context
1567
+ */
1568
+ getMultipleAccountsInfoAndContext(
1569
+ publicKeys: PublicKey[],
1570
+ commitment?: Commitment,
1571
+ ): Promise<RpcResponseAndContext<(AccountInfo<Buffer> | null)[]>>;
1530
1572
  /**
1531
1573
  * Fetch all the account info for multiple accounts specified by an array of public keys
1532
1574
  */
1533
1575
  getMultipleAccountsInfo(
1534
1576
  publicKeys: PublicKey[],
1535
- configOrCommitment?: GetMultipleAccountsConfig | Commitment,
1536
- ): Promise<(AccountInfo<Buffer | ParsedAccountData> | null)[]>;
1577
+ commitment?: Commitment,
1578
+ ): Promise<(AccountInfo<Buffer> | null)[]>;
1537
1579
  /**
1538
1580
  * Returns epoch activation information for a stake account that has been delegated
1539
1581
  */
@@ -1735,6 +1777,10 @@ declare module '@solana/web3.js' {
1735
1777
  commitment?: Finality;
1736
1778
  },
1737
1779
  ): Promise<BlockResponse | null>;
1780
+ getBlockHeight(commitment?: Commitment): Promise<number>;
1781
+ getBlockProduction(
1782
+ configOrCommitment?: GetBlockProductionConfig | Commitment,
1783
+ ): Promise<RpcResponseAndContext<BlockProduction>>;
1738
1784
  /**
1739
1785
  * Fetch a confirmed or finalized transaction from the cluster.
1740
1786
  */
@@ -2373,14 +2419,14 @@ declare module '@solana/web3.js' {
2373
2419
  * An enumeration of valid StakeInstructionType's
2374
2420
  */
2375
2421
  export type StakeInstructionType =
2376
- | 'AuthorizeWithSeed'
2377
2422
  | 'Authorize'
2423
+ | 'AuthorizeWithSeed'
2378
2424
  | 'Deactivate'
2379
2425
  | 'Delegate'
2380
2426
  | 'Initialize'
2427
+ | 'Merge'
2381
2428
  | 'Split'
2382
- | 'Withdraw'
2383
- | 'Merge';
2429
+ | 'Withdraw';
2384
2430
  /**
2385
2431
  * Stake authorization type
2386
2432
  */
@@ -2922,24 +2968,24 @@ declare module '@solana/web3.js' {
2922
2968
  /**
2923
2969
  * History of how many credits earned by the end of each epoch
2924
2970
  */
2925
- export type EpochCredits = {
2971
+ export type EpochCredits = Readonly<{
2926
2972
  epoch: number;
2927
2973
  credits: number;
2928
2974
  prevCredits: number;
2929
- };
2930
- export type AuthorizedVoter = {
2975
+ }>;
2976
+ export type AuthorizedVoter = Readonly<{
2931
2977
  epoch: number;
2932
2978
  authorizedVoter: PublicKey;
2933
- };
2934
- export type PriorVoter = {
2979
+ }>;
2980
+ export type PriorVoter = Readonly<{
2935
2981
  authorizedPubkey: PublicKey;
2936
2982
  epochOfLastAuthorizedSwitch: number;
2937
2983
  targetEpoch: number;
2938
- };
2939
- export type BlockTimestamp = {
2984
+ }>;
2985
+ export type BlockTimestamp = Readonly<{
2940
2986
  slot: number;
2941
- timetamp: number;
2942
- };
2987
+ timestamp: number;
2988
+ }>;
2943
2989
  /**
2944
2990
  * VoteAccount class
2945
2991
  */
package/lib/index.esm.js CHANGED
@@ -46,32 +46,38 @@ var inherits_browser = {exports: {}};
46
46
  if (typeof Object.create === 'function') {
47
47
  // implementation from standard node.js 'util' module
48
48
  inherits_browser.exports = function inherits(ctor, superCtor) {
49
- ctor.super_ = superCtor;
50
- ctor.prototype = Object.create(superCtor.prototype, {
51
- constructor: {
52
- value: ctor,
53
- enumerable: false,
54
- writable: true,
55
- configurable: true
56
- }
57
- });
49
+ if (superCtor) {
50
+ ctor.super_ = superCtor;
51
+ ctor.prototype = Object.create(superCtor.prototype, {
52
+ constructor: {
53
+ value: ctor,
54
+ enumerable: false,
55
+ writable: true,
56
+ configurable: true
57
+ }
58
+ });
59
+ }
58
60
  };
59
61
  } else {
60
62
  // old school shim for old browsers
61
63
  inherits_browser.exports = function inherits(ctor, superCtor) {
62
- ctor.super_ = superCtor;
63
- var TempCtor = function () {};
64
- TempCtor.prototype = superCtor.prototype;
65
- ctor.prototype = new TempCtor();
66
- ctor.prototype.constructor = ctor;
64
+ if (superCtor) {
65
+ ctor.super_ = superCtor;
66
+ var TempCtor = function () {};
67
+ TempCtor.prototype = superCtor.prototype;
68
+ ctor.prototype = new TempCtor();
69
+ ctor.prototype.constructor = ctor;
70
+ }
67
71
  };
68
72
  }
69
73
 
70
74
  try {
71
75
  var util = require('util');
76
+ /* istanbul ignore next */
72
77
  if (typeof util.inherits !== 'function') throw '';
73
78
  inherits$1.exports = util.inherits;
74
79
  } catch (e) {
80
+ /* istanbul ignore next */
75
81
  inherits$1.exports = inherits_browser.exports;
76
82
  }
77
83
 
@@ -1284,7 +1290,7 @@ hash.ripemd160 = hash.ripemd.ripemd160;
1284
1290
 
1285
1291
  var hash = hash$1;
1286
1292
 
1287
- const version$2 = "logger/5.5.0";
1293
+ const version$2 = "logger/5.6.0";
1288
1294
 
1289
1295
  let _permanentCensorErrors = false;
1290
1296
  let _censorErrors = false;
@@ -1463,6 +1469,40 @@ class Logger {
1463
1469
  messageDetails.push(`code=${code}`);
1464
1470
  messageDetails.push(`version=${this.version}`);
1465
1471
  const reason = message;
1472
+ let url = "";
1473
+ switch (code) {
1474
+ case ErrorCode.NUMERIC_FAULT: {
1475
+ url = "NUMERIC_FAULT";
1476
+ const fault = message;
1477
+ switch (fault) {
1478
+ case "overflow":
1479
+ case "underflow":
1480
+ case "division-by-zero":
1481
+ url += "-" + fault;
1482
+ break;
1483
+ case "negative-power":
1484
+ case "negative-width":
1485
+ url += "-unsupported";
1486
+ break;
1487
+ case "unbound-bitwise-result":
1488
+ url += "-unbound-result";
1489
+ break;
1490
+ }
1491
+ break;
1492
+ }
1493
+ case ErrorCode.CALL_EXCEPTION:
1494
+ case ErrorCode.INSUFFICIENT_FUNDS:
1495
+ case ErrorCode.MISSING_NEW:
1496
+ case ErrorCode.NONCE_EXPIRED:
1497
+ case ErrorCode.REPLACEMENT_UNDERPRICED:
1498
+ case ErrorCode.TRANSACTION_REPLACED:
1499
+ case ErrorCode.UNPREDICTABLE_GAS_LIMIT:
1500
+ url = code;
1501
+ break;
1502
+ }
1503
+ if (url) {
1504
+ message += " [ See: https:/\/links.ethers.org/v5-errors-" + url + " ]";
1505
+ }
1466
1506
  if (messageDetails.length) {
1467
1507
  message += " (" + messageDetails.join(", ") + ")";
1468
1508
  }
@@ -1596,7 +1636,7 @@ class Logger {
1596
1636
  Logger.errors = ErrorCode;
1597
1637
  Logger.levels = LogLevel;
1598
1638
 
1599
- const version$1 = "bytes/5.5.0";
1639
+ const version$1 = "bytes/5.6.0";
1600
1640
 
1601
1641
  const logger = new Logger(version$1);
1602
1642
  ///////////////////////////////
@@ -1693,7 +1733,7 @@ function isHexString(value, length) {
1693
1733
  return true;
1694
1734
  }
1695
1735
 
1696
- const version = "sha2/5.5.0";
1736
+ const version = "sha2/5.6.0";
1697
1737
 
1698
1738
  new Logger(version);
1699
1739
  function sha256(data) {
@@ -2031,10 +2071,10 @@ const BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey('BPFLoader111111111111111
2031
2071
  const publicKey = (property = 'publicKey') => {
2032
2072
  return BufferLayout.blob(32, property);
2033
2073
  };
2074
+
2034
2075
  /**
2035
2076
  * Layout for a Rust String type
2036
2077
  */
2037
-
2038
2078
  const rustString = (property = 'string') => {
2039
2079
  const rsl = BufferLayout.struct([BufferLayout.u32('length'), BufferLayout.u32('lengthPadding'), BufferLayout.blob(BufferLayout.offset(BufferLayout.u32(), -8), 'chars')], property);
2040
2080
 
@@ -2042,24 +2082,26 @@ const rustString = (property = 'string') => {
2042
2082
 
2043
2083
  const _encode = rsl.encode.bind(rsl);
2044
2084
 
2045
- rsl.decode = (buffer, offset) => {
2046
- const data = _decode(buffer, offset);
2085
+ const rslShim = rsl;
2086
+
2087
+ rslShim.decode = (b, offset) => {
2088
+ const data = _decode(b, offset);
2047
2089
 
2048
- return data['chars'].toString('utf8');
2090
+ return data['chars'].toString();
2049
2091
  };
2050
2092
 
2051
- rsl.encode = (str, buffer, offset) => {
2093
+ rslShim.encode = (str, b, offset) => {
2052
2094
  const data = {
2053
2095
  chars: Buffer.from(str, 'utf8')
2054
2096
  };
2055
- return _encode(data, buffer, offset);
2097
+ return _encode(data, b, offset);
2056
2098
  };
2057
2099
 
2058
- rsl.alloc = str => {
2100
+ rslShim.alloc = str => {
2059
2101
  return BufferLayout.u32().span + BufferLayout.u32().span + Buffer.from(str, 'utf8').length;
2060
2102
  };
2061
2103
 
2062
- return rsl;
2104
+ return rslShim;
2063
2105
  };
2064
2106
  /**
2065
2107
  * Layout for an Authorized object
@@ -2179,7 +2221,7 @@ class Message {
2179
2221
  accounts,
2180
2222
  programIdIndex
2181
2223
  } = instruction;
2182
- const data = bs58.decode(instruction.data);
2224
+ const data = Array.from(bs58.decode(instruction.data));
2183
2225
  let keyIndicesCount = [];
2184
2226
  encodeLength(keyIndicesCount, accounts.length);
2185
2227
  let dataCount = [];
@@ -2187,7 +2229,7 @@ class Message {
2187
2229
  return {
2188
2230
  programIdIndex,
2189
2231
  keyIndicesCount: Buffer.from(keyIndicesCount),
2190
- keyIndices: Buffer.from(accounts),
2232
+ keyIndices: accounts,
2191
2233
  dataLength: Buffer.from(dataCount),
2192
2234
  data
2193
2235
  };
@@ -2591,6 +2633,14 @@ class Transaction {
2591
2633
  serializeMessage() {
2592
2634
  return this._compile().serialize();
2593
2635
  }
2636
+ /**
2637
+ * Get the estimated fee associated with a transaction
2638
+ */
2639
+
2640
+
2641
+ async getEstimatedFee(connection) {
2642
+ return (await connection.getFeeForMessage(this.compileMessage())).value;
2643
+ }
2594
2644
  /**
2595
2645
  * Specify the public keys which will be used to sign the Transaction.
2596
2646
  * The first signer will be used as the transaction fee payer account.
@@ -2954,10 +3004,6 @@ function sleep(ms) {
2954
3004
  return new Promise(resolve => setTimeout(resolve, ms));
2955
3005
  }
2956
3006
 
2957
- /**
2958
- * @internal
2959
- */
2960
-
2961
3007
  /**
2962
3008
  * Populate a buffer of instruction data using an InstructionType
2963
3009
  * @internal
@@ -3757,11 +3803,11 @@ class SystemProgram {
3757
3803
  }
3758
3804
  SystemProgram.programId = new PublicKey('11111111111111111111111111111111');
3759
3805
 
3806
+ // Keep program chunks under PACKET_DATA_SIZE, leaving enough room for the
3760
3807
  // rest of the Transaction fields
3761
3808
  //
3762
3809
  // TODO: replace 300 with a proper constant for the size of the other
3763
3810
  // Transaction fields
3764
-
3765
3811
  const CHUNK_SIZE = PACKET_DATA_SIZE - 300;
3766
3812
  /**
3767
3813
  * Program loader interface
@@ -3869,7 +3915,9 @@ class Loader {
3869
3915
  instruction: 0,
3870
3916
  // Load instruction
3871
3917
  offset,
3872
- bytes
3918
+ bytes: bytes,
3919
+ bytesLength: 0,
3920
+ bytesLengthPadding: 0
3873
3921
  }, data);
3874
3922
  const transaction = new Transaction().add({
3875
3923
  keys: [{
@@ -4319,16 +4367,30 @@ const VersionResult = type({
4319
4367
  const SimulatedTransactionResponseStruct = jsonRpcResultAndContext(type({
4320
4368
  err: nullable(union([type({}), string()])),
4321
4369
  logs: nullable(array(string())),
4322
- accounts: optional(nullable(array(type({
4370
+ accounts: optional(nullable(array(nullable(type({
4323
4371
  executable: boolean(),
4324
4372
  owner: string(),
4325
4373
  lamports: number(),
4326
4374
  data: array(string()),
4327
4375
  rentEpoch: optional(number())
4328
- })))),
4376
+ }))))),
4329
4377
  unitsConsumed: optional(number())
4330
4378
  }));
4331
4379
 
4380
+ /**
4381
+ * Expected JSON RPC response for the "getBlockProduction" message
4382
+ */
4383
+ const BlockProductionResponseStruct = jsonRpcResultAndContext(type({
4384
+ byIdentity: record(string(), array(number())),
4385
+ range: type({
4386
+ firstSlot: number(),
4387
+ lastSlot: number()
4388
+ })
4389
+ }));
4390
+ /**
4391
+ * A performance sample
4392
+ */
4393
+
4332
4394
  function createRpcClient(url, useHttps, httpHeaders, fetchMiddleware, disableRetryOnRateLimit) {
4333
4395
  let agentManager;
4334
4396
 
@@ -5189,6 +5251,14 @@ class Connection {
5189
5251
  get commitment() {
5190
5252
  return this._commitment;
5191
5253
  }
5254
+ /**
5255
+ * The RPC endpoint
5256
+ */
5257
+
5258
+
5259
+ get rpcEndpoint() {
5260
+ return this._rpcEndpoint;
5261
+ }
5192
5262
  /**
5193
5263
  * Fetch the balance for the specified public key, return with context
5194
5264
  */
@@ -5474,35 +5544,32 @@ class Connection {
5474
5544
  }
5475
5545
  }
5476
5546
  /**
5477
- * Fetch all the account info for multiple accounts specified by an array of public keys
5547
+ * Fetch all the account info for multiple accounts specified by an array of public keys, return with context
5478
5548
  */
5479
5549
 
5480
5550
 
5481
- async getMultipleAccountsInfo(publicKeys, configOrCommitment) {
5551
+ async getMultipleAccountsInfoAndContext(publicKeys, commitment) {
5482
5552
  const keys = publicKeys.map(key => key.toBase58());
5483
- let commitment;
5484
- let encoding = 'base64';
5485
-
5486
- if (configOrCommitment) {
5487
- if (typeof configOrCommitment === 'string') {
5488
- commitment = configOrCommitment;
5489
- encoding = 'base64';
5490
- } else {
5491
- commitment = configOrCommitment.commitment;
5492
- encoding = configOrCommitment.encoding || 'base64';
5493
- }
5494
- }
5495
5553
 
5496
- const args = this._buildArgs([keys], commitment, encoding);
5554
+ const args = this._buildArgs([keys], commitment, 'base64');
5497
5555
 
5498
5556
  const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
5499
- const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(ParsedAccountInfoResult))));
5557
+ const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(AccountInfoResult))));
5500
5558
 
5501
5559
  if ('error' in res) {
5502
5560
  throw new Error('failed to get info for accounts ' + keys + ': ' + res.error.message);
5503
5561
  }
5504
5562
 
5505
- return res.result.value;
5563
+ return res.result;
5564
+ }
5565
+ /**
5566
+ * Fetch all the account info for multiple accounts specified by an array of public keys
5567
+ */
5568
+
5569
+
5570
+ async getMultipleAccountsInfo(publicKeys, commitment) {
5571
+ const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitment);
5572
+ return res.value;
5506
5573
  }
5507
5574
  /**
5508
5575
  * Returns epoch activation information for a stake account that has been delegated
@@ -6114,6 +6181,54 @@ class Connection {
6114
6181
  })
6115
6182
  };
6116
6183
  }
6184
+ /*
6185
+ * Returns the current block height of the node
6186
+ */
6187
+
6188
+
6189
+ async getBlockHeight(commitment) {
6190
+ const args = this._buildArgs([], commitment);
6191
+
6192
+ const unsafeRes = await this._rpcRequest('getBlockHeight', args);
6193
+ const res = create(unsafeRes, jsonRpcResult(number()));
6194
+
6195
+ if ('error' in res) {
6196
+ throw new Error('failed to get block height information: ' + res.error.message);
6197
+ }
6198
+
6199
+ return res.result;
6200
+ }
6201
+ /*
6202
+ * Returns recent block production information from the current or previous epoch
6203
+ */
6204
+
6205
+
6206
+ async getBlockProduction(configOrCommitment) {
6207
+ let extra;
6208
+ let commitment;
6209
+
6210
+ if (typeof configOrCommitment === 'string') {
6211
+ commitment = configOrCommitment;
6212
+ } else if (configOrCommitment) {
6213
+ const {
6214
+ commitment: c,
6215
+ ...rest
6216
+ } = configOrCommitment;
6217
+ commitment = c;
6218
+ extra = rest;
6219
+ }
6220
+
6221
+ const args = this._buildArgs([], commitment, 'base64', extra);
6222
+
6223
+ const unsafeRes = await this._rpcRequest('getBlockProduction', args);
6224
+ const res = create(unsafeRes, BlockProductionResponseStruct);
6225
+
6226
+ if ('error' in res) {
6227
+ throw new Error('failed to get block production information: ' + res.error.message);
6228
+ }
6229
+
6230
+ return res.result;
6231
+ }
6117
6232
  /**
6118
6233
  * Fetch a confirmed or finalized transaction from the cluster.
6119
6234
  */
@@ -7595,16 +7710,18 @@ class Ed25519Program {
7595
7710
  const messageDataOffset = signatureOffset + signature.length;
7596
7711
  const numSignatures = 1;
7597
7712
  const instructionData = Buffer.alloc(messageDataOffset + message.length);
7713
+ const index = instructionIndex == null ? 0xffff // An index of `u16::MAX` makes it default to the current instruction.
7714
+ : instructionIndex;
7598
7715
  ED25519_INSTRUCTION_LAYOUT.encode({
7599
7716
  numSignatures,
7600
7717
  padding: 0,
7601
7718
  signatureOffset,
7602
- signatureInstructionIndex: instructionIndex,
7719
+ signatureInstructionIndex: index,
7603
7720
  publicKeyOffset,
7604
- publicKeyInstructionIndex: instructionIndex,
7721
+ publicKeyInstructionIndex: index,
7605
7722
  messageDataOffset,
7606
7723
  messageDataSize: message.length,
7607
- messageInstructionIndex: instructionIndex
7724
+ messageInstructionIndex: index
7608
7725
  }, instructionData);
7609
7726
  instructionData.fill(publicKey, publicKeyOffset);
7610
7727
  instructionData.fill(signature, signatureOffset);
@@ -7675,10 +7792,10 @@ class Authorized {
7675
7792
  }
7676
7793
 
7677
7794
  }
7795
+
7678
7796
  /**
7679
7797
  * Stake account lockup info
7680
7798
  */
7681
-
7682
7799
  class Lockup {
7683
7800
  /** Unix timestamp of lockup expiration */
7684
7801
 
@@ -7703,10 +7820,6 @@ class Lockup {
7703
7820
 
7704
7821
 
7705
7822
  }
7706
- /**
7707
- * Create stake account transaction params
7708
- */
7709
-
7710
7823
  Lockup.default = new Lockup(0, 0, PublicKey.default);
7711
7824
 
7712
7825
  /**
@@ -8734,8 +8847,8 @@ class VoteAccount {
8734
8847
  }
8735
8848
 
8736
8849
  function parseAuthorizedVoter({
8737
- epoch,
8738
- authorizedVoter
8850
+ authorizedVoter,
8851
+ epoch
8739
8852
  }) {
8740
8853
  return {
8741
8854
  epoch,
@@ -8764,7 +8877,7 @@ function getPriorVoters({
8764
8877
  return [];
8765
8878
  }
8766
8879
 
8767
- return [...buf.slice(idx + 1).map(parsePriorVoters), ...buf.slice(0, idx)];
8880
+ return [...buf.slice(idx + 1).map(parsePriorVoters), ...buf.slice(0, idx).map(parsePriorVoters)];
8768
8881
  }
8769
8882
 
8770
8883
  /**