@exodus/solana-api 1.2.9 → 1.2.10

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.
Files changed (2) hide show
  1. package/package.json +4 -3
  2. package/src/index.js +8 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-api",
3
- "version": "1.2.9",
3
+ "version": "1.2.10",
4
4
  "description": "Exodus internal Solana asset API wrapper",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -14,11 +14,12 @@
14
14
  },
15
15
  "dependencies": {
16
16
  "@exodus/asset-json-rpc": "^1.0.0",
17
- "@exodus/solana-lib": "^1.2.9",
17
+ "@exodus/solana-lib": "^1.2.10",
18
18
  "lodash": "^4.17.11",
19
19
  "wretch": "^1.5.2"
20
20
  },
21
21
  "devDependencies": {
22
22
  "node-fetch": "~1.6.3"
23
- }
23
+ },
24
+ "gitHead": "9ea01d6b464b1a6a23e49f3634b9e661e755efc8"
24
25
  }
package/src/index.js CHANGED
@@ -115,21 +115,18 @@ class Api {
115
115
  let txsId = txsResultsByAccount.reduce((arr, row) => arr.concat(row), []) // merge arrays
116
116
  txsId = lodash.uniqBy(txsId, 'signature')
117
117
 
118
- for (let tx of txsId) {
119
- // get tx details
120
- const [txDetails, blockTime] = await Promise.all([
121
- this.getTransactionById(tx.signature),
122
- this.getBlockTime(tx.slot),
123
- ])
124
- if (txDetails === null) continue
125
-
126
- const timestamp = blockTime * 1000
118
+ // get txs details in parallel
119
+ const txsDetails = await Promise.all(txsId.map((tx) => this.getTransactionById(tx.signature)))
120
+ txsDetails.forEach((txDetail) => {
121
+ if (txDetail === null) return
122
+
123
+ const timestamp = txDetail.blockTime * 1000
127
124
  transactions.push({
128
125
  timestamp,
129
126
  date: new Date(timestamp),
130
- ...Api.parseTransaction(address, txDetails, tokenAccountsByOwner),
127
+ ...Api.parseTransaction(address, txDetail, tokenAccountsByOwner),
131
128
  })
132
- }
129
+ })
133
130
  } catch (err) {
134
131
  console.warn('Solana error:', err)
135
132
  throw err