@exodus/ethereum-api 8.18.0 → 8.18.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/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.18.2](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.18.1...@exodus/ethereum-api@8.18.2) (2024-09-17)
7
+
8
+ **Note:** Version bump only for package @exodus/ethereum-api
9
+
10
+
11
+
12
+
13
+
14
+ ## [8.18.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.18.0...@exodus/ethereum-api@8.18.1) (2024-09-11)
15
+
16
+ **Note:** Version bump only for package @exodus/ethereum-api
17
+
18
+
19
+
20
+
21
+
6
22
  ## [8.18.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.17.0...@exodus/ethereum-api@8.18.0) (2024-09-06)
7
23
 
8
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.18.0",
3
+ "version": "8.18.2",
4
4
  "description": "Ethereum Api",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -28,7 +28,7 @@
28
28
  "@exodus/bip44-constants": "^195.0.0",
29
29
  "@exodus/crypto": "^1.0.0-rc.0",
30
30
  "@exodus/currency": "^5.0.2",
31
- "@exodus/ethereum-lib": "^5.0.0",
31
+ "@exodus/ethereum-lib": "^5.4.0",
32
32
  "@exodus/ethereum-meta": "^2.0.0",
33
33
  "@exodus/ethereumholesky-meta": "^2.0.0",
34
34
  "@exodus/ethereumjs-util": "^7.1.0-exodus.7",
@@ -65,5 +65,5 @@
65
65
  "type": "git",
66
66
  "url": "git+https://github.com/ExodusMovement/assets.git"
67
67
  },
68
- "gitHead": "b03f9102b0401e40f0484c2195061a907eae9b47"
68
+ "gitHead": "ddeb04e25e5cb7dda81cc453c292e3aa6bfa25a1"
69
69
  }
@@ -1,5 +1,4 @@
1
1
  import { bufferToHex } from '@exodus/ethereumjs-util'
2
- import { fetch } from '@exodus/fetch'
3
2
  import SolidityContract from '@exodus/solidity-contract'
4
3
  import EventEmitter from 'events'
5
4
  import lodash from 'lodash'
@@ -1,4 +1,3 @@
1
- import { fetch } from '@exodus/fetch'
2
1
  import { retry } from '@exodus/simple-retry'
3
2
 
4
3
  import ClarityServer from './clarity.js'
@@ -40,7 +39,7 @@ export default class ClarityServerV2 extends ClarityServer {
40
39
  let { blockNumber } = this.#decodeCursor(cursor)
41
40
  blockNumber = blockNumber.toString()
42
41
 
43
- const transactions = []
42
+ let transactions = []
44
43
 
45
44
  while (true) {
46
45
  const url = new URL(`${this.baseApiPath}/addresses/${address}/transactions`)
@@ -56,7 +55,15 @@ export default class ClarityServerV2 extends ClarityServer {
56
55
  }
57
56
 
58
57
  if (nextBlockNumber <= blockNumber) {
59
- console.warn('Invalid cursor: next block number is not greater than current block number')
58
+ console.warn(
59
+ `Invalid cursor: next block number is not greater than current block number at cursor ${blockNumber}`
60
+ )
61
+
62
+ // self healing, reset cursor to the smaller block number and remove the transactions greater than the block number
63
+ transactions.push(...txs)
64
+ transactions = transactions.filter((tx) => tx.blockNumber <= nextBlockNumber)
65
+ blockNumber = nextBlockNumber
66
+ break
60
67
  }
61
68
 
62
69
  transactions.push(...txs)
@@ -5,23 +5,18 @@ import {
5
5
  getUnconfirmedSentBalance,
6
6
  } from '@exodus/asset-lib'
7
7
  import { isRpcBalanceAsset } from '@exodus/ethereum-lib'
8
- import lodash from 'lodash'
9
8
  import assert from 'minimalistic-assert'
10
9
 
11
- const { get } = lodash
12
-
13
10
  const getStaked = ({ accountState, asset }) => {
14
- return get(accountState, ['staking', asset.name, 'delegatedBalance']) || asset.currency.ZERO
11
+ return accountState?.staking?.[asset.name]?.delegatedBalance || asset.currency.ZERO
15
12
  }
16
13
 
17
14
  const getUnstaking = ({ accountState, asset }) => {
18
- return get(accountState, ['staking', asset.name, 'undelegatedBalance']) || asset.currency.ZERO
15
+ return accountState?.staking?.[asset.name]?.undelegatedBalance || asset.currency.ZERO
19
16
  }
20
17
 
21
18
  const getUnstaked = ({ accountState, asset }) => {
22
- return (
23
- get(accountState, ['staking', asset.name, 'unclaimedUndelegatedBalance']) || asset.currency.ZERO
24
- )
19
+ return accountState?.staking?.[asset.name]?.unclaimedUndelegatedBalance || asset.currency.ZERO
25
20
  }
26
21
 
27
22
  /**
@@ -1,5 +1,3 @@
1
- import { fetch } from '@exodus/fetch'
2
-
3
1
  const ETHEREUM_TX_PREVIEW_API = 'https://simulation.a.exodus.io/simulate'
4
2
 
5
3
  export async function fetchTxPreview(transaction) {