@solana/client 1.2.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.mjs +2 -2
- package/dist/index.native.mjs +2 -2
- package/dist/index.node.mjs +424 -61
- package/dist/types/client/actions.d.ts +3 -1
- package/dist/types/client/actions.d.ts.map +1 -1
- package/dist/types/client/createClient.d.ts.map +1 -1
- package/dist/types/client/createClientHelpers.d.ts +2 -1
- package/dist/types/client/createClientHelpers.d.ts.map +1 -1
- package/dist/types/client/defaultClient.d.ts +2 -1
- package/dist/types/client/defaultClient.d.ts.map +1 -1
- package/dist/types/client/watchers.d.ts +2 -1
- package/dist/types/client/watchers.d.ts.map +1 -1
- package/dist/types/controllers/wsolController.d.ts +30 -0
- package/dist/types/controllers/wsolController.d.ts.map +1 -0
- package/dist/types/features/sol.d.ts +2 -1
- package/dist/types/features/sol.d.ts.map +1 -1
- package/dist/types/features/spl.d.ts +2 -1
- package/dist/types/features/spl.d.ts.map +1 -1
- package/dist/types/features/stake.d.ts +2 -1
- package/dist/types/features/stake.d.ts.map +1 -1
- package/dist/types/features/transactions.d.ts +2 -1
- package/dist/types/features/transactions.d.ts.map +1 -1
- package/dist/types/features/wsol.d.ts +86 -0
- package/dist/types/features/wsol.d.ts.map +1 -0
- package/dist/types/index.d.ts +5 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/rpc/types.d.ts +8 -0
- package/dist/types/rpc/types.d.ts.map +1 -0
- package/dist/types/signers/walletTransactionSigner.d.ts +1 -1
- package/dist/types/signers/walletTransactionSigner.d.ts.map +1 -1
- package/dist/types/types.d.ts +8 -64
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/wallet/connectors.d.ts +1 -1
- package/dist/types/wallet/connectors.d.ts.map +1 -1
- package/dist/types/wallet/registry.d.ts +1 -1
- package/dist/types/wallet/registry.d.ts.map +1 -1
- package/dist/types/wallet/standard.d.ts +1 -1
- package/dist/types/wallet/standard.d.ts.map +1 -1
- package/dist/types/wallet/types.d.ts +60 -0
- package/dist/types/wallet/types.d.ts.map +1 -0
- package/package.json +4 -3
package/dist/index.node.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createSolanaRpc, createSolanaRpcSubscriptions,
|
|
1
|
+
import { address, createSolanaRpc, createSolanaRpcSubscriptions, getBase64EncodedWireTransaction, compileTransaction, partiallySignTransactionMessageWithSigners, appendTransactionMessageInstruction, setTransactionMessageLifetimeUsingBlockhash, isTransactionSendingSigner, getMessagePackerInstructionPlanFromInstructions, signature, AccountRole, pipe, createTransactionMessage, setTransactionMessageFeePayer, singleTransactionPlan, signAndSendTransactionMessageWithSigners, createTransactionPlanExecutor, signTransactionMessageWithSigners, isSolanaError, SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED, generateKeyPairSigner, appendTransactionMessageInstructions, createTransactionPlanner, setTransactionMessageFeePayerSigner, isTransactionPartialSigner, SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED, isInstructionForProgram, isInstructionWithData, SolanaError, SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR, isSome, airdropFactory, signatureBytes } from '@solana/kit';
|
|
2
2
|
import { createBlockHeightExceedencePromiseFactory, createRecentSignatureConfirmationPromiseFactory, waitForRecentTransactionConfirmation } from '@solana/transaction-confirmation';
|
|
3
3
|
import { fetchAddressLookupTable, fetchAllAddressLookupTable } from '@solana-program/address-lookup-table';
|
|
4
4
|
import { getTransferSolInstruction, getCreateAccountInstruction, fetchNonce } from '@solana-program/system';
|
|
5
5
|
import { getBase58Decoder, getBase58Encoder } from '@solana/codecs-strings';
|
|
6
|
-
import { TOKEN_PROGRAM_ADDRESS, fetchMint, findAssociatedTokenPda, getCreateAssociatedTokenInstruction, getTransferCheckedInstruction } from '@solana-program/token';
|
|
6
|
+
import { TOKEN_PROGRAM_ADDRESS, fetchMint, findAssociatedTokenPda, getCreateAssociatedTokenInstruction, getTransferCheckedInstruction, getCreateAssociatedTokenIdempotentInstruction, getSyncNativeInstruction, getCloseAccountInstruction } from '@solana-program/token';
|
|
7
7
|
import { getInitializeInstruction, getDelegateStakeInstruction, getDeactivateInstruction, getWithdrawInstruction } from '@solana-program/stake';
|
|
8
8
|
import { getSetComputeUnitLimitInstruction, getSetComputeUnitPriceInstruction, COMPUTE_BUDGET_PROGRAM_ADDRESS, ComputeBudgetInstruction } from '@solana-program/compute-budget';
|
|
9
9
|
import { createStore } from 'zustand/vanilla';
|
|
@@ -500,6 +500,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
500
500
|
level: "info",
|
|
501
501
|
message: "wallet connected"
|
|
502
502
|
});
|
|
503
|
+
return session;
|
|
503
504
|
} catch (error) {
|
|
504
505
|
store.setState((state) => ({
|
|
505
506
|
...state,
|
|
@@ -540,38 +541,42 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
540
541
|
}
|
|
541
542
|
}
|
|
542
543
|
__name(disconnectWallet3, "disconnectWallet");
|
|
543
|
-
async function fetchBalance2(
|
|
544
|
-
const key =
|
|
544
|
+
async function fetchBalance2(address6, commitment) {
|
|
545
|
+
const key = address6.toString();
|
|
545
546
|
store.setState((state) => ({
|
|
546
547
|
...state,
|
|
547
548
|
accounts: {
|
|
548
549
|
...state.accounts,
|
|
549
550
|
[key]: {
|
|
550
|
-
address:
|
|
551
|
+
address: address6,
|
|
551
552
|
data: state.accounts[key]?.data,
|
|
552
553
|
error: void 0,
|
|
554
|
+
executable: state.accounts[key]?.executable ?? null,
|
|
553
555
|
fetching: true,
|
|
554
556
|
lamports: state.accounts[key]?.lamports ?? null,
|
|
555
557
|
lastFetchedAt: now(),
|
|
558
|
+
owner: state.accounts[key]?.owner ?? null,
|
|
556
559
|
slot: state.accounts[key]?.slot ?? null
|
|
557
560
|
}
|
|
558
561
|
},
|
|
559
562
|
lastUpdatedAt: now()
|
|
560
563
|
}));
|
|
561
564
|
try {
|
|
562
|
-
const response = await runtime.rpc.getBalance(
|
|
565
|
+
const response = await runtime.rpc.getBalance(address6, { commitment: getCommitment(commitment) }).send({ abortSignal: AbortSignal.timeout(1e4) });
|
|
563
566
|
const lamports2 = response.value;
|
|
564
567
|
store.setState((state) => ({
|
|
565
568
|
...state,
|
|
566
569
|
accounts: {
|
|
567
570
|
...state.accounts,
|
|
568
571
|
[key]: {
|
|
569
|
-
address:
|
|
572
|
+
address: address6,
|
|
570
573
|
data: state.accounts[key]?.data,
|
|
571
574
|
error: void 0,
|
|
575
|
+
executable: state.accounts[key]?.executable ?? null,
|
|
572
576
|
fetching: false,
|
|
573
577
|
lamports: lamports2,
|
|
574
578
|
lastFetchedAt: now(),
|
|
579
|
+
owner: state.accounts[key]?.owner ?? null,
|
|
575
580
|
slot: response.context.slot
|
|
576
581
|
}
|
|
577
582
|
},
|
|
@@ -584,12 +589,14 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
584
589
|
accounts: {
|
|
585
590
|
...state.accounts,
|
|
586
591
|
[key]: {
|
|
587
|
-
address:
|
|
592
|
+
address: address6,
|
|
588
593
|
data: state.accounts[key]?.data,
|
|
589
594
|
error,
|
|
595
|
+
executable: state.accounts[key]?.executable ?? null,
|
|
590
596
|
fetching: false,
|
|
591
597
|
lamports: state.accounts[key]?.lamports ?? null,
|
|
592
598
|
lastFetchedAt: now(),
|
|
599
|
+
owner: state.accounts[key]?.owner ?? null,
|
|
593
600
|
slot: state.accounts[key]?.slot ?? null
|
|
594
601
|
}
|
|
595
602
|
},
|
|
@@ -604,39 +611,45 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
604
611
|
}
|
|
605
612
|
}
|
|
606
613
|
__name(fetchBalance2, "fetchBalance");
|
|
607
|
-
async function fetchAccount2(
|
|
608
|
-
const key =
|
|
614
|
+
async function fetchAccount2(address6, commitment) {
|
|
615
|
+
const key = address6.toString();
|
|
609
616
|
store.setState((state) => ({
|
|
610
617
|
...state,
|
|
611
618
|
accounts: {
|
|
612
619
|
...state.accounts,
|
|
613
620
|
[key]: {
|
|
614
|
-
address:
|
|
621
|
+
address: address6,
|
|
615
622
|
data: state.accounts[key]?.data,
|
|
616
623
|
error: void 0,
|
|
624
|
+
executable: state.accounts[key]?.executable ?? null,
|
|
617
625
|
fetching: true,
|
|
618
626
|
lamports: state.accounts[key]?.lamports ?? null,
|
|
619
627
|
lastFetchedAt: now(),
|
|
628
|
+
owner: state.accounts[key]?.owner ?? null,
|
|
620
629
|
slot: state.accounts[key]?.slot ?? null
|
|
621
630
|
}
|
|
622
631
|
},
|
|
623
632
|
lastUpdatedAt: now()
|
|
624
633
|
}));
|
|
625
634
|
try {
|
|
626
|
-
const response = await runtime.rpc.getAccountInfo(
|
|
635
|
+
const response = await runtime.rpc.getAccountInfo(address6, { commitment: getCommitment(commitment), encoding: "base64" }).send({ abortSignal: AbortSignal.timeout(1e4) });
|
|
627
636
|
const value = response.value;
|
|
628
637
|
const lamports2 = value?.lamports ?? null;
|
|
638
|
+
const executable = value?.executable ?? null;
|
|
639
|
+
const owner = value?.owner ?? null;
|
|
629
640
|
store.setState((state) => ({
|
|
630
641
|
...state,
|
|
631
642
|
accounts: {
|
|
632
643
|
...state.accounts,
|
|
633
644
|
[key]: {
|
|
634
|
-
address:
|
|
645
|
+
address: address6,
|
|
635
646
|
data: value,
|
|
636
647
|
error: void 0,
|
|
648
|
+
executable,
|
|
637
649
|
fetching: false,
|
|
638
650
|
lamports: lamports2,
|
|
639
651
|
lastFetchedAt: now(),
|
|
652
|
+
owner,
|
|
640
653
|
slot: response.context.slot
|
|
641
654
|
}
|
|
642
655
|
},
|
|
@@ -649,12 +662,14 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
649
662
|
accounts: {
|
|
650
663
|
...state.accounts,
|
|
651
664
|
[key]: {
|
|
652
|
-
address:
|
|
665
|
+
address: address6,
|
|
653
666
|
data: state.accounts[key]?.data,
|
|
654
667
|
error,
|
|
668
|
+
executable: state.accounts[key]?.executable ?? null,
|
|
655
669
|
fetching: false,
|
|
656
670
|
lamports: state.accounts[key]?.lamports ?? null,
|
|
657
671
|
lastFetchedAt: now(),
|
|
672
|
+
owner: state.accounts[key]?.owner ?? null,
|
|
658
673
|
slot: state.accounts[key]?.slot ?? null
|
|
659
674
|
}
|
|
660
675
|
},
|
|
@@ -707,11 +722,11 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
707
722
|
async function sendTransaction2(transaction, commitment) {
|
|
708
723
|
const targetCommitment = getCommitment(commitment);
|
|
709
724
|
const abortController = new AbortController();
|
|
710
|
-
const
|
|
725
|
+
const signature6 = await runtime.rpc.sendTransaction(getBase64EncodedWireTransaction(transaction), {
|
|
711
726
|
encoding: "base64",
|
|
712
727
|
preflightCommitment: targetCommitment
|
|
713
728
|
}).send({ abortSignal: abortController.signal });
|
|
714
|
-
const key =
|
|
729
|
+
const key = signature6.toString();
|
|
715
730
|
store.setState((state) => ({
|
|
716
731
|
...state,
|
|
717
732
|
lastUpdatedAt: now(),
|
|
@@ -719,7 +734,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
719
734
|
...state.transactions,
|
|
720
735
|
[key]: {
|
|
721
736
|
lastUpdatedAt: now(),
|
|
722
|
-
signature:
|
|
737
|
+
signature: signature6,
|
|
723
738
|
status: "sending"
|
|
724
739
|
}
|
|
725
740
|
}
|
|
@@ -747,12 +762,12 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
747
762
|
...state.transactions,
|
|
748
763
|
[key]: {
|
|
749
764
|
lastUpdatedAt: now(),
|
|
750
|
-
signature:
|
|
765
|
+
signature: signature6,
|
|
751
766
|
status: "confirmed"
|
|
752
767
|
}
|
|
753
768
|
}
|
|
754
769
|
}));
|
|
755
|
-
return
|
|
770
|
+
return signature6;
|
|
756
771
|
} catch (error) {
|
|
757
772
|
store.setState((state) => ({
|
|
758
773
|
...state,
|
|
@@ -762,7 +777,7 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
762
777
|
[key]: {
|
|
763
778
|
error,
|
|
764
779
|
lastUpdatedAt: now(),
|
|
765
|
-
signature:
|
|
780
|
+
signature: signature6,
|
|
766
781
|
status: "failed"
|
|
767
782
|
}
|
|
768
783
|
}
|
|
@@ -776,26 +791,26 @@ function createActions({ connectors, logger: inputLogger, runtime, store }) {
|
|
|
776
791
|
}
|
|
777
792
|
}
|
|
778
793
|
__name(sendTransaction2, "sendTransaction");
|
|
779
|
-
async function requestAirdrop2(
|
|
794
|
+
async function requestAirdrop2(address6, lamports2) {
|
|
780
795
|
try {
|
|
781
796
|
const factory = airdropFactory({
|
|
782
797
|
rpc: runtime.rpc,
|
|
783
798
|
rpcSubscriptions: runtime.rpcSubscriptions
|
|
784
799
|
});
|
|
785
|
-
const
|
|
800
|
+
const signature6 = await factory({
|
|
786
801
|
commitment: getCommitment("confirmed"),
|
|
787
802
|
lamports: lamports2,
|
|
788
|
-
recipientAddress:
|
|
803
|
+
recipientAddress: address6
|
|
789
804
|
});
|
|
790
805
|
logger({
|
|
791
|
-
data: { address:
|
|
806
|
+
data: { address: address6.toString(), lamports: lamports2.toString(), signature: signature6 },
|
|
792
807
|
level: "info",
|
|
793
808
|
message: "airdrop requested"
|
|
794
809
|
});
|
|
795
|
-
return
|
|
810
|
+
return signature6;
|
|
796
811
|
} catch (error) {
|
|
797
812
|
logger({
|
|
798
|
-
data: { address:
|
|
813
|
+
data: { address: address6.toString(), lamports: lamports2.toString(), ...formatError(error) },
|
|
799
814
|
level: "error",
|
|
800
815
|
message: "airdrop request failed"
|
|
801
816
|
});
|
|
@@ -1199,11 +1214,11 @@ function isWalletSession(value) {
|
|
|
1199
1214
|
__name(isWalletSession, "isWalletSession");
|
|
1200
1215
|
function createWalletTransactionSigner(session, config = {}) {
|
|
1201
1216
|
const { commitment } = config;
|
|
1202
|
-
const
|
|
1217
|
+
const address6 = session.account.address;
|
|
1203
1218
|
if (session.signTransaction) {
|
|
1204
1219
|
const signTransaction = session.signTransaction.bind(session);
|
|
1205
1220
|
const modifyingSigner = Object.freeze({
|
|
1206
|
-
address:
|
|
1221
|
+
address: address6,
|
|
1207
1222
|
async modifyAndSignTransactions(transactions) {
|
|
1208
1223
|
const signedTransactions = [];
|
|
1209
1224
|
for (const transaction of transactions) {
|
|
@@ -1211,8 +1226,8 @@ function createWalletTransactionSigner(session, config = {}) {
|
|
|
1211
1226
|
const signed = await signTransaction(
|
|
1212
1227
|
castTransaction
|
|
1213
1228
|
);
|
|
1214
|
-
const
|
|
1215
|
-
if (!
|
|
1229
|
+
const signature6 = signed.signatures[address6];
|
|
1230
|
+
if (!signature6) {
|
|
1216
1231
|
throw new Error("Wallet did not populate the expected fee payer signature.");
|
|
1217
1232
|
}
|
|
1218
1233
|
const mergedTransaction = Object.freeze({
|
|
@@ -1231,11 +1246,11 @@ function createWalletTransactionSigner(session, config = {}) {
|
|
|
1231
1246
|
const signedTransactions = await this.modifyAndSignTransactions(transactions);
|
|
1232
1247
|
return Object.freeze(
|
|
1233
1248
|
signedTransactions.map((signedTransaction) => {
|
|
1234
|
-
const
|
|
1235
|
-
if (!
|
|
1249
|
+
const signature6 = signedTransaction.signatures[address6];
|
|
1250
|
+
if (!signature6) {
|
|
1236
1251
|
throw new Error("Expected signer to produce a signature for the provided address.");
|
|
1237
1252
|
}
|
|
1238
|
-
return Object.freeze({ [
|
|
1253
|
+
return Object.freeze({ [address6]: signature6 });
|
|
1239
1254
|
})
|
|
1240
1255
|
);
|
|
1241
1256
|
}
|
|
@@ -1249,7 +1264,7 @@ function createWalletTransactionSigner(session, config = {}) {
|
|
|
1249
1264
|
const base58Encoder = getBase58Encoder();
|
|
1250
1265
|
const sendTransaction2 = session.sendTransaction.bind(session);
|
|
1251
1266
|
const sendingSigner = Object.freeze({
|
|
1252
|
-
address:
|
|
1267
|
+
address: address6,
|
|
1253
1268
|
async signAndSendTransactions(transactions) {
|
|
1254
1269
|
const signatures = [];
|
|
1255
1270
|
for (const transaction of transactions) {
|
|
@@ -2044,11 +2059,11 @@ function resolveFeePayerAddress(feePayer, authoritySigner) {
|
|
|
2044
2059
|
return { address: feePayer.address, signer: feePayer };
|
|
2045
2060
|
}
|
|
2046
2061
|
if (feePayer) {
|
|
2047
|
-
const
|
|
2048
|
-
if (authoritySigner && authoritySigner.address ===
|
|
2049
|
-
return { address:
|
|
2062
|
+
const address6 = toAddress(feePayer);
|
|
2063
|
+
if (authoritySigner && authoritySigner.address === address6) {
|
|
2064
|
+
return { address: address6, signer: authoritySigner };
|
|
2050
2065
|
}
|
|
2051
|
-
return { address:
|
|
2066
|
+
return { address: address6 };
|
|
2052
2067
|
}
|
|
2053
2068
|
if (!authoritySigner) {
|
|
2054
2069
|
throw new Error("Unable to resolve authority signer for the fee payer.");
|
|
@@ -2268,6 +2283,221 @@ function createTransactionHelper(runtime, getFallbackCommitment) {
|
|
|
2268
2283
|
});
|
|
2269
2284
|
}
|
|
2270
2285
|
__name(createTransactionHelper, "createTransactionHelper");
|
|
2286
|
+
var WRAPPED_SOL_MINT = address("So11111111111111111111111111111111111111112");
|
|
2287
|
+
function ensureAddress4(value, fallback) {
|
|
2288
|
+
if (value) {
|
|
2289
|
+
return typeof value === "string" ? address(value) : value;
|
|
2290
|
+
}
|
|
2291
|
+
if (!fallback) {
|
|
2292
|
+
throw new Error("An address value was expected but not provided.");
|
|
2293
|
+
}
|
|
2294
|
+
return fallback;
|
|
2295
|
+
}
|
|
2296
|
+
__name(ensureAddress4, "ensureAddress");
|
|
2297
|
+
async function resolveLifetime4(runtime, commitment, fallback) {
|
|
2298
|
+
if (fallback) {
|
|
2299
|
+
return fallback;
|
|
2300
|
+
}
|
|
2301
|
+
const { value } = await runtime.rpc.getLatestBlockhash({ commitment }).send();
|
|
2302
|
+
return value;
|
|
2303
|
+
}
|
|
2304
|
+
__name(resolveLifetime4, "resolveLifetime");
|
|
2305
|
+
function resolveSigner4(authority, commitment) {
|
|
2306
|
+
if (isWalletSession(authority)) {
|
|
2307
|
+
const { signer, mode } = createWalletTransactionSigner(authority, { commitment });
|
|
2308
|
+
return { mode, signer };
|
|
2309
|
+
}
|
|
2310
|
+
return { mode: resolveSignerMode(authority), signer: authority };
|
|
2311
|
+
}
|
|
2312
|
+
__name(resolveSigner4, "resolveSigner");
|
|
2313
|
+
function toLamportAmount3(input) {
|
|
2314
|
+
return lamportsMath.fromLamports(input);
|
|
2315
|
+
}
|
|
2316
|
+
__name(toLamportAmount3, "toLamportAmount");
|
|
2317
|
+
function createWsolHelper(runtime) {
|
|
2318
|
+
const tokenProgram = address(TOKEN_PROGRAM_ADDRESS);
|
|
2319
|
+
async function deriveWsolAddress(owner) {
|
|
2320
|
+
const [ata] = await findAssociatedTokenPda({
|
|
2321
|
+
mint: WRAPPED_SOL_MINT,
|
|
2322
|
+
owner: ensureAddress4(owner),
|
|
2323
|
+
tokenProgram
|
|
2324
|
+
});
|
|
2325
|
+
return ata;
|
|
2326
|
+
}
|
|
2327
|
+
__name(deriveWsolAddress, "deriveWsolAddress");
|
|
2328
|
+
async function fetchWsolBalance(owner, commitment) {
|
|
2329
|
+
const ataAddress = await deriveWsolAddress(owner);
|
|
2330
|
+
try {
|
|
2331
|
+
const { value } = await runtime.rpc.getTokenAccountBalance(ataAddress, { commitment }).send();
|
|
2332
|
+
const amount = BigInt(value.amount);
|
|
2333
|
+
return {
|
|
2334
|
+
amount,
|
|
2335
|
+
ataAddress,
|
|
2336
|
+
exists: true
|
|
2337
|
+
};
|
|
2338
|
+
} catch {
|
|
2339
|
+
return {
|
|
2340
|
+
amount: 0n,
|
|
2341
|
+
ataAddress,
|
|
2342
|
+
exists: false
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
__name(fetchWsolBalance, "fetchWsolBalance");
|
|
2347
|
+
async function prepareWrap(config) {
|
|
2348
|
+
const commitment = config.commitment;
|
|
2349
|
+
const lifetime = await resolveLifetime4(runtime, commitment, config.lifetime);
|
|
2350
|
+
const { signer, mode } = resolveSigner4(config.authority, commitment);
|
|
2351
|
+
const owner = ensureAddress4(config.owner, signer.address);
|
|
2352
|
+
const amount = toLamportAmount3(config.amount);
|
|
2353
|
+
const ataAddress = await deriveWsolAddress(owner);
|
|
2354
|
+
const instructions = [
|
|
2355
|
+
getCreateAssociatedTokenIdempotentInstruction({
|
|
2356
|
+
ata: ataAddress,
|
|
2357
|
+
mint: WRAPPED_SOL_MINT,
|
|
2358
|
+
owner,
|
|
2359
|
+
payer: signer,
|
|
2360
|
+
tokenProgram
|
|
2361
|
+
}),
|
|
2362
|
+
getTransferSolInstruction({
|
|
2363
|
+
amount,
|
|
2364
|
+
destination: ataAddress,
|
|
2365
|
+
source: signer
|
|
2366
|
+
}),
|
|
2367
|
+
getSyncNativeInstruction({
|
|
2368
|
+
account: ataAddress
|
|
2369
|
+
})
|
|
2370
|
+
];
|
|
2371
|
+
const message = pipe(
|
|
2372
|
+
createTransactionMessage({ version: config.transactionVersion ?? 0 }),
|
|
2373
|
+
(m) => setTransactionMessageFeePayer(signer.address, m),
|
|
2374
|
+
(m) => setTransactionMessageLifetimeUsingBlockhash(lifetime, m),
|
|
2375
|
+
(m) => appendTransactionMessageInstructions(instructions, m)
|
|
2376
|
+
);
|
|
2377
|
+
return {
|
|
2378
|
+
amount,
|
|
2379
|
+
ataAddress,
|
|
2380
|
+
commitment,
|
|
2381
|
+
lifetime,
|
|
2382
|
+
message,
|
|
2383
|
+
mode,
|
|
2384
|
+
owner,
|
|
2385
|
+
plan: singleTransactionPlan(message),
|
|
2386
|
+
signer
|
|
2387
|
+
};
|
|
2388
|
+
}
|
|
2389
|
+
__name(prepareWrap, "prepareWrap");
|
|
2390
|
+
async function prepareUnwrap(config) {
|
|
2391
|
+
const commitment = config.commitment;
|
|
2392
|
+
const lifetime = await resolveLifetime4(runtime, commitment, config.lifetime);
|
|
2393
|
+
const { signer, mode } = resolveSigner4(config.authority, commitment);
|
|
2394
|
+
const owner = ensureAddress4(config.owner, signer.address);
|
|
2395
|
+
const ataAddress = await deriveWsolAddress(owner);
|
|
2396
|
+
const instruction = getCloseAccountInstruction({
|
|
2397
|
+
account: ataAddress,
|
|
2398
|
+
destination: owner,
|
|
2399
|
+
owner: signer
|
|
2400
|
+
});
|
|
2401
|
+
const message = pipe(
|
|
2402
|
+
createTransactionMessage({ version: config.transactionVersion ?? 0 }),
|
|
2403
|
+
(m) => setTransactionMessageFeePayer(signer.address, m),
|
|
2404
|
+
(m) => setTransactionMessageLifetimeUsingBlockhash(lifetime, m),
|
|
2405
|
+
(m) => appendTransactionMessageInstruction(instruction, m)
|
|
2406
|
+
);
|
|
2407
|
+
return {
|
|
2408
|
+
ataAddress,
|
|
2409
|
+
commitment,
|
|
2410
|
+
lifetime,
|
|
2411
|
+
message,
|
|
2412
|
+
mode,
|
|
2413
|
+
owner,
|
|
2414
|
+
plan: singleTransactionPlan(message),
|
|
2415
|
+
signer
|
|
2416
|
+
};
|
|
2417
|
+
}
|
|
2418
|
+
__name(prepareUnwrap, "prepareUnwrap");
|
|
2419
|
+
async function sendPreparedTransaction(prepared, options = {}) {
|
|
2420
|
+
if (prepared.mode === "send" && isTransactionSendingSigner(prepared.signer)) {
|
|
2421
|
+
const signatureBytes2 = await signAndSendTransactionMessageWithSigners(prepared.message, {
|
|
2422
|
+
abortSignal: options.abortSignal,
|
|
2423
|
+
minContextSlot: options.minContextSlot
|
|
2424
|
+
});
|
|
2425
|
+
const base58Decoder2 = getBase58Decoder();
|
|
2426
|
+
return signature(base58Decoder2.decode(signatureBytes2));
|
|
2427
|
+
}
|
|
2428
|
+
const commitment = options.commitment ?? prepared.commitment;
|
|
2429
|
+
const maxRetries = options.maxRetries === void 0 ? void 0 : typeof options.maxRetries === "bigint" ? options.maxRetries : BigInt(options.maxRetries);
|
|
2430
|
+
let latestSignature = null;
|
|
2431
|
+
const executor = createTransactionPlanExecutor({
|
|
2432
|
+
async executeTransactionMessage(message, config = {}) {
|
|
2433
|
+
const signed = await signTransactionMessageWithSigners(message, {
|
|
2434
|
+
abortSignal: config.abortSignal ?? options.abortSignal,
|
|
2435
|
+
minContextSlot: options.minContextSlot
|
|
2436
|
+
});
|
|
2437
|
+
const wire = getBase64EncodedWireTransaction(signed);
|
|
2438
|
+
const response = await runtime.rpc.sendTransaction(wire, {
|
|
2439
|
+
encoding: "base64",
|
|
2440
|
+
maxRetries,
|
|
2441
|
+
preflightCommitment: commitment,
|
|
2442
|
+
skipPreflight: options.skipPreflight
|
|
2443
|
+
}).send({ abortSignal: config.abortSignal ?? options.abortSignal });
|
|
2444
|
+
latestSignature = signature(response);
|
|
2445
|
+
return { transaction: signed };
|
|
2446
|
+
}
|
|
2447
|
+
});
|
|
2448
|
+
await executor(prepared.plan ?? singleTransactionPlan(prepared.message), { abortSignal: options.abortSignal });
|
|
2449
|
+
if (!latestSignature) {
|
|
2450
|
+
throw new Error("Failed to resolve transaction signature.");
|
|
2451
|
+
}
|
|
2452
|
+
return latestSignature;
|
|
2453
|
+
}
|
|
2454
|
+
__name(sendPreparedTransaction, "sendPreparedTransaction");
|
|
2455
|
+
async function sendPreparedWrap(prepared, options) {
|
|
2456
|
+
return sendPreparedTransaction(prepared, options);
|
|
2457
|
+
}
|
|
2458
|
+
__name(sendPreparedWrap, "sendPreparedWrap");
|
|
2459
|
+
async function sendPreparedUnwrap(prepared, options) {
|
|
2460
|
+
return sendPreparedTransaction(prepared, options);
|
|
2461
|
+
}
|
|
2462
|
+
__name(sendPreparedUnwrap, "sendPreparedUnwrap");
|
|
2463
|
+
async function sendWrap(config, options) {
|
|
2464
|
+
const prepared = await prepareWrap(config);
|
|
2465
|
+
try {
|
|
2466
|
+
return await sendPreparedWrap(prepared, options);
|
|
2467
|
+
} catch (error) {
|
|
2468
|
+
if (isSolanaError(error, SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED)) {
|
|
2469
|
+
const retriedPrepared = await prepareWrap({ ...config, lifetime: void 0 });
|
|
2470
|
+
return await sendPreparedWrap(retriedPrepared, options);
|
|
2471
|
+
}
|
|
2472
|
+
throw error;
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
__name(sendWrap, "sendWrap");
|
|
2476
|
+
async function sendUnwrap(config, options) {
|
|
2477
|
+
const prepared = await prepareUnwrap(config);
|
|
2478
|
+
try {
|
|
2479
|
+
return await sendPreparedUnwrap(prepared, options);
|
|
2480
|
+
} catch (error) {
|
|
2481
|
+
if (isSolanaError(error, SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED)) {
|
|
2482
|
+
const retriedPrepared = await prepareUnwrap({ ...config, lifetime: void 0 });
|
|
2483
|
+
return await sendPreparedUnwrap(retriedPrepared, options);
|
|
2484
|
+
}
|
|
2485
|
+
throw error;
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
__name(sendUnwrap, "sendUnwrap");
|
|
2489
|
+
return {
|
|
2490
|
+
deriveWsolAddress,
|
|
2491
|
+
fetchWsolBalance,
|
|
2492
|
+
prepareUnwrap,
|
|
2493
|
+
prepareWrap,
|
|
2494
|
+
sendPreparedUnwrap,
|
|
2495
|
+
sendPreparedWrap,
|
|
2496
|
+
sendUnwrap,
|
|
2497
|
+
sendWrap
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
__name(createWsolHelper, "createWsolHelper");
|
|
2271
2501
|
|
|
2272
2502
|
// src/client/createClientHelpers.ts
|
|
2273
2503
|
function withDefaultCommitment(config, getFallback, baseCommitment) {
|
|
@@ -2315,6 +2545,19 @@ function wrapStakeHelper(helper, getFallback) {
|
|
|
2315
2545
|
};
|
|
2316
2546
|
}
|
|
2317
2547
|
__name(wrapStakeHelper, "wrapStakeHelper");
|
|
2548
|
+
function wrapWsolHelper(helper, getFallback) {
|
|
2549
|
+
return {
|
|
2550
|
+
deriveWsolAddress: helper.deriveWsolAddress,
|
|
2551
|
+
fetchWsolBalance: /* @__PURE__ */ __name((owner, commitment) => helper.fetchWsolBalance(owner, commitment ?? getFallback()), "fetchWsolBalance"),
|
|
2552
|
+
prepareWrap: /* @__PURE__ */ __name((config) => helper.prepareWrap(withDefaultCommitment(config, getFallback)), "prepareWrap"),
|
|
2553
|
+
prepareUnwrap: /* @__PURE__ */ __name((config) => helper.prepareUnwrap(withDefaultCommitment(config, getFallback)), "prepareUnwrap"),
|
|
2554
|
+
sendPreparedWrap: helper.sendPreparedWrap,
|
|
2555
|
+
sendPreparedUnwrap: helper.sendPreparedUnwrap,
|
|
2556
|
+
sendWrap: /* @__PURE__ */ __name((config, options) => helper.sendWrap(withDefaultCommitment(config, getFallback), options), "sendWrap"),
|
|
2557
|
+
sendUnwrap: /* @__PURE__ */ __name((config, options) => helper.sendUnwrap(withDefaultCommitment(config, getFallback), options), "sendUnwrap")
|
|
2558
|
+
};
|
|
2559
|
+
}
|
|
2560
|
+
__name(wrapWsolHelper, "wrapWsolHelper");
|
|
2318
2561
|
function normaliseConfigValue(value) {
|
|
2319
2562
|
if (value === null || value === void 0) {
|
|
2320
2563
|
return void 0;
|
|
@@ -2344,6 +2587,7 @@ function createClientHelpers(runtime, store) {
|
|
|
2344
2587
|
let solTransfer;
|
|
2345
2588
|
let stake;
|
|
2346
2589
|
let transaction;
|
|
2590
|
+
let wsol;
|
|
2347
2591
|
const getSolTransfer = /* @__PURE__ */ __name(() => {
|
|
2348
2592
|
if (!solTransfer) {
|
|
2349
2593
|
solTransfer = wrapSolTransferHelper(createSolTransferHelper(runtime), getFallbackCommitment);
|
|
@@ -2362,6 +2606,12 @@ function createClientHelpers(runtime, store) {
|
|
|
2362
2606
|
}
|
|
2363
2607
|
return transaction;
|
|
2364
2608
|
}, "getTransaction");
|
|
2609
|
+
const getWsol = /* @__PURE__ */ __name(() => {
|
|
2610
|
+
if (!wsol) {
|
|
2611
|
+
wsol = wrapWsolHelper(createWsolHelper(runtime), getFallbackCommitment);
|
|
2612
|
+
}
|
|
2613
|
+
return wsol;
|
|
2614
|
+
}, "getWsol");
|
|
2365
2615
|
function getSplTokenHelper(config) {
|
|
2366
2616
|
const cacheKey = serialiseSplConfig(config);
|
|
2367
2617
|
const cached = splTokenCache.get(cacheKey);
|
|
@@ -2392,6 +2642,9 @@ function createClientHelpers(runtime, store) {
|
|
|
2392
2642
|
get transaction() {
|
|
2393
2643
|
return getTransaction();
|
|
2394
2644
|
},
|
|
2645
|
+
get wsol() {
|
|
2646
|
+
return getWsol();
|
|
2647
|
+
},
|
|
2395
2648
|
prepareTransaction: prepareTransactionWithRuntime
|
|
2396
2649
|
});
|
|
2397
2650
|
}
|
|
@@ -2471,14 +2724,18 @@ function createWatchers({ logger: inputLogger, runtime, store }) {
|
|
|
2471
2724
|
setSubscriptionStatus("account", key, { status: "active" });
|
|
2472
2725
|
for await (const notification of iterator) {
|
|
2473
2726
|
const lamports2 = notification.value?.lamports ?? null;
|
|
2727
|
+
const executable = notification.value?.executable ?? null;
|
|
2728
|
+
const owner = notification.value?.owner ?? null;
|
|
2474
2729
|
const slot = notification.context?.slot ?? null;
|
|
2475
2730
|
const entry = {
|
|
2476
2731
|
address: config.address,
|
|
2477
2732
|
data: notification.value?.data,
|
|
2478
2733
|
error: void 0,
|
|
2734
|
+
executable,
|
|
2479
2735
|
fetching: false,
|
|
2480
2736
|
lamports: lamports2,
|
|
2481
2737
|
lastFetchedAt: now(),
|
|
2738
|
+
owner,
|
|
2482
2739
|
slot
|
|
2483
2740
|
};
|
|
2484
2741
|
listener(entry);
|
|
@@ -2662,6 +2919,9 @@ function createClient(config) {
|
|
|
2662
2919
|
get transaction() {
|
|
2663
2920
|
return helpers.transaction;
|
|
2664
2921
|
},
|
|
2922
|
+
get wsol() {
|
|
2923
|
+
return helpers.wsol;
|
|
2924
|
+
},
|
|
2665
2925
|
prepareTransaction: helpers.prepareTransaction,
|
|
2666
2926
|
watchers
|
|
2667
2927
|
};
|
|
@@ -3034,9 +3294,9 @@ function createSolTransferController(config) {
|
|
|
3034
3294
|
const request = ensureAuthority(config2, authorityProvider);
|
|
3035
3295
|
setState(createAsyncState("loading"));
|
|
3036
3296
|
try {
|
|
3037
|
-
const
|
|
3038
|
-
setState(createAsyncState("success", { data:
|
|
3039
|
-
return
|
|
3297
|
+
const signature6 = await helper.sendTransfer(request, options);
|
|
3298
|
+
setState(createAsyncState("success", { data: signature6 }));
|
|
3299
|
+
return signature6;
|
|
3040
3300
|
} catch (error) {
|
|
3041
3301
|
setState(createAsyncState("error", { error }));
|
|
3042
3302
|
throw error;
|
|
@@ -3106,9 +3366,9 @@ function createSplTransferController(config) {
|
|
|
3106
3366
|
);
|
|
3107
3367
|
setState(createAsyncState("loading"));
|
|
3108
3368
|
try {
|
|
3109
|
-
const
|
|
3110
|
-
setState(createAsyncState("success", { data:
|
|
3111
|
-
return
|
|
3369
|
+
const signature6 = await helper.sendTransfer(resolvedConfig, options);
|
|
3370
|
+
setState(createAsyncState("success", { data: signature6 }));
|
|
3371
|
+
return signature6;
|
|
3112
3372
|
} catch (error) {
|
|
3113
3373
|
setState(createAsyncState("error", { error }));
|
|
3114
3374
|
throw error;
|
|
@@ -3216,9 +3476,9 @@ function createStakeController(config) {
|
|
|
3216
3476
|
const request = ensureAuthority2(config2, authorityProvider);
|
|
3217
3477
|
setState(createAsyncState("loading"));
|
|
3218
3478
|
try {
|
|
3219
|
-
const
|
|
3220
|
-
setState(createAsyncState("success", { data:
|
|
3221
|
-
return
|
|
3479
|
+
const signature6 = await helper.sendStake(request, options);
|
|
3480
|
+
setState(createAsyncState("success", { data: signature6 }));
|
|
3481
|
+
return signature6;
|
|
3222
3482
|
} catch (error) {
|
|
3223
3483
|
setState(createAsyncState("error", { error }));
|
|
3224
3484
|
throw error;
|
|
@@ -3229,9 +3489,9 @@ function createStakeController(config) {
|
|
|
3229
3489
|
const request = ensureUnstakeAuthority(config2, authorityProvider);
|
|
3230
3490
|
setUnstakeState(createAsyncState("loading"));
|
|
3231
3491
|
try {
|
|
3232
|
-
const
|
|
3233
|
-
setUnstakeState(createAsyncState("success", { data:
|
|
3234
|
-
return
|
|
3492
|
+
const signature6 = await helper.sendUnstake(request, options);
|
|
3493
|
+
setUnstakeState(createAsyncState("success", { data: signature6 }));
|
|
3494
|
+
return signature6;
|
|
3235
3495
|
} catch (error) {
|
|
3236
3496
|
setUnstakeState(createAsyncState("error", { error }));
|
|
3237
3497
|
throw error;
|
|
@@ -3242,9 +3502,9 @@ function createStakeController(config) {
|
|
|
3242
3502
|
const request = ensureWithdrawAuthority(config2, authorityProvider);
|
|
3243
3503
|
setWithdrawState(createAsyncState("loading"));
|
|
3244
3504
|
try {
|
|
3245
|
-
const
|
|
3246
|
-
setWithdrawState(createAsyncState("success", { data:
|
|
3247
|
-
return
|
|
3505
|
+
const signature6 = await helper.sendWithdraw(request, options);
|
|
3506
|
+
setWithdrawState(createAsyncState("success", { data: signature6 }));
|
|
3507
|
+
return signature6;
|
|
3248
3508
|
} catch (error) {
|
|
3249
3509
|
setWithdrawState(createAsyncState("error", { error }));
|
|
3250
3510
|
throw error;
|
|
@@ -3302,6 +3562,109 @@ function createStakeController(config) {
|
|
|
3302
3562
|
}
|
|
3303
3563
|
__name(createStakeController, "createStakeController");
|
|
3304
3564
|
|
|
3565
|
+
// src/controllers/wsolController.ts
|
|
3566
|
+
function ensureAuthority3(input, resolveDefault) {
|
|
3567
|
+
const authority = input.authority ?? resolveDefault?.();
|
|
3568
|
+
if (!authority) {
|
|
3569
|
+
throw new Error("Connect a wallet or supply an `authority` before wrapping/unwrapping SOL.");
|
|
3570
|
+
}
|
|
3571
|
+
return {
|
|
3572
|
+
...input,
|
|
3573
|
+
authority
|
|
3574
|
+
};
|
|
3575
|
+
}
|
|
3576
|
+
__name(ensureAuthority3, "ensureAuthority");
|
|
3577
|
+
function createWsolController(config) {
|
|
3578
|
+
const wrapListeners = /* @__PURE__ */ new Set();
|
|
3579
|
+
const unwrapListeners = /* @__PURE__ */ new Set();
|
|
3580
|
+
const helper = config.helper;
|
|
3581
|
+
const authorityProvider = config.authorityProvider;
|
|
3582
|
+
let wrapState = createInitialAsyncState();
|
|
3583
|
+
let unwrapState = createInitialAsyncState();
|
|
3584
|
+
function notifyWrap() {
|
|
3585
|
+
for (const listener of wrapListeners) {
|
|
3586
|
+
listener();
|
|
3587
|
+
}
|
|
3588
|
+
}
|
|
3589
|
+
__name(notifyWrap, "notifyWrap");
|
|
3590
|
+
function notifyUnwrap() {
|
|
3591
|
+
for (const listener of unwrapListeners) {
|
|
3592
|
+
listener();
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3595
|
+
__name(notifyUnwrap, "notifyUnwrap");
|
|
3596
|
+
function setWrapState(next) {
|
|
3597
|
+
wrapState = next;
|
|
3598
|
+
notifyWrap();
|
|
3599
|
+
}
|
|
3600
|
+
__name(setWrapState, "setWrapState");
|
|
3601
|
+
function setUnwrapState(next) {
|
|
3602
|
+
unwrapState = next;
|
|
3603
|
+
notifyUnwrap();
|
|
3604
|
+
}
|
|
3605
|
+
__name(setUnwrapState, "setUnwrapState");
|
|
3606
|
+
async function wrap(input, options) {
|
|
3607
|
+
const request = ensureAuthority3(input, authorityProvider);
|
|
3608
|
+
setWrapState(createAsyncState("loading"));
|
|
3609
|
+
try {
|
|
3610
|
+
const signature6 = await helper.sendWrap(request, options);
|
|
3611
|
+
setWrapState(createAsyncState("success", { data: signature6 }));
|
|
3612
|
+
return signature6;
|
|
3613
|
+
} catch (error) {
|
|
3614
|
+
setWrapState(createAsyncState("error", { error }));
|
|
3615
|
+
throw error;
|
|
3616
|
+
}
|
|
3617
|
+
}
|
|
3618
|
+
__name(wrap, "wrap");
|
|
3619
|
+
async function unwrap(input, options) {
|
|
3620
|
+
const request = ensureAuthority3(input, authorityProvider);
|
|
3621
|
+
setUnwrapState(createAsyncState("loading"));
|
|
3622
|
+
try {
|
|
3623
|
+
const signature6 = await helper.sendUnwrap(request, options);
|
|
3624
|
+
setUnwrapState(createAsyncState("success", { data: signature6 }));
|
|
3625
|
+
return signature6;
|
|
3626
|
+
} catch (error) {
|
|
3627
|
+
setUnwrapState(createAsyncState("error", { error }));
|
|
3628
|
+
throw error;
|
|
3629
|
+
}
|
|
3630
|
+
}
|
|
3631
|
+
__name(unwrap, "unwrap");
|
|
3632
|
+
function subscribeWrap(listener) {
|
|
3633
|
+
wrapListeners.add(listener);
|
|
3634
|
+
return () => {
|
|
3635
|
+
wrapListeners.delete(listener);
|
|
3636
|
+
};
|
|
3637
|
+
}
|
|
3638
|
+
__name(subscribeWrap, "subscribeWrap");
|
|
3639
|
+
function subscribeUnwrap(listener) {
|
|
3640
|
+
unwrapListeners.add(listener);
|
|
3641
|
+
return () => {
|
|
3642
|
+
unwrapListeners.delete(listener);
|
|
3643
|
+
};
|
|
3644
|
+
}
|
|
3645
|
+
__name(subscribeUnwrap, "subscribeUnwrap");
|
|
3646
|
+
function resetWrap() {
|
|
3647
|
+
setWrapState(createInitialAsyncState());
|
|
3648
|
+
}
|
|
3649
|
+
__name(resetWrap, "resetWrap");
|
|
3650
|
+
function resetUnwrap() {
|
|
3651
|
+
setUnwrapState(createInitialAsyncState());
|
|
3652
|
+
}
|
|
3653
|
+
__name(resetUnwrap, "resetUnwrap");
|
|
3654
|
+
return {
|
|
3655
|
+
getHelper: /* @__PURE__ */ __name(() => helper, "getHelper"),
|
|
3656
|
+
getWrapState: /* @__PURE__ */ __name(() => wrapState, "getWrapState"),
|
|
3657
|
+
getUnwrapState: /* @__PURE__ */ __name(() => unwrapState, "getUnwrapState"),
|
|
3658
|
+
resetWrap,
|
|
3659
|
+
resetUnwrap,
|
|
3660
|
+
wrap,
|
|
3661
|
+
unwrap,
|
|
3662
|
+
subscribeWrap,
|
|
3663
|
+
subscribeUnwrap
|
|
3664
|
+
};
|
|
3665
|
+
}
|
|
3666
|
+
__name(createWsolController, "createWsolController");
|
|
3667
|
+
|
|
3305
3668
|
// src/serialization/json.ts
|
|
3306
3669
|
function bigintToJson(value) {
|
|
3307
3670
|
return value.toString();
|
|
@@ -3376,7 +3739,7 @@ function insertReferenceKeys(references, transaction) {
|
|
|
3376
3739
|
const targetInstruction = transaction.instructions[index];
|
|
3377
3740
|
const accounts = [
|
|
3378
3741
|
...targetInstruction.accounts ?? [],
|
|
3379
|
-
...references.map((
|
|
3742
|
+
...references.map((address6) => ({ address: address6, role: AccountRole.READONLY }))
|
|
3380
3743
|
];
|
|
3381
3744
|
const updatedInstructions = [...transaction.instructions];
|
|
3382
3745
|
updatedInstructions.splice(index, 1, { ...targetInstruction, accounts });
|
|
@@ -3531,9 +3894,9 @@ function createTransactionPoolController(config) {
|
|
|
3531
3894
|
const target = resolvePrepared(overridePrepared);
|
|
3532
3895
|
sendStateStore.setSnapshot(createAsyncState("loading"));
|
|
3533
3896
|
try {
|
|
3534
|
-
const
|
|
3535
|
-
sendStateStore.setSnapshot(createAsyncState("success", { data:
|
|
3536
|
-
return
|
|
3897
|
+
const signature6 = await helper.send(target, rest);
|
|
3898
|
+
sendStateStore.setSnapshot(createAsyncState("success", { data: signature6 }));
|
|
3899
|
+
return signature6;
|
|
3537
3900
|
} catch (error) {
|
|
3538
3901
|
sendStateStore.setSnapshot(createAsyncState("error", { error }));
|
|
3539
3902
|
throw error;
|
|
@@ -3547,15 +3910,15 @@ function createTransactionPoolController(config) {
|
|
|
3547
3910
|
sendStateStore.setSnapshot(createAsyncState("loading"));
|
|
3548
3911
|
try {
|
|
3549
3912
|
const restWithLifetime = resolveLifetimeOptions(rest);
|
|
3550
|
-
const
|
|
3913
|
+
const signature6 = await helper.prepareAndSend(
|
|
3551
3914
|
{
|
|
3552
3915
|
...restWithLifetime,
|
|
3553
3916
|
instructions: nextInstructions
|
|
3554
3917
|
},
|
|
3555
3918
|
sendOptions
|
|
3556
3919
|
);
|
|
3557
|
-
sendStateStore.setSnapshot(createAsyncState("success", { data:
|
|
3558
|
-
return
|
|
3920
|
+
sendStateStore.setSnapshot(createAsyncState("success", { data: signature6 }));
|
|
3921
|
+
return signature6;
|
|
3559
3922
|
} catch (error) {
|
|
3560
3923
|
sendStateStore.setSnapshot(createAsyncState("error", { error }));
|
|
3561
3924
|
throw error;
|
|
@@ -3646,6 +4009,6 @@ function stableStringify(value) {
|
|
|
3646
4009
|
}
|
|
3647
4010
|
__name(stableStringify, "stableStringify");
|
|
3648
4011
|
|
|
3649
|
-
export { LAMPORTS_PER_SOL, SIGNATURE_STATUS_TIMEOUT_MS, applyRatio, applySerializableState, assertDecimals, assertNonNegative, autoDiscover, backpack, bigintFromJson, bigintToJson, checkedAdd, checkedDivide, checkedMultiply, checkedSubtract, confirmationMeetsCommitment, connectWallet, createAsyncState, createClient, createClientStore, createDefaultClient, createDefaultClientStore, createInitialAsyncState, createInitialClientState, createRatio, createSolTransferController, createSolTransferHelper, createSolanaRpcClient, createSplTokenHelper, createSplTransferController, createStakeController, createStakeHelper, createTokenAmount, createTransactionHelper, createTransactionPoolController, createTransactionRecipe, createWalletRegistry, createWalletStandardConnector, defaultWalletConnectors, deriveConfirmationStatus, deserializeSolanaState, disconnectWallet, fetchAccount, fetchBalance, fetchLookupTable, fetchLookupTables, fetchNonceAccount, getInitialSerializableState, getWalletStandardConnectors, injected, insertReferenceKey, insertReferenceKeys, lamports, lamportsFromJson, lamportsFromSol, lamportsMath, lamportsToJson, lamportsToSolString, metamask, normalizeSignature, phantom, pow10, prepareTransaction, requestAirdrop, resolveClientConfig, resolveCluster, sendTransaction, serializeSolanaState, setCluster, solflare, stableStringify, subscribeSolanaState, toAddress2 as toAddress, toAddressString, toBigint2 as toBigint, transactionToBase64, transactionToBase64WithSigners, watchWalletStandardConnectors };
|
|
4012
|
+
export { LAMPORTS_PER_SOL, SIGNATURE_STATUS_TIMEOUT_MS, WRAPPED_SOL_MINT, applyRatio, applySerializableState, assertDecimals, assertNonNegative, autoDiscover, backpack, bigintFromJson, bigintToJson, checkedAdd, checkedDivide, checkedMultiply, checkedSubtract, confirmationMeetsCommitment, connectWallet, createAsyncState, createClient, createClientStore, createDefaultClient, createDefaultClientStore, createInitialAsyncState, createInitialClientState, createRatio, createSolTransferController, createSolTransferHelper, createSolanaRpcClient, createSplTokenHelper, createSplTransferController, createStakeController, createStakeHelper, createTokenAmount, createTransactionHelper, createTransactionPoolController, createTransactionRecipe, createWalletRegistry, createWalletStandardConnector, createWsolController, createWsolHelper, defaultWalletConnectors, deriveConfirmationStatus, deserializeSolanaState, disconnectWallet, fetchAccount, fetchBalance, fetchLookupTable, fetchLookupTables, fetchNonceAccount, getInitialSerializableState, getWalletStandardConnectors, injected, insertReferenceKey, insertReferenceKeys, lamports, lamportsFromJson, lamportsFromSol, lamportsMath, lamportsToJson, lamportsToSolString, metamask, normalizeSignature, phantom, pow10, prepareTransaction, requestAirdrop, resolveClientConfig, resolveCluster, sendTransaction, serializeSolanaState, setCluster, solflare, stableStringify, subscribeSolanaState, toAddress2 as toAddress, toAddressString, toBigint2 as toBigint, transactionToBase64, transactionToBase64WithSigners, watchWalletStandardConnectors };
|
|
3650
4013
|
//# sourceMappingURL=index.node.mjs.map
|
|
3651
4014
|
//# sourceMappingURL=index.node.mjs.map
|