@meshconnect/web-link-sdk 3.2.9 → 3.2.10
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/package.json +1 -1
- package/utils/connectors/solana/transaction.js +17 -14
- package/utils/version.d.ts +1 -1
- package/utils/version.js +1 -1
package/package.json
CHANGED
@@ -115,7 +115,7 @@ export function createSPLTransferInstruction(_a) {
|
|
115
115
|
}
|
116
116
|
export function createTransferTransaction(config) {
|
117
117
|
return __awaiter(this, void 0, void 0, function () {
|
118
|
-
var fromPubkey, toPubkey, instructions, connection, token2022Accounts,
|
118
|
+
var fromPubkey, toPubkey, instructions, connection, token2022Accounts, tokenMintPubkey, fromTokenAccount2022_1, tokenProgram, fromTokenAccount, toTokenAccount_1, messageV0;
|
119
119
|
var _a;
|
120
120
|
return __generator(this, function (_b) {
|
121
121
|
switch (_b.label) {
|
@@ -129,7 +129,7 @@ export function createTransferTransaction(config) {
|
|
129
129
|
toPubkey: toPubkey,
|
130
130
|
lamports: Number(config.amount)
|
131
131
|
}));
|
132
|
-
return [3 /*break*/,
|
132
|
+
return [3 /*break*/, 7];
|
133
133
|
case 1:
|
134
134
|
connection = void 0;
|
135
135
|
// special use case for PYUSD on solana devnet. TODO: make it generic
|
@@ -142,37 +142,40 @@ export function createTransferTransaction(config) {
|
|
142
142
|
return [4 /*yield*/, connection.getTokenAccountsByOwner(fromPubkey, { programId: TOKEN_2022_PROGRAM_ID })];
|
143
143
|
case 2:
|
144
144
|
token2022Accounts = _b.sent();
|
145
|
-
|
145
|
+
tokenMintPubkey = new PublicKey(config.tokenMint);
|
146
|
+
return [4 /*yield*/, getAssociatedTokenAddress(tokenMintPubkey, fromPubkey, TOKEN_2022_PROGRAM_ID.toBase58())];
|
147
|
+
case 3:
|
148
|
+
fromTokenAccount2022_1 = _b.sent();
|
149
|
+
tokenProgram = (token2022Accounts === null || token2022Accounts === void 0 ? void 0 : token2022Accounts.value.filter(function (x) { return x.pubkey.toBase58() === fromTokenAccount2022_1.toBase58(); }).length)
|
146
150
|
? TOKEN_2022_PROGRAM_ID
|
147
151
|
: TOKEN_PROGRAM_ID;
|
148
152
|
config.tokenProgram = tokenProgram.toBase58();
|
149
|
-
tokenMintPubkey = new PublicKey(config.tokenMint);
|
150
153
|
return [4 /*yield*/, getAssociatedTokenAddress(tokenMintPubkey, fromPubkey, config.tokenProgram)];
|
151
|
-
case
|
154
|
+
case 4:
|
152
155
|
fromTokenAccount = _b.sent();
|
153
156
|
return [4 /*yield*/, getAssociatedTokenAddress(tokenMintPubkey, toPubkey, config.tokenProgram)];
|
154
|
-
case
|
155
|
-
|
157
|
+
case 5:
|
158
|
+
toTokenAccount_1 = _b.sent();
|
156
159
|
return [4 /*yield*/, connection.getTokenAccountsByOwner(toPubkey, {
|
157
160
|
programId: tokenProgram
|
158
161
|
})];
|
159
|
-
case
|
160
|
-
if (!((_a = (_b.sent())) === null || _a === void 0 ? void 0 : _a.value.length)) {
|
161
|
-
instructions.push(createTokenAccountInstruction(fromPubkey,
|
162
|
+
case 6:
|
163
|
+
if (!((_a = (_b.sent())) === null || _a === void 0 ? void 0 : _a.value.filter(function (x) { return x.pubkey.toBase58() === toTokenAccount_1.toBase58(); }).length)) {
|
164
|
+
instructions.push(createTokenAccountInstruction(fromPubkey, toTokenAccount_1, toPubkey, tokenMintPubkey, tokenProgram));
|
162
165
|
}
|
163
166
|
if (config.tokenProgram === TOKEN_2022_PROGRAM_ID.toBase58()) {
|
164
|
-
instructions.push(createTransferCheckedInstruction(fromTokenAccount,
|
167
|
+
instructions.push(createTransferCheckedInstruction(fromTokenAccount, toTokenAccount_1, fromPubkey, BigInt(config.amount), config.tokenDecimals, tokenMintPubkey));
|
165
168
|
}
|
166
169
|
else {
|
167
170
|
instructions.push(createSPLTransferInstruction({
|
168
171
|
fromTokenAccount: fromTokenAccount,
|
169
|
-
toTokenAccount:
|
172
|
+
toTokenAccount: toTokenAccount_1,
|
170
173
|
owner: fromPubkey,
|
171
174
|
amount: BigInt(config.amount)
|
172
175
|
}));
|
173
176
|
}
|
174
|
-
_b.label =
|
175
|
-
case
|
177
|
+
_b.label = 7;
|
178
|
+
case 7:
|
176
179
|
messageV0 = new TransactionMessage({
|
177
180
|
payerKey: fromPubkey,
|
178
181
|
recentBlockhash: config.blockhash,
|
package/utils/version.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const sdkVersion = "3.2.
|
1
|
+
export declare const sdkVersion = "3.2.10";
|
package/utils/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export var sdkVersion = '3.2.
|
1
|
+
export var sdkVersion = '3.2.10';
|