@exodus/ethereum-api 8.10.0 → 8.11.0
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 +23 -0
- package/package.json +3 -4
- package/src/allowance/index.js +1 -1
- package/src/create-asset-plugin-factory.js +3 -2
- package/src/create-asset.js +15 -17
- package/src/create-token-factory.js +2 -2
- package/src/ens/index.js +1 -1
- package/src/eth-like-util.js +5 -4
- package/src/etherscan/account.js +1 -0
- package/src/etherscan/logs.js +1 -0
- package/src/etherscan/request.js +2 -2
- package/src/etherscan/ws.js +1 -0
- package/src/exodus-eth-server/api-coin-nodes.js +2 -1
- package/src/exodus-eth-server/api.js +10 -5
- package/src/exodus-eth-server/clarity.js +1 -0
- package/src/exodus-eth-server/index.js +2 -2
- package/src/exodus-eth-server/ws.js +2 -1
- package/src/gas-estimation.js +3 -2
- package/src/get-balances.js +3 -5
- package/src/get-fee-async.js +5 -1
- package/src/hooks/monitor.js +2 -1
- package/src/nft-utils.js +2 -1
- package/src/optimism-gas/index.js +3 -2
- package/src/server-based-fee-monitor.js +2 -1
- package/src/simulate-tx/simulate-eth-tx.js +4 -4
- package/src/staking/ethereum/api.js +3 -2
- package/src/staking/ethereum/service.js +4 -3
- package/src/staking/matic/api.js +4 -3
- package/src/staking/matic/service.js +3 -2
- package/src/staking/staking-provider-client.js +1 -1
- package/src/tx-log/clarity-monitor.js +4 -4
- package/src/tx-log/clarity-utils/get-log-items-from-server-tx.js +6 -5
- package/src/tx-log/clarity-utils/get-names-of-tokens-transferred-by-server-tx.js +2 -1
- package/src/tx-log/ethereum-monitor.js +7 -10
- package/src/tx-log/ethereum-no-history-monitor.js +5 -8
- package/src/tx-log/monitor-utils/check-pending-transactions.js +1 -1
- package/src/tx-log/monitor-utils/get-derive-transactions-to-check.js +2 -1
- package/src/tx-log/monitor-utils/get-log-items-from-server-tx.js +6 -5
- package/src/tx-log/monitor-utils/get-names-of-tokens-transferred-by-server-tx.js +2 -1
- package/src/tx-send/tx-send.js +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,29 @@
|
|
|
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.11.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.10.1...@exodus/ethereum-api@8.11.0) (2024-07-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* ethereum fee async allow clients to provide custom gas limit ([#2988](https://github.com/ExodusMovement/assets/issues/2988)) ([7f6630f](https://github.com/ExodusMovement/assets/commit/7f6630f7421220393308ecba5e05f2cab73867ff))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* lint for EVM assets ([#2969](https://github.com/ExodusMovement/assets/issues/2969)) ([16ca272](https://github.com/ExodusMovement/assets/commit/16ca272524ab1530800ca84f1df045293c08a3aa))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## [8.10.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.10.0...@exodus/ethereum-api@8.10.1) (2024-07-18)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* use magnifier proxy_v2 to support large NFT txs ([#2788](https://github.com/ExodusMovement/assets/issues/2788)) ([fd80841](https://github.com/ExodusMovement/assets/commit/fd8084196dc2d4620cb5d5a6e6b4501d5bff2f7e))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [8.10.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.9.4...@exodus/ethereum-api@8.10.0) (2024-07-16)
|
|
7
30
|
|
|
8
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.0",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"access": "restricted"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"test": "run -T jest",
|
|
18
|
+
"test": "run -T exodus-test --jest --esbuild",
|
|
19
19
|
"lint": "run -T eslint .",
|
|
20
20
|
"lint:fix": "yarn lint --fix"
|
|
21
21
|
},
|
|
@@ -56,7 +56,6 @@
|
|
|
56
56
|
"@exodus/ethereumsepolia-meta": "^1.0.3",
|
|
57
57
|
"@exodus/fantommainnet-meta": "^1.1.2",
|
|
58
58
|
"@exodus/rootstock-meta": "^1.0.7",
|
|
59
|
-
"cross-fetch": "^3.1.5",
|
|
60
59
|
"delay": "4.0.1"
|
|
61
60
|
},
|
|
62
61
|
"bugs": {
|
|
@@ -66,5 +65,5 @@
|
|
|
66
65
|
"type": "git",
|
|
67
66
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
68
67
|
},
|
|
69
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "70583d4d7487eb844193b87a148c4308bf2dcd27"
|
|
70
69
|
}
|
package/src/allowance/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { fetchGasLimit } from '../gas-estimation'
|
|
2
1
|
import { getServer } from '../exodus-eth-server'
|
|
2
|
+
import { fetchGasLimit } from '../gas-estimation'
|
|
3
3
|
import { ALLOWANCE_TX_TIMEOUT, APPROVAL_GAS_LIMIT, ZERO_ALLOWANCE_ASSETS } from './constants'
|
|
4
4
|
|
|
5
5
|
export const isZeroAllowanceAsset = (assetName) => ZERO_ALLOWANCE_ASSETS.includes(assetName)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createMetaDef } from '@exodus/asset'
|
|
2
2
|
import { FeeData } from '@exodus/asset-lib'
|
|
3
|
-
import { createAssetFactory } from './create-asset'
|
|
4
|
-
import assert from 'minimalistic-assert'
|
|
5
3
|
import { UnitType } from '@exodus/currency'
|
|
4
|
+
import assert from 'minimalistic-assert'
|
|
5
|
+
|
|
6
|
+
import { createAssetFactory } from './create-asset'
|
|
6
7
|
|
|
7
8
|
// Move to ethereum-api for config base evm
|
|
8
9
|
export const createAssetPluginFactory = (config) => {
|
package/src/create-asset.js
CHANGED
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
import { connectAssetsList } from '@exodus/assets'
|
|
2
2
|
import { pick } from '@exodus/basic-utils'
|
|
3
3
|
import bip44Constants from '@exodus/bip44-constants/by-ticker'
|
|
4
|
-
import { getBalancesFactory } from './get-balances'
|
|
5
|
-
import { ClarityMonitor } from './tx-log/clarity-monitor'
|
|
6
|
-
import { EthereumNoHistoryMonitor } from './tx-log/ethereum-no-history-monitor'
|
|
7
|
-
import { EthereumMonitor } from './tx-log/ethereum-monitor'
|
|
8
|
-
|
|
9
|
-
import { createEvmServer } from './exodus-eth-server'
|
|
10
|
-
|
|
11
4
|
import {
|
|
12
5
|
createEthereumLikeAccountState,
|
|
13
6
|
createGetKeyIdentifier as defaultCreateGetKeyIdentifier,
|
|
7
|
+
createUnsignedTxFactory,
|
|
8
|
+
DEFAULT_FEE_MONITOR_INTERVAL,
|
|
14
9
|
encodePrivate,
|
|
15
10
|
encodePublicFactory,
|
|
16
11
|
hasChecksum,
|
|
17
|
-
|
|
18
|
-
signUnsignedTxWithSigner,
|
|
12
|
+
signHardwareFactory,
|
|
19
13
|
signMessage,
|
|
20
14
|
signMessageWithSigner,
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
signUnsignedTx,
|
|
16
|
+
signUnsignedTxWithSigner,
|
|
23
17
|
validateFactory,
|
|
24
|
-
createUnsignedTxFactory,
|
|
25
18
|
} from '@exodus/ethereum-lib'
|
|
19
|
+
import { mapValues } from 'lodash'
|
|
26
20
|
import assert from 'minimalistic-assert'
|
|
27
21
|
import ms from 'ms'
|
|
28
22
|
|
|
29
23
|
import { addressHasHistoryFactory } from './address-has-history'
|
|
30
24
|
import { createTokenFactory } from './create-token-factory'
|
|
25
|
+
import { createEvmServer } from './exodus-eth-server'
|
|
26
|
+
import { createGetBalanceForAddress } from './get-balance-for-address'
|
|
27
|
+
import { getBalancesFactory } from './get-balances'
|
|
31
28
|
import { getEffectiveGasPrice, getFeeFactory } from './get-fee'
|
|
29
|
+
import getFeeAsyncFactory from './get-fee-async'
|
|
32
30
|
import { createEthereumHooks } from './hooks'
|
|
31
|
+
import { estimateL1DataFeeFactory, getL1GetFeeFactory } from './optimism-gas'
|
|
32
|
+
import { serverBasedFeeMonitorFactoryFactory } from './server-based-fee-monitor'
|
|
33
33
|
import { createStakingApi } from './staking-api'
|
|
34
|
+
import { ClarityMonitor } from './tx-log/clarity-monitor'
|
|
35
|
+
import { EthereumMonitor } from './tx-log/ethereum-monitor'
|
|
36
|
+
import { EthereumNoHistoryMonitor } from './tx-log/ethereum-no-history-monitor'
|
|
34
37
|
import { txSendFactory } from './tx-send'
|
|
35
|
-
import { serverBasedFeeMonitorFactoryFactory } from './server-based-fee-monitor'
|
|
36
|
-
import { createGetBalanceForAddress } from './get-balance-for-address'
|
|
37
|
-
import { estimateL1DataFeeFactory, getL1GetFeeFactory } from './optimism-gas'
|
|
38
|
-
import { mapValues } from 'lodash'
|
|
39
38
|
import { createWeb3API } from './web3'
|
|
40
|
-
import getFeeAsyncFactory from './get-fee-async'
|
|
41
39
|
|
|
42
40
|
export const createAssetFactory = ({
|
|
43
41
|
AccountState: CustomAccountState,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { isPolygonClaimUndelegate, isPolygonDelegate, isPolygonUndelegate } from './staking/matic'
|
|
2
1
|
import { createContract } from '@exodus/ethereum-lib'
|
|
2
|
+
import assert from 'minimalistic-assert'
|
|
3
3
|
|
|
4
|
+
import { isPolygonClaimUndelegate, isPolygonDelegate, isPolygonUndelegate } from './staking/matic'
|
|
4
5
|
import { createStakingApi } from './staking-api'
|
|
5
|
-
import assert from 'minimalistic-assert'
|
|
6
6
|
|
|
7
7
|
const defaultTokenFeatures = {
|
|
8
8
|
isMaxFeeAsset: true,
|
package/src/ens/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ABI } from '@exodus/ethereum-lib'
|
|
1
2
|
import SolidityContract from '@exodus/solidity-contract'
|
|
2
3
|
import { toUnicode } from 'idna-uts46-hx'
|
|
3
4
|
import { keccak256 } from 'js-sha3'
|
|
4
|
-
import { ABI } from '@exodus/ethereum-lib'
|
|
5
5
|
|
|
6
6
|
import ENS_REGISTRY_ADDRESSES from './addresses'
|
|
7
7
|
|
package/src/eth-like-util.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import assert from 'minimalistic-assert'
|
|
2
|
-
import { normalizeTxId, isEthereumLikeAsset, isEthereumLikeToken, ABI } from '@exodus/ethereum-lib'
|
|
3
1
|
import { memoizeLruCache } from '@exodus/asset-lib'
|
|
2
|
+
import { ABI, isEthereumLikeAsset, isEthereumLikeToken, normalizeTxId } from '@exodus/ethereum-lib'
|
|
4
3
|
import SolidityContract from '@exodus/solidity-contract'
|
|
5
|
-
import
|
|
6
|
-
|
|
4
|
+
import assert from 'minimalistic-assert'
|
|
5
|
+
|
|
7
6
|
import * as ErrorWrapper from './error-wrapper'
|
|
7
|
+
import { getServer, getServerByName } from './exodus-eth-server'
|
|
8
|
+
import { fromHexToString } from './number-utils'
|
|
8
9
|
|
|
9
10
|
export async function isContract(baseAssetName, address) {
|
|
10
11
|
return getServerByName(baseAssetName).isContract(address)
|
package/src/etherscan/account.js
CHANGED
package/src/etherscan/logs.js
CHANGED
package/src/etherscan/request.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ms from 'ms'
|
|
2
|
-
import makeConcurrent from 'make-concurrent'
|
|
3
1
|
import fetchival from '@exodus/fetch/experimental/fetchival'
|
|
2
|
+
import makeConcurrent from 'make-concurrent'
|
|
3
|
+
import ms from 'ms'
|
|
4
4
|
|
|
5
5
|
const ETHERSCAN_API_URL = 'https://api.etherscan.io/api'
|
|
6
6
|
const DEFAULT_ETHERSCAN_API_KEY = 'XM3VGRSNW1TMSIR14I9MVFP15X74GNHTRI'
|
package/src/etherscan/ws.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
2
|
+
import { fetch } from '@exodus/fetch'
|
|
2
3
|
import SolidityContract from '@exodus/solidity-contract'
|
|
3
4
|
import EventEmitter from 'events'
|
|
4
5
|
import { isEmpty } from 'lodash'
|
|
5
|
-
|
|
6
|
+
|
|
6
7
|
import { fromHexToString } from '../number-utils'
|
|
7
8
|
|
|
8
9
|
export default class ApiCoinNodesServer extends EventEmitter {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { randomUUID } from '@exodus/crypto/randomUUID'
|
|
2
|
+
import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
3
3
|
import fetchival from '@exodus/fetch/experimental/fetchival'
|
|
4
4
|
import { retry } from '@exodus/simple-retry'
|
|
5
5
|
import SolidityContract from '@exodus/solidity-contract'
|
|
6
|
-
import
|
|
7
|
-
|
|
6
|
+
import ms from 'ms'
|
|
7
|
+
|
|
8
8
|
import { fromHexToString } from '../number-utils'
|
|
9
|
+
import createWebSocket from './ws'
|
|
9
10
|
|
|
10
11
|
const RETRY_DELAYS = ['10s']
|
|
11
12
|
|
|
@@ -164,7 +165,11 @@ export function create(defaultURL, ensAssetName) {
|
|
|
164
165
|
|
|
165
166
|
async sendRawTransaction(data) {
|
|
166
167
|
const hex = data.startsWith('0x') ? data : '0x' + data
|
|
167
|
-
return requestWithRetry(
|
|
168
|
+
return requestWithRetry(
|
|
169
|
+
'proxy',
|
|
170
|
+
{ method: 'eth_sendRawTransaction', params: [hex] },
|
|
171
|
+
{ version: 'v2', method: 'post' }
|
|
172
|
+
)
|
|
168
173
|
},
|
|
169
174
|
|
|
170
175
|
async estimateGas(data, tag = 'latest') {
|
|
@@ -2,6 +2,7 @@ import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
|
2
2
|
import SolidityContract from '@exodus/solidity-contract'
|
|
3
3
|
import EventEmitter from 'events'
|
|
4
4
|
import io from 'socket.io-client'
|
|
5
|
+
|
|
5
6
|
import { fromHexToString } from '../number-utils'
|
|
6
7
|
|
|
7
8
|
export default class ClarityServer extends EventEmitter {
|
|
@@ -6,11 +6,11 @@ import {
|
|
|
6
6
|
// eslint-disable-next-line import/no-deprecated
|
|
7
7
|
ETHEREUM_LIKE_MONITOR_TYPES,
|
|
8
8
|
} from '@exodus/ethereum-lib'
|
|
9
|
+
import assert from 'minimalistic-assert'
|
|
9
10
|
|
|
10
11
|
import { create } from './api'
|
|
11
|
-
import ClarityServer from './clarity'
|
|
12
12
|
import ApiCoinNodesServer from './api-coin-nodes'
|
|
13
|
-
import
|
|
13
|
+
import ClarityServer from './clarity'
|
|
14
14
|
|
|
15
15
|
export function createEvmServer({ assetName, serverUrl, monitorType }) {
|
|
16
16
|
assert(assetName, 'assetName is required')
|
package/src/gas-estimation.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import BN from 'bn.js'
|
|
2
|
-
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
3
1
|
import { currency2buffer, isEthereumLikeToken } from '@exodus/ethereum-lib'
|
|
2
|
+
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
3
|
+
import BN from 'bn.js'
|
|
4
|
+
|
|
4
5
|
import { estimateGas, isContractAddressCached } from './eth-like-util'
|
|
5
6
|
|
|
6
7
|
const EXTRA_PERCENTAGE = 20
|
package/src/get-balances.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { isRpcBalanceAsset } from '@exodus/ethereum-lib'
|
|
2
|
-
|
|
3
|
-
import { get } from 'lodash'
|
|
4
|
-
import assert from 'minimalistic-assert'
|
|
5
|
-
|
|
6
1
|
import {
|
|
7
2
|
getBalanceFromAccountState,
|
|
8
3
|
getBalanceFromTxLog,
|
|
9
4
|
getUnconfirmedReceivedBalance,
|
|
10
5
|
getUnconfirmedSentBalance,
|
|
11
6
|
} from '@exodus/asset-lib'
|
|
7
|
+
import { isRpcBalanceAsset } from '@exodus/ethereum-lib'
|
|
8
|
+
import { get } from 'lodash'
|
|
9
|
+
import assert from 'minimalistic-assert'
|
|
12
10
|
|
|
13
11
|
const getStaked = ({ accountState, asset }) => {
|
|
14
12
|
return get(accountState, ['staking', asset.name, 'delegatedBalance']) || asset.currency.ZERO
|
package/src/get-fee-async.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import assert from 'minimalistic-assert'
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { isForwarderContractCached } from './eth-like-util'
|
|
4
|
+
import { fetchGasLimit, resolveDefaultTxInput } from './gas-estimation'
|
|
4
5
|
import { getFeeFactory } from './get-fee'
|
|
5
6
|
import { getNftArguments } from './nft-utils'
|
|
6
7
|
|
|
@@ -45,6 +46,7 @@ const getFeeAsyncFactory = ({
|
|
|
45
46
|
customFee,
|
|
46
47
|
calculateEffectiveFee,
|
|
47
48
|
isSendAll,
|
|
49
|
+
gasLimit: providedGasLimit,
|
|
48
50
|
isRbfAllowed = true, // Destkop, isRbfAllowed=true when advanced panel is on
|
|
49
51
|
}) => {
|
|
50
52
|
const resolveGasLimit = async () => {
|
|
@@ -55,6 +57,8 @@ const getFeeAsyncFactory = ({
|
|
|
55
57
|
if (!amount) amount = asset.currency.ZERO
|
|
56
58
|
const extraPercentage = await resolveExtraPercentage({ asset, toAddress })
|
|
57
59
|
const txInput = txInputPram || resolveDefaultTxInput({ asset, toAddress, amount })
|
|
60
|
+
if (providedGasLimit) return { gasLimit: providedGasLimit, txInput }
|
|
61
|
+
|
|
58
62
|
const gasLimit = await fetchGasLimit({
|
|
59
63
|
asset,
|
|
60
64
|
fromAddress,
|
package/src/hooks/monitor.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import assert from 'minimalistic-assert'
|
|
2
|
+
|
|
1
3
|
import { getEthereumStakingInfo, getPolygonStakingInfo } from '../staking'
|
|
2
4
|
import processTxLog from '../tx-log-staking-processor'
|
|
3
|
-
import assert from 'minimalistic-assert'
|
|
4
5
|
|
|
5
6
|
export const createEthereumHooks = ({
|
|
6
7
|
assetClientInterface,
|
package/src/nft-utils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import SolidityContract from '@exodus/solidity-contract'
|
|
2
|
-
import { fetchGasLimit } from './gas-estimation'
|
|
3
2
|
import assert from 'minimalistic-assert'
|
|
3
|
+
|
|
4
4
|
import * as ErrorWrapper from './error-wrapper'
|
|
5
|
+
import { fetchGasLimit } from './gas-estimation'
|
|
5
6
|
|
|
6
7
|
export const getNftArguments = async ({ asset, nft, fromAddress, toAddress }) => {
|
|
7
8
|
assert(asset, 'asset is required')
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { createContract, createEthereumJsTx } from '@exodus/ethereum-lib'
|
|
1
2
|
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
2
|
-
import { createEthereumJsTx, createContract } from '@exodus/ethereum-lib'
|
|
3
|
-
import { fromHexToBigInt } from '../number-utils'
|
|
4
3
|
import assert from 'minimalistic-assert'
|
|
5
4
|
|
|
5
|
+
import { fromHexToBigInt } from '../number-utils'
|
|
6
|
+
|
|
6
7
|
export const estimateL1DataFeeFactory = ({ l1GasOracleAddress, server }) => {
|
|
7
8
|
assert(l1GasOracleAddress, 'l1GasOracleAddress is required')
|
|
8
9
|
assert(server, 'server is required')
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import assert from 'minimalistic-assert'
|
|
2
|
-
import { asset as ethereum } from '@exodus/ethereum-meta'
|
|
3
1
|
import {
|
|
2
|
+
APPROVE_METHOD_ID,
|
|
4
3
|
checkIsERC721InputData,
|
|
5
4
|
checkIsNFTInputData,
|
|
6
|
-
APPROVE_METHOD_ID,
|
|
7
5
|
} from '@exodus/ethereum-lib'
|
|
6
|
+
import { asset as ethereum } from '@exodus/ethereum-meta'
|
|
8
7
|
import SolidityContract from '@exodus/solidity-contract'
|
|
8
|
+
import assert from 'minimalistic-assert'
|
|
9
9
|
|
|
10
|
-
import { fetchTxPreview } from './fetch-tx-preview'
|
|
11
10
|
import { getERC20Params } from '../eth-like-util'
|
|
11
|
+
import { fetchTxPreview } from './fetch-tx-preview'
|
|
12
12
|
|
|
13
13
|
const ethDecimals = ethereum.units.ETH
|
|
14
14
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createContract } from '@exodus/ethereum-lib'
|
|
2
|
-
import { getServerByName } from '../../exodus-eth-server'
|
|
3
|
-
import { retry } from '@exodus/simple-retry'
|
|
4
2
|
import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
3
|
+
import { retry } from '@exodus/simple-retry'
|
|
4
|
+
|
|
5
|
+
import { getServerByName } from '../../exodus-eth-server'
|
|
5
6
|
|
|
6
7
|
const MIN_AMOUNT = '0.1'
|
|
7
8
|
const RETRY_DELAYS = ['10s']
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { estimateGasLimit } from '../../gas-estimation'
|
|
2
|
-
import { getServer } from '../../exodus-eth-server'
|
|
3
1
|
import { isNumberUnit } from '@exodus/currency'
|
|
2
|
+
|
|
3
|
+
import { getServer } from '../../exodus-eth-server'
|
|
4
|
+
import { estimateGasLimit } from '../../gas-estimation'
|
|
5
|
+
import { fromHexToBigInt } from '../../number-utils'
|
|
4
6
|
import { stakingProviderClientFactory } from '../staking-provider-client'
|
|
5
7
|
import { EthereumStaking } from './api'
|
|
6
|
-
import { fromHexToBigInt } from '../../number-utils'
|
|
7
8
|
|
|
8
9
|
const extraGasLimit = 20_000 // extra gas Limit to prevent tx failing if something change on pool state (till tx is in mempool)
|
|
9
10
|
|
package/src/staking/matic/api.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import BN from 'bn.js'
|
|
2
1
|
import { createContract } from '@exodus/ethereum-lib'
|
|
3
2
|
import ethAssets from '@exodus/ethereum-meta'
|
|
4
|
-
import { getServerByName } from '../../exodus-eth-server'
|
|
5
|
-
import { retry } from '@exodus/simple-retry'
|
|
6
3
|
import { bufferToHex } from '@exodus/ethereumjs-util'
|
|
4
|
+
import { retry } from '@exodus/simple-retry'
|
|
5
|
+
import BN from 'bn.js'
|
|
6
|
+
|
|
7
|
+
import { getServerByName } from '../../exodus-eth-server'
|
|
7
8
|
|
|
8
9
|
const polygonEthToken = ethAssets.find(({ name: tokenName }) => tokenName === 'polygon')
|
|
9
10
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { isNumberUnit } from '@exodus/currency'
|
|
1
2
|
import BN from 'bn.js'
|
|
3
|
+
|
|
2
4
|
import { getServer } from '../../exodus-eth-server'
|
|
3
5
|
import { estimateGasLimit } from '../../gas-estimation'
|
|
4
|
-
import { MaticStakingApi } from './api'
|
|
5
6
|
import { stakingProviderClientFactory } from '../staking-provider-client'
|
|
6
|
-
import {
|
|
7
|
+
import { MaticStakingApi } from './api'
|
|
7
8
|
|
|
8
9
|
export function createPolygonStakingService({ assetClientInterface, createAndBroadcastTX }) {
|
|
9
10
|
const stakingApi = new MaticStakingApi()
|
|
@@ -2,14 +2,14 @@ import { BaseMonitor } from '@exodus/asset-lib'
|
|
|
2
2
|
import { getAssetAddresses, isRpcBalanceAsset } from '@exodus/ethereum-lib'
|
|
3
3
|
import { isEmpty } from 'lodash'
|
|
4
4
|
|
|
5
|
+
import { fromHexToString } from '../number-utils'
|
|
6
|
+
import { filterEffects, getDeriveDataNeededForTick, getLogItemsFromServerTx } from './clarity-utils'
|
|
5
7
|
import {
|
|
6
|
-
getAllLogItemsByAsset,
|
|
7
8
|
checkPendingTransactions,
|
|
8
|
-
getDeriveTransactionsToCheck,
|
|
9
9
|
excludeUnchangedTokenBalances,
|
|
10
|
+
getAllLogItemsByAsset,
|
|
11
|
+
getDeriveTransactionsToCheck,
|
|
10
12
|
} from './monitor-utils'
|
|
11
|
-
import { getLogItemsFromServerTx, getDeriveDataNeededForTick, filterEffects } from './clarity-utils'
|
|
12
|
-
import { fromHexToString } from '../number-utils'
|
|
13
13
|
|
|
14
14
|
export class ClarityMonitor extends BaseMonitor {
|
|
15
15
|
constructor({ server, config, ...args }) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import lodash from 'lodash'
|
|
2
|
+
|
|
3
3
|
import getFeeAmount from '../monitor-utils/get-fee-amount'
|
|
4
|
-
import
|
|
4
|
+
import getTransfersByTokenName from '../monitor-utils/get-transfers-by-token-name'
|
|
5
|
+
import getValueOfTransfers from '../monitor-utils/get-value-of-transfers'
|
|
5
6
|
import isConfirmedServerTx from '../monitor-utils/is-confirmed-server-tx'
|
|
6
|
-
import
|
|
7
|
+
import isConsideredSentTokenTx from '../monitor-utils/is-considered-sent-token-tx'
|
|
7
8
|
import filterEffects from './filter-effects'
|
|
8
|
-
import
|
|
9
|
+
import getNamesOfTokensTransferredByServerTx from './get-names-of-tokens-transferred-by-server-tx'
|
|
9
10
|
|
|
10
11
|
// This function takes a server transaction object fetched from magnifier,
|
|
11
12
|
// and transforms it into Tx models to update the exodus state.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { FEE_PAYMENT_PREFIX } from '@exodus/ethereum-lib'
|
|
1
2
|
import lodash from 'lodash'
|
|
3
|
+
|
|
2
4
|
import getValueOfTransfers from '../monitor-utils/get-value-of-transfers'
|
|
3
|
-
import { FEE_PAYMENT_PREFIX } from '@exodus/ethereum-lib'
|
|
4
5
|
|
|
5
6
|
// For ETH transactions, we store an array of token names inside
|
|
6
7
|
// the TX model. This array is used to display text in the UI for
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BaseMonitor } from '@exodus/asset-lib'
|
|
2
|
+
import { getAssetAddresses, isRpcBalanceAsset } from '@exodus/ethereum-lib'
|
|
3
|
+
import { isEmpty } from 'lodash'
|
|
2
4
|
|
|
5
|
+
import { fromHexToString } from '../number-utils'
|
|
3
6
|
import {
|
|
4
7
|
checkPendingTransactions,
|
|
8
|
+
excludeUnchangedTokenBalances,
|
|
5
9
|
getAllLogItemsByAsset,
|
|
6
|
-
getLogItemsFromServerTx,
|
|
7
10
|
getDeriveDataNeededForTick,
|
|
8
11
|
getDeriveTransactionsToCheck,
|
|
9
12
|
getHistoryFromServer,
|
|
10
|
-
|
|
13
|
+
getLogItemsFromServerTx,
|
|
11
14
|
} from './monitor-utils'
|
|
12
|
-
|
|
13
15
|
import {
|
|
14
16
|
enableWSUpdates,
|
|
15
17
|
subscribeToGasPriceNotifications,
|
|
16
18
|
subscribeToWSNotifications,
|
|
17
19
|
} from './ws-updates'
|
|
18
20
|
|
|
19
|
-
import { isEmpty } from 'lodash'
|
|
20
|
-
|
|
21
|
-
import { BaseMonitor } from '@exodus/asset-lib'
|
|
22
|
-
import { fromHexToString } from '../number-utils'
|
|
23
|
-
|
|
24
21
|
// The base ethereum monitor class handles listening for, fetching,
|
|
25
22
|
// formatting, and populating-to-state all ETH/ETC/ERC20 transactions.
|
|
26
23
|
|
|
@@ -125,7 +122,7 @@ export class EthereumMonitor extends BaseMonitor {
|
|
|
125
122
|
// Once the real bug is found, remove this logic
|
|
126
123
|
const rpcTx = await this.server.getTransactionByHash(tx.txId)
|
|
127
124
|
const isTxConfirmed = !!rpcTx?.blockNumber
|
|
128
|
-
this.logger.
|
|
125
|
+
this.logger.info(`tx ${tx.txId} confirmed: ${isTxConfirmed}`)
|
|
129
126
|
await updateTx(tx, assetName, { isTxConfirmed })
|
|
130
127
|
}
|
|
131
128
|
}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
+
import { BaseMonitor } from '@exodus/asset-lib'
|
|
2
|
+
import { SynchronizedTime } from '@exodus/basic-utils'
|
|
1
3
|
import { Tx } from '@exodus/models'
|
|
4
|
+
import { isEmpty, unionBy, zipObject } from 'lodash'
|
|
2
5
|
|
|
6
|
+
import { fromHexToString } from '../number-utils'
|
|
3
7
|
import {
|
|
8
|
+
excludeUnchangedTokenBalances,
|
|
4
9
|
getDeriveDataNeededForTick,
|
|
5
10
|
getDeriveTransactionsToCheck,
|
|
6
|
-
excludeUnchangedTokenBalances,
|
|
7
11
|
} from './monitor-utils'
|
|
8
|
-
|
|
9
|
-
import { isEmpty, unionBy, zipObject } from 'lodash'
|
|
10
|
-
|
|
11
|
-
import { BaseMonitor } from '@exodus/asset-lib'
|
|
12
|
-
|
|
13
12
|
import { UNCONFIRMED_TX_LIMIT } from './monitor-utils/get-derive-transactions-to-check'
|
|
14
|
-
import { fromHexToString } from '../number-utils'
|
|
15
|
-
import { SynchronizedTime } from '@exodus/basic-utils'
|
|
16
13
|
|
|
17
14
|
// The base ethereum monitor no history class handles listening for assets with no history
|
|
18
15
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import getNamesOfTokensTransferredByServerTx from './get-names-of-tokens-transferred-by-server-tx'
|
|
1
|
+
import lodash from 'lodash'
|
|
2
|
+
|
|
4
3
|
import getFeeAmount from './get-fee-amount'
|
|
5
|
-
import
|
|
4
|
+
import getNamesOfTokensTransferredByServerTx from './get-names-of-tokens-transferred-by-server-tx'
|
|
5
|
+
import getTransfersByTokenName from './get-transfers-by-token-name'
|
|
6
|
+
import getValueOfTransfers from './get-value-of-transfers'
|
|
6
7
|
import isConfirmedServerTx from './is-confirmed-server-tx'
|
|
7
|
-
import
|
|
8
|
+
import isConsideredSentTokenTx from './is-considered-sent-token-tx'
|
|
8
9
|
|
|
9
10
|
// This function takes a server transaction object fetched from magnifier,
|
|
10
11
|
// and transforms it into Tx models to update the exodus state.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { FEE_PAYMENT_PREFIX } from '@exodus/ethereum-lib'
|
|
1
2
|
import lodash from 'lodash'
|
|
3
|
+
|
|
2
4
|
import getValueOfTransfers from './get-value-of-transfers'
|
|
3
|
-
import { FEE_PAYMENT_PREFIX } from '@exodus/ethereum-lib'
|
|
4
5
|
|
|
5
6
|
// For ETH transactions, we store an array of token names inside
|
|
6
7
|
// the TX model. This array is used to display text in the UI for
|
package/src/tx-send/tx-send.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* eslint-disable @exodus/export-default/last */
|
|
2
2
|
|
|
3
|
-
import { getNonce, transactionExists } from '../eth-like-util'
|
|
4
3
|
import { calculateBumpedGasPrice, isEthereumLikeToken, normalizeTxId } from '@exodus/ethereum-lib'
|
|
5
4
|
import assert from 'minimalistic-assert'
|
|
6
|
-
|
|
7
|
-
import { getNftArguments } from '../nft-utils'
|
|
5
|
+
|
|
8
6
|
import * as ErrorWrapper from '../error-wrapper'
|
|
7
|
+
import { getNonce, transactionExists } from '../eth-like-util'
|
|
8
|
+
import { getNftArguments } from '../nft-utils'
|
|
9
|
+
import getFeeInfo from './get-fee-info'
|
|
9
10
|
|
|
10
11
|
const txSendFactory = ({ assetClientInterface, createUnsignedTx }) => {
|
|
11
12
|
assert(assetClientInterface, 'assetClientInterface is required')
|