@exodus/solana-api 2.5.7 → 2.5.8

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.7",
3
+ "version": "2.5.8",
4
4
  "description": "Exodus internal Solana asset API wrapper",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -31,5 +31,5 @@
31
31
  "url-join": "4.0.0",
32
32
  "wretch": "^1.5.2"
33
33
  },
34
- "gitHead": "10002728d5cb5c64b3031382956af2ea07981b08"
34
+ "gitHead": "46b0e2b60d3b21c3aa9e33be5785d34b0ba29cca"
35
35
  }
package/src/api.js CHANGED
@@ -48,7 +48,7 @@ export class Api {
48
48
 
49
49
  setTokens(assets = {}) {
50
50
  const solTokens = lodash.pickBy(assets, (asset) => asset.assetType === 'SOLANA_TOKEN')
51
- this.tokens = lodash.mapKeys(solTokens, (v) => v.mintAddress)
51
+ this.tokens = new Map(Object.values(solTokens).map((v) => [v.mintAddress, v]))
52
52
  }
53
53
 
54
54
  request(path, contentType = 'application/json'): Wretcher {
@@ -102,11 +102,11 @@ export class Api {
102
102
  }
103
103
 
104
104
  getTokenByAddress(mint: string) {
105
- return this.tokens[mint]
105
+ return this.tokens.get(mint)
106
106
  }
107
107
 
108
108
  isTokenSupported(mint: string) {
109
- return !!this.getTokenByAddress(mint)
109
+ return this.tokens.has(mint)
110
110
  }
111
111
 
112
112
  async getEpochInfo(): number {
@@ -68,7 +68,7 @@ export class SolanaMonitor extends BaseMonitor {
68
68
  async emitUnknownTokensEvent({ tokenAccounts }) {
69
69
  const tokensList = await this.api.getWalletTokensList({ tokenAccounts })
70
70
  const unknownTokensList = tokensList.filter((mintAddress) => {
71
- return !this.api.tokens[mintAddress]
71
+ return !this.api.tokens.has(mintAddress)
72
72
  })
73
73
  if (unknownTokensList.length > 0) {
74
74
  this.emit('unknown-tokens', unknownTokensList)