@exodus/solana-lib 3.8.0 → 3.9.1
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 +20 -0
- package/package.json +3 -3
- package/src/fee-data/index.js +1 -0
- package/src/transaction.js +15 -15
- package/src/tx/prepare-for-signing.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.9.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.9.0...@exodus/solana-lib@3.9.1) (2024-12-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### License
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* license: re-license under MIT license (#4515)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [3.9.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.8.0...@exodus/solana-lib@3.9.0) (2024-11-29)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* feat: avoid checking a balance (#4597)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [3.8.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-lib@3.7.1...@exodus/solana-lib@3.8.0) (2024-11-29)
|
|
7
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-lib",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
4
4
|
"description": "Solana utils, such as for cryptography, address encoding/decoding, transaction building, etc.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "Exodus Movement, Inc.",
|
|
13
13
|
"license": "ISC",
|
|
14
14
|
"publishConfig": {
|
|
15
|
-
"access": "
|
|
15
|
+
"access": "public"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
18
|
"test": "run -T exodus-test --jest",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"type": "git",
|
|
46
46
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "46f31ffb8a59f043ca4bd3855c88d6640ca35a1d"
|
|
49
49
|
}
|
package/src/fee-data/index.js
CHANGED
package/src/transaction.js
CHANGED
|
@@ -183,17 +183,22 @@ class Tx {
|
|
|
183
183
|
} of fromTokenAddresses) {
|
|
184
184
|
// need to add more of this instruction until we reach the desired balance (amount) to send
|
|
185
185
|
assert(mintAddress === tokenMintAddress, `Got unexpected mintAddress ${mintAddress}`)
|
|
186
|
-
if (amountLeft === 0) break
|
|
187
186
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
187
|
+
if (checkBalances) {
|
|
188
|
+
if (amountLeft === 0) break
|
|
189
|
+
|
|
190
|
+
balance = Number(balance)
|
|
191
|
+
if (balance >= amountLeft) {
|
|
192
|
+
amountToSend = amountLeft
|
|
193
|
+
amountLeft = 0
|
|
194
|
+
} else {
|
|
195
|
+
// Not enough balance case.
|
|
196
|
+
isNotEnoughBalance = true
|
|
197
|
+
amountToSend = balance
|
|
198
|
+
amountLeft -= amountToSend
|
|
199
|
+
}
|
|
192
200
|
} else {
|
|
193
|
-
|
|
194
|
-
isNotEnoughBalance = true
|
|
195
|
-
amountToSend = balance
|
|
196
|
-
amountLeft -= amountToSend
|
|
201
|
+
amountToSend = amountLeft
|
|
197
202
|
}
|
|
198
203
|
|
|
199
204
|
const dest = isSOLaddress
|
|
@@ -238,12 +243,7 @@ class Tx {
|
|
|
238
243
|
this.transaction.add(tokenTransferInstruction)
|
|
239
244
|
}
|
|
240
245
|
|
|
241
|
-
|
|
242
|
-
assert(
|
|
243
|
-
isNotEnoughBalance === false,
|
|
244
|
-
`Not enough balance to send ${amount} ${tokenMintAddress}`
|
|
245
|
-
)
|
|
246
|
-
}
|
|
246
|
+
assert(isNotEnoughBalance === false, `Not enough balance to send ${amount} ${tokenMintAddress}`)
|
|
247
247
|
}
|
|
248
248
|
|
|
249
249
|
static createStakeAccountTransaction({ address, amount, seed = SEED, pool, recentBlockhash }) {
|
|
@@ -15,7 +15,7 @@ const addPriorityFeeToTransaction = ({ transaction, priorityFee }) => {
|
|
|
15
15
|
|
|
16
16
|
const addComputeBudgetToTransaction = ({ transaction, computeUnits }) => {
|
|
17
17
|
const computeBudgetInstruction = ComputeBudgetProgram.setComputeUnitLimit({
|
|
18
|
-
units: computeUnits
|
|
18
|
+
units: computeUnits,
|
|
19
19
|
})
|
|
20
20
|
transaction.add(computeBudgetInstruction)
|
|
21
21
|
}
|