@exodus/ethereum-api 4.0.1 → 4.0.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/ethereum-api",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -36,5 +36,5 @@
36
36
  "devDependencies": {
37
37
  "@exodus/models": "^8.10.4"
38
38
  },
39
- "gitHead": "729674ae988309eccf03feefbf891d8b43947577"
39
+ "gitHead": "d3498091de0e60d3593995c846acbe62cacecc1c"
40
40
  }
@@ -152,10 +152,13 @@ export default class ClarityServer extends EventEmitter {
152
152
 
153
153
  async sendRequest(request) {
154
154
  const response = await this.sendRpcRequest(request)
155
- if (!response?.result) {
156
- throw new Error('Bad Response')
155
+ const result = response?.result
156
+ const error = response?.error
157
+ if (error || !result) {
158
+ const message = error?.message || error?.code || 'no result'
159
+ throw new Error(`Bad rpc response: ${message}`)
157
160
  }
158
- return response.result
161
+ return result
159
162
  }
160
163
 
161
164
  async isContract(address) {
@@ -20,8 +20,8 @@ export default function getLogItemsFromServerTx({
20
20
  const confirmations = isConfirmedServerTx(serverTx) ? 1 : 0
21
21
  const date = parseServerTxDate(serverTx.timestamp) // included even for unconfirmed txs
22
22
  const txId = serverTx.hash
23
- const nonce = parseInt(serverTx.nonce, 16)
24
- const gasLimit = parseInt(serverTx.gas, 16)
23
+ const nonce = parseInt(serverTx.nonce, 10)
24
+ const gasLimit = parseInt(serverTx.gas, 10)
25
25
  const error = serverTx.error || (serverTx.status === '0' ? 'Failed' : null)
26
26
  const feeAmount = getFeeAmount(asset, serverTx)
27
27
  const internalTransfers = filterEffects(serverTx.effects, 'internal') || []