@exodus/solana-lib 1.2.13 → 1.2.16
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 +3 -3
- package/src/tokens.js +10 -17
- package/src/transaction.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-lib",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.16",
|
|
4
4
|
"description": "Exodus internal Solana low-level library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@exodus/asset-lib": "^3.4.3",
|
|
17
|
-
"@exodus/assets": "^8.0.
|
|
17
|
+
"@exodus/assets": "^8.0.53",
|
|
18
18
|
"@exodus/buffer-layout": "^1.2.0-exodus1",
|
|
19
19
|
"@exodus/models": "^8.4.0",
|
|
20
20
|
"bn.js": "^4.11.0",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"lodash": "^4.17.11",
|
|
24
24
|
"tweetnacl": "^1.0.3"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "882b8a97ef05cbd0fbd7da0b2ce457e0a0ae7e35"
|
|
27
27
|
}
|
package/src/tokens.js
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import assets from '@exodus/assets'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
{
|
|
5
|
-
mintAddress: 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt',
|
|
6
|
-
tokenName: 'serum',
|
|
7
|
-
tokenProperName: 'Serum',
|
|
8
|
-
tokenSymbol: 'SRM',
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
mintAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
12
|
-
tokenName: 'usdcoin_solana',
|
|
13
|
-
tokenProperName: 'USD Coin Solana',
|
|
14
|
-
tokenSymbol: 'USDCSOL',
|
|
15
|
-
},
|
|
16
|
-
// ....
|
|
17
|
-
]
|
|
3
|
+
// tokens info: https://github.com/project-serum/spl-token-wallet/blob/master/src/utils/tokens/names.js
|
|
18
4
|
|
|
19
|
-
|
|
5
|
+
const tokens = Object.values(assets)
|
|
6
|
+
.filter((asset) => asset.assetType === 'SOLANA_TOKEN')
|
|
7
|
+
.map((token) => ({
|
|
8
|
+
...token,
|
|
9
|
+
tokenName: token.name, // alias
|
|
10
|
+
}))
|
|
11
|
+
|
|
12
|
+
export default tokens
|
package/src/transaction.js
CHANGED
|
@@ -52,7 +52,7 @@ class Tx {
|
|
|
52
52
|
assert(Array.isArray(fromTokenAddresses), 'fromTokenAddresses Array is required')
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
const token = TOKENS.find(({
|
|
55
|
+
const token = TOKENS.find(({ name }) => name === tokenName)
|
|
56
56
|
this.txObj = {
|
|
57
57
|
from,
|
|
58
58
|
to,
|
|
@@ -110,7 +110,7 @@ class Tx {
|
|
|
110
110
|
let amountToSend
|
|
111
111
|
for (let { ticker, tokenAccountAddress, balance } of fromTokenAddresses) {
|
|
112
112
|
// need to add more of this instruction until we reach the desired balance (amount) to send
|
|
113
|
-
assert(ticker === token.
|
|
113
|
+
assert(ticker === token.ticker, `Got unexpected ticker ${ticker}`)
|
|
114
114
|
if (amountLeft === 0) break
|
|
115
115
|
|
|
116
116
|
balance = Number(balance)
|
|
@@ -129,7 +129,7 @@ class Tx {
|
|
|
129
129
|
)
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
assert(amountLeft === 0, `Not enough balance to send ${amount} ${token.
|
|
132
|
+
assert(amountLeft === 0, `Not enough balance to send ${amount} ${token.ticker}`)
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
static createStakeAccountTransaction({ address, amount, seed = SEED, pool, recentBlockhash }) {
|