@exodus/ethereum-api 2.25.2 → 2.25.3

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/ethereum-api",
3
- "version": "2.25.2",
3
+ "version": "2.25.3",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -34,5 +34,5 @@
34
34
  "devDependencies": {
35
35
  "@exodus/models": "^8.7.2"
36
36
  },
37
- "gitHead": "0466bafed6bfbfb5198758df301a1a163266cb34"
37
+ "gitHead": "5fc9011ce93fad50a48bccb4ab25930dbf7d762b"
38
38
  }
@@ -23,10 +23,21 @@ async function getAssetSymbolFromContract(contractAddress) {
23
23
  return assetSymbol
24
24
  }
25
25
 
26
- async function prepareBalanceChanges(internalTransactions, balanceChanges, transactionInput) {
26
+ async function prepareBalanceChanges(
27
+ internalTransactions,
28
+ balanceChanges,
29
+ transactionInput,
30
+ assetName = 'ethereum'
31
+ ) {
32
+ const assetNameToSymbolMap = Object.create(null)
33
+ assetNameToSymbolMap['ethereum'] = 'ETH' // Refactor after blowfish integration
34
+
35
+ const asset = assets[assetName]
27
36
  const preparedBalanceChanges = [...balanceChanges]
28
37
 
29
38
  const decimals = Object.create(null)
39
+ decimals[assetNameToSymbolMap[asset.name]] = asset.currency.defaultUnit.power // Always have a default asset decimal in map for edge cases
40
+
30
41
  const assetSymbols = Object.create(null)
31
42
  let contractName
32
43
  let isERC721 = false
@@ -115,7 +126,7 @@ async function tryToDecodeApprovalTransaction(transaction) {
115
126
  }
116
127
  }
117
128
 
118
- export async function simulateAndRetrieveSideEffects(transaction) {
129
+ export async function simulateAndRetrieveSideEffects(transaction, assetName) {
119
130
  const willSend = []
120
131
  const willReceive = []
121
132
 
@@ -150,7 +161,8 @@ export async function simulateAndRetrieveSideEffects(transaction) {
150
161
  const preparedBalanceChanges = await prepareBalanceChanges(
151
162
  internalTransactions,
152
163
  sender.balanceChanges,
153
- transaction.data
164
+ transaction.data,
165
+ assetName
154
166
  )
155
167
 
156
168
  for (const balanceChange of preparedBalanceChanges) {