@solana/web3.js 1.22.1 → 1.23.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.iife.js CHANGED
@@ -8325,6 +8325,8 @@ var solanaWeb3 = (function (exports) {
8325
8325
 
8326
8326
  var bs58 = basex(ALPHABET);
8327
8327
 
8328
+ var bs58$1 = bs58;
8329
+
8328
8330
  var browser$2 = {};
8329
8331
 
8330
8332
  /* eslint-env browser */
@@ -9486,7 +9488,7 @@ var solanaWeb3 = (function (exports) {
9486
9488
  } else {
9487
9489
  if (typeof value === 'string') {
9488
9490
  // assume base 58 encoding by default
9489
- const decoded = bs58.decode(value);
9491
+ const decoded = bs58$1.decode(value);
9490
9492
 
9491
9493
  if (decoded.length != 32) {
9492
9494
  throw new Error(`Invalid public key input`);
@@ -9519,7 +9521,7 @@ var solanaWeb3 = (function (exports) {
9519
9521
 
9520
9522
 
9521
9523
  toBase58() {
9522
- return bs58.encode(this.toBytes());
9524
+ return bs58$1.encode(this.toBytes());
9523
9525
  }
9524
9526
  /**
9525
9527
  * Return the byte array representation of the public key
@@ -12482,7 +12484,7 @@ var solanaWeb3 = (function (exports) {
12482
12484
  accounts,
12483
12485
  programIdIndex
12484
12486
  } = instruction;
12485
- const data = bs58.decode(instruction.data);
12487
+ const data = bs58$1.decode(instruction.data);
12486
12488
  let keyIndicesCount = [];
12487
12489
  encodeLength(keyIndicesCount, accounts.length);
12488
12490
  let dataCount = [];
@@ -12513,7 +12515,7 @@ var solanaWeb3 = (function (exports) {
12513
12515
  numReadonlyUnsignedAccounts: buffer.Buffer.from([this.header.numReadonlyUnsignedAccounts]),
12514
12516
  keyCount: buffer.Buffer.from(keyCount),
12515
12517
  keys: this.accountKeys.map(key => toBuffer(key.toBytes())),
12516
- recentBlockhash: bs58.decode(this.recentBlockhash)
12518
+ recentBlockhash: bs58$1.decode(this.recentBlockhash)
12517
12519
  };
12518
12520
  let signData = buffer.Buffer.alloc(2048);
12519
12521
  const length = signDataLayout.encode(transaction, signData);
@@ -12536,7 +12538,7 @@ var solanaWeb3 = (function (exports) {
12536
12538
 
12537
12539
  for (let i = 0; i < accountCount; i++) {
12538
12540
  const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
12539
- accountKeys.push(bs58.encode(buffer.Buffer.from(account)));
12541
+ accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
12540
12542
  }
12541
12543
 
12542
12544
  const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
@@ -12549,7 +12551,7 @@ var solanaWeb3 = (function (exports) {
12549
12551
  const accounts = guardedSplice(byteArray, 0, accountCount);
12550
12552
  const dataLength = decodeLength(byteArray);
12551
12553
  const dataSlice = guardedSplice(byteArray, 0, dataLength);
12552
- const data = bs58.encode(buffer.Buffer.from(dataSlice));
12554
+ const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
12553
12555
  instructions.push({
12554
12556
  programIdIndex,
12555
12557
  accounts,
@@ -12563,7 +12565,7 @@ var solanaWeb3 = (function (exports) {
12563
12565
  numReadonlySignedAccounts,
12564
12566
  numReadonlyUnsignedAccounts
12565
12567
  },
12566
- recentBlockhash: bs58.encode(buffer.Buffer.from(recentBlockhash)),
12568
+ recentBlockhash: bs58$1.encode(buffer.Buffer.from(recentBlockhash)),
12567
12569
  accountKeys,
12568
12570
  instructions
12569
12571
  };
@@ -12853,7 +12855,7 @@ var solanaWeb3 = (function (exports) {
12853
12855
  return {
12854
12856
  programIdIndex: accountKeys.indexOf(programId.toString()),
12855
12857
  accounts: instruction.keys.map(meta => accountKeys.indexOf(meta.pubkey.toString())),
12856
- data: bs58.encode(data)
12858
+ data: bs58$1.encode(data)
12857
12859
  };
12858
12860
  });
12859
12861
  instructions.forEach(instruction => {
@@ -13176,7 +13178,7 @@ var solanaWeb3 = (function (exports) {
13176
13178
 
13177
13179
  for (let i = 0; i < signatureCount; i++) {
13178
13180
  const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
13179
- signatures.push(bs58.encode(buffer.Buffer.from(signature)));
13181
+ signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
13180
13182
  }
13181
13183
 
13182
13184
  return Transaction.populate(Message.from(byteArray), signatures);
@@ -13196,7 +13198,7 @@ var solanaWeb3 = (function (exports) {
13196
13198
 
13197
13199
  signatures.forEach((signature, index) => {
13198
13200
  const sigPubkeyPair = {
13199
- signature: signature == bs58.encode(DEFAULT_SIGNATURE) ? null : bs58.decode(signature),
13201
+ signature: signature == bs58$1.encode(DEFAULT_SIGNATURE) ? null : bs58$1.decode(signature),
13200
13202
  publicKey: message.accountKeys[index]
13201
13203
  };
13202
13204
  transaction.signatures.push(sigPubkeyPair);
@@ -13213,7 +13215,7 @@ var solanaWeb3 = (function (exports) {
13213
13215
  transaction.instructions.push(new TransactionInstruction({
13214
13216
  keys,
13215
13217
  programId: message.accountKeys[instruction.programIdIndex],
13216
- data: bs58.decode(instruction.data)
13218
+ data: bs58$1.decode(instruction.data)
13217
13219
  }));
13218
13220
  });
13219
13221
  return transaction;
@@ -14093,8 +14095,7 @@ var solanaWeb3 = (function (exports) {
14093
14095
  * Can be used to calculate transaction fees
14094
14096
  */
14095
14097
  static getMinNumSignatures(dataLength) {
14096
- return 2 * ( // Every transaction requires two signatures (payer + program)
14097
- Math.ceil(dataLength / Loader.chunkSize) + 1 + // Add one for Create transaction
14098
+ return 2 * (Math.ceil(dataLength / Loader.chunkSize) + 1 + // Add one for Create transaction
14098
14099
  1) // Add one for Finalize transaction
14099
14100
  ;
14100
14101
  }
@@ -17392,6 +17393,8 @@ var solanaWeb3 = (function (exports) {
17392
17393
  callback(null, response);
17393
17394
  };
17394
17395
 
17396
+ var RpcClient = browser;
17397
+
17395
17398
  const MINIMUM_SLOT_PER_EPOCH = 32; // Returns the number of trailing zeros in the binary representation of self.
17396
17399
 
17397
17400
  function trailingZeros(n) {
@@ -17730,7 +17733,7 @@ var solanaWeb3 = (function (exports) {
17730
17733
  };
17731
17734
  }
17732
17735
 
17733
- const clientBrowser = new browser(async (request, callback) => {
17736
+ const clientBrowser = new RpcClient(async (request, callback) => {
17734
17737
  const agent = undefined;
17735
17738
  const options = {
17736
17739
  method: 'POST',
@@ -17756,8 +17759,8 @@ var solanaWeb3 = (function (exports) {
17756
17759
  if (res.status !== 429
17757
17760
  /* Too many requests */
17758
17761
  ) {
17759
- break;
17760
- }
17762
+ break;
17763
+ }
17761
17764
 
17762
17765
  if (disableRetryOnRateLimit === true) {
17763
17766
  break;
@@ -18947,7 +18950,7 @@ var solanaWeb3 = (function (exports) {
18947
18950
  let decodedSignature;
18948
18951
 
18949
18952
  try {
18950
- decodedSignature = bs58.decode(signature);
18953
+ decodedSignature = bs58$1.decode(signature);
18951
18954
  } catch (err) {
18952
18955
  throw new Error('signature must be base58 encoded: ' + signature);
18953
18956
  }
@@ -25257,7 +25260,7 @@ var solanaWeb3 = (function (exports) {
25257
25260
  hash.ripemd160 = hash.ripemd.ripemd160;
25258
25261
  }(hash$2));
25259
25262
 
25260
- var secp256k1 = {
25263
+ var secp256k1$1 = {
25261
25264
  doubles: {
25262
25265
  step: 4,
25263
25266
  points: [
@@ -26208,7 +26211,7 @@ var solanaWeb3 = (function (exports) {
26208
26211
 
26209
26212
  var pre;
26210
26213
  try {
26211
- pre = secp256k1;
26214
+ pre = secp256k1$1;
26212
26215
  } catch (e) {
26213
26216
  pre = undefined;
26214
26217
  }
@@ -27580,6 +27583,8 @@ var solanaWeb3 = (function (exports) {
27580
27583
 
27581
27584
  var elliptic = lib(elliptic$1);
27582
27585
 
27586
+ var secp256k1 = elliptic;
27587
+
27583
27588
  var sha3 = {exports: {}};
27584
27589
 
27585
27590
  /**
@@ -28238,7 +28243,7 @@ var solanaWeb3 = (function (exports) {
28238
28243
  const {
28239
28244
  publicKeyCreate,
28240
28245
  ecdsaSign
28241
- } = elliptic;
28246
+ } = secp256k1;
28242
28247
  const PRIVATE_KEY_BYTES = 32;
28243
28248
  const ETHEREUM_ADDRESS_BYTES = 20;
28244
28249
  const PUBLIC_KEY_BYTES = 64;
@@ -28282,13 +28287,15 @@ var solanaWeb3 = (function (exports) {
28282
28287
  publicKey,
28283
28288
  message,
28284
28289
  signature,
28285
- recoveryId
28290
+ recoveryId,
28291
+ instructionIndex
28286
28292
  } = params;
28287
28293
  return Secp256k1Program.createInstructionWithEthAddress({
28288
28294
  ethAddress: Secp256k1Program.publicKeyToEthAddress(publicKey),
28289
28295
  message,
28290
28296
  signature,
28291
- recoveryId
28297
+ recoveryId,
28298
+ instructionIndex
28292
28299
  });
28293
28300
  }
28294
28301
  /**
@@ -28302,7 +28309,8 @@ var solanaWeb3 = (function (exports) {
28302
28309
  ethAddress: rawAddress,
28303
28310
  message,
28304
28311
  signature,
28305
- recoveryId
28312
+ recoveryId,
28313
+ instructionIndex = 0
28306
28314
  } = params;
28307
28315
  let ethAddress;
28308
28316
 
@@ -28326,12 +28334,12 @@ var solanaWeb3 = (function (exports) {
28326
28334
  SECP256K1_INSTRUCTION_LAYOUT.encode({
28327
28335
  numSignatures,
28328
28336
  signatureOffset,
28329
- signatureInstructionIndex: 0,
28337
+ signatureInstructionIndex: instructionIndex,
28330
28338
  ethAddressOffset,
28331
- ethAddressInstructionIndex: 0,
28339
+ ethAddressInstructionIndex: instructionIndex,
28332
28340
  messageDataOffset,
28333
28341
  messageDataSize: message.length,
28334
- messageInstructionIndex: 0,
28342
+ messageInstructionIndex: instructionIndex,
28335
28343
  signature: toBuffer(signature),
28336
28344
  ethAddress: toBuffer(ethAddress),
28337
28345
  recoveryId
@@ -28352,7 +28360,8 @@ var solanaWeb3 = (function (exports) {
28352
28360
  static createInstructionWithPrivateKey(params) {
28353
28361
  const {
28354
28362
  privateKey: pkey,
28355
- message
28363
+ message,
28364
+ instructionIndex
28356
28365
  } = params;
28357
28366
  assert$i(pkey.length === PRIVATE_KEY_BYTES, `Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`);
28358
28367
 
@@ -28369,7 +28378,8 @@ var solanaWeb3 = (function (exports) {
28369
28378
  publicKey,
28370
28379
  message,
28371
28380
  signature,
28372
- recoveryId
28381
+ recoveryId,
28382
+ instructionIndex
28373
28383
  });
28374
28384
  } catch (error) {
28375
28385
  throw new Error(`Error creating instruction; ${error}`);