@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-lib",
3
- "version": "1.2.13",
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.2",
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": "df87ac51e1f8ff2d14664a0707166cdc3ccd9a8d"
26
+ "gitHead": "882b8a97ef05cbd0fbd7da0b2ce457e0a0ae7e35"
27
27
  }
package/src/tokens.js CHANGED
@@ -1,19 +1,12 @@
1
- // adapted from https://github.com/project-serum/spl-token-wallet/blob/master/src/utils/tokens/names.js
1
+ import assets from '@exodus/assets'
2
2
 
3
- const TOKENS = [
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
- export default TOKENS
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
@@ -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(({ tokenName: name }) => name === tokenName)
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.tokenSymbol, `Got unexpected ticker ${ticker}`)
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.tokenSymbol}`)
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 }) {