@solana/web3.js 1.4.1 → 1.5.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
@@ -18470,8 +18470,10 @@ var solanaWeb3 = (function (exports) {
18470
18470
  */
18471
18471
 
18472
18472
 
18473
- async getConfirmedBlock(slot) {
18474
- const unsafeRes = await this._rpcRequest('getConfirmedBlock', [slot]);
18473
+ async getConfirmedBlock(slot, commitment) {
18474
+ const args = this._buildArgsAtLeastConfirmed([slot], commitment);
18475
+
18476
+ const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);
18475
18477
  const res = create(unsafeRes, GetConfirmedBlockRpcResult);
18476
18478
 
18477
18479
  if ('error' in res) {
@@ -18491,11 +18493,13 @@ var solanaWeb3 = (function (exports) {
18491
18493
  */
18492
18494
 
18493
18495
 
18494
- async getConfirmedBlockSignatures(slot) {
18495
- const unsafeRes = await this._rpcRequest('getConfirmedBlock', [slot, {
18496
+ async getConfirmedBlockSignatures(slot, commitment) {
18497
+ const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, {
18496
18498
  transactionDetails: 'signatures',
18497
18499
  rewards: false
18498
- }]);
18500
+ });
18501
+
18502
+ const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);
18499
18503
  const res = create(unsafeRes, GetConfirmedBlockSignaturesRpcResult);
18500
18504
 
18501
18505
  if ('error' in res) {
@@ -18515,8 +18519,10 @@ var solanaWeb3 = (function (exports) {
18515
18519
  */
18516
18520
 
18517
18521
 
18518
- async getConfirmedTransaction(signature) {
18519
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', [signature]);
18522
+ async getConfirmedTransaction(signature, commitment) {
18523
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment);
18524
+
18525
+ const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
18520
18526
  const res = create(unsafeRes, GetConfirmedTransactionRpcResult);
18521
18527
 
18522
18528
  if ('error' in res) {
@@ -18530,8 +18536,10 @@ var solanaWeb3 = (function (exports) {
18530
18536
  */
18531
18537
 
18532
18538
 
18533
- async getParsedConfirmedTransaction(signature) {
18534
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', [signature, 'jsonParsed']);
18539
+ async getParsedConfirmedTransaction(signature, commitment) {
18540
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
18541
+
18542
+ const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
18535
18543
  const res = create(unsafeRes, GetParsedConfirmedTransactionRpcResult);
18536
18544
 
18537
18545
  if ('error' in res) {
@@ -18545,11 +18553,13 @@ var solanaWeb3 = (function (exports) {
18545
18553
  */
18546
18554
 
18547
18555
 
18548
- async getParsedConfirmedTransactions(signatures) {
18556
+ async getParsedConfirmedTransactions(signatures, commitment) {
18549
18557
  const batch = signatures.map(signature => {
18558
+ const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');
18559
+
18550
18560
  return {
18551
18561
  methodName: 'getConfirmedTransaction',
18552
- args: [signature, 'jsonParsed']
18562
+ args
18553
18563
  };
18554
18564
  });
18555
18565
  const unsafeRes = await this._rpcBatchRequest(batch);
@@ -18587,7 +18597,7 @@ var solanaWeb3 = (function (exports) {
18587
18597
  }
18588
18598
 
18589
18599
  try {
18590
- const block = await this.getConfirmedBlockSignatures(startSlot);
18600
+ const block = await this.getConfirmedBlockSignatures(startSlot, 'finalized');
18591
18601
 
18592
18602
  if (block.signatures.length > 0) {
18593
18603
  options.until = block.signatures[block.signatures.length - 1].toString();
@@ -18638,8 +18648,10 @@ var solanaWeb3 = (function (exports) {
18638
18648
  */
18639
18649
 
18640
18650
 
18641
- async getConfirmedSignaturesForAddress2(address, options) {
18642
- const unsafeRes = await this._rpcRequest('getConfirmedSignaturesForAddress2', [address.toBase58(), options]);
18651
+ async getConfirmedSignaturesForAddress2(address, options, commitment) {
18652
+ const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options);
18653
+
18654
+ const unsafeRes = await this._rpcRequest('getConfirmedSignaturesForAddress2', args);
18643
18655
  const res = create(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);
18644
18656
 
18645
18657
  if ('error' in res) {
@@ -19349,6 +19361,20 @@ var solanaWeb3 = (function (exports) {
19349
19361
  */
19350
19362
 
19351
19363
 
19364
+ _buildArgsAtLeastConfirmed(args, override, encoding, extra) {
19365
+ const commitment = override || this._commitment;
19366
+
19367
+ if (commitment && !['confirmed', 'finalized'].includes(commitment)) {
19368
+ throw new Error('Using Connection with default commitment: `' + this._commitment + '`, but method requires at least `confirmed`');
19369
+ }
19370
+
19371
+ return this._buildArgs(args, override, encoding, extra);
19372
+ }
19373
+ /**
19374
+ * @internal
19375
+ */
19376
+
19377
+
19352
19378
  _wsOnSignatureNotification(notification) {
19353
19379
  const res = create(notification, SignatureNotificationResult);
19354
19380