@solana/web3.js 2.0.0-experimental.e72afd8 → 2.0.0-experimental.e9c1b10

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.
Files changed (42) hide show
  1. package/README.md +21 -23
  2. package/dist/index.browser.cjs +158 -33
  3. package/dist/index.browser.cjs.map +1 -1
  4. package/dist/index.browser.js +124 -33
  5. package/dist/index.browser.js.map +1 -1
  6. package/dist/index.development.js +4046 -2468
  7. package/dist/index.development.js.map +1 -1
  8. package/dist/index.native.js +124 -33
  9. package/dist/index.native.js.map +1 -1
  10. package/dist/index.node.cjs +158 -33
  11. package/dist/index.node.cjs.map +1 -1
  12. package/dist/index.node.js +124 -33
  13. package/dist/index.node.js.map +1 -1
  14. package/dist/index.production.min.js +270 -80
  15. package/dist/types/airdrop-confirmer.d.ts +3 -3
  16. package/dist/types/airdrop-confirmer.d.ts.map +1 -1
  17. package/dist/types/airdrop.d.ts +2 -2
  18. package/dist/types/airdrop.d.ts.map +1 -1
  19. package/dist/types/decode-transaction.d.ts +10 -0
  20. package/dist/types/decode-transaction.d.ts.map +1 -0
  21. package/dist/types/index.d.ts +16 -9
  22. package/dist/types/index.d.ts.map +1 -1
  23. package/dist/types/rpc-default-config.d.ts.map +1 -1
  24. package/dist/types/rpc-integer-overflow-error.d.ts +3 -2
  25. package/dist/types/rpc-integer-overflow-error.d.ts.map +1 -1
  26. package/dist/types/rpc-request-coalescer.d.ts.map +1 -1
  27. package/dist/types/rpc-subscription-coalescer.d.ts +1 -1
  28. package/dist/types/rpc-subscription-coalescer.d.ts.map +1 -1
  29. package/dist/types/rpc.d.ts +2 -1
  30. package/dist/types/rpc.d.ts.map +1 -1
  31. package/dist/types/send-transaction.d.ts +2 -3
  32. package/dist/types/send-transaction.d.ts.map +1 -1
  33. package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +9 -4
  34. package/dist/types/transaction-confirmation-strategy-blockheight.d.ts.map +1 -1
  35. package/dist/types/transaction-confirmation-strategy-nonce.d.ts +1 -2
  36. package/dist/types/transaction-confirmation-strategy-nonce.d.ts.map +1 -1
  37. package/dist/types/transaction-confirmation-strategy-racer.d.ts +1 -1
  38. package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts +1 -2
  39. package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts.map +1 -1
  40. package/dist/types/transaction-confirmation.d.ts +6 -6
  41. package/dist/types/transaction-confirmation.d.ts.map +1 -1
  42. package/package.json +21 -16
package/README.md CHANGED
@@ -34,17 +34,17 @@ In response to your feedback, we began a process of modernizing the library to p
34
34
  ### For use in Node.js or a web application
35
35
 
36
36
  ```shell
37
- npm install --save @solana/web3.js@ts
37
+ npm install --save @solana/web3.js@tp
38
38
  ```
39
39
 
40
40
  ### For use in a browser, without a build system
41
41
 
42
42
  ```html
43
43
  <!-- Development (debug mode, unminified) -->
44
- <script src="https://unpkg.com/@solana/web3.js@ts/dist/index.development.js"></script>
44
+ <script src="https://unpkg.com/@solana/web3.js@tp/dist/index.development.js"></script>
45
45
 
46
46
  <!-- Production (minified) -->
47
- <script src="https://unpkg.com/@solana/web3.js@ts/dist/index.production.min.js"></script>
47
+ <script src="https://unpkg.com/@solana/web3.js@tp/dist/index.production.min.js"></script>
48
48
  ```
49
49
 
50
50
  What follows is an overview of *why* the library was re-engineered, what changes have been introduced, and how the JavaScript landscape might look across Solana in the near future.
@@ -80,7 +80,7 @@ The inability to customize web3.js has been a source of frustration for some:
80
80
 
81
81
  ## Lagging Behind Modern JavaScript
82
82
 
83
- The advance of modern JavaScript features presents an opportunity to developers of crypto applcations, such as the ability to use native Ed25519 keys and to express large values as native `bigint`.
83
+ The advance of modern JavaScript features presents an opportunity to developers of crypto applications, such as the ability to use native Ed25519 keys and to express large values as native `bigint`.
84
84
 
85
85
  The Web Incubator Community Group has advocated for the addition of Ed25519 support to the [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API), and support has already landed in *most* modern JavaScript runtimes.
86
86
 
@@ -102,7 +102,7 @@ Enter web3.js 2.0. The new API aims to deliver a re-imagined experience of build
102
102
 
103
103
  ## Features
104
104
 
105
- The new (2.0) version of `@solana/web3.js` aims to address shortcomings in the legacy library first, then goes even further .
105
+ The new (2.0) version of `@solana/web3.js` aims to address shortcomings in the legacy library first, then goes even further.
106
106
 
107
107
  ### Tree-Shaking
108
108
 
@@ -251,8 +251,7 @@ const rpc = createJsonRpc<SolanaRpcMethods>({ api, transport });
251
251
  If you want to, you can also reduce the scope of the API’s type-spec so you are left only with the types you need. Keep in mind types don’t affect bundle size, but you may choose to scope the type-spec for a variety of reasons, including reducing TypeScript noise.
252
252
 
253
253
  ```tsx
254
- import { createSolanaRpcApi } from '@solana/rpc-core';
255
- import type { GetAccountInfoApi } from '@solana/rpc-core/dist/types/rpc-methods/getAccountInfo';
254
+ import { createSolanaRpcApi, type GetAccountInfoApi } from '@solana/rpc-core';
256
255
  import { createHttpTransport, createJsonRpc } from '@solana/rpc-transport';
257
256
 
258
257
  const api = createSolanaRpcApi();
@@ -325,8 +324,7 @@ Here’s an example of how someone might implement a “round robin” approach
325
324
 
326
325
  ```tsx
327
326
  import { createSolanaRpcApi } from '@solana/rpc-core';
328
- import { createJsonRpc } from '@solana/rpc-transport';
329
- import { IRpcTransport } from '@solana/rpc-transport/dist/types/transports/transport-types';
327
+ import { createJsonRpc, type IRpcTransport } from '@solana/rpc-transport';
330
328
  import { createDefaultRpcTransport } from '@solana/web3.js';
331
329
 
332
330
  // Create a transport for each RPC server
@@ -364,10 +362,9 @@ Another example of a possible customization for RPC transports is sharding. Here
364
362
  The transport library can also be used to implement custom retry logic on any request:
365
363
 
366
364
  ```tsx
367
- import { createDefaultRpcTransport } from "@solana/web3.js";
368
- import { IRpcTransport } from "@solana/rpc-transport/dist/types/transports/transport-types";
369
- import { createJsonRpc } from "@solana/rpc-transport";
370
- import { createSolanaRpcApi } from "@solana/rpc-core";
365
+ import { createDefaultRpcTransport } from '@solana/web3.js';
366
+ import { createJsonRpc, IRpcTransport } from '@solana/rpc-transport';
367
+ import { createSolanaRpcApi } from '@solana/rpc-core';
371
368
 
372
369
  // Set the maximum number of attempts to retry a request
373
370
  const MAX_ATTEMPTS = 4;
@@ -425,15 +422,14 @@ Perhaps your application needs to make a large number of requests, or needs to f
425
422
 
426
423
  ```tsx
427
424
  import { createSolanaRpcApi } from '@solana/rpc-core';
428
- import { createJsonRpc } from '@solana/rpc-transport';
429
- import { IRpcTransport } from '@solana/rpc-transport/dist/types/transports/transport-types';
425
+ import { createJsonRpc, IRpcTransport } from '@solana/rpc-transport';
430
426
  import { createDefaultRpcTransport } from '@solana/web3.js';
431
427
 
432
428
  // Create multiple transports
433
- const transportA = createDefaultRpcTransport({ url: 'https://mainnet-beta.my-server-1.com' }));
434
- const transportB = createDefaultRpcTransport({ url: 'https://mainnet-beta.my-server-2.com' }));
435
- const transportC = createDefaultRpcTransport({ url: 'https://mainnet-beta.my-server-3.com' }));
436
- const transportD = createDefaultRpcTransport({ url: 'https://mainnet-beta.my-server-4.com' }));
429
+ const transportA = createDefaultRpcTransport({ url: 'https://mainnet-beta.my-server-1.com' });
430
+ const transportB = createDefaultRpcTransport({ url: 'https://mainnet-beta.my-server-2.com' });
431
+ const transportC = createDefaultRpcTransport({ url: 'https://mainnet-beta.my-server-3.com' });
432
+ const transportD = createDefaultRpcTransport({ url: 'https://mainnet-beta.my-server-4.com' });
437
433
 
438
434
  // Function to determine which shard to use based on the request method
439
435
  function selectShard(method: string): IRpcTransport {
@@ -551,7 +547,7 @@ for await (const notification of accountNotifications) {
551
547
 
552
548
  One of the most crucial aspects of any subscription API is managing potential missed messages. Missing messages, such as account state updates, could be catastrophic for an application. That’s why the new library provides native support for recovering missed messages using the `AsyncIterator`.
553
549
 
554
- When a connection fails unexpectedly, any messages you miss while disconnected can result in your UI falling behind or becoming corrupt. Because subscription failure is now made explicit in the new API, you can implement ‘catch up’ logic after re-estabilshing the subscription.
550
+ When a connection fails unexpectedly, any messages you miss while disconnected can result in your UI falling behind or becoming corrupt. Because subscription failure is now made explicit in the new API, you can implement ‘catch up’ logic after re-establishing the subscription.
555
551
 
556
552
  Here’s an example of such logic:
557
553
 
@@ -754,7 +750,7 @@ const transactionSignedWithFeePayer = await signTransaction([signer], transactio
754
750
 
755
751
  Transaction objects are also ********frozen by these functions******** to prevent transactions from being mutated in place by functions you pass them to.
756
752
 
757
- Building transactions in this manner might feel different to what you’re used to. Also, we certainly wouldn’t want you to have to bind transformed transactions to a new variable at each step, so we have released a functional programming library dubbed `@solana/functional` that lets you build transactions in **********************************pipelines**********************************. Here’s how it can be used:
753
+ Building transactions in this manner might feel different from what you’re used to. Also, we certainly wouldn’t want you to have to bind transformed transactions to a new variable at each step, so we have released a functional programming library dubbed `@solana/functional` that lets you build transactions in **********************************pipelines**********************************. Here’s how it can be used:
758
754
 
759
755
  ```tsx
760
756
  import { pipe } from '@solana/functional';
@@ -788,6 +784,8 @@ Solana’s codecs libraries are broken up into modular components so you only ne
788
784
  - `@solana/codecs-data-structures`: Codecs and serializers for structs
789
785
  - `@solana/options`: Designed to build codecs and serializers for types that mimic Rust’s enums, which can include embedded data within their variants such as values, tuples, and structs
790
786
 
787
+ These packages are included in the main `@solana/web3.js` library but you may also import them from `@solana/codecs` if you only need the codecs.
788
+
791
789
  Here’s an example of encoding and decoding a custom struct with some strings and numbers:
792
790
 
793
791
  ```tsx
@@ -814,7 +812,7 @@ const myToken = {
814
812
  };
815
813
 
816
814
  const myEncodedToken: Uint8Array = structCodec.encode(myToken);
817
- const myDecodedToken = structCodec.decode(myEncodedToken)[0];
815
+ const myDecodedToken = structCodec.decode(myEncodedToken);
818
816
 
819
817
  myDecodedToken satisfies {
820
818
  amount: bigint;
@@ -913,7 +911,7 @@ const blockWithRewardsAndTransactionsResponse = await rpc.getBlock(0n, {
913
911
 
914
912
  ### Catching Compile-Time Bugs with TypeScript
915
913
 
916
- As previously mentioned, the type coverage in web3.js 2.0 allow developers to catch common bugs at compile time, rather than runtime.
914
+ As previously mentioned, the type coverage in web3.js 2.0 allows developers to catch common bugs at compile time, rather than runtime.
917
915
 
918
916
  In the example below, a transaction is created and then attempted to be compiled without setting the fee payer. This would result in a runtime error from the RPC, but instead you will see a type error from TypeScript as you type:
919
917
 
@@ -1,15 +1,19 @@
1
1
  'use strict';
2
2
 
3
+ var accounts = require('@solana/accounts');
3
4
  var addresses = require('@solana/addresses');
5
+ var codecs = require('@solana/codecs');
6
+ var functional = require('@solana/functional');
4
7
  var instructions = require('@solana/instructions');
5
8
  var keys = require('@solana/keys');
9
+ var programs = require('@solana/programs');
10
+ var rpcParsedTypes = require('@solana/rpc-parsed-types');
6
11
  var rpcTypes = require('@solana/rpc-types');
12
+ var signers = require('@solana/signers');
7
13
  var transactions = require('@solana/transactions');
8
- var functional = require('@solana/functional');
9
14
  var rpcCore = require('@solana/rpc-core');
10
15
  var rpcTransport = require('@solana/rpc-transport');
11
16
  var fastStableStringify = require('fast-stable-stringify');
12
- var codecsStrings = require('@solana/codecs-strings');
13
17
 
14
18
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
19
 
@@ -172,6 +176,36 @@ async function requestAndConfirmAirdrop({
172
176
  });
173
177
  return airdropTransactionSignature;
174
178
  }
179
+ var compiledTransactionDecoder = void 0;
180
+ async function fetchLookupTables(lookupTableAddresses, rpc, config) {
181
+ const fetchedLookupTables = await accounts.fetchJsonParsedAccounts(
182
+ rpc,
183
+ lookupTableAddresses,
184
+ config
185
+ );
186
+ accounts.assertAccountsDecoded(fetchedLookupTables);
187
+ accounts.assertAccountsExist(fetchedLookupTables);
188
+ return fetchedLookupTables.reduce((acc, lookup) => {
189
+ return {
190
+ ...acc,
191
+ [lookup.address]: lookup.data.addresses
192
+ };
193
+ }, {});
194
+ }
195
+ async function decodeTransaction(encodedTransaction, rpc, config) {
196
+ const { lastValidBlockHeight, ...fetchAccountsConfig } = config ?? {};
197
+ if (!compiledTransactionDecoder)
198
+ compiledTransactionDecoder = transactions.getCompiledTransactionDecoder();
199
+ const compiledTransaction = compiledTransactionDecoder.decode(encodedTransaction);
200
+ const { compiledMessage } = compiledTransaction;
201
+ const lookupTables = "addressTableLookups" in compiledMessage && compiledMessage.addressTableLookups !== void 0 && compiledMessage.addressTableLookups.length > 0 ? compiledMessage.addressTableLookups : [];
202
+ const lookupTableAddresses = lookupTables.map((l) => l.lookupTableAddress);
203
+ const fetchedLookupTables = lookupTableAddresses.length > 0 ? await fetchLookupTables(lookupTableAddresses, rpc, fetchAccountsConfig) : {};
204
+ return transactions.decompileTransaction(compiledTransaction, {
205
+ addressesByLookupTableAddress: fetchedLookupTables,
206
+ lastValidBlockHeight
207
+ });
208
+ }
175
209
 
176
210
  // src/rpc-integer-overflow-error.ts
177
211
  var SolanaJsonRpcIntegerOverflowError = class extends Error {
@@ -179,22 +213,26 @@ var SolanaJsonRpcIntegerOverflowError = class extends Error {
179
213
  keyPath;
180
214
  value;
181
215
  constructor(methodName, keyPath, value) {
182
- const argPosition = (typeof keyPath[0] === "number" ? keyPath[0] : parseInt(keyPath[0], 10)) + 1;
183
- let ordinal = "";
184
- const lastDigit = argPosition % 10;
185
- const lastTwoDigits = argPosition % 100;
186
- if (lastDigit == 1 && lastTwoDigits != 11) {
187
- ordinal = argPosition + "st";
188
- } else if (lastDigit == 2 && lastTwoDigits != 12) {
189
- ordinal = argPosition + "nd";
190
- } else if (lastDigit == 3 && lastTwoDigits != 13) {
191
- ordinal = argPosition + "rd";
216
+ let argumentLabel = "";
217
+ if (typeof keyPath[0] === "number") {
218
+ const argPosition = keyPath[0] + 1;
219
+ const lastDigit = argPosition % 10;
220
+ const lastTwoDigits = argPosition % 100;
221
+ if (lastDigit == 1 && lastTwoDigits != 11) {
222
+ argumentLabel = argPosition + "st";
223
+ } else if (lastDigit == 2 && lastTwoDigits != 12) {
224
+ argumentLabel = argPosition + "nd";
225
+ } else if (lastDigit == 3 && lastTwoDigits != 13) {
226
+ argumentLabel = argPosition + "rd";
227
+ } else {
228
+ argumentLabel = argPosition + "th";
229
+ }
192
230
  } else {
193
- ordinal = argPosition + "th";
231
+ argumentLabel = `\`${keyPath[0].toString()}\``;
194
232
  }
195
233
  const path = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : null;
196
234
  super(
197
- `The ${ordinal} argument to the \`${methodName}\` RPC method${path ? ` at path \`${path}\`` : ""} was \`${value}\`. This number is unsafe for use with the Solana JSON-RPC because it exceeds \`Number.MAX_SAFE_INTEGER\`.`
235
+ `The ${argumentLabel} argument to the \`${methodName}\` RPC method${path ? ` at path \`${path}\`` : ""} was \`${value}\`. This number is unsafe for use with the Solana JSON-RPC because it exceeds \`Number.MAX_SAFE_INTEGER\`.`
198
236
  );
199
237
  this.keyPath = keyPath;
200
238
  this.methodName = methodName;
@@ -207,6 +245,7 @@ var SolanaJsonRpcIntegerOverflowError = class extends Error {
207
245
 
208
246
  // src/rpc-default-config.ts
209
247
  var DEFAULT_RPC_CONFIG = {
248
+ defaultCommitment: "confirmed",
210
249
  onIntegerOverflow(methodName, keyPath, value) {
211
250
  throw new SolanaJsonRpcIntegerOverflowError(methodName, keyPath, value);
212
251
  }
@@ -442,13 +481,23 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
442
481
  }
443
482
  if (coalescedRequestsByDeduplicationKey[deduplicationKey] == null) {
444
483
  const abortController = new AbortController();
484
+ const responsePromise = (async () => {
485
+ try {
486
+ return await transport({
487
+ ...config,
488
+ signal: abortController.signal
489
+ });
490
+ } catch (e) {
491
+ if (e && typeof e === "object" && "name" in e && e.name === "AbortError") {
492
+ return;
493
+ }
494
+ throw e;
495
+ }
496
+ })();
445
497
  coalescedRequestsByDeduplicationKey[deduplicationKey] = {
446
498
  abortController,
447
499
  numConsumers: 0,
448
- responsePromise: transport({
449
- ...config,
450
- signal: abortController.signal
451
- })
500
+ responsePromise
452
501
  };
453
502
  }
454
503
  const coalescedRequest = coalescedRequestsByDeduplicationKey[deduplicationKey];
@@ -613,22 +662,52 @@ function createDefaultRpcSubscriptionsTransport(config) {
613
662
  }
614
663
 
615
664
  // src/transaction-confirmation-strategy-blockheight.ts
616
- function createBlockHeightExceedencePromiseFactory(rpcSubscriptions) {
617
- return async function getBlockHeightExceedencePromise({ abortSignal: callerAbortSignal, lastValidBlockHeight }) {
665
+ function createBlockHeightExceedencePromiseFactory({
666
+ rpc,
667
+ rpcSubscriptions
668
+ }) {
669
+ return async function getBlockHeightExceedencePromise({
670
+ abortSignal: callerAbortSignal,
671
+ commitment,
672
+ lastValidBlockHeight
673
+ }) {
618
674
  const abortController = new AbortController();
619
- function handleAbort() {
675
+ const handleAbort = () => {
620
676
  abortController.abort();
621
- }
677
+ };
622
678
  callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
623
- const slotNotifications = await rpcSubscriptions.slotNotifications().subscribe({ abortSignal: abortController.signal });
679
+ async function getBlockHeightAndDifferenceBetweenSlotHeightAndBlockHeight() {
680
+ const { absoluteSlot, blockHeight } = await rpc.getEpochInfo({ commitment }).send({ abortSignal: abortController.signal });
681
+ return {
682
+ blockHeight,
683
+ differenceBetweenSlotHeightAndBlockHeight: absoluteSlot - blockHeight
684
+ };
685
+ }
624
686
  try {
625
- for await (const slotNotification of slotNotifications) {
626
- if (slotNotification.slot > lastValidBlockHeight) {
627
- throw new Error(
628
- "The network has progressed past the last block for which this transaction could have committed."
629
- );
687
+ const [slotNotifications, { blockHeight, differenceBetweenSlotHeightAndBlockHeight }] = await Promise.all([
688
+ rpcSubscriptions.slotNotifications().subscribe({ abortSignal: abortController.signal }),
689
+ getBlockHeightAndDifferenceBetweenSlotHeightAndBlockHeight()
690
+ ]);
691
+ if (blockHeight <= lastValidBlockHeight) {
692
+ let lastKnownDifferenceBetweenSlotHeightAndBlockHeight = differenceBetweenSlotHeightAndBlockHeight;
693
+ for await (const slotNotification of slotNotifications) {
694
+ const { slot } = slotNotification;
695
+ if (slot - lastKnownDifferenceBetweenSlotHeightAndBlockHeight > lastValidBlockHeight) {
696
+ const {
697
+ blockHeight: currentBlockHeight,
698
+ differenceBetweenSlotHeightAndBlockHeight: currentDifferenceBetweenSlotHeightAndBlockHeight
699
+ } = await getBlockHeightAndDifferenceBetweenSlotHeightAndBlockHeight();
700
+ if (currentBlockHeight > lastValidBlockHeight) {
701
+ break;
702
+ } else {
703
+ lastKnownDifferenceBetweenSlotHeightAndBlockHeight = currentDifferenceBetweenSlotHeightAndBlockHeight;
704
+ }
705
+ }
630
706
  }
631
707
  }
708
+ throw new Error(
709
+ "The network has progressed past the last block for which this transaction could have been committed."
710
+ );
632
711
  } finally {
633
712
  abortController.abort();
634
713
  }
@@ -650,12 +729,12 @@ function createNonceInvalidationPromiseFactory(rpc, rpcSubscriptions) {
650
729
  }
651
730
  callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
652
731
  const accountNotifications = await rpcSubscriptions.accountNotifications(nonceAccountAddress, { commitment, encoding: "base64" }).subscribe({ abortSignal: abortController.signal });
653
- const base58Decoder = codecsStrings.getBase58Decoder();
654
- const base64Encoder = codecsStrings.getBase64Encoder();
732
+ const base58Decoder = codecs.getBase58Decoder();
733
+ const base64Encoder = codecs.getBase64Encoder();
655
734
  function getNonceFromAccountData([base64EncodedBytes]) {
656
735
  const data = base64Encoder.encode(base64EncodedBytes);
657
736
  const nonceValueBytes = data.slice(NONCE_VALUE_OFFSET, NONCE_VALUE_OFFSET + 32);
658
- return base58Decoder.decode(nonceValueBytes)[0];
737
+ return base58Decoder.decode(nonceValueBytes);
659
738
  }
660
739
  const nonceAccountDidAdvancePromise = (async () => {
661
740
  for await (const accountNotification of accountNotifications) {
@@ -720,7 +799,10 @@ function createDefaultRecentTransactionConfirmer({
720
799
  rpc,
721
800
  rpcSubscriptions
722
801
  }) {
723
- const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory(rpcSubscriptions);
802
+ const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory({
803
+ rpc,
804
+ rpcSubscriptions
805
+ });
724
806
  const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory(
725
807
  rpc,
726
808
  rpcSubscriptions
@@ -753,10 +835,16 @@ async function waitForRecentTransactionConfirmation(config) {
753
835
  await raceStrategies(
754
836
  transactions.getSignatureFromTransaction(config.transaction),
755
837
  config,
756
- function getSpecificStrategiesForRace({ abortSignal, getBlockHeightExceedencePromise, transaction }) {
838
+ function getSpecificStrategiesForRace({
839
+ abortSignal,
840
+ commitment,
841
+ getBlockHeightExceedencePromise,
842
+ transaction
843
+ }) {
757
844
  return [
758
845
  getBlockHeightExceedencePromise({
759
846
  abortSignal,
847
+ commitment,
760
848
  lastValidBlockHeight: transaction.lifetimeConstraint.lastValidBlockHeight
761
849
  })
762
850
  ];
@@ -891,17 +979,36 @@ exports.createRecentSignatureConfirmationPromiseFactory = createRecentSignatureC
891
979
  exports.createSolanaRpc = createSolanaRpc;
892
980
  exports.createSolanaRpcSubscriptions = createSolanaRpcSubscriptions;
893
981
  exports.createSolanaRpcSubscriptions_UNSTABLE = createSolanaRpcSubscriptions_UNSTABLE;
982
+ exports.decodeTransaction = decodeTransaction;
894
983
  exports.requestAndConfirmAirdrop = requestAndConfirmAirdrop;
895
984
  exports.sendAndConfirmDurableNonceTransaction = sendAndConfirmDurableNonceTransaction;
896
985
  exports.sendAndConfirmTransaction = sendAndConfirmTransaction;
897
986
  exports.waitForDurableNonceTransactionConfirmation = waitForDurableNonceTransactionConfirmation;
898
987
  exports.waitForRecentTransactionConfirmation = waitForRecentTransactionConfirmation;
988
+ Object.keys(accounts).forEach(function (k) {
989
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
990
+ enumerable: true,
991
+ get: function () { return accounts[k]; }
992
+ });
993
+ });
899
994
  Object.keys(addresses).forEach(function (k) {
900
995
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
901
996
  enumerable: true,
902
997
  get: function () { return addresses[k]; }
903
998
  });
904
999
  });
1000
+ Object.keys(codecs).forEach(function (k) {
1001
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1002
+ enumerable: true,
1003
+ get: function () { return codecs[k]; }
1004
+ });
1005
+ });
1006
+ Object.keys(functional).forEach(function (k) {
1007
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1008
+ enumerable: true,
1009
+ get: function () { return functional[k]; }
1010
+ });
1011
+ });
905
1012
  Object.keys(instructions).forEach(function (k) {
906
1013
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
907
1014
  enumerable: true,
@@ -914,12 +1021,30 @@ Object.keys(keys).forEach(function (k) {
914
1021
  get: function () { return keys[k]; }
915
1022
  });
916
1023
  });
1024
+ Object.keys(programs).forEach(function (k) {
1025
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1026
+ enumerable: true,
1027
+ get: function () { return programs[k]; }
1028
+ });
1029
+ });
1030
+ Object.keys(rpcParsedTypes).forEach(function (k) {
1031
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1032
+ enumerable: true,
1033
+ get: function () { return rpcParsedTypes[k]; }
1034
+ });
1035
+ });
917
1036
  Object.keys(rpcTypes).forEach(function (k) {
918
1037
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
919
1038
  enumerable: true,
920
1039
  get: function () { return rpcTypes[k]; }
921
1040
  });
922
1041
  });
1042
+ Object.keys(signers).forEach(function (k) {
1043
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1044
+ enumerable: true,
1045
+ get: function () { return signers[k]; }
1046
+ });
1047
+ });
923
1048
  Object.keys(transactions).forEach(function (k) {
924
1049
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
925
1050
  enumerable: true,