@solana/web3.js 2.0.0-experimental.278784a → 2.0.0-experimental.2938d71
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/LICENSE +1 -1
- package/README.md +3 -3
- package/dist/index.browser.cjs +305 -76
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +294 -74
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +1299 -962
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +294 -74
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +305 -74
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +294 -74
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +72 -47
- package/dist/types/airdrop-confirmer.d.ts +20 -0
- package/dist/types/airdrop-confirmer.d.ts.map +1 -0
- package/dist/types/airdrop.d.ts +23 -0
- package/dist/types/airdrop.d.ts.map +1 -0
- package/dist/types/cached-abortable-iterable.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -1
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/rpc-default-config.d.ts.map +1 -0
- package/dist/types/rpc-integer-overflow-error.d.ts.map +1 -0
- package/dist/types/rpc-request-coalescer.d.ts.map +1 -0
- package/dist/types/rpc-request-deduplication.d.ts.map +1 -0
- package/dist/types/rpc-subscription-coalescer.d.ts.map +1 -0
- package/dist/types/rpc-transport.d.ts.map +1 -0
- package/dist/types/rpc-websocket-autopinger.d.ts.map +1 -0
- package/dist/types/rpc-websocket-connection-sharding.d.ts.map +1 -0
- package/dist/types/rpc-websocket-transport.d.ts.map +1 -0
- package/dist/types/rpc.d.ts.map +1 -0
- package/dist/types/send-transaction.d.ts +37 -0
- package/dist/types/send-transaction.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-blockheight.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts +1 -1
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-racer.d.ts +14 -0
- package/dist/types/transaction-confirmation-strategy-racer.d.ts.map +1 -0
- package/dist/types/{transaction-confirmation-strategy-signature.d.ts → transaction-confirmation-strategy-recent-signature.d.ts} +4 -4
- package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts.map +1 -0
- package/dist/types/transaction-confirmation-strategy-timeout.d.ts +8 -0
- package/dist/types/transaction-confirmation-strategy-timeout.d.ts.map +1 -0
- package/dist/types/transaction-confirmation.d.ts +16 -18
- package/dist/types/transaction-confirmation.d.ts.map +1 -0
- package/package.json +15 -14
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -77,10 +77,10 @@ Unimplemented.
|
|
|
77
77
|
|
|
78
78
|
Client applications primarily deal with addresses and public keys in the form of base58-encoded strings. Addresses and public keys returned from the RPC API conform to the type `Base58EncodedAddress`. You can use a value of that type wherever a base58-encoded address or key is expected.
|
|
79
79
|
|
|
80
|
-
From time to time you might acquire a string, that you expect to validate as an address, from an untrusted network API or user input. To assert that such an arbitrary string is a base58-encoded address, use the `
|
|
80
|
+
From time to time you might acquire a string, that you expect to validate as an address, from an untrusted network API or user input. To assert that such an arbitrary string is a base58-encoded address, use the `assertIsAddress` function.
|
|
81
81
|
|
|
82
82
|
```ts
|
|
83
|
-
import {
|
|
83
|
+
import { assertIsAddress } from '@solana/web3.js';
|
|
84
84
|
|
|
85
85
|
// Imagine a function that fetches an account's balance when a user submits a form.
|
|
86
86
|
async function handleSubmit() {
|
|
@@ -89,7 +89,7 @@ async function handleSubmit() {
|
|
|
89
89
|
try {
|
|
90
90
|
// If this type assertion function doesn't throw, then
|
|
91
91
|
// Typescript will upcast `address` to `Base58EncodedAddress`.
|
|
92
|
-
|
|
92
|
+
assertIsAddress(address);
|
|
93
93
|
// At this point, `address` is a `Base58EncodedAddress` that can be used with the RPC.
|
|
94
94
|
const balanceInLamports = await rpc.getBalance(address).send();
|
|
95
95
|
} catch (e) {
|
package/dist/index.browser.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var addresses = require('@solana/addresses');
|
|
4
4
|
var instructions = require('@solana/instructions');
|
|
5
5
|
var keys = require('@solana/keys');
|
|
6
|
+
var rpcTypes = require('@solana/rpc-types');
|
|
6
7
|
var transactions = require('@solana/transactions');
|
|
7
8
|
var functional = require('@solana/functional');
|
|
8
9
|
var rpcCore = require('@solana/rpc-core');
|
|
@@ -17,6 +18,161 @@ var fastStableStringify__default = /*#__PURE__*/_interopDefault(fastStableString
|
|
|
17
18
|
// ../build-scripts/env-shim.ts
|
|
18
19
|
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
|
|
19
20
|
|
|
21
|
+
// src/transaction-confirmation-strategy-racer.ts
|
|
22
|
+
async function raceStrategies(signature, config, getSpecificStrategiesForRace) {
|
|
23
|
+
const { abortSignal: callerAbortSignal, commitment, getRecentSignatureConfirmationPromise } = config;
|
|
24
|
+
callerAbortSignal?.throwIfAborted();
|
|
25
|
+
const abortController = new AbortController();
|
|
26
|
+
if (callerAbortSignal) {
|
|
27
|
+
const handleAbort = () => {
|
|
28
|
+
abortController.abort();
|
|
29
|
+
};
|
|
30
|
+
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const specificStrategies = getSpecificStrategiesForRace({
|
|
34
|
+
...config,
|
|
35
|
+
abortSignal: abortController.signal
|
|
36
|
+
});
|
|
37
|
+
return await Promise.race([
|
|
38
|
+
getRecentSignatureConfirmationPromise({
|
|
39
|
+
abortSignal: abortController.signal,
|
|
40
|
+
commitment,
|
|
41
|
+
signature
|
|
42
|
+
}),
|
|
43
|
+
...specificStrategies
|
|
44
|
+
]);
|
|
45
|
+
} finally {
|
|
46
|
+
abortController.abort();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function createRecentSignatureConfirmationPromiseFactory(rpc, rpcSubscriptions) {
|
|
50
|
+
return async function getRecentSignatureConfirmationPromise({
|
|
51
|
+
abortSignal: callerAbortSignal,
|
|
52
|
+
commitment,
|
|
53
|
+
signature
|
|
54
|
+
}) {
|
|
55
|
+
const abortController = new AbortController();
|
|
56
|
+
function handleAbort() {
|
|
57
|
+
abortController.abort();
|
|
58
|
+
}
|
|
59
|
+
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
60
|
+
const signatureStatusNotifications = await rpcSubscriptions.signatureNotifications(signature, { commitment }).subscribe({ abortSignal: abortController.signal });
|
|
61
|
+
const signatureDidCommitPromise = (async () => {
|
|
62
|
+
for await (const signatureStatusNotification of signatureStatusNotifications) {
|
|
63
|
+
if (signatureStatusNotification.value.err) {
|
|
64
|
+
throw new Error(`The transaction with signature \`${signature}\` failed.`, {
|
|
65
|
+
cause: signatureStatusNotification.value.err
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
})();
|
|
72
|
+
const signatureStatusLookupPromise = (async () => {
|
|
73
|
+
const { value: signatureStatusResults } = await rpc.getSignatureStatuses([signature]).send({ abortSignal: abortController.signal });
|
|
74
|
+
const signatureStatus = signatureStatusResults[0];
|
|
75
|
+
if (signatureStatus && signatureStatus.confirmationStatus && rpcTypes.commitmentComparator(signatureStatus.confirmationStatus, commitment) >= 0) {
|
|
76
|
+
return;
|
|
77
|
+
} else {
|
|
78
|
+
await new Promise(() => {
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
})();
|
|
82
|
+
try {
|
|
83
|
+
return await Promise.race([signatureDidCommitPromise, signatureStatusLookupPromise]);
|
|
84
|
+
} finally {
|
|
85
|
+
abortController.abort();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// src/transaction-confirmation-strategy-timeout.ts
|
|
91
|
+
async function getTimeoutPromise({ abortSignal: callerAbortSignal, commitment }) {
|
|
92
|
+
return await new Promise((_, reject) => {
|
|
93
|
+
const handleAbort = (e) => {
|
|
94
|
+
clearTimeout(timeoutId);
|
|
95
|
+
const abortError = new DOMException(e.target.reason, "AbortError");
|
|
96
|
+
reject(abortError);
|
|
97
|
+
};
|
|
98
|
+
callerAbortSignal.addEventListener("abort", handleAbort);
|
|
99
|
+
const timeoutMs = commitment === "processed" ? 3e4 : 6e4;
|
|
100
|
+
const startMs = performance.now();
|
|
101
|
+
const timeoutId = (
|
|
102
|
+
// We use `setTimeout` instead of `AbortSignal.timeout()` because we want to measure
|
|
103
|
+
// elapsed time instead of active time.
|
|
104
|
+
// See https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/timeout_static
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
const elapsedMs = performance.now() - startMs;
|
|
107
|
+
reject(new DOMException(`Timeout elapsed after ${elapsedMs} ms`, "TimeoutError"));
|
|
108
|
+
}, timeoutMs)
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/airdrop-confirmer.ts
|
|
114
|
+
function createDefaultSignatureOnlyRecentTransactionConfirmer({
|
|
115
|
+
rpc,
|
|
116
|
+
rpcSubscriptions
|
|
117
|
+
}) {
|
|
118
|
+
const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory(
|
|
119
|
+
rpc,
|
|
120
|
+
rpcSubscriptions
|
|
121
|
+
);
|
|
122
|
+
return async function confirmSignatureOnlyRecentTransaction(config) {
|
|
123
|
+
await waitForRecentTransactionConfirmationUntilTimeout({
|
|
124
|
+
...config,
|
|
125
|
+
getRecentSignatureConfirmationPromise,
|
|
126
|
+
getTimeoutPromise
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
async function waitForRecentTransactionConfirmationUntilTimeout(config) {
|
|
131
|
+
await raceStrategies(
|
|
132
|
+
config.signature,
|
|
133
|
+
config,
|
|
134
|
+
function getSpecificStrategiesForRace({ abortSignal, commitment, getTimeoutPromise: getTimeoutPromise2 }) {
|
|
135
|
+
return [
|
|
136
|
+
getTimeoutPromise2({
|
|
137
|
+
abortSignal,
|
|
138
|
+
commitment
|
|
139
|
+
})
|
|
140
|
+
];
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/airdrop.ts
|
|
146
|
+
function createDefaultAirdropRequester({ rpc, rpcSubscriptions }) {
|
|
147
|
+
const confirmSignatureOnlyTransaction = createDefaultSignatureOnlyRecentTransactionConfirmer({
|
|
148
|
+
rpc,
|
|
149
|
+
rpcSubscriptions
|
|
150
|
+
});
|
|
151
|
+
return async function requestAirdrop(config) {
|
|
152
|
+
return await requestAndConfirmAirdrop({
|
|
153
|
+
...config,
|
|
154
|
+
confirmSignatureOnlyTransaction,
|
|
155
|
+
rpc
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
async function requestAndConfirmAirdrop({
|
|
160
|
+
abortSignal,
|
|
161
|
+
commitment,
|
|
162
|
+
confirmSignatureOnlyTransaction,
|
|
163
|
+
lamports,
|
|
164
|
+
recipientAddress,
|
|
165
|
+
rpc
|
|
166
|
+
}) {
|
|
167
|
+
const airdropTransactionSignature = await rpc.requestAirdrop(recipientAddress, lamports, { commitment }).send({ abortSignal });
|
|
168
|
+
await confirmSignatureOnlyTransaction({
|
|
169
|
+
abortSignal,
|
|
170
|
+
commitment,
|
|
171
|
+
signature: airdropTransactionSignature
|
|
172
|
+
});
|
|
173
|
+
return airdropTransactionSignature;
|
|
174
|
+
}
|
|
175
|
+
|
|
20
176
|
// src/rpc-integer-overflow-error.ts
|
|
21
177
|
var SolanaJsonRpcIntegerOverflowError = class extends Error {
|
|
22
178
|
constructor(methodName, keyPath, value) {
|
|
@@ -536,97 +692,45 @@ function createNonceInvalidationPromiseFactory(rpc, rpcSubscriptions) {
|
|
|
536
692
|
}
|
|
537
693
|
};
|
|
538
694
|
}
|
|
539
|
-
function createSignatureConfirmationPromiseFactory(rpc, rpcSubscriptions) {
|
|
540
|
-
return async function getSignatureConfirmationPromise({ abortSignal: callerAbortSignal, commitment, signature }) {
|
|
541
|
-
const abortController = new AbortController();
|
|
542
|
-
function handleAbort() {
|
|
543
|
-
abortController.abort();
|
|
544
|
-
}
|
|
545
|
-
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
546
|
-
const signatureStatusNotifications = await rpcSubscriptions.signatureNotifications(signature, { commitment }).subscribe({ abortSignal: abortController.signal });
|
|
547
|
-
const signatureDidCommitPromise = (async () => {
|
|
548
|
-
for await (const signatureStatusNotification of signatureStatusNotifications) {
|
|
549
|
-
if (signatureStatusNotification.value.err) {
|
|
550
|
-
throw new Error(`The transaction with signature \`${signature}\` failed.`, {
|
|
551
|
-
cause: signatureStatusNotification.value.err
|
|
552
|
-
});
|
|
553
|
-
} else {
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
})();
|
|
558
|
-
const signatureStatusLookupPromise = (async () => {
|
|
559
|
-
const { value: signatureStatusResults } = await rpc.getSignatureStatuses([signature]).send({ abortSignal: abortController.signal });
|
|
560
|
-
const signatureStatus = signatureStatusResults[0];
|
|
561
|
-
if (signatureStatus && signatureStatus.confirmationStatus && rpcCore.commitmentComparator(signatureStatus.confirmationStatus, commitment) >= 0) {
|
|
562
|
-
return;
|
|
563
|
-
} else {
|
|
564
|
-
await new Promise(() => {
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
})();
|
|
568
|
-
try {
|
|
569
|
-
return await Promise.race([signatureDidCommitPromise, signatureStatusLookupPromise]);
|
|
570
|
-
} finally {
|
|
571
|
-
abortController.abort();
|
|
572
|
-
}
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
695
|
|
|
576
696
|
// src/transaction-confirmation.ts
|
|
577
|
-
async function raceStrategies(config, getSpecificStrategiesForRace) {
|
|
578
|
-
const { abortSignal: callerAbortSignal, commitment, getSignatureConfirmationPromise, transaction } = config;
|
|
579
|
-
callerAbortSignal.throwIfAborted();
|
|
580
|
-
const signature = transactions.getSignatureFromTransaction(transaction);
|
|
581
|
-
const abortController = new AbortController();
|
|
582
|
-
function handleAbort() {
|
|
583
|
-
abortController.abort();
|
|
584
|
-
}
|
|
585
|
-
callerAbortSignal.addEventListener("abort", handleAbort, { signal: abortController.signal });
|
|
586
|
-
try {
|
|
587
|
-
const specificStrategies = getSpecificStrategiesForRace({
|
|
588
|
-
...config,
|
|
589
|
-
abortSignal: abortController.signal
|
|
590
|
-
});
|
|
591
|
-
return await Promise.race([
|
|
592
|
-
getSignatureConfirmationPromise({
|
|
593
|
-
abortSignal: abortController.signal,
|
|
594
|
-
commitment,
|
|
595
|
-
signature
|
|
596
|
-
}),
|
|
597
|
-
...specificStrategies
|
|
598
|
-
]);
|
|
599
|
-
} finally {
|
|
600
|
-
abortController.abort();
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
697
|
function createDefaultDurableNonceTransactionConfirmer({
|
|
604
698
|
rpc,
|
|
605
699
|
rpcSubscriptions
|
|
606
700
|
}) {
|
|
607
701
|
const getNonceInvalidationPromise = createNonceInvalidationPromiseFactory(rpc, rpcSubscriptions);
|
|
608
|
-
const
|
|
609
|
-
|
|
702
|
+
const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory(
|
|
703
|
+
rpc,
|
|
704
|
+
rpcSubscriptions
|
|
705
|
+
);
|
|
706
|
+
return async function confirmDurableNonceTransaction(config) {
|
|
610
707
|
await waitForDurableNonceTransactionConfirmation({
|
|
611
708
|
...config,
|
|
612
709
|
getNonceInvalidationPromise,
|
|
613
|
-
|
|
710
|
+
getRecentSignatureConfirmationPromise
|
|
614
711
|
});
|
|
615
712
|
};
|
|
616
713
|
}
|
|
617
|
-
function
|
|
714
|
+
function createDefaultRecentTransactionConfirmer({
|
|
715
|
+
rpc,
|
|
716
|
+
rpcSubscriptions
|
|
717
|
+
}) {
|
|
618
718
|
const getBlockHeightExceedencePromise = createBlockHeightExceedencePromiseFactory(rpcSubscriptions);
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
|
|
719
|
+
const getRecentSignatureConfirmationPromise = createRecentSignatureConfirmationPromiseFactory(
|
|
720
|
+
rpc,
|
|
721
|
+
rpcSubscriptions
|
|
722
|
+
);
|
|
723
|
+
return async function confirmRecentTransaction(config) {
|
|
724
|
+
await waitForRecentTransactionConfirmation({
|
|
622
725
|
...config,
|
|
623
726
|
getBlockHeightExceedencePromise,
|
|
624
|
-
|
|
727
|
+
getRecentSignatureConfirmationPromise
|
|
625
728
|
});
|
|
626
729
|
};
|
|
627
730
|
}
|
|
628
731
|
async function waitForDurableNonceTransactionConfirmation(config) {
|
|
629
732
|
await raceStrategies(
|
|
733
|
+
transactions.getSignatureFromTransaction(config.transaction),
|
|
630
734
|
config,
|
|
631
735
|
function getSpecificStrategiesForRace({ abortSignal, commitment, getNonceInvalidationPromise, transaction }) {
|
|
632
736
|
return [
|
|
@@ -640,8 +744,9 @@ async function waitForDurableNonceTransactionConfirmation(config) {
|
|
|
640
744
|
}
|
|
641
745
|
);
|
|
642
746
|
}
|
|
643
|
-
async function
|
|
747
|
+
async function waitForRecentTransactionConfirmation(config) {
|
|
644
748
|
await raceStrategies(
|
|
749
|
+
transactions.getSignatureFromTransaction(config.transaction),
|
|
645
750
|
config,
|
|
646
751
|
function getSpecificStrategiesForRace({ abortSignal, getBlockHeightExceedencePromise, transaction }) {
|
|
647
752
|
return [
|
|
@@ -654,18 +759,138 @@ async function waitForTransactionConfirmation(config) {
|
|
|
654
759
|
);
|
|
655
760
|
}
|
|
656
761
|
|
|
762
|
+
// src/send-transaction.ts
|
|
763
|
+
function getSendTransactionConfigWithAdjustedPreflightCommitment(commitment, config) {
|
|
764
|
+
if (
|
|
765
|
+
// The developer has supplied no value for `preflightCommitment`.
|
|
766
|
+
!config?.preflightCommitment && // The value of `commitment` is lower than the server default of `preflightCommitment`.
|
|
767
|
+
rpcTypes.commitmentComparator(
|
|
768
|
+
commitment,
|
|
769
|
+
"finalized"
|
|
770
|
+
/* default value of `preflightCommitment` */
|
|
771
|
+
) < 0
|
|
772
|
+
) {
|
|
773
|
+
return {
|
|
774
|
+
...config,
|
|
775
|
+
// In the common case, it is unlikely that you want to simulate a transaction at
|
|
776
|
+
// `finalized` commitment when your standard of commitment for confirming the
|
|
777
|
+
// transaction is lower. Cap the simulation commitment level to the level of the
|
|
778
|
+
// confirmation commitment.
|
|
779
|
+
preflightCommitment: commitment
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
return config;
|
|
783
|
+
}
|
|
784
|
+
async function sendTransaction_INTERNAL({
|
|
785
|
+
abortSignal,
|
|
786
|
+
commitment,
|
|
787
|
+
rpc,
|
|
788
|
+
transaction,
|
|
789
|
+
...sendTransactionConfig
|
|
790
|
+
}) {
|
|
791
|
+
const base64EncodedWireTransaction = transactions.getBase64EncodedWireTransaction(transaction);
|
|
792
|
+
return await rpc.sendTransaction(base64EncodedWireTransaction, {
|
|
793
|
+
...getSendTransactionConfigWithAdjustedPreflightCommitment(commitment, sendTransactionConfig),
|
|
794
|
+
encoding: "base64"
|
|
795
|
+
}).send({ abortSignal });
|
|
796
|
+
}
|
|
797
|
+
function createDefaultDurableNonceTransactionSender({
|
|
798
|
+
rpc,
|
|
799
|
+
rpcSubscriptions
|
|
800
|
+
}) {
|
|
801
|
+
const confirmDurableNonceTransaction = createDefaultDurableNonceTransactionConfirmer({
|
|
802
|
+
rpc,
|
|
803
|
+
rpcSubscriptions
|
|
804
|
+
});
|
|
805
|
+
return async function sendDurableNonceTransaction(transaction, config) {
|
|
806
|
+
await sendAndConfirmDurableNonceTransaction({
|
|
807
|
+
...config,
|
|
808
|
+
confirmDurableNonceTransaction,
|
|
809
|
+
rpc,
|
|
810
|
+
transaction
|
|
811
|
+
});
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
function createDefaultTransactionSender({
|
|
815
|
+
rpc,
|
|
816
|
+
rpcSubscriptions
|
|
817
|
+
}) {
|
|
818
|
+
const confirmRecentTransaction = createDefaultRecentTransactionConfirmer({
|
|
819
|
+
rpc,
|
|
820
|
+
rpcSubscriptions
|
|
821
|
+
});
|
|
822
|
+
return async function sendTransaction(transaction, config) {
|
|
823
|
+
await sendAndConfirmTransaction({
|
|
824
|
+
...config,
|
|
825
|
+
confirmRecentTransaction,
|
|
826
|
+
rpc,
|
|
827
|
+
transaction
|
|
828
|
+
});
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
async function sendAndConfirmDurableNonceTransaction({
|
|
832
|
+
abortSignal,
|
|
833
|
+
commitment,
|
|
834
|
+
confirmDurableNonceTransaction,
|
|
835
|
+
rpc,
|
|
836
|
+
transaction,
|
|
837
|
+
...sendTransactionConfig
|
|
838
|
+
}) {
|
|
839
|
+
const transactionSignature = await sendTransaction_INTERNAL({
|
|
840
|
+
...sendTransactionConfig,
|
|
841
|
+
abortSignal,
|
|
842
|
+
commitment,
|
|
843
|
+
rpc,
|
|
844
|
+
transaction
|
|
845
|
+
});
|
|
846
|
+
await confirmDurableNonceTransaction({
|
|
847
|
+
abortSignal,
|
|
848
|
+
commitment,
|
|
849
|
+
transaction
|
|
850
|
+
});
|
|
851
|
+
return transactionSignature;
|
|
852
|
+
}
|
|
853
|
+
async function sendAndConfirmTransaction({
|
|
854
|
+
abortSignal,
|
|
855
|
+
commitment,
|
|
856
|
+
confirmRecentTransaction,
|
|
857
|
+
rpc,
|
|
858
|
+
transaction,
|
|
859
|
+
...sendTransactionConfig
|
|
860
|
+
}) {
|
|
861
|
+
const transactionSignature = await sendTransaction_INTERNAL({
|
|
862
|
+
...sendTransactionConfig,
|
|
863
|
+
abortSignal,
|
|
864
|
+
commitment,
|
|
865
|
+
rpc,
|
|
866
|
+
transaction
|
|
867
|
+
});
|
|
868
|
+
await confirmRecentTransaction({
|
|
869
|
+
abortSignal,
|
|
870
|
+
commitment,
|
|
871
|
+
transaction
|
|
872
|
+
});
|
|
873
|
+
return transactionSignature;
|
|
874
|
+
}
|
|
875
|
+
|
|
657
876
|
exports.createBlockHeightExceedencePromiseFactory = createBlockHeightExceedencePromiseFactory;
|
|
877
|
+
exports.createDefaultAirdropRequester = createDefaultAirdropRequester;
|
|
658
878
|
exports.createDefaultDurableNonceTransactionConfirmer = createDefaultDurableNonceTransactionConfirmer;
|
|
879
|
+
exports.createDefaultDurableNonceTransactionSender = createDefaultDurableNonceTransactionSender;
|
|
880
|
+
exports.createDefaultRecentTransactionConfirmer = createDefaultRecentTransactionConfirmer;
|
|
659
881
|
exports.createDefaultRpcSubscriptionsTransport = createDefaultRpcSubscriptionsTransport;
|
|
660
882
|
exports.createDefaultRpcTransport = createDefaultRpcTransport;
|
|
661
|
-
exports.
|
|
883
|
+
exports.createDefaultTransactionSender = createDefaultTransactionSender;
|
|
662
884
|
exports.createNonceInvalidationPromiseFactory = createNonceInvalidationPromiseFactory;
|
|
663
|
-
exports.
|
|
885
|
+
exports.createRecentSignatureConfirmationPromiseFactory = createRecentSignatureConfirmationPromiseFactory;
|
|
664
886
|
exports.createSolanaRpc = createSolanaRpc;
|
|
665
887
|
exports.createSolanaRpcSubscriptions = createSolanaRpcSubscriptions;
|
|
666
888
|
exports.createSolanaRpcSubscriptions_UNSTABLE = createSolanaRpcSubscriptions_UNSTABLE;
|
|
889
|
+
exports.requestAndConfirmAirdrop = requestAndConfirmAirdrop;
|
|
890
|
+
exports.sendAndConfirmDurableNonceTransaction = sendAndConfirmDurableNonceTransaction;
|
|
891
|
+
exports.sendAndConfirmTransaction = sendAndConfirmTransaction;
|
|
667
892
|
exports.waitForDurableNonceTransactionConfirmation = waitForDurableNonceTransactionConfirmation;
|
|
668
|
-
exports.
|
|
893
|
+
exports.waitForRecentTransactionConfirmation = waitForRecentTransactionConfirmation;
|
|
669
894
|
Object.keys(addresses).forEach(function (k) {
|
|
670
895
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
671
896
|
enumerable: true,
|
|
@@ -684,11 +909,15 @@ Object.keys(keys).forEach(function (k) {
|
|
|
684
909
|
get: function () { return keys[k]; }
|
|
685
910
|
});
|
|
686
911
|
});
|
|
912
|
+
Object.keys(rpcTypes).forEach(function (k) {
|
|
913
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
914
|
+
enumerable: true,
|
|
915
|
+
get: function () { return rpcTypes[k]; }
|
|
916
|
+
});
|
|
917
|
+
});
|
|
687
918
|
Object.keys(transactions).forEach(function (k) {
|
|
688
919
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
689
920
|
enumerable: true,
|
|
690
921
|
get: function () { return transactions[k]; }
|
|
691
922
|
});
|
|
692
923
|
});
|
|
693
|
-
//# sourceMappingURL=out.js.map
|
|
694
|
-
//# sourceMappingURL=index.browser.cjs.map
|