@solana/web3.js 2.0.0-experimental.c29513e → 2.0.0-experimental.c34bab9

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 (58) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +1153 -43
  3. package/dist/index.browser.cjs +923 -26
  4. package/dist/index.browser.cjs.map +1 -1
  5. package/dist/index.browser.js +860 -27
  6. package/dist/index.browser.js.map +1 -1
  7. package/dist/index.development.js +5307 -537
  8. package/dist/index.development.js.map +1 -1
  9. package/dist/index.native.js +847 -27
  10. package/dist/index.native.js.map +1 -1
  11. package/dist/index.node.cjs +912 -26
  12. package/dist/index.node.cjs.map +1 -1
  13. package/dist/index.node.js +847 -27
  14. package/dist/index.node.js.map +1 -1
  15. package/dist/index.production.min.js +273 -16
  16. package/dist/types/airdrop-confirmer.d.ts +19 -0
  17. package/dist/types/airdrop-confirmer.d.ts.map +1 -0
  18. package/dist/types/airdrop.d.ts +21 -0
  19. package/dist/types/airdrop.d.ts.map +1 -0
  20. package/dist/types/cached-abortable-iterable.d.ts +11 -0
  21. package/dist/types/cached-abortable-iterable.d.ts.map +1 -0
  22. package/dist/types/decode-transaction.d.ts +10 -0
  23. package/dist/types/decode-transaction.d.ts.map +1 -0
  24. package/dist/types/index.d.ts +19 -2
  25. package/dist/types/index.d.ts.map +1 -0
  26. package/dist/types/rpc-default-config.d.ts.map +1 -0
  27. package/dist/types/rpc-integer-overflow-error.d.ts +3 -2
  28. package/dist/types/rpc-integer-overflow-error.d.ts.map +1 -0
  29. package/dist/types/rpc-request-coalescer.d.ts +1 -1
  30. package/dist/types/rpc-request-coalescer.d.ts.map +1 -0
  31. package/dist/types/rpc-request-deduplication.d.ts.map +1 -0
  32. package/dist/types/rpc-subscription-coalescer.d.ts +10 -0
  33. package/dist/types/rpc-subscription-coalescer.d.ts.map +1 -0
  34. package/dist/types/rpc-transport.d.ts +1 -2
  35. package/dist/types/rpc-transport.d.ts.map +1 -0
  36. package/dist/types/rpc-websocket-autopinger.d.ts +8 -0
  37. package/dist/types/rpc-websocket-autopinger.d.ts.map +1 -0
  38. package/dist/types/rpc-websocket-connection-sharding.d.ts +13 -0
  39. package/dist/types/rpc-websocket-connection-sharding.d.ts.map +1 -0
  40. package/dist/types/rpc-websocket-transport.d.ts +12 -0
  41. package/dist/types/rpc-websocket-transport.d.ts.map +1 -0
  42. package/dist/types/rpc.d.ts +5 -3
  43. package/dist/types/rpc.d.ts.map +1 -0
  44. package/dist/types/send-transaction.d.ts +37 -0
  45. package/dist/types/send-transaction.d.ts.map +1 -0
  46. package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +14 -0
  47. package/dist/types/transaction-confirmation-strategy-blockheight.d.ts.map +1 -0
  48. package/dist/types/transaction-confirmation-strategy-nonce.d.ts +13 -0
  49. package/dist/types/transaction-confirmation-strategy-nonce.d.ts.map +1 -0
  50. package/dist/types/transaction-confirmation-strategy-racer.d.ts +14 -0
  51. package/dist/types/transaction-confirmation-strategy-racer.d.ts.map +1 -0
  52. package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts +11 -0
  53. package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts.map +1 -0
  54. package/dist/types/transaction-confirmation-strategy-timeout.d.ts +8 -0
  55. package/dist/types/transaction-confirmation-strategy-timeout.d.ts.map +1 -0
  56. package/dist/types/transaction-confirmation.d.ts +32 -0
  57. package/dist/types/transaction-confirmation.d.ts.map +1 -0
  58. package/package.json +30 -23
@@ -1,7 +1,16 @@
1
1
  'use strict';
2
2
 
3
+ var accounts = require('@solana/accounts');
4
+ var addresses = require('@solana/addresses');
5
+ var codecs = require('@solana/codecs');
6
+ var functional = require('@solana/functional');
3
7
  var instructions = require('@solana/instructions');
4
8
  var keys = require('@solana/keys');
9
+ var programs = require('@solana/programs');
10
+ var rpcParsedTypes = require('@solana/rpc-parsed-types');
11
+ var rpcTypes = require('@solana/rpc-types');
12
+ var signers = require('@solana/signers');
13
+ var transactions = require('@solana/transactions');
5
14
  var rpcCore = require('@solana/rpc-core');
6
15
  var rpcTransport = require('@solana/rpc-transport');
7
16
  var fastStableStringify = require('fast-stable-stringify');
@@ -10,27 +19,220 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
19
 
11
20
  var fastStableStringify__default = /*#__PURE__*/_interopDefault(fastStableStringify);
12
21
 
13
- // src/index.ts
22
+ // ../build-scripts/env-shim.ts
23
+ var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
24
+
25
+ // src/transaction-confirmation-strategy-racer.ts
26
+ async function raceStrategies(signature, config, getSpecificStrategiesForRace) {
27
+ const { abortSignal: callerAbortSignal, commitment, getRecentSignatureConfirmationPromise } = config;
28
+ callerAbortSignal?.throwIfAborted();
29
+ const abortController = new AbortController();
30
+ if (callerAbortSignal) {
31
+ const handleAbort = () => {
32
+ abortController.abort();
33
+ };
34
+ callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
35
+ }
36
+ try {
37
+ const specificStrategies = getSpecificStrategiesForRace({
38
+ ...config,
39
+ abortSignal: abortController.signal
40
+ });
41
+ return await Promise.race([
42
+ getRecentSignatureConfirmationPromise({
43
+ abortSignal: abortController.signal,
44
+ commitment,
45
+ signature
46
+ }),
47
+ ...specificStrategies
48
+ ]);
49
+ } finally {
50
+ abortController.abort();
51
+ }
52
+ }
53
+ function createRecentSignatureConfirmationPromiseFactory(rpc, rpcSubscriptions) {
54
+ return async function getRecentSignatureConfirmationPromise({
55
+ abortSignal: callerAbortSignal,
56
+ commitment,
57
+ signature
58
+ }) {
59
+ const abortController = new AbortController();
60
+ function handleAbort() {
61
+ abortController.abort();
62
+ }
63
+ callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
64
+ const signatureStatusNotifications = await rpcSubscriptions.signatureNotifications(signature, { commitment }).subscribe({ abortSignal: abortController.signal });
65
+ const signatureDidCommitPromise = (async () => {
66
+ for await (const signatureStatusNotification of signatureStatusNotifications) {
67
+ if (signatureStatusNotification.value.err) {
68
+ throw new Error(`The transaction with signature \`${signature}\` failed.`, {
69
+ cause: signatureStatusNotification.value.err
70
+ });
71
+ } else {
72
+ return;
73
+ }
74
+ }
75
+ })();
76
+ const signatureStatusLookupPromise = (async () => {
77
+ const { value: signatureStatusResults } = await rpc.getSignatureStatuses([signature]).send({ abortSignal: abortController.signal });
78
+ const signatureStatus = signatureStatusResults[0];
79
+ if (signatureStatus && signatureStatus.confirmationStatus && rpcTypes.commitmentComparator(signatureStatus.confirmationStatus, commitment) >= 0) {
80
+ return;
81
+ } else {
82
+ await new Promise(() => {
83
+ });
84
+ }
85
+ })();
86
+ try {
87
+ return await Promise.race([signatureDidCommitPromise, signatureStatusLookupPromise]);
88
+ } finally {
89
+ abortController.abort();
90
+ }
91
+ };
92
+ }
93
+
94
+ // src/transaction-confirmation-strategy-timeout.ts
95
+ async function getTimeoutPromise({ abortSignal: callerAbortSignal, commitment }) {
96
+ return await new Promise((_, reject) => {
97
+ const handleAbort = (e) => {
98
+ clearTimeout(timeoutId);
99
+ const abortError = new DOMException(e.target.reason, "AbortError");
100
+ reject(abortError);
101
+ };
102
+ callerAbortSignal.addEventListener("abort", handleAbort);
103
+ const timeoutMs = commitment === "processed" ? 3e4 : 6e4;
104
+ const startMs = performance.now();
105
+ const timeoutId = (
106
+ // We use `setTimeout` instead of `AbortSignal.timeout()` because we want to measure
107
+ // elapsed time instead of active time.
108
+ // See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static
109
+ setTimeout(() => {
110
+ const elapsedMs = performance.now() - startMs;
111
+ reject(new DOMException(`Timeout elapsed after ${elapsedMs} ms`, "TimeoutError"));
112
+ }, timeoutMs)
113
+ );
114
+ });
115
+ }
116
+
117
+ // src/airdrop-confirmer.ts
118
+ function createDefaultSignatureOnlyRecentTransactionConfirmer({
119
+ rpc,
120
+ rpcSubscriptions
121
+ }) {
122
+ const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory(
123
+ rpc,
124
+ rpcSubscriptions
125
+ );
126
+ return async function confirmSignatureOnlyRecentTransaction(config) {
127
+ await waitForRecentTransactionConfirmationUntilTimeout({
128
+ ...config,
129
+ getRecentSignatureConfirmationPromise,
130
+ getTimeoutPromise
131
+ });
132
+ };
133
+ }
134
+ async function waitForRecentTransactionConfirmationUntilTimeout(config) {
135
+ await raceStrategies(
136
+ config.signature,
137
+ config,
138
+ function getSpecificStrategiesForRace({ abortSignal, commitment, getTimeoutPromise: getTimeoutPromise2 }) {
139
+ return [
140
+ getTimeoutPromise2({
141
+ abortSignal,
142
+ commitment
143
+ })
144
+ ];
145
+ }
146
+ );
147
+ }
148
+
149
+ // src/airdrop.ts
150
+ function createDefaultAirdropRequester({ rpc, rpcSubscriptions }) {
151
+ const confirmSignatureOnlyTransaction = createDefaultSignatureOnlyRecentTransactionConfirmer({
152
+ rpc,
153
+ rpcSubscriptions
154
+ });
155
+ return async function requestAirdrop(config) {
156
+ return await requestAndConfirmAirdrop({
157
+ ...config,
158
+ confirmSignatureOnlyTransaction,
159
+ rpc
160
+ });
161
+ };
162
+ }
163
+ async function requestAndConfirmAirdrop({
164
+ abortSignal,
165
+ commitment,
166
+ confirmSignatureOnlyTransaction,
167
+ lamports,
168
+ recipientAddress,
169
+ rpc
170
+ }) {
171
+ const airdropTransactionSignature = await rpc.requestAirdrop(recipientAddress, lamports, { commitment }).send({ abortSignal });
172
+ await confirmSignatureOnlyTransaction({
173
+ abortSignal,
174
+ commitment,
175
+ signature: airdropTransactionSignature
176
+ });
177
+ return airdropTransactionSignature;
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
+ }
14
209
 
15
210
  // src/rpc-integer-overflow-error.ts
16
211
  var SolanaJsonRpcIntegerOverflowError = class extends Error {
212
+ methodName;
213
+ keyPath;
214
+ value;
17
215
  constructor(methodName, keyPath, value) {
18
- const argPosition = (typeof keyPath[0] === "number" ? keyPath[0] : parseInt(keyPath[0], 10)) + 1;
19
- let ordinal = "";
20
- const lastDigit = argPosition % 10;
21
- const lastTwoDigits = argPosition % 100;
22
- if (lastDigit == 1 && lastTwoDigits != 11) {
23
- ordinal = argPosition + "st";
24
- } else if (lastDigit == 2 && lastTwoDigits != 12) {
25
- ordinal = argPosition + "nd";
26
- } else if (lastDigit == 3 && lastTwoDigits != 13) {
27
- 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
+ }
28
230
  } else {
29
- ordinal = argPosition + "th";
231
+ argumentLabel = `\`${keyPath[0].toString()}\``;
30
232
  }
31
233
  const path = keyPath.length > 1 ? keyPath.slice(1).map((pathPart) => typeof pathPart === "number" ? `[${pathPart}]` : pathPart).join(".") : null;
32
234
  super(
33
- `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\`.`
34
236
  );
35
237
  this.keyPath = keyPath;
36
238
  this.methodName = methodName;
@@ -43,11 +245,199 @@ var SolanaJsonRpcIntegerOverflowError = class extends Error {
43
245
 
44
246
  // src/rpc-default-config.ts
45
247
  var DEFAULT_RPC_CONFIG = {
248
+ defaultCommitment: "confirmed",
46
249
  onIntegerOverflow(methodName, keyPath, value) {
47
250
  throw new SolanaJsonRpcIntegerOverflowError(methodName, keyPath, value);
48
251
  }
49
252
  };
50
253
 
254
+ // src/cached-abortable-iterable.ts
255
+ function registerIterableCleanup(iterable, cleanupFn) {
256
+ (async () => {
257
+ try {
258
+ for await (const _ of iterable)
259
+ ;
260
+ } catch {
261
+ } finally {
262
+ cleanupFn();
263
+ }
264
+ })();
265
+ }
266
+ function getCachedAbortableIterableFactory({
267
+ getAbortSignalFromInputArgs,
268
+ getCacheEntryMissingError,
269
+ getCacheKeyFromInputArgs,
270
+ onCacheHit,
271
+ onCreateIterable
272
+ }) {
273
+ const cache = /* @__PURE__ */ new Map();
274
+ function getCacheEntryOrThrow(cacheKey) {
275
+ const currentCacheEntry = cache.get(cacheKey);
276
+ if (!currentCacheEntry) {
277
+ throw getCacheEntryMissingError(cacheKey);
278
+ }
279
+ return currentCacheEntry;
280
+ }
281
+ return async (...args) => {
282
+ const cacheKey = getCacheKeyFromInputArgs(...args);
283
+ const signal = getAbortSignalFromInputArgs(...args);
284
+ if (cacheKey === void 0) {
285
+ return await onCreateIterable(signal, ...args);
286
+ }
287
+ const cleanup = () => {
288
+ cache.delete(cacheKey);
289
+ signal.removeEventListener("abort", handleAbort);
290
+ };
291
+ const handleAbort = () => {
292
+ const cacheEntry = getCacheEntryOrThrow(cacheKey);
293
+ if (cacheEntry.purgeScheduled !== true) {
294
+ cacheEntry.purgeScheduled = true;
295
+ globalThis.queueMicrotask(() => {
296
+ cacheEntry.purgeScheduled = false;
297
+ if (cacheEntry.referenceCount === 0) {
298
+ cacheEntry.abortController.abort();
299
+ cleanup();
300
+ }
301
+ });
302
+ }
303
+ cacheEntry.referenceCount--;
304
+ };
305
+ signal.addEventListener("abort", handleAbort);
306
+ try {
307
+ const cacheEntry = cache.get(cacheKey);
308
+ if (!cacheEntry) {
309
+ const singletonAbortController = new AbortController();
310
+ const newIterablePromise = onCreateIterable(singletonAbortController.signal, ...args);
311
+ const newCacheEntry = {
312
+ abortController: singletonAbortController,
313
+ iterable: newIterablePromise,
314
+ purgeScheduled: false,
315
+ referenceCount: 1
316
+ };
317
+ cache.set(cacheKey, newCacheEntry);
318
+ const newIterable = await newIterablePromise;
319
+ registerIterableCleanup(newIterable, cleanup);
320
+ newCacheEntry.iterable = newIterable;
321
+ return newIterable;
322
+ } else {
323
+ cacheEntry.referenceCount++;
324
+ const iterableOrIterablePromise = cacheEntry.iterable;
325
+ const cachedIterable = "then" in iterableOrIterablePromise ? await iterableOrIterablePromise : iterableOrIterablePromise;
326
+ await onCacheHit(cachedIterable, ...args);
327
+ return cachedIterable;
328
+ }
329
+ } catch (e) {
330
+ cleanup();
331
+ throw e;
332
+ }
333
+ };
334
+ }
335
+
336
+ // src/rpc-subscription-coalescer.ts
337
+ var EXPLICIT_ABORT_TOKEN = Symbol(
338
+ __DEV__ ? "This symbol is thrown from a subscription's iterator when the subscription is explicitly aborted by the user" : void 0
339
+ );
340
+ function registerIterableCleanup2(iterable, cleanupFn) {
341
+ (async () => {
342
+ try {
343
+ for await (const _ of iterable)
344
+ ;
345
+ } catch {
346
+ } finally {
347
+ cleanupFn();
348
+ }
349
+ })();
350
+ }
351
+ function getRpcSubscriptionsWithSubscriptionCoalescing({
352
+ getDeduplicationKey,
353
+ rpcSubscriptions
354
+ }) {
355
+ const cache = /* @__PURE__ */ new Map();
356
+ return new Proxy(rpcSubscriptions, {
357
+ defineProperty() {
358
+ return false;
359
+ },
360
+ deleteProperty() {
361
+ return false;
362
+ },
363
+ get(target, p, receiver) {
364
+ const subscriptionMethod = Reflect.get(target, p, receiver);
365
+ if (typeof subscriptionMethod !== "function") {
366
+ return subscriptionMethod;
367
+ }
368
+ return function(...rawParams) {
369
+ const deduplicationKey = getDeduplicationKey(p, rawParams);
370
+ if (deduplicationKey === void 0) {
371
+ return subscriptionMethod(...rawParams);
372
+ }
373
+ if (cache.has(deduplicationKey)) {
374
+ return cache.get(deduplicationKey);
375
+ }
376
+ const iterableFactory = getCachedAbortableIterableFactory({
377
+ getAbortSignalFromInputArgs: ({ abortSignal }) => abortSignal,
378
+ getCacheEntryMissingError(deduplicationKey2) {
379
+ return new Error(
380
+ `Found no cache entry for subscription with deduplication key \`${deduplicationKey2?.toString()}\``
381
+ );
382
+ },
383
+ getCacheKeyFromInputArgs: () => deduplicationKey,
384
+ async onCacheHit(_iterable, _config) {
385
+ },
386
+ async onCreateIterable(abortSignal, config) {
387
+ const pendingSubscription2 = subscriptionMethod(
388
+ ...rawParams
389
+ );
390
+ const iterable = await pendingSubscription2.subscribe({
391
+ ...config,
392
+ abortSignal
393
+ });
394
+ registerIterableCleanup2(iterable, () => {
395
+ cache.delete(deduplicationKey);
396
+ });
397
+ return iterable;
398
+ }
399
+ });
400
+ const pendingSubscription = {
401
+ async subscribe(...args) {
402
+ const iterable = await iterableFactory(...args);
403
+ const { abortSignal } = args[0];
404
+ let abortPromise;
405
+ return {
406
+ ...iterable,
407
+ async *[Symbol.asyncIterator]() {
408
+ abortPromise ||= abortSignal.aborted ? Promise.reject(EXPLICIT_ABORT_TOKEN) : new Promise((_, reject) => {
409
+ abortSignal.addEventListener("abort", () => {
410
+ reject(EXPLICIT_ABORT_TOKEN);
411
+ });
412
+ });
413
+ try {
414
+ const iterator = iterable[Symbol.asyncIterator]();
415
+ while (true) {
416
+ const iteratorResult = await Promise.race([iterator.next(), abortPromise]);
417
+ if (iteratorResult.done) {
418
+ return;
419
+ } else {
420
+ yield iteratorResult.value;
421
+ }
422
+ }
423
+ } catch (e) {
424
+ if (e === EXPLICIT_ABORT_TOKEN) {
425
+ return;
426
+ }
427
+ cache.delete(deduplicationKey);
428
+ throw e;
429
+ }
430
+ }
431
+ };
432
+ }
433
+ };
434
+ cache.set(deduplicationKey, pendingSubscription);
435
+ return pendingSubscription;
436
+ };
437
+ }
438
+ });
439
+ }
440
+
51
441
  // src/rpc.ts
52
442
  function createSolanaRpc(config) {
53
443
  return rpcTransport.createJsonRpc({
@@ -55,6 +445,24 @@ function createSolanaRpc(config) {
55
445
  api: rpcCore.createSolanaRpcApi(DEFAULT_RPC_CONFIG)
56
446
  });
57
447
  }
448
+ function createSolanaRpcSubscriptions(config) {
449
+ return functional.pipe(
450
+ rpcTransport.createJsonSubscriptionRpc({
451
+ ...config,
452
+ api: rpcCore.createSolanaRpcSubscriptionsApi(DEFAULT_RPC_CONFIG)
453
+ }),
454
+ (rpcSubscriptions) => getRpcSubscriptionsWithSubscriptionCoalescing({
455
+ getDeduplicationKey: (...args) => fastStableStringify__default.default(args),
456
+ rpcSubscriptions
457
+ })
458
+ );
459
+ }
460
+ function createSolanaRpcSubscriptions_UNSTABLE(config) {
461
+ return rpcTransport.createJsonSubscriptionRpc({
462
+ ...config,
463
+ api: rpcCore.createSolanaRpcSubscriptionsApi_UNSTABLE(DEFAULT_RPC_CONFIG)
464
+ });
465
+ }
58
466
 
59
467
  // src/rpc-request-coalescer.ts
60
468
  function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
@@ -73,13 +481,23 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
73
481
  }
74
482
  if (coalescedRequestsByDeduplicationKey[deduplicationKey] == null) {
75
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
+ })();
76
497
  coalescedRequestsByDeduplicationKey[deduplicationKey] = {
77
498
  abortController,
78
499
  numConsumers: 0,
79
- responsePromise: transport({
80
- ...config,
81
- signal: abortController.signal
82
- })
500
+ responsePromise
83
501
  };
84
502
  }
85
503
  const coalescedRequest = coalescedRequestsByDeduplicationKey[deduplicationKey];
@@ -107,13 +525,14 @@ function getRpcTransportWithRequestCoalescing(transport, getDeduplicationKey) {
107
525
  }
108
526
  };
109
527
  }
110
- function getSolanaRpcPayloadDeduplicationKey(payload) {
528
+ function isJsonRpcPayload(payload) {
111
529
  if (payload == null || typeof payload !== "object" || Array.isArray(payload)) {
112
- return;
113
- }
114
- if ("jsonrpc" in payload && payload.jsonrpc === "2.0" && "method" in payload && "params" in payload) {
115
- return fastStableStringify__default.default([payload.method, payload.params]);
530
+ return false;
116
531
  }
532
+ return "jsonrpc" in payload && payload.jsonrpc === "2.0" && "method" in payload && typeof payload.method === "string" && "params" in payload;
533
+ }
534
+ function getSolanaRpcPayloadDeduplicationKey(payload) {
535
+ return isJsonRpcPayload(payload) ? fastStableStringify__default.default([payload.method, payload.params]) : void 0;
117
536
  }
118
537
 
119
538
  // src/rpc-transport.ts
@@ -125,7 +544,7 @@ function normalizeHeaders(headers) {
125
544
  return out;
126
545
  }
127
546
  function createDefaultRpcTransport(config) {
128
- return getRpcTransportWithRequestCoalescing(
547
+ return functional.pipe(
129
548
  rpcTransport.createHttpTransport({
130
549
  ...config,
131
550
  headers: {
@@ -136,23 +555,501 @@ function createDefaultRpcTransport(config) {
136
555
  }
137
556
  }
138
557
  }),
139
- getSolanaRpcPayloadDeduplicationKey
558
+ (transport) => getRpcTransportWithRequestCoalescing(transport, getSolanaRpcPayloadDeduplicationKey)
140
559
  );
141
560
  }
142
561
 
562
+ // src/rpc-websocket-autopinger.ts
563
+ var PING_PAYLOAD = {
564
+ jsonrpc: "2.0",
565
+ method: "ping"
566
+ };
567
+ function getWebSocketTransportWithAutoping({ intervalMs, transport }) {
568
+ const pingableConnections = /* @__PURE__ */ new Map();
569
+ return async (...args) => {
570
+ const connection = await transport(...args);
571
+ let intervalId;
572
+ function sendPing() {
573
+ connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(PING_PAYLOAD);
574
+ }
575
+ function restartPingTimer() {
576
+ clearInterval(intervalId);
577
+ intervalId = setInterval(sendPing, intervalMs);
578
+ }
579
+ if (pingableConnections.has(connection) === false) {
580
+ pingableConnections.set(connection, {
581
+ [Symbol.asyncIterator]: connection[Symbol.asyncIterator].bind(connection),
582
+ send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: (...args2) => {
583
+ restartPingTimer();
584
+ return connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(...args2);
585
+ }
586
+ });
587
+ (async () => {
588
+ try {
589
+ for await (const _ of connection) {
590
+ restartPingTimer();
591
+ }
592
+ } catch {
593
+ } finally {
594
+ pingableConnections.delete(connection);
595
+ clearInterval(intervalId);
596
+ if (handleOffline) {
597
+ globalThis.window.removeEventListener("offline", handleOffline);
598
+ }
599
+ if (handleOnline) {
600
+ globalThis.window.removeEventListener("online", handleOnline);
601
+ }
602
+ }
603
+ })();
604
+ if (globalThis.navigator.onLine) {
605
+ restartPingTimer();
606
+ }
607
+ let handleOffline;
608
+ let handleOnline;
609
+ {
610
+ handleOffline = () => {
611
+ clearInterval(intervalId);
612
+ };
613
+ handleOnline = () => {
614
+ sendPing();
615
+ restartPingTimer();
616
+ };
617
+ globalThis.window.addEventListener("offline", handleOffline);
618
+ globalThis.window.addEventListener("online", handleOnline);
619
+ }
620
+ }
621
+ return pingableConnections.get(connection);
622
+ };
623
+ }
624
+
625
+ // src/rpc-websocket-connection-sharding.ts
626
+ var NULL_SHARD_CACHE_KEY = Symbol(
627
+ __DEV__ ? "Cache key to use when there is no connection sharding strategy" : void 0
628
+ );
629
+ function getWebSocketTransportWithConnectionSharding({ getShard, transport }) {
630
+ return getCachedAbortableIterableFactory({
631
+ getAbortSignalFromInputArgs: ({ signal }) => signal,
632
+ getCacheEntryMissingError(shardKey) {
633
+ return new Error(`Found no cache entry for connection with shard key \`${shardKey?.toString()}\``);
634
+ },
635
+ getCacheKeyFromInputArgs: ({ payload }) => getShard ? getShard(payload) : NULL_SHARD_CACHE_KEY,
636
+ onCacheHit: (connection, { payload }) => connection.send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED(payload),
637
+ onCreateIterable: (abortSignal, config) => transport({
638
+ ...config,
639
+ signal: abortSignal
640
+ })
641
+ });
642
+ }
643
+
644
+ // src/rpc-websocket-transport.ts
645
+ function createDefaultRpcSubscriptionsTransport(config) {
646
+ const { getShard, intervalMs, ...rest } = config;
647
+ return functional.pipe(
648
+ rpcTransport.createWebSocketTransport({
649
+ ...rest,
650
+ sendBufferHighWatermark: config.sendBufferHighWatermark ?? // Let 128KB of data into the WebSocket buffer before buffering it in the app.
651
+ 131072
652
+ }),
653
+ (transport) => getWebSocketTransportWithAutoping({
654
+ intervalMs: intervalMs ?? 5e3,
655
+ transport
656
+ }),
657
+ (transport) => getWebSocketTransportWithConnectionSharding({
658
+ getShard,
659
+ transport
660
+ })
661
+ );
662
+ }
663
+
664
+ // src/transaction-confirmation-strategy-blockheight.ts
665
+ function createBlockHeightExceedencePromiseFactory({
666
+ rpc,
667
+ rpcSubscriptions
668
+ }) {
669
+ return async function getBlockHeightExceedencePromise({
670
+ abortSignal: callerAbortSignal,
671
+ commitment,
672
+ lastValidBlockHeight
673
+ }) {
674
+ const abortController = new AbortController();
675
+ const handleAbort = () => {
676
+ abortController.abort();
677
+ };
678
+ callerAbortSignal.addEventListener("abort", handleAbort, { signal: 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
+ }
686
+ try {
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
+ }
706
+ }
707
+ }
708
+ throw new Error(
709
+ "The network has progressed past the last block for which this transaction could have been committed."
710
+ );
711
+ } finally {
712
+ abortController.abort();
713
+ }
714
+ };
715
+ }
716
+ var NONCE_VALUE_OFFSET = 4 + // version(u32)
717
+ 4 + // state(u32)
718
+ 32;
719
+ function createNonceInvalidationPromiseFactory(rpc, rpcSubscriptions) {
720
+ return async function getNonceInvalidationPromise({
721
+ abortSignal: callerAbortSignal,
722
+ commitment,
723
+ currentNonceValue,
724
+ nonceAccountAddress
725
+ }) {
726
+ const abortController = new AbortController();
727
+ function handleAbort() {
728
+ abortController.abort();
729
+ }
730
+ callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
731
+ const accountNotifications = await rpcSubscriptions.accountNotifications(nonceAccountAddress, { commitment, encoding: "base64" }).subscribe({ abortSignal: abortController.signal });
732
+ const base58Decoder = codecs.getBase58Decoder();
733
+ const base64Encoder = codecs.getBase64Encoder();
734
+ function getNonceFromAccountData([base64EncodedBytes]) {
735
+ const data = base64Encoder.encode(base64EncodedBytes);
736
+ const nonceValueBytes = data.slice(NONCE_VALUE_OFFSET, NONCE_VALUE_OFFSET + 32);
737
+ return base58Decoder.decode(nonceValueBytes);
738
+ }
739
+ const nonceAccountDidAdvancePromise = (async () => {
740
+ for await (const accountNotification of accountNotifications) {
741
+ const nonceValue = getNonceFromAccountData(accountNotification.value.data);
742
+ if (nonceValue !== currentNonceValue) {
743
+ throw new Error(
744
+ `The nonce \`${currentNonceValue}\` is no longer valid. It has advanced to \`${nonceValue}\`.`
745
+ );
746
+ }
747
+ }
748
+ })();
749
+ const nonceIsAlreadyInvalidPromise = (async () => {
750
+ const { value: nonceAccount } = await rpc.getAccountInfo(nonceAccountAddress, {
751
+ commitment,
752
+ dataSlice: { length: 32, offset: NONCE_VALUE_OFFSET },
753
+ encoding: "base58"
754
+ }).send({ abortSignal: abortController.signal });
755
+ if (!nonceAccount) {
756
+ throw new Error(`No nonce account could be found at address \`${nonceAccountAddress}\`.`);
757
+ }
758
+ const nonceValue = (
759
+ // This works because we asked for the exact slice of data representing the nonce
760
+ // value, and furthermore asked for it in `base58` encoding.
761
+ nonceAccount.data[0]
762
+ );
763
+ if (nonceValue !== currentNonceValue) {
764
+ throw new Error(
765
+ `The nonce \`${currentNonceValue}\` is no longer valid. It has advanced to \`${nonceValue}\`.`
766
+ );
767
+ } else {
768
+ await new Promise(() => {
769
+ });
770
+ }
771
+ })();
772
+ try {
773
+ return await Promise.race([nonceAccountDidAdvancePromise, nonceIsAlreadyInvalidPromise]);
774
+ } finally {
775
+ abortController.abort();
776
+ }
777
+ };
778
+ }
779
+
780
+ // src/transaction-confirmation.ts
781
+ function createDefaultDurableNonceTransactionConfirmer({
782
+ rpc,
783
+ rpcSubscriptions
784
+ }) {
785
+ const getNonceInvalidationPromise = createNonceInvalidationPromiseFactory(rpc, rpcSubscriptions);
786
+ const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory(
787
+ rpc,
788
+ rpcSubscriptions
789
+ );
790
+ return async function confirmDurableNonceTransaction(config) {
791
+ await waitForDurableNonceTransactionConfirmation({
792
+ ...config,
793
+ getNonceInvalidationPromise,
794
+ getRecentSignatureConfirmationPromise
795
+ });
796
+ };
797
+ }
798
+ function createDefaultRecentTransactionConfirmer({
799
+ rpc,
800
+ rpcSubscriptions
801
+ }) {
802
+ const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory({
803
+ rpc,
804
+ rpcSubscriptions
805
+ });
806
+ const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory(
807
+ rpc,
808
+ rpcSubscriptions
809
+ );
810
+ return async function confirmRecentTransaction(config) {
811
+ await waitForRecentTransactionConfirmation({
812
+ ...config,
813
+ getBlockHeightExceedencePromise,
814
+ getRecentSignatureConfirmationPromise
815
+ });
816
+ };
817
+ }
818
+ async function waitForDurableNonceTransactionConfirmation(config) {
819
+ await raceStrategies(
820
+ transactions.getSignatureFromTransaction(config.transaction),
821
+ config,
822
+ function getSpecificStrategiesForRace({ abortSignal, commitment, getNonceInvalidationPromise, transaction }) {
823
+ return [
824
+ getNonceInvalidationPromise({
825
+ abortSignal,
826
+ commitment,
827
+ currentNonceValue: transaction.lifetimeConstraint.nonce,
828
+ nonceAccountAddress: transaction.instructions[0].accounts[0].address
829
+ })
830
+ ];
831
+ }
832
+ );
833
+ }
834
+ async function waitForRecentTransactionConfirmation(config) {
835
+ await raceStrategies(
836
+ transactions.getSignatureFromTransaction(config.transaction),
837
+ config,
838
+ function getSpecificStrategiesForRace({
839
+ abortSignal,
840
+ commitment,
841
+ getBlockHeightExceedencePromise,
842
+ transaction
843
+ }) {
844
+ return [
845
+ getBlockHeightExceedencePromise({
846
+ abortSignal,
847
+ commitment,
848
+ lastValidBlockHeight: transaction.lifetimeConstraint.lastValidBlockHeight
849
+ })
850
+ ];
851
+ }
852
+ );
853
+ }
854
+
855
+ // src/send-transaction.ts
856
+ function getSendTransactionConfigWithAdjustedPreflightCommitment(commitment, config) {
857
+ if (
858
+ // The developer has supplied no value for `preflightCommitment`.
859
+ !config?.preflightCommitment && // The value of `commitment` is lower than the server default of `preflightCommitment`.
860
+ rpcTypes.commitmentComparator(
861
+ commitment,
862
+ "finalized"
863
+ /* default value of `preflightCommitment` */
864
+ ) < 0
865
+ ) {
866
+ return {
867
+ ...config,
868
+ // In the common case, it is unlikely that you want to simulate a transaction at
869
+ // `finalized` commitment when your standard of commitment for confirming the
870
+ // transaction is lower. Cap the simulation commitment level to the level of the
871
+ // confirmation commitment.
872
+ preflightCommitment: commitment
873
+ };
874
+ }
875
+ return config;
876
+ }
877
+ async function sendTransaction_INTERNAL({
878
+ abortSignal,
879
+ commitment,
880
+ rpc,
881
+ transaction,
882
+ ...sendTransactionConfig
883
+ }) {
884
+ const base64EncodedWireTransaction = transactions.getBase64EncodedWireTransaction(transaction);
885
+ return await rpc.sendTransaction(base64EncodedWireTransaction, {
886
+ ...getSendTransactionConfigWithAdjustedPreflightCommitment(commitment, sendTransactionConfig),
887
+ encoding: "base64"
888
+ }).send({ abortSignal });
889
+ }
890
+ function createDefaultDurableNonceTransactionSender({
891
+ rpc,
892
+ rpcSubscriptions
893
+ }) {
894
+ const confirmDurableNonceTransaction = createDefaultDurableNonceTransactionConfirmer({
895
+ rpc,
896
+ rpcSubscriptions
897
+ });
898
+ return async function sendDurableNonceTransaction(transaction, config) {
899
+ await sendAndConfirmDurableNonceTransaction({
900
+ ...config,
901
+ confirmDurableNonceTransaction,
902
+ rpc,
903
+ transaction
904
+ });
905
+ };
906
+ }
907
+ function createDefaultTransactionSender({
908
+ rpc,
909
+ rpcSubscriptions
910
+ }) {
911
+ const confirmRecentTransaction = createDefaultRecentTransactionConfirmer({
912
+ rpc,
913
+ rpcSubscriptions
914
+ });
915
+ return async function sendTransaction(transaction, config) {
916
+ await sendAndConfirmTransaction({
917
+ ...config,
918
+ confirmRecentTransaction,
919
+ rpc,
920
+ transaction
921
+ });
922
+ };
923
+ }
924
+ async function sendAndConfirmDurableNonceTransaction({
925
+ abortSignal,
926
+ commitment,
927
+ confirmDurableNonceTransaction,
928
+ rpc,
929
+ transaction,
930
+ ...sendTransactionConfig
931
+ }) {
932
+ const transactionSignature = await sendTransaction_INTERNAL({
933
+ ...sendTransactionConfig,
934
+ abortSignal,
935
+ commitment,
936
+ rpc,
937
+ transaction
938
+ });
939
+ await confirmDurableNonceTransaction({
940
+ abortSignal,
941
+ commitment,
942
+ transaction
943
+ });
944
+ return transactionSignature;
945
+ }
946
+ async function sendAndConfirmTransaction({
947
+ abortSignal,
948
+ commitment,
949
+ confirmRecentTransaction,
950
+ rpc,
951
+ transaction,
952
+ ...sendTransactionConfig
953
+ }) {
954
+ const transactionSignature = await sendTransaction_INTERNAL({
955
+ ...sendTransactionConfig,
956
+ abortSignal,
957
+ commitment,
958
+ rpc,
959
+ transaction
960
+ });
961
+ await confirmRecentTransaction({
962
+ abortSignal,
963
+ commitment,
964
+ transaction
965
+ });
966
+ return transactionSignature;
967
+ }
968
+
969
+ exports.createBlockHeightExceedencePromiseFactory = createBlockHeightExceedencePromiseFactory;
970
+ exports.createDefaultAirdropRequester = createDefaultAirdropRequester;
971
+ exports.createDefaultDurableNonceTransactionConfirmer = createDefaultDurableNonceTransactionConfirmer;
972
+ exports.createDefaultDurableNonceTransactionSender = createDefaultDurableNonceTransactionSender;
973
+ exports.createDefaultRecentTransactionConfirmer = createDefaultRecentTransactionConfirmer;
974
+ exports.createDefaultRpcSubscriptionsTransport = createDefaultRpcSubscriptionsTransport;
143
975
  exports.createDefaultRpcTransport = createDefaultRpcTransport;
976
+ exports.createDefaultTransactionSender = createDefaultTransactionSender;
977
+ exports.createNonceInvalidationPromiseFactory = createNonceInvalidationPromiseFactory;
978
+ exports.createRecentSignatureConfirmationPromiseFactory = createRecentSignatureConfirmationPromiseFactory;
144
979
  exports.createSolanaRpc = createSolanaRpc;
980
+ exports.createSolanaRpcSubscriptions = createSolanaRpcSubscriptions;
981
+ exports.createSolanaRpcSubscriptions_UNSTABLE = createSolanaRpcSubscriptions_UNSTABLE;
982
+ exports.decodeTransaction = decodeTransaction;
983
+ exports.requestAndConfirmAirdrop = requestAndConfirmAirdrop;
984
+ exports.sendAndConfirmDurableNonceTransaction = sendAndConfirmDurableNonceTransaction;
985
+ exports.sendAndConfirmTransaction = sendAndConfirmTransaction;
986
+ exports.waitForDurableNonceTransactionConfirmation = waitForDurableNonceTransactionConfirmation;
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
+ });
994
+ Object.keys(addresses).forEach(function (k) {
995
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
996
+ enumerable: true,
997
+ get: function () { return addresses[k]; }
998
+ });
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
+ });
145
1012
  Object.keys(instructions).forEach(function (k) {
146
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
1013
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
147
1014
  enumerable: true,
148
1015
  get: function () { return instructions[k]; }
149
1016
  });
150
1017
  });
151
1018
  Object.keys(keys).forEach(function (k) {
152
- if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
1019
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
153
1020
  enumerable: true,
154
1021
  get: function () { return keys[k]; }
155
1022
  });
156
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
+ });
1036
+ Object.keys(rpcTypes).forEach(function (k) {
1037
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1038
+ enumerable: true,
1039
+ get: function () { return rpcTypes[k]; }
1040
+ });
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
+ });
1048
+ Object.keys(transactions).forEach(function (k) {
1049
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
1050
+ enumerable: true,
1051
+ get: function () { return transactions[k]; }
1052
+ });
1053
+ });
157
1054
  //# sourceMappingURL=out.js.map
158
1055
  //# sourceMappingURL=index.browser.cjs.map