@solana/web3.js 1.13.1 → 1.14.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
@@ -18552,10 +18552,6 @@ var solanaWeb3 = (function (exports) {
18552
18552
  */
18553
18553
 
18554
18554
  const GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult(number());
18555
- /**
18556
- * @internal
18557
- */
18558
-
18559
18555
  const ConfirmedTransactionResult = type({
18560
18556
  signatures: array(string()),
18561
18557
  message: type({
@@ -18573,13 +18569,6 @@ var solanaWeb3 = (function (exports) {
18573
18569
  recentBlockhash: string()
18574
18570
  })
18575
18571
  });
18576
- const TransactionFromConfirmed = coerce(instance(Transaction), ConfirmedTransactionResult, result => {
18577
- const {
18578
- message,
18579
- signatures
18580
- } = result;
18581
- return Transaction.populate(new Message(message), signatures);
18582
- });
18583
18572
  const ParsedInstructionResult = type({
18584
18573
  parsed: unknown(),
18585
18574
  program: string(),
@@ -18675,7 +18664,7 @@ var solanaWeb3 = (function (exports) {
18675
18664
  previousBlockhash: string(),
18676
18665
  parentSlot: number(),
18677
18666
  transactions: array(type({
18678
- transaction: TransactionFromConfirmed,
18667
+ transaction: ConfirmedTransactionResult,
18679
18668
  meta: nullable(ConfirmedTransactionMetaResult)
18680
18669
  })),
18681
18670
  rewards: optional(array(type({
@@ -18703,9 +18692,9 @@ var solanaWeb3 = (function (exports) {
18703
18692
 
18704
18693
  const GetConfirmedTransactionRpcResult = jsonRpcResult(nullable(type({
18705
18694
  slot: number(),
18706
- transaction: TransactionFromConfirmed,
18707
18695
  meta: ConfirmedTransactionMetaResult,
18708
- blockTime: optional(nullable(number()))
18696
+ blockTime: optional(nullable(number())),
18697
+ transaction: ConfirmedTransactionResult
18709
18698
  })));
18710
18699
  /**
18711
18700
  * Expected JSON RPC response for the "getConfirmedTransaction" message
@@ -19518,7 +19507,8 @@ var solanaWeb3 = (function (exports) {
19518
19507
  }
19519
19508
  /**
19520
19509
  * Fetch the current total currency supply of the cluster in lamports
19521
- * @deprecated Deprecated since v1.2.8. Use `Connection.getSupply()` instead.
19510
+ *
19511
+ * @deprecated Deprecated since v1.2.8. Please use {@link getSupply} instead.
19522
19512
  */
19523
19513
 
19524
19514
 
@@ -19727,13 +19717,12 @@ var solanaWeb3 = (function (exports) {
19727
19717
  return res.result;
19728
19718
  }
19729
19719
  /**
19730
- * Fetch a list of Transactions and transaction statuses from the cluster
19731
- * for a confirmed block
19720
+ * Fetch a processed block from the cluster.
19732
19721
  */
19733
19722
 
19734
19723
 
19735
- async getConfirmedBlock(slot, commitment) {
19736
- const args = this._buildArgsAtLeastConfirmed([slot], commitment);
19724
+ async getBlock(slot, opts) {
19725
+ const args = this._buildArgsAtLeastConfirmed([slot], opts && opts.commitment);
19737
19726
 
19738
19727
  const unsafeRes = await this._rpcRequest('getConfirmedBlock', args);
19739
19728
  const res = create(unsafeRes, GetConfirmedBlockRpcResult);
@@ -19743,12 +19732,73 @@ var solanaWeb3 = (function (exports) {
19743
19732
  }
19744
19733
 
19745
19734
  const result = res.result;
19735
+ if (!result) return result;
19736
+ return { ...result,
19737
+ transactions: result.transactions.map(({
19738
+ transaction,
19739
+ meta
19740
+ }) => {
19741
+ const message = new Message(transaction.message);
19742
+ return {
19743
+ meta,
19744
+ transaction: { ...transaction,
19745
+ message
19746
+ }
19747
+ };
19748
+ })
19749
+ };
19750
+ }
19751
+ /**
19752
+ * Fetch a processed transaction from the cluster.
19753
+ */
19754
+
19755
+
19756
+ async getTransaction(signature, opts) {
19757
+ const args = this._buildArgsAtLeastConfirmed([signature], opts && opts.commitment);
19758
+
19759
+ const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
19760
+ const res = create(unsafeRes, GetConfirmedTransactionRpcResult);
19761
+
19762
+ if ('error' in res) {
19763
+ throw new Error('failed to get confirmed transaction: ' + res.error.message);
19764
+ }
19765
+
19766
+ const result = res.result;
19767
+ if (!result) return result;
19768
+ return { ...result,
19769
+ transaction: { ...result.transaction,
19770
+ message: new Message(result.transaction.message)
19771
+ }
19772
+ };
19773
+ }
19774
+ /**
19775
+ * Fetch a list of Transactions and transaction statuses from the cluster
19776
+ * for a confirmed block.
19777
+ *
19778
+ * @deprecated Deprecated since v1.13.0. Please use {@link getBlock} instead.
19779
+ */
19780
+
19781
+
19782
+ async getConfirmedBlock(slot, commitment) {
19783
+ const result = await this.getBlock(slot, {
19784
+ commitment
19785
+ });
19746
19786
 
19747
19787
  if (!result) {
19748
19788
  throw new Error('Confirmed block ' + slot + ' not found');
19749
19789
  }
19750
19790
 
19751
- return result;
19791
+ return { ...result,
19792
+ transactions: result.transactions.map(({
19793
+ transaction,
19794
+ meta
19795
+ }) => {
19796
+ return {
19797
+ meta,
19798
+ transaction: Transaction.populate(transaction.message, transaction.signatures)
19799
+ };
19800
+ })
19801
+ };
19752
19802
  }
19753
19803
  /**
19754
19804
  * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
@@ -19782,16 +19832,17 @@ var solanaWeb3 = (function (exports) {
19782
19832
 
19783
19833
 
19784
19834
  async getConfirmedTransaction(signature, commitment) {
19785
- const args = this._buildArgsAtLeastConfirmed([signature], commitment);
19786
-
19787
- const unsafeRes = await this._rpcRequest('getConfirmedTransaction', args);
19788
- const res = create(unsafeRes, GetConfirmedTransactionRpcResult);
19789
-
19790
- if ('error' in res) {
19791
- throw new Error('failed to get confirmed transaction: ' + res.error.message);
19792
- }
19793
-
19794
- return res.result;
19835
+ const result = await this.getTransaction(signature, {
19836
+ commitment
19837
+ });
19838
+ if (!result) return result;
19839
+ const {
19840
+ message,
19841
+ signatures
19842
+ } = result.transaction;
19843
+ return { ...result,
19844
+ transaction: Transaction.populate(message, signatures)
19845
+ };
19795
19846
  }
19796
19847
  /**
19797
19848
  * Fetch parsed transaction details for a confirmed transaction
@@ -19839,7 +19890,8 @@ var solanaWeb3 = (function (exports) {
19839
19890
  /**
19840
19891
  * Fetch a list of all the confirmed signatures for transactions involving an address
19841
19892
  * within a specified slot range. Max range allowed is 10,000 slots.
19842
- * @deprecated Deprecated since v1.3. Use `Connection.getConfirmedSignaturesForAddress2()` instead.
19893
+ *
19894
+ * @deprecated Deprecated since v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.
19843
19895
  *
19844
19896
  * @param address queried address
19845
19897
  * @param startSlot start slot, inclusive