@solana/web3.js 1.76.0 → 1.77.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.iife.js CHANGED
@@ -13704,6 +13704,29 @@ var solanaWeb3 = (function (exports) {
13704
13704
  }
13705
13705
  }
13706
13706
 
13707
+ // TODO: These constants should be removed in favor of reading them out of a
13708
+ // Syscall account
13709
+
13710
+ /**
13711
+ * @internal
13712
+ */
13713
+ const NUM_TICKS_PER_SECOND = 160;
13714
+
13715
+ /**
13716
+ * @internal
13717
+ */
13718
+ const DEFAULT_TICKS_PER_SLOT = 64;
13719
+
13720
+ /**
13721
+ * @internal
13722
+ */
13723
+ const NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
13724
+
13725
+ /**
13726
+ * @internal
13727
+ */
13728
+ const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;
13729
+
13707
13730
  const SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');
13708
13731
  const SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey('SysvarEpochSchedu1e111111111111111111111111');
13709
13732
  const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey('Sysvar1nstructions1111111111111111111111111');
@@ -14782,9 +14805,37 @@ var solanaWeb3 = (function (exports) {
14782
14805
  programId,
14783
14806
  data
14784
14807
  });
14785
- await sendAndConfirmTransaction(connection, transaction, [payer, program], {
14786
- commitment: 'confirmed'
14808
+ const deployCommitment = 'processed';
14809
+ const finalizeSignature = await connection.sendTransaction(transaction, [payer, program], {
14810
+ preflightCommitment: deployCommitment
14787
14811
  });
14812
+ const {
14813
+ context,
14814
+ value
14815
+ } = await connection.confirmTransaction({
14816
+ signature: finalizeSignature,
14817
+ lastValidBlockHeight: transaction.lastValidBlockHeight,
14818
+ blockhash: transaction.recentBlockhash
14819
+ }, deployCommitment);
14820
+ if (value.err) {
14821
+ throw new Error(`Transaction ${finalizeSignature} failed (${JSON.stringify(value)})`);
14822
+ }
14823
+ // We prevent programs from being usable until the slot after their deployment.
14824
+ // See https://github.com/solana-labs/solana/pull/29654
14825
+ while (true // eslint-disable-line no-constant-condition
14826
+ ) {
14827
+ try {
14828
+ const currentSlot = await connection.getSlot({
14829
+ commitment: deployCommitment
14830
+ });
14831
+ if (currentSlot > context.slot) {
14832
+ break;
14833
+ }
14834
+ } catch {
14835
+ /* empty */
14836
+ }
14837
+ await new Promise(resolve => setTimeout(resolve, Math.round(MS_PER_SLOT / 2)));
14838
+ }
14788
14839
  }
14789
14840
 
14790
14841
  // success
@@ -18145,29 +18196,6 @@ var solanaWeb3 = (function (exports) {
18145
18196
  }
18146
18197
  }
18147
18198
 
18148
- // TODO: These constants should be removed in favor of reading them out of a
18149
- // Syscall account
18150
-
18151
- /**
18152
- * @internal
18153
- */
18154
- const NUM_TICKS_PER_SECOND = 160;
18155
-
18156
- /**
18157
- * @internal
18158
- */
18159
- const DEFAULT_TICKS_PER_SLOT = 64;
18160
-
18161
- /**
18162
- * @internal
18163
- */
18164
- const NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;
18165
-
18166
- /**
18167
- * @internal
18168
- */
18169
- const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;
18170
-
18171
18199
  /**
18172
18200
  * @internal
18173
18201
  */
@@ -19599,7 +19627,7 @@ var solanaWeb3 = (function (exports) {
19599
19627
  /**
19600
19628
  * Fetch all the token accounts owned by the specified account
19601
19629
  *
19602
- * @return {Promise<RpcResponseAndContext<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>>>}
19630
+ * @return {Promise<RpcResponseAndContext<GetProgramAccountsResponse>}
19603
19631
  */
19604
19632
  async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {
19605
19633
  const {
@@ -19796,6 +19824,8 @@ var solanaWeb3 = (function (exports) {
19796
19824
  *
19797
19825
  * @return {Promise<Array<{pubkey: PublicKey, account: AccountInfo<Buffer>}>>}
19798
19826
  */
19827
+
19828
+ // eslint-disable-next-line no-dupe-class-members
19799
19829
  async getProgramAccounts(programId, configOrCommitment) {
19800
19830
  const {
19801
19831
  commitment,
@@ -19807,7 +19837,8 @@ var solanaWeb3 = (function (exports) {
19807
19837
  } = config || {};
19808
19838
  const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', configWithoutEncoding);
19809
19839
  const unsafeRes = await this._rpcRequest('getProgramAccounts', args);
19810
- const res = create(unsafeRes, jsonRpcResult(array(KeyedAccountInfoResult)));
19840
+ const baseSchema = array(KeyedAccountInfoResult);
19841
+ const res = configWithoutEncoding.withContext === true ? create(unsafeRes, jsonRpcResultAndContext(baseSchema)) : create(unsafeRes, jsonRpcResult(baseSchema));
19811
19842
  if ('error' in res) {
19812
19843
  throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);
19813
19844
  }
@@ -25614,7 +25645,7 @@ var solanaWeb3 = (function (exports) {
25614
25645
  }
25615
25646
  }
25616
25647
  VoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');
25617
- VoteProgram.space = 3731;
25648
+ VoteProgram.space = process.env.TEST_LIVE ? 3762 : 3731;
25618
25649
 
25619
25650
  const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');
25620
25651