@dynamic-labs/solana-core 4.61.6 → 4.62.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/CHANGELOG.md +22 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +7 -7
- package/src/utils/SolanaUiTransaction/SolanaUiTransaction.cjs +9 -4
- package/src/utils/SolanaUiTransaction/SolanaUiTransaction.js +10 -5
- package/src/utils/createNonNativeTokenTransfer/createNonNativeTokenTransfer.cjs +9 -4
- package/src/utils/createNonNativeTokenTransfer/createNonNativeTokenTransfer.js +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.62.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.61.7...v4.62.0) (2026-02-23)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add stellar waas connector ([#10472](https://github.com/dynamic-labs/dynamic-auth/issues/10472)) ([8349afe](https://github.com/dynamic-labs/dynamic-auth/commit/8349afece59b430ef398585b372d4cd2733c0ce4))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **react-native:** ensure transaction confirmation UI is displayed ([#10488](https://github.com/dynamic-labs/dynamic-auth/issues/10488)) ([dfa2304](https://github.com/dynamic-labs/dynamic-auth/commit/dfa230435a9ce0febc5b66fcca5098cbe979f8d7))
|
|
13
|
+
|
|
14
|
+
### [4.61.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.61.6...v4.61.7) (2026-02-20)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* coinbase deeplink url ([#10468](https://github.com/dynamic-labs/dynamic-auth/issues/10468)) ([5bd249f](https://github.com/dynamic-labs/dynamic-auth/commit/5bd249ff3788a9718aee802840a73b408675a02b))
|
|
20
|
+
* **react-native:** ensure sign transaction with viem ([#10463](https://github.com/dynamic-labs/dynamic-auth/issues/10463)) ([1048694](https://github.com/dynamic-labs/dynamic-auth/commit/1048694f2a468780ce7398c5ed82a38e6d3e0d76))
|
|
21
|
+
* **react-native:** upgrade react-native-passkey to v3.3.2 ([#10453](https://github.com/dynamic-labs/dynamic-auth/issues/10453)) ([db68ec8](https://github.com/dynamic-labs/dynamic-auth/commit/db68ec819fe8d3e326ed7ed36b1701b0cb3caded))
|
|
22
|
+
* **solana:** token 2022 send balance ([#10470](https://github.com/dynamic-labs/dynamic-auth/issues/10470)) ([2c5ee3e](https://github.com/dynamic-labs/dynamic-auth/commit/2c5ee3e007d1e0feb02b632deb6d23f8f6ba55f7))
|
|
23
|
+
|
|
2
24
|
### [4.61.6](https://github.com/dynamic-labs/dynamic-auth/compare/v4.61.5...v4.61.6) (2026-02-19)
|
|
3
25
|
|
|
4
26
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.62.0",
|
|
4
4
|
"description": "Core package for utilities and types for solana",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"@dynamic-labs/sdk-api-core": "0.0.864",
|
|
22
22
|
"@solana/web3.js": "1.98.1",
|
|
23
23
|
"@solana/spl-token": "0.4.14",
|
|
24
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
25
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
26
|
-
"@dynamic-labs/types": "4.
|
|
27
|
-
"@dynamic-labs/utils": "4.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
24
|
+
"@dynamic-labs/assert-package-version": "4.62.0",
|
|
25
|
+
"@dynamic-labs/rpc-providers": "4.62.0",
|
|
26
|
+
"@dynamic-labs/types": "4.62.0",
|
|
27
|
+
"@dynamic-labs/utils": "4.62.0",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.62.0",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.62.0",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {}
|
|
@@ -130,6 +130,10 @@ class SolanaUiTransaction {
|
|
|
130
130
|
if (splTokenMintAddress && nonNativeValue) {
|
|
131
131
|
const tokenMintPubkey = new web3_js.PublicKey(splTokenMintAddress);
|
|
132
132
|
const amount = nonNativeValue;
|
|
133
|
+
const mintAccountInfo = yield this.connection.getAccountInfo(tokenMintPubkey);
|
|
134
|
+
const tokenProgramId = (mintAccountInfo === null || mintAccountInfo === void 0 ? void 0 : mintAccountInfo.owner.equals(splToken.TOKEN_2022_PROGRAM_ID))
|
|
135
|
+
? splToken.TOKEN_2022_PROGRAM_ID
|
|
136
|
+
: splToken.TOKEN_PROGRAM_ID;
|
|
133
137
|
const fromTokenAccount = (_a = (yield this.connection.getTokenAccountsByOwner(fromPubkey, {
|
|
134
138
|
mint: tokenMintPubkey,
|
|
135
139
|
})).value[0]) === null || _a === void 0 ? void 0 : _a.pubkey;
|
|
@@ -137,15 +141,16 @@ class SolanaUiTransaction {
|
|
|
137
141
|
throw new Error('Source token account not found');
|
|
138
142
|
let toTokenAccountPubkey;
|
|
139
143
|
try {
|
|
140
|
-
toTokenAccountPubkey = yield splToken.getAssociatedTokenAddress(tokenMintPubkey, toPubkey);
|
|
144
|
+
toTokenAccountPubkey = yield splToken.getAssociatedTokenAddress(tokenMintPubkey, toPubkey, false, tokenProgramId);
|
|
141
145
|
yield this.connection.getTokenAccountBalance(toTokenAccountPubkey);
|
|
142
146
|
}
|
|
143
147
|
catch (_b) {
|
|
144
148
|
// If the recipient doesn't have a token account, create one
|
|
145
|
-
toTokenAccountPubkey = yield splToken.getAssociatedTokenAddress(tokenMintPubkey, toPubkey);
|
|
146
|
-
sendTransaction.add(splToken.createAssociatedTokenAccountInstruction(fromPubkey, toTokenAccountPubkey, toPubkey, tokenMintPubkey));
|
|
149
|
+
toTokenAccountPubkey = yield splToken.getAssociatedTokenAddress(tokenMintPubkey, toPubkey, false, tokenProgramId);
|
|
150
|
+
sendTransaction.add(splToken.createAssociatedTokenAccountInstruction(fromPubkey, toTokenAccountPubkey, toPubkey, tokenMintPubkey, tokenProgramId));
|
|
147
151
|
}
|
|
148
|
-
|
|
152
|
+
const tokenDecimals = this.nonNativeDecimal || 0;
|
|
153
|
+
sendTransaction.add(splToken.createTransferCheckedInstruction(fromTokenAccount, tokenMintPubkey, toTokenAccountPubkey, fromPubkey, amount, tokenDecimals, [], tokenProgramId));
|
|
149
154
|
}
|
|
150
155
|
else {
|
|
151
156
|
// Native SOL transfer
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
3
|
import { PublicKey, Transaction, SystemProgram } from '@solana/web3.js';
|
|
4
|
-
import { getAssociatedTokenAddress, createAssociatedTokenAccountInstruction,
|
|
4
|
+
import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, createTransferCheckedInstruction } from '@solana/spl-token';
|
|
5
5
|
import { formatNumberText } from '@dynamic-labs/utils';
|
|
6
6
|
|
|
7
7
|
const LAMPORTS_PER_SOL = 1000000000;
|
|
@@ -126,6 +126,10 @@ class SolanaUiTransaction {
|
|
|
126
126
|
if (splTokenMintAddress && nonNativeValue) {
|
|
127
127
|
const tokenMintPubkey = new PublicKey(splTokenMintAddress);
|
|
128
128
|
const amount = nonNativeValue;
|
|
129
|
+
const mintAccountInfo = yield this.connection.getAccountInfo(tokenMintPubkey);
|
|
130
|
+
const tokenProgramId = (mintAccountInfo === null || mintAccountInfo === void 0 ? void 0 : mintAccountInfo.owner.equals(TOKEN_2022_PROGRAM_ID))
|
|
131
|
+
? TOKEN_2022_PROGRAM_ID
|
|
132
|
+
: TOKEN_PROGRAM_ID;
|
|
129
133
|
const fromTokenAccount = (_a = (yield this.connection.getTokenAccountsByOwner(fromPubkey, {
|
|
130
134
|
mint: tokenMintPubkey,
|
|
131
135
|
})).value[0]) === null || _a === void 0 ? void 0 : _a.pubkey;
|
|
@@ -133,15 +137,16 @@ class SolanaUiTransaction {
|
|
|
133
137
|
throw new Error('Source token account not found');
|
|
134
138
|
let toTokenAccountPubkey;
|
|
135
139
|
try {
|
|
136
|
-
toTokenAccountPubkey = yield getAssociatedTokenAddress(tokenMintPubkey, toPubkey);
|
|
140
|
+
toTokenAccountPubkey = yield getAssociatedTokenAddress(tokenMintPubkey, toPubkey, false, tokenProgramId);
|
|
137
141
|
yield this.connection.getTokenAccountBalance(toTokenAccountPubkey);
|
|
138
142
|
}
|
|
139
143
|
catch (_b) {
|
|
140
144
|
// If the recipient doesn't have a token account, create one
|
|
141
|
-
toTokenAccountPubkey = yield getAssociatedTokenAddress(tokenMintPubkey, toPubkey);
|
|
142
|
-
sendTransaction.add(createAssociatedTokenAccountInstruction(fromPubkey, toTokenAccountPubkey, toPubkey, tokenMintPubkey));
|
|
145
|
+
toTokenAccountPubkey = yield getAssociatedTokenAddress(tokenMintPubkey, toPubkey, false, tokenProgramId);
|
|
146
|
+
sendTransaction.add(createAssociatedTokenAccountInstruction(fromPubkey, toTokenAccountPubkey, toPubkey, tokenMintPubkey, tokenProgramId));
|
|
143
147
|
}
|
|
144
|
-
|
|
148
|
+
const tokenDecimals = this.nonNativeDecimal || 0;
|
|
149
|
+
sendTransaction.add(createTransferCheckedInstruction(fromTokenAccount, tokenMintPubkey, toTokenAccountPubkey, fromPubkey, amount, tokenDecimals, [], tokenProgramId));
|
|
145
150
|
}
|
|
146
151
|
else {
|
|
147
152
|
// Native SOL transfer
|
|
@@ -12,6 +12,10 @@ const createNonNativeTokenTransfer = (_a) => _tslib.__awaiter(void 0, [_a], void
|
|
|
12
12
|
const fromPublicKey = new web3_js.PublicKey(fromAddress);
|
|
13
13
|
const toPublicKey = new web3_js.PublicKey(toAddress);
|
|
14
14
|
const tokenPublicKey = new web3_js.PublicKey(tokenAddress);
|
|
15
|
+
const mintAccountInfo = yield connection.getAccountInfo(tokenPublicKey);
|
|
16
|
+
const tokenProgramId = mintAccountInfo && mintAccountInfo.owner.equals(splToken.TOKEN_2022_PROGRAM_ID)
|
|
17
|
+
? splToken.TOKEN_2022_PROGRAM_ID
|
|
18
|
+
: splToken.TOKEN_PROGRAM_ID;
|
|
15
19
|
const fromTokenAccount = (_c = (_b = (yield connection.getTokenAccountsByOwner(fromPublicKey, {
|
|
16
20
|
mint: tokenPublicKey,
|
|
17
21
|
}))) === null || _b === void 0 ? void 0 : _b.value[0]) === null || _c === void 0 ? void 0 : _c.pubkey;
|
|
@@ -20,14 +24,15 @@ const createNonNativeTokenTransfer = (_a) => _tslib.__awaiter(void 0, [_a], void
|
|
|
20
24
|
let toTokenAccountPubkey;
|
|
21
25
|
const instructions = [];
|
|
22
26
|
try {
|
|
23
|
-
toTokenAccountPubkey = yield splToken.getAssociatedTokenAddress(tokenPublicKey, toPublicKey);
|
|
27
|
+
toTokenAccountPubkey = yield splToken.getAssociatedTokenAddress(tokenPublicKey, toPublicKey, false, tokenProgramId);
|
|
24
28
|
yield connection.getTokenAccountBalance(toTokenAccountPubkey);
|
|
25
29
|
}
|
|
26
30
|
catch (e) {
|
|
27
|
-
toTokenAccountPubkey = yield splToken.getAssociatedTokenAddress(tokenPublicKey, toPublicKey);
|
|
28
|
-
instructions.push(splToken.createAssociatedTokenAccountInstruction(fromPublicKey, toTokenAccountPubkey, toPublicKey, tokenPublicKey));
|
|
31
|
+
toTokenAccountPubkey = yield splToken.getAssociatedTokenAddress(tokenPublicKey, toPublicKey, false, tokenProgramId);
|
|
32
|
+
instructions.push(splToken.createAssociatedTokenAccountInstruction(fromPublicKey, toTokenAccountPubkey, toPublicKey, tokenPublicKey, tokenProgramId));
|
|
29
33
|
}
|
|
30
|
-
|
|
34
|
+
const tokenDecimals = decimals || 0;
|
|
35
|
+
instructions.push(splToken.createTransferCheckedInstruction(fromTokenAccount, tokenPublicKey, toTokenAccountPubkey, fromPublicKey, BigInt(Number(amount) * Math.pow(10, tokenDecimals)), tokenDecimals, [], tokenProgramId));
|
|
31
36
|
const transaction = new web3_js.Transaction().add(...instructions);
|
|
32
37
|
transaction.recentBlockhash = blockhash;
|
|
33
38
|
transaction.lastValidBlockHeight = lastValidBlockHeight;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
-
import { getAssociatedTokenAddress, createAssociatedTokenAccountInstruction,
|
|
3
|
+
import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, createTransferCheckedInstruction } from '@solana/spl-token';
|
|
4
4
|
import { PublicKey, Transaction } from '@solana/web3.js';
|
|
5
5
|
|
|
6
6
|
const createNonNativeTokenTransfer = (_a) => __awaiter(void 0, [_a], void 0, function* ({ connection, fromAddress, toAddress, tokenAddress, amount, decimals, blockhash, lastValidBlockHeight, }) {
|
|
@@ -8,6 +8,10 @@ const createNonNativeTokenTransfer = (_a) => __awaiter(void 0, [_a], void 0, fun
|
|
|
8
8
|
const fromPublicKey = new PublicKey(fromAddress);
|
|
9
9
|
const toPublicKey = new PublicKey(toAddress);
|
|
10
10
|
const tokenPublicKey = new PublicKey(tokenAddress);
|
|
11
|
+
const mintAccountInfo = yield connection.getAccountInfo(tokenPublicKey);
|
|
12
|
+
const tokenProgramId = mintAccountInfo && mintAccountInfo.owner.equals(TOKEN_2022_PROGRAM_ID)
|
|
13
|
+
? TOKEN_2022_PROGRAM_ID
|
|
14
|
+
: TOKEN_PROGRAM_ID;
|
|
11
15
|
const fromTokenAccount = (_c = (_b = (yield connection.getTokenAccountsByOwner(fromPublicKey, {
|
|
12
16
|
mint: tokenPublicKey,
|
|
13
17
|
}))) === null || _b === void 0 ? void 0 : _b.value[0]) === null || _c === void 0 ? void 0 : _c.pubkey;
|
|
@@ -16,14 +20,15 @@ const createNonNativeTokenTransfer = (_a) => __awaiter(void 0, [_a], void 0, fun
|
|
|
16
20
|
let toTokenAccountPubkey;
|
|
17
21
|
const instructions = [];
|
|
18
22
|
try {
|
|
19
|
-
toTokenAccountPubkey = yield getAssociatedTokenAddress(tokenPublicKey, toPublicKey);
|
|
23
|
+
toTokenAccountPubkey = yield getAssociatedTokenAddress(tokenPublicKey, toPublicKey, false, tokenProgramId);
|
|
20
24
|
yield connection.getTokenAccountBalance(toTokenAccountPubkey);
|
|
21
25
|
}
|
|
22
26
|
catch (e) {
|
|
23
|
-
toTokenAccountPubkey = yield getAssociatedTokenAddress(tokenPublicKey, toPublicKey);
|
|
24
|
-
instructions.push(createAssociatedTokenAccountInstruction(fromPublicKey, toTokenAccountPubkey, toPublicKey, tokenPublicKey));
|
|
27
|
+
toTokenAccountPubkey = yield getAssociatedTokenAddress(tokenPublicKey, toPublicKey, false, tokenProgramId);
|
|
28
|
+
instructions.push(createAssociatedTokenAccountInstruction(fromPublicKey, toTokenAccountPubkey, toPublicKey, tokenPublicKey, tokenProgramId));
|
|
25
29
|
}
|
|
26
|
-
|
|
30
|
+
const tokenDecimals = decimals || 0;
|
|
31
|
+
instructions.push(createTransferCheckedInstruction(fromTokenAccount, tokenPublicKey, toTokenAccountPubkey, fromPublicKey, BigInt(Number(amount) * Math.pow(10, tokenDecimals)), tokenDecimals, [], tokenProgramId));
|
|
27
32
|
const transaction = new Transaction().add(...instructions);
|
|
28
33
|
transaction.recentBlockhash = blockhash;
|
|
29
34
|
transaction.lastValidBlockHeight = lastValidBlockHeight;
|