@exodus/solana-api 2.5.0 → 2.5.2

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-api",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Exodus internal Solana asset API wrapper",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -15,18 +15,19 @@
15
15
  "dependencies": {
16
16
  "@exodus/asset-json-rpc": "^1.0.0",
17
17
  "@exodus/asset-lib": "^3.7.1",
18
- "@exodus/assets": "^8.0.78",
19
- "@exodus/assets-base": "^8.0.157",
18
+ "@exodus/assets": "^8.0.85",
19
+ "@exodus/basic-utils": "^1.3.0",
20
20
  "@exodus/fetch": "^1.2.0",
21
21
  "@exodus/models": "^8.10.4",
22
22
  "@exodus/nfts-core": "^0.5.0",
23
23
  "@exodus/simple-retry": "^0.0.6",
24
- "@exodus/solana-lib": "^1.6.1",
24
+ "@exodus/solana-lib": "^1.6.3",
25
+ "@exodus/solana-meta": "^1.0.2",
25
26
  "bn.js": "^4.11.0",
26
27
  "debug": "^4.1.1",
27
28
  "lodash": "^4.17.11",
28
29
  "url-join": "4.0.0",
29
30
  "wretch": "^1.5.2"
30
31
  },
31
- "gitHead": "145ae526c51aefa39ffda8c63c70b30724aa9881"
32
+ "gitHead": "a7b27e4f299057c16dda446f006fa61a945a6cbf"
32
33
  }
@@ -1,9 +1,6 @@
1
- import assets from '@exodus/assets'
1
+ import { asset, tokens } from '@exodus/solana-meta'
2
2
  import { AccountState } from '@exodus/models'
3
3
 
4
- const asset = assets.solana
5
- const solTokens = Object.values(assets).filter((asset) => asset.assetType === 'SOLANA_TOKEN')
6
-
7
4
  export class SolanaAccountState extends AccountState {
8
5
  static defaults = {
9
6
  cursor: '',
@@ -24,7 +21,7 @@ export class SolanaAccountState extends AccountState {
24
21
  accounts: {}, // stake accounts
25
22
  },
26
23
  }
27
- static _tokens = [asset, ...solTokens] // deprecated - will be removed
24
+ static _tokens = [asset, ...tokens] // deprecated - will be removed
28
25
 
29
26
  static _postParse(data) {
30
27
  return { ...data, tokenBalances: {} }
package/src/api.js CHANGED
@@ -15,7 +15,6 @@ import {
15
15
  SolanaWeb3Message,
16
16
  buildRawTransaction,
17
17
  } from '@exodus/solana-lib'
18
- import assets from '@exodus/assets'
19
18
  import assert from 'assert'
20
19
  import lodash from 'lodash'
21
20
  import urljoin from 'url-join'
@@ -30,7 +29,7 @@ const WS_ENDPOINT = 'wss://solana.a.exodus.io/ws'
30
29
 
31
30
  // Tokens + SOL api support
32
31
  export class Api {
33
- constructor(rpcUrl, wsUrl) {
32
+ constructor({ rpcUrl, wsUrl, assets }) {
34
33
  this.setServer(rpcUrl)
35
34
  this.setWsEndpoint(wsUrl)
36
35
  this.setTokens(assets)
@@ -603,7 +602,7 @@ export class Api {
603
602
  const { pubkey, account } = entry
604
603
 
605
604
  const mint = lodash.get(account, 'data.parsed.info.mint')
606
- const token = this.tokens[mint] || {
605
+ const token = this.getTokenByAddress(mint) || {
607
606
  name: 'unknown',
608
607
  ticker: 'UNKNOWN',
609
608
  }
package/src/index.js CHANGED
@@ -1,9 +1,18 @@
1
+ import { keyBy } from '@exodus/basic-utils'
2
+ import { connectAssets } from '@exodus/assets'
3
+ import assetsList from '@exodus/solana-meta'
4
+
1
5
  import { Api } from './api'
6
+
2
7
  export * from './api'
3
8
  export * from './tx-log'
4
9
  export * from './account-state'
5
10
 
11
+ // These are not the same asset objects as the wallet creates, so they should never be returned to the wallet.
12
+ // Initially this may be violated by the Solana code until the first monitor tick updates assets with setTokens()
13
+ const assets = connectAssets(keyBy(assetsList, (asset) => asset.name))
14
+
6
15
  // At some point we would like to exclude this export. Default export should be the whole asset "plugin" ready to be injected.
7
16
  // Clients should not call an specific server api directly.
8
- const serverApi = new Api()
17
+ const serverApi = new Api({ assets })
9
18
  export default serverApi