@exodus/ethereum-lib 5.8.1 → 6.0.0-alpha.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/package.json +24 -30
- package/src/abi/index.js +19 -19
- package/src/account-state/index.js +1 -1
- package/src/account-state/parse-legacy-balances.js +2 -4
- package/src/balances/ethereum-balance.js +29 -0
- package/src/balances/index.js +3 -0
- package/src/balances/polygon-balance.js +23 -0
- package/src/constants.js +0 -148
- package/src/create-contract/erc20.js +19 -19
- package/src/create-contract/index.js +1 -2
- package/src/encode.js +8 -14
- package/src/index.js +12 -11
- package/src/key-identifier.js +1 -1
- package/src/selectors/get-can-accelerate-tx-factory.js +9 -6
- package/src/selectors/index.js +2 -2
- package/src/sign-message.js +28 -13
- package/src/unsigned-tx/create-and-sign-tx.js +2 -2
- package/src/unsigned-tx/create-ethereumjs-tx.js +2 -2
- package/src/unsigned-tx/create-unsigned-tx.js +4 -3
- package/src/unsigned-tx/index.js +6 -6
- package/src/unsigned-tx/parse-unsigned-tx.js +4 -5
- package/src/unsigned-tx/sign-hardware.js +1 -2
- package/src/unsigned-tx/sign-unsigned-tx.js +9 -7
- package/src/utils/calculate-extra-eth.js +1 -6
- package/src/utils/index.js +9 -12
- package/CHANGELOG.md +0 -249
- package/README.md +0 -3
package/package.json
CHANGED
|
@@ -1,55 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Ethereum
|
|
5
|
-
"type": "module",
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
|
+
"description": "Ethereum Library",
|
|
6
5
|
"main": "src/index.js",
|
|
7
6
|
"files": [
|
|
8
7
|
"src",
|
|
9
|
-
"CHANGELOG.md",
|
|
10
8
|
"!src/**/__tests__"
|
|
11
9
|
],
|
|
12
10
|
"author": "Exodus Movement, Inc.",
|
|
13
11
|
"license": "UNLICENSED",
|
|
14
|
-
"homepage": "https://github.com/ExodusMovement/assets/tree/
|
|
12
|
+
"homepage": "https://github.com/ExodusMovement/assets/tree/main/ethereum",
|
|
15
13
|
"publishConfig": {
|
|
16
14
|
"access": "restricted"
|
|
17
15
|
},
|
|
18
16
|
"scripts": {
|
|
19
|
-
"test": "run -T
|
|
20
|
-
"lint": "run -T
|
|
17
|
+
"test": "run -T jest",
|
|
18
|
+
"lint": "run -T eslint src",
|
|
21
19
|
"lint:fix": "yarn lint --fix"
|
|
22
20
|
},
|
|
23
21
|
"dependencies": {
|
|
24
|
-
"@exodus/
|
|
25
|
-
"@exodus/
|
|
26
|
-
"@exodus/
|
|
27
|
-
"@exodus/
|
|
28
|
-
"@exodus/
|
|
22
|
+
"@exodus/asset-lib": "^4.1.0",
|
|
23
|
+
"@exodus/basic-utils": "^0.7.0",
|
|
24
|
+
"@exodus/currency": "^2.3.2",
|
|
25
|
+
"@exodus/ethereum-meta": "^1.5.1",
|
|
26
|
+
"@exodus/ethereumjs-common": "^2.4.0-exodus.6",
|
|
27
|
+
"@exodus/ethereumjs-tx": "^3.3.0-exodus.7",
|
|
28
|
+
"@exodus/ethereumjs-util": "^7.1.0-exodus.7",
|
|
29
|
+
"@exodus/key-utils": "^3.1.0",
|
|
30
|
+
"@exodus/models": "^11.0.0",
|
|
29
31
|
"@exodus/solidity-contract": "^1.1.3",
|
|
30
32
|
"@metamask/eth-sig-util": "^4.0.1",
|
|
31
33
|
"base-x": "^3.0.2",
|
|
34
|
+
"ethjs-util": "0.1.6",
|
|
32
35
|
"lodash": "^4.17.15",
|
|
33
36
|
"minimalistic-assert": "^1.0.1",
|
|
34
37
|
"ms": "^2.1.1",
|
|
35
|
-
"reselect": "
|
|
38
|
+
"reselect": "~3.0.1"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
|
-
"@exodus/assets": "^
|
|
39
|
-
"@exodus/bitcoin-meta": "^
|
|
40
|
-
"@exodus/bsc-meta": "^2.
|
|
41
|
-
"@exodus/
|
|
42
|
-
"@exodus/
|
|
43
|
-
"@exodus/
|
|
44
|
-
"@exodus/
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aethereum-lib"
|
|
49
|
-
},
|
|
50
|
-
"repository": {
|
|
51
|
-
"type": "git",
|
|
52
|
-
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
53
|
-
},
|
|
54
|
-
"gitHead": "2a5e9f37cb3694f7fc17f8760c69cbccda13e462"
|
|
41
|
+
"@exodus/assets": "^9.1.1",
|
|
42
|
+
"@exodus/bitcoin-meta": "^1.0.2",
|
|
43
|
+
"@exodus/bsc-meta": "^1.2.2",
|
|
44
|
+
"@exodus/elliptic": "^6.5.4-precomputed",
|
|
45
|
+
"@exodus/ethereumclassic-meta": "^1.0.3",
|
|
46
|
+
"@exodus/fantommainnet-meta": "^1.1.2",
|
|
47
|
+
"@exodus/matic-meta": "^1.3.0"
|
|
48
|
+
}
|
|
55
49
|
}
|
package/src/abi/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import ant from './ant
|
|
2
|
-
import cdai from './cdai
|
|
3
|
-
import dai from './dai
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import erc721 from './erc721
|
|
7
|
-
import ethStakingAccounting from './eth-staking-accounting
|
|
8
|
-
import ethStakingPool from './eth-staking-pool
|
|
9
|
-
import
|
|
10
|
-
import gnt from './gnt.js'
|
|
11
|
-
import erc20BytesParams from './ierc20-bytes-params.js'
|
|
12
|
-
import erc20 from './ierc20-extended.js'
|
|
1
|
+
import ant from './ant'
|
|
2
|
+
import cdai from './cdai'
|
|
3
|
+
import dai from './dai'
|
|
4
|
+
import erc20 from './ierc20-extended'
|
|
5
|
+
import erc20BytesParams from './ierc20-bytes-params'
|
|
6
|
+
import erc721 from './erc721'
|
|
7
|
+
import ethStakingAccounting from './eth-staking-accounting'
|
|
8
|
+
import ethStakingPool from './eth-staking-pool'
|
|
9
|
+
import gnt from './gnt'
|
|
13
10
|
import kyberv2 from './kyberv2.js'
|
|
14
|
-
import loomv2Swap from './loomv2-swap
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import maticValidatorShare from './matic-validator-share
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
11
|
+
import loomv2Swap from './loomv2-swap'
|
|
12
|
+
import repv2 from './repv2'
|
|
13
|
+
import scdMcdMigration from './scd-mcd-migration'
|
|
14
|
+
import maticValidatorShare from './matic-validator-share'
|
|
15
|
+
import maticStakingManager from './matic-staking-manager'
|
|
16
|
+
import matic from './matic'
|
|
17
|
+
import fantomSfc from './fantom-sfc'
|
|
18
|
+
import ensRegistry from './ens-registry'
|
|
19
|
+
import ensResolver from './ens-resolver'
|
|
20
|
+
import optimismGasOracle from './optimism-gas-oracle'
|
|
21
21
|
|
|
22
22
|
const index = {
|
|
23
23
|
ant,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AccountState } from '@exodus/models'
|
|
2
2
|
|
|
3
|
-
import { parseLegacyBalances } from './parse-legacy-balances
|
|
3
|
+
import { parseLegacyBalances } from './parse-legacy-balances'
|
|
4
4
|
|
|
5
5
|
// `assets` are only needed for chains that may need legacy parsing and staking support
|
|
6
6
|
export default function createEthereumLikeAccountState({ asset, extraData = {}, assets = {} }) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { isNumberUnit } from '@exodus/currency'
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const { isNumber, isString } = lodash
|
|
2
|
+
import { isNumber, isString } from 'lodash'
|
|
5
3
|
|
|
6
4
|
function parseBalance({ asset, balance }) {
|
|
7
5
|
const currency = asset.currency
|
|
@@ -11,7 +9,7 @@ function parseBalance({ asset, balance }) {
|
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
throw new Error(
|
|
14
|
-
`Balance '${balance.toDefaultString(
|
|
12
|
+
`Balance '${balance.toDefaultString()}' is not of currency ${currency.toString()}`
|
|
15
13
|
)
|
|
16
14
|
}
|
|
17
15
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { get } from 'lodash'
|
|
2
|
+
|
|
3
|
+
// @deprecated to be removed. Use balances!
|
|
4
|
+
export const getEthereumBalances = ({ asset, liquidBalance, accountState }) => {
|
|
5
|
+
// asset = ethereum or ethereumgoerli or ethereumholesky
|
|
6
|
+
const delegatedBalance = get(
|
|
7
|
+
accountState,
|
|
8
|
+
['staking', asset.name, 'delegatedBalance'],
|
|
9
|
+
asset.currency.ZERO
|
|
10
|
+
)
|
|
11
|
+
const undelegatedBalance = get(
|
|
12
|
+
accountState,
|
|
13
|
+
['staking', asset.name, 'unclaimedUndelegatedBalance'],
|
|
14
|
+
asset.currency.ZERO
|
|
15
|
+
)
|
|
16
|
+
const rewardsReceived = get(
|
|
17
|
+
accountState,
|
|
18
|
+
['staking', asset.name, 'totalRewardsReceived'],
|
|
19
|
+
asset.currency.ZERO
|
|
20
|
+
)
|
|
21
|
+
const totalBalance = liquidBalance
|
|
22
|
+
.add(delegatedBalance)
|
|
23
|
+
.add(undelegatedBalance)
|
|
24
|
+
.add(rewardsReceived)
|
|
25
|
+
return {
|
|
26
|
+
balance: totalBalance,
|
|
27
|
+
liquidBalance: liquidBalance.add(rewardsReceived),
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { get } from 'lodash'
|
|
2
|
+
import assets from '@exodus/ethereum-meta'
|
|
3
|
+
|
|
4
|
+
const polygon = assets.find(({ name: tokenName }) => tokenName === 'polygon')
|
|
5
|
+
|
|
6
|
+
// @deprecated to be removed. Use balances!
|
|
7
|
+
export const getPolygonBalances = ({ liquidBalance, accountState }) => {
|
|
8
|
+
const delegatedBalance = get(
|
|
9
|
+
accountState,
|
|
10
|
+
'staking.polygon.delegatedBalance',
|
|
11
|
+
polygon.currency.ZERO
|
|
12
|
+
)
|
|
13
|
+
const undelegatedBalance = get(
|
|
14
|
+
accountState,
|
|
15
|
+
'staking.polygon.unclaimedUndelegatedBalance',
|
|
16
|
+
polygon.currency.ZERO
|
|
17
|
+
)
|
|
18
|
+
const totalBalance = liquidBalance.add(delegatedBalance).add(undelegatedBalance)
|
|
19
|
+
return {
|
|
20
|
+
balance: totalBalance,
|
|
21
|
+
liquidBalance,
|
|
22
|
+
}
|
|
23
|
+
}
|
package/src/constants.js
CHANGED
|
@@ -1,152 +1,4 @@
|
|
|
1
|
-
import { mapValues } from '@exodus/basic-utils'
|
|
2
|
-
|
|
3
|
-
/* @deprecated */
|
|
4
|
-
const CHAIN_DATA = {
|
|
5
|
-
ethereum: {
|
|
6
|
-
chainId: 1,
|
|
7
|
-
serverUrl: 'https://geth.a.exodus.io/wallet/v1/',
|
|
8
|
-
confirmationsNumber: 30,
|
|
9
|
-
},
|
|
10
|
-
ethereumclassic: {
|
|
11
|
-
chainId: 61,
|
|
12
|
-
serverUrl: 'https://getc.a.exodus.io/wallet/v1/',
|
|
13
|
-
confirmationsNumber: 5000,
|
|
14
|
-
},
|
|
15
|
-
ethereumgoerli: {
|
|
16
|
-
chainId: 5,
|
|
17
|
-
serverUrl: 'https://geth-goerli-testnet-d.a.exodus.io/wallet/v1/',
|
|
18
|
-
confirmationsNumber: 30,
|
|
19
|
-
},
|
|
20
|
-
ethereumholesky: {
|
|
21
|
-
chainId: 17_000,
|
|
22
|
-
serverUrl: 'https://geth-holesky-testnet-d.a.exodus.io/wallet/v1/',
|
|
23
|
-
confirmationsNumber: 30,
|
|
24
|
-
},
|
|
25
|
-
ethereumsepolia: {
|
|
26
|
-
chainId: 11_155_111,
|
|
27
|
-
serverUrl: 'https://geth-sepolia-testnet-d.a.exodus.io/wallet/v1/',
|
|
28
|
-
confirmationsNumber: 30,
|
|
29
|
-
},
|
|
30
|
-
bsc: {
|
|
31
|
-
chainId: 56,
|
|
32
|
-
serverUrl: 'https://bsc-clarity.a.exodus.io/',
|
|
33
|
-
confirmationsNumber: 15,
|
|
34
|
-
monitorType: 'clarity',
|
|
35
|
-
tokenType: 'BSC_BEP20',
|
|
36
|
-
},
|
|
37
|
-
matic: {
|
|
38
|
-
chainId: 137,
|
|
39
|
-
serverUrl: 'https://polygon-clarity.a.exodus.io/',
|
|
40
|
-
monitorType: 'clarity',
|
|
41
|
-
confirmationsNumber: 50,
|
|
42
|
-
},
|
|
43
|
-
avalanchec: {
|
|
44
|
-
chainId: 43_114,
|
|
45
|
-
serverUrl: 'https://avax-c.a.exodus.io/wallet/v1/',
|
|
46
|
-
confirmationsNumber: 30,
|
|
47
|
-
tokenType: 'AVAX_ERC20',
|
|
48
|
-
},
|
|
49
|
-
fantommainnet: {
|
|
50
|
-
chainId: 250,
|
|
51
|
-
serverUrl: 'https://fantom.a.exodus.io/wallet/v1/',
|
|
52
|
-
confirmationsNumber: 3,
|
|
53
|
-
},
|
|
54
|
-
harmonymainnet: {
|
|
55
|
-
chainId: 1_666_600_000,
|
|
56
|
-
serverUrl: 'https://harmony.a.exodus.io/wallet/v1/',
|
|
57
|
-
confirmationsNumber: 6,
|
|
58
|
-
},
|
|
59
|
-
ethereumarbnova: {
|
|
60
|
-
chainId: 42_170,
|
|
61
|
-
serverUrl: 'https://nova.arbitrum.io/rpc',
|
|
62
|
-
confirmationsNumber: 3,
|
|
63
|
-
monitorType: 'no-history',
|
|
64
|
-
},
|
|
65
|
-
ethereumarbone: {
|
|
66
|
-
chainId: 42_161,
|
|
67
|
-
serverUrl: 'https://arbitrum-one-clarity.a.exodus.io',
|
|
68
|
-
confirmationsNumber: 3,
|
|
69
|
-
monitorType: 'clarity',
|
|
70
|
-
},
|
|
71
|
-
optimism: {
|
|
72
|
-
chainId: 10,
|
|
73
|
-
serverUrl: 'https://optimism-clarity.a.exodus.io',
|
|
74
|
-
confirmationsNumber: 3,
|
|
75
|
-
monitorType: 'clarity',
|
|
76
|
-
tokenType: 'OPT_ERC20',
|
|
77
|
-
},
|
|
78
|
-
rootstock: {
|
|
79
|
-
chainId: 30,
|
|
80
|
-
serverUrl: 'https://rsk.a.exodus.io',
|
|
81
|
-
confirmationsNumber: 3,
|
|
82
|
-
monitorType: 'no-history',
|
|
83
|
-
},
|
|
84
|
-
flare: {
|
|
85
|
-
chainId: 14,
|
|
86
|
-
serverUrl: 'https://flare-nn.a.exodus.io/ext/C/rpc',
|
|
87
|
-
confirmationsNumber: 30,
|
|
88
|
-
monitorType: 'no-history',
|
|
89
|
-
},
|
|
90
|
-
aurora: {
|
|
91
|
-
chainId: 1_313_161_554,
|
|
92
|
-
serverUrl: 'https://aurora.a.exodus.io',
|
|
93
|
-
confirmationsNumber: 3,
|
|
94
|
-
monitorType: 'no-history',
|
|
95
|
-
},
|
|
96
|
-
basemainnet: {
|
|
97
|
-
chainId: 8453,
|
|
98
|
-
serverUrl: 'https://base-qn.a.exodus.io',
|
|
99
|
-
confirmationsNumber: 30,
|
|
100
|
-
monitorType: 'no-history',
|
|
101
|
-
},
|
|
102
|
-
cronos: {
|
|
103
|
-
chainId: 25,
|
|
104
|
-
serverUrl: 'https://cronos.a.exodus.io',
|
|
105
|
-
confirmationsNumber: 6,
|
|
106
|
-
monitorType: 'no-history',
|
|
107
|
-
},
|
|
108
|
-
mantle: {
|
|
109
|
-
chainId: 5000,
|
|
110
|
-
serverUrl: 'https://mantle-qn.a.exodus.io',
|
|
111
|
-
confirmationsNumber: 30,
|
|
112
|
-
monitorType: 'no-history',
|
|
113
|
-
},
|
|
114
|
-
mantlesepolia: {
|
|
115
|
-
chainId: 5003,
|
|
116
|
-
serverUrl: 'https://mantle-sepolia-qn.a.exodus.io',
|
|
117
|
-
confirmationsNumber: 30,
|
|
118
|
-
monitorType: 'no-history',
|
|
119
|
-
},
|
|
120
|
-
ethereumarbonesepolia: {
|
|
121
|
-
chainId: 421_614,
|
|
122
|
-
serverUrl: 'https://arbitrum-sepolia-qn.a.exodus.io',
|
|
123
|
-
confirmationsNumber: 3,
|
|
124
|
-
monitorType: 'no-history',
|
|
125
|
-
},
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/* @deprecated */
|
|
129
|
-
export const DEFAULT_SERVER_URLS = mapValues(CHAIN_DATA, ({ serverUrl }) => serverUrl)
|
|
130
|
-
/* @deprecated */
|
|
131
|
-
export const ETHEREUM_LIKE_MONITOR_TYPES = mapValues(
|
|
132
|
-
CHAIN_DATA,
|
|
133
|
-
({ monitorType }) => monitorType || 'magnifier'
|
|
134
|
-
)
|
|
135
|
-
/* @deprecated */
|
|
136
|
-
export const CHAIN_IDS = mapValues(CHAIN_DATA, ({ chainId }) => chainId)
|
|
137
|
-
|
|
138
1
|
export const MIN_GASPRICE = 1e9 // 1 gwei
|
|
139
2
|
export const DEFAULT_FEE_MONITOR_INTERVAL = '1m'
|
|
140
|
-
/* @deprecated */
|
|
141
|
-
export const CONFIRMATIONS_NUMBER = mapValues(
|
|
142
|
-
CHAIN_DATA,
|
|
143
|
-
({ confirmationsNumber }) => confirmationsNumber
|
|
144
|
-
)
|
|
145
|
-
/* @deprecated */
|
|
146
|
-
export const ETHEREUM_LIKE_ASSETS = Object.keys(CHAIN_DATA)
|
|
147
3
|
|
|
148
4
|
export const BUMP_RATE = 1.2
|
|
149
|
-
/* @deprecated */
|
|
150
|
-
export const ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES = Object.keys(CHAIN_DATA).filter(
|
|
151
|
-
(key) => CHAIN_DATA[key].monitorType === 'no-history'
|
|
152
|
-
)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import ethUtil from '@exodus/ethereumjs-util'
|
|
2
2
|
|
|
3
3
|
// TODO: obsolete, remove this
|
|
4
4
|
// TODO: migrate to using solidity-contract
|
|
5
5
|
export default function createContract(addresses, currency) {
|
|
6
6
|
// First 4 bytes of Keccak256('transfer(address,uint256)')
|
|
7
|
-
// const TRANSFER_METHOD_ID = bufferToHex(sha3('transfer(address,uint256)').slice(0, 4))
|
|
7
|
+
// const TRANSFER_METHOD_ID = ethUtil.bufferToHex(ethUtil.sha3('transfer(address,uint256)').slice(0, 4))
|
|
8
8
|
const TRANSFER_METHOD_ID = '0xa9059cbb'
|
|
9
9
|
|
|
10
10
|
// Keccak256('Transfer(address,address,uint256)')
|
|
11
|
-
// const TRANSFER_EVENT_ID = bufferToHex(sha3('Transfer(address,address,uint256)'))
|
|
11
|
+
// const TRANSFER_EVENT_ID = ethUtil.bufferToHex(ethUtil.sha3('Transfer(address,address,uint256)'))
|
|
12
12
|
const TRANSFER_EVENT_ID = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
|
|
13
13
|
|
|
14
14
|
const transfer = {
|
|
@@ -17,33 +17,33 @@ export default function createContract(addresses, currency) {
|
|
|
17
17
|
|
|
18
18
|
build(to, bufAmount) {
|
|
19
19
|
return Buffer.concat([
|
|
20
|
-
toBuffer(TRANSFER_METHOD_ID),
|
|
21
|
-
|
|
22
|
-
toBuffer(to),
|
|
23
|
-
|
|
20
|
+
ethUtil.toBuffer(TRANSFER_METHOD_ID),
|
|
21
|
+
ethUtil.zeros(12),
|
|
22
|
+
ethUtil.toBuffer(to),
|
|
23
|
+
ethUtil.zeros(32 - bufAmount.length),
|
|
24
24
|
bufAmount,
|
|
25
25
|
])
|
|
26
26
|
},
|
|
27
27
|
|
|
28
28
|
test(data) {
|
|
29
|
-
return bufferToHex(data.slice(0, 4)) === TRANSFER_METHOD_ID
|
|
29
|
+
return ethUtil.bufferToHex(data.slice(0, 4)) === TRANSFER_METHOD_ID
|
|
30
30
|
},
|
|
31
31
|
|
|
32
32
|
parse(data) {
|
|
33
33
|
if (!transfer.test(data)) throw new Error('It is not transfer data')
|
|
34
34
|
|
|
35
35
|
return {
|
|
36
|
-
to: bufferToHex(data.slice(16, 36)),
|
|
37
|
-
amount: currency.baseUnit(bufferToHex(data.slice(36, 68))),
|
|
36
|
+
to: ethUtil.bufferToHex(data.slice(16, 36)),
|
|
37
|
+
amount: currency.baseUnit(ethUtil.bufferToHex(data.slice(36, 68))),
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
// bufferToHex(sha3('approve(address,uint256)').slice(0, 4))
|
|
42
|
+
// ethUtil.bufferToHex(ethUtil.sha3('approve(address,uint256)').slice(0, 4))
|
|
43
43
|
const APPROVE_METHOD_ID = '0x095ea7b3'
|
|
44
44
|
|
|
45
45
|
// TODO: not verified:
|
|
46
|
-
// bufferToHex(sha3('Approval(address,address,uint256)'))
|
|
46
|
+
// ethUtil.bufferToHex(ethUtil.sha3('Approval(address,address,uint256)'))
|
|
47
47
|
const APPROVE_EVENT_ID = '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
|
|
48
48
|
|
|
49
49
|
const approve = {
|
|
@@ -52,24 +52,24 @@ export default function createContract(addresses, currency) {
|
|
|
52
52
|
|
|
53
53
|
build(address, bufAmount) {
|
|
54
54
|
return Buffer.concat([
|
|
55
|
-
toBuffer(APPROVE_METHOD_ID),
|
|
56
|
-
|
|
57
|
-
toBuffer(address),
|
|
58
|
-
|
|
55
|
+
ethUtil.toBuffer(APPROVE_METHOD_ID),
|
|
56
|
+
ethUtil.zeros(12),
|
|
57
|
+
ethUtil.toBuffer(address),
|
|
58
|
+
ethUtil.zeros(32 - bufAmount.length),
|
|
59
59
|
bufAmount,
|
|
60
60
|
])
|
|
61
61
|
},
|
|
62
62
|
|
|
63
63
|
test(data) {
|
|
64
|
-
return bufferToHex(data.slice(0, 4)) === APPROVE_METHOD_ID
|
|
64
|
+
return ethUtil.bufferToHex(data.slice(0, 4)) === APPROVE_METHOD_ID
|
|
65
65
|
},
|
|
66
66
|
|
|
67
67
|
parse(data) {
|
|
68
68
|
if (!approve.test(data)) throw new Error('It is not approve data')
|
|
69
69
|
|
|
70
70
|
return {
|
|
71
|
-
address: bufferToHex(data.slice(16, 36)),
|
|
72
|
-
amount: currency.baseUnit(bufferToHex(data.slice(36, 68))),
|
|
71
|
+
address: ethUtil.bufferToHex(data.slice(16, 36)),
|
|
72
|
+
amount: currency.baseUnit(ethUtil.bufferToHex(data.slice(36, 68))),
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
}
|
package/src/encode.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
isValidChecksumAddress,
|
|
3
|
-
isValidPrivate as _isValidPrivate,
|
|
4
|
-
privateToAddress,
|
|
5
|
-
publicToAddress,
|
|
6
|
-
toChecksumAddress,
|
|
7
|
-
} from '@exodus/ethereumjs/util'
|
|
1
|
+
import * as etherUtil from '@exodus/ethereumjs-util'
|
|
8
2
|
import assert from 'minimalistic-assert'
|
|
9
3
|
|
|
10
4
|
export const validateFactory = ({ chainId, useEip1191ChainIdChecksum }) => {
|
|
@@ -21,8 +15,8 @@ export const validateFactory = ({ chainId, useEip1191ChainIdChecksum }) => {
|
|
|
21
15
|
if (!hasChecksum(address)) return true
|
|
22
16
|
|
|
23
17
|
return (
|
|
24
|
-
(useEip1191ChainIdChecksum && isValidChecksumAddress(address, chainId)) ||
|
|
25
|
-
isValidChecksumAddress(address)
|
|
18
|
+
(useEip1191ChainIdChecksum && etherUtil.isValidChecksumAddress(address, chainId)) ||
|
|
19
|
+
etherUtil.isValidChecksumAddress(address)
|
|
26
20
|
)
|
|
27
21
|
}
|
|
28
22
|
}
|
|
@@ -41,9 +35,9 @@ export const encodePublicFactory = ({ chainId, useEip1191ChainIdChecksum }) => {
|
|
|
41
35
|
'chainId is required when useEip1191ChainIdChecksum is true'
|
|
42
36
|
)
|
|
43
37
|
return (compressedPubKey) => {
|
|
44
|
-
const hash160bits = publicToAddress(compressedPubKey, true)
|
|
38
|
+
const hash160bits = etherUtil.publicToAddress(compressedPubKey, true)
|
|
45
39
|
|
|
46
|
-
const basicAddress = toChecksumAddress(
|
|
40
|
+
const basicAddress = etherUtil.toChecksumAddress(
|
|
47
41
|
'0x' + hash160bits.toString('hex'),
|
|
48
42
|
useEip1191ChainIdChecksum ? chainId : undefined
|
|
49
43
|
)
|
|
@@ -52,7 +46,7 @@ export const encodePublicFactory = ({ chainId, useEip1191ChainIdChecksum }) => {
|
|
|
52
46
|
}
|
|
53
47
|
|
|
54
48
|
export function isValidPrivate(privateKey) {
|
|
55
|
-
return privateKey.length
|
|
49
|
+
return !(privateKey.length !== 32 || !etherUtil.isValidPrivate(privateKey))
|
|
56
50
|
}
|
|
57
51
|
|
|
58
52
|
export const encodePublicFromPrivateFactory = ({ chainId, useEip1191ChainIdChecksum }) => {
|
|
@@ -61,8 +55,8 @@ export const encodePublicFromPrivateFactory = ({ chainId, useEip1191ChainIdCheck
|
|
|
61
55
|
'chainId is required when useEip1191ChainIdChecksum is true'
|
|
62
56
|
)
|
|
63
57
|
return (privateKey) => {
|
|
64
|
-
return toChecksumAddress(
|
|
65
|
-
'0x' + privateToAddress(privateKey).toString('hex'),
|
|
58
|
+
return etherUtil.toChecksumAddress(
|
|
59
|
+
'0x' + etherUtil.privateToAddress(privateKey).toString('hex'),
|
|
66
60
|
useEip1191ChainIdChecksum ? chainId : undefined
|
|
67
61
|
)
|
|
68
62
|
}
|
package/src/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export
|
|
7
|
-
export {
|
|
8
|
-
export { default as
|
|
1
|
+
export * from './balances'
|
|
2
|
+
export * from './encode'
|
|
3
|
+
export * from './unsigned-tx'
|
|
4
|
+
export * from './utils'
|
|
5
|
+
export * from './constants'
|
|
6
|
+
export * from './selectors'
|
|
7
|
+
export { signMessage, signMessageWithSigner } from './sign-message'
|
|
8
|
+
export { default as createGetKeyIdentifier } from './key-identifier'
|
|
9
|
+
export { default as createEthereumLikeAccountState } from './account-state'
|
|
9
10
|
|
|
10
|
-
export { default as createContract } from './create-contract
|
|
11
|
-
export { default as ABI } from './abi
|
|
12
|
-
export { ethStakeAccountState } from './account-state/staking-data
|
|
11
|
+
export { default as createContract } from './create-contract'
|
|
12
|
+
export { default as ABI } from './abi'
|
|
13
|
+
export { ethStakeAccountState } from './account-state/staking-data'
|
package/src/key-identifier.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createGetKeyIdentifier, unhardenDerivationIndex } from '@exodus/key-utils'
|
|
2
1
|
import assert from 'minimalistic-assert'
|
|
2
|
+
import { createGetKeyIdentifier, unhardenDerivationIndex } from '@exodus/key-utils'
|
|
3
3
|
|
|
4
4
|
const createEthereumGetKeyIdentifier =
|
|
5
5
|
({ bip44, assetName, keyType = 'secp256k1', allowMetaMaskCompat = false } = {}) =>
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import ms from 'ms'
|
|
2
1
|
import { createSelector } from 'reselect'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import ms from 'ms'
|
|
3
|
+
import { isEthereumLike } from '../utils'
|
|
4
|
+
import { BUMP_RATE } from '../constants'
|
|
6
5
|
|
|
7
6
|
const MINUTE = ms('1m')
|
|
8
7
|
const BumpType = {
|
|
@@ -130,9 +129,13 @@ export const canAccelerateTx = ({
|
|
|
130
129
|
if (isQueuedPendingTx(tx, baseAssetName, activeWalletAccount, getTxLog))
|
|
131
130
|
return wrapResponseToObject({ errorMessage: 'there is a stuck TX with lower nonce' })
|
|
132
131
|
|
|
133
|
-
const {
|
|
132
|
+
const {
|
|
133
|
+
gasPrice: currentGasPrice,
|
|
134
|
+
gasPriceEconomicalRate,
|
|
135
|
+
eip1559Enabled,
|
|
136
|
+
} = getFeeData(assetName)
|
|
134
137
|
|
|
135
|
-
if (calculateTxGasPrice(tx).gte(currentGasPrice))
|
|
138
|
+
if (calculateTxGasPrice(tx).gte(currentGasPrice.mul(gasPriceEconomicalRate)))
|
|
136
139
|
return wrapResponseToObject({ errorMessage: 'the used gas price is still high enough' })
|
|
137
140
|
|
|
138
141
|
const { bumpedGasPrice: gasPriceToUse } = calculateBumpedGasPrice({
|
package/src/selectors/index.js
CHANGED
|
@@ -3,6 +3,6 @@ export {
|
|
|
3
3
|
calculateBumpedGasPrice,
|
|
4
4
|
getPendingNonExchangeTxs,
|
|
5
5
|
getAssetPendingNonExchangeTxs,
|
|
6
|
-
} from './get-can-accelerate-tx-factory
|
|
6
|
+
} from './get-can-accelerate-tx-factory'
|
|
7
7
|
|
|
8
|
-
export { default as getIsEnoughBalanceToAccelerateSelectorFactory } from './get-is-enough-balance-to-accelerate-factory
|
|
8
|
+
export { default as getIsEnoughBalanceToAccelerateSelectorFactory } from './get-is-enough-balance-to-accelerate-factory'
|
package/src/sign-message.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
1
|
+
import assert from 'minimalistic-assert'
|
|
2
2
|
import {
|
|
3
|
-
personalSign,
|
|
4
|
-
signTypedData,
|
|
5
3
|
SignTypedDataVersion,
|
|
6
|
-
TypedDataUtils,
|
|
7
4
|
typedSignatureHash,
|
|
5
|
+
TypedDataUtils,
|
|
6
|
+
personalSign,
|
|
7
|
+
signTypedData,
|
|
8
|
+
concatSig,
|
|
8
9
|
} from '@metamask/eth-sig-util'
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
import { normalizeRecoveryParam } from './utils/ecdsa.js'
|
|
10
|
+
import { hashPersonalMessage, toBuffer } from '@exodus/ethereumjs-util'
|
|
11
|
+
import { normalizeRecoveryParam } from './utils/ecdsa'
|
|
12
12
|
|
|
13
13
|
function hex0xStringToBuffer(hex) {
|
|
14
14
|
// Remove the 0x
|
|
@@ -55,11 +55,20 @@ export const signMessage = async ({ privateKey, message }) => {
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {import('bn.js').BN} BN
|
|
60
|
+
* @typedef {{r: BN, s: BN, recoverParam: number}} Signature
|
|
61
|
+
* @typedef {{
|
|
62
|
+
* sign: ({ data: Buffer, ecOptions?: { canonical?: boolean }, enc?: string }) => Promise<Signature | Buffer>
|
|
63
|
+
* getPublicKey: () => Promise<Buffer>
|
|
64
|
+
* }} Signer
|
|
65
|
+
*/
|
|
66
|
+
|
|
58
67
|
/**
|
|
59
68
|
* @param {object} params
|
|
60
69
|
* @param {{rawMessage: Buffer, EIP712Message: any}} params.message
|
|
61
|
-
* @param {
|
|
62
|
-
* @
|
|
70
|
+
* @param {Signer} signer
|
|
71
|
+
* @return {Promise<string>}
|
|
63
72
|
*/
|
|
64
73
|
export async function signMessageWithSigner({ message, signer }) {
|
|
65
74
|
const { rawMessage, EIP712Message } = message
|
|
@@ -69,14 +78,20 @@ export async function signMessageWithSigner({ message, signer }) {
|
|
|
69
78
|
? getEIP712MessageHash(EIP712Message)
|
|
70
79
|
: hashPersonalMessage(rawMessage)
|
|
71
80
|
|
|
72
|
-
const
|
|
81
|
+
const sig = await signer.sign({
|
|
73
82
|
data: msgHash,
|
|
74
|
-
|
|
83
|
+
ecOptions: { canonical: true },
|
|
84
|
+
enc: 'raw',
|
|
75
85
|
signatureType: 'ecdsa',
|
|
76
86
|
})
|
|
77
87
|
|
|
78
|
-
|
|
79
|
-
|
|
88
|
+
return hex0xStringToBuffer(
|
|
89
|
+
concatSig(
|
|
90
|
+
toBuffer(normalizeRecoveryParam(sig.recoveryParam, { includeBase: true })),
|
|
91
|
+
sig.r.toBuffer(),
|
|
92
|
+
sig.s.toBuffer()
|
|
93
|
+
)
|
|
94
|
+
)
|
|
80
95
|
}
|
|
81
96
|
|
|
82
97
|
function getEIP712MessageHash(message) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import createUnsignedTxFactory from './create-unsigned-tx
|
|
2
|
-
import signUnsignedTx from './sign-unsigned-tx
|
|
1
|
+
import createUnsignedTxFactory from './create-unsigned-tx'
|
|
2
|
+
import signUnsignedTx from './sign-unsigned-tx'
|
|
3
3
|
|
|
4
4
|
export default function createAndSignTxFactory({ chainId }) {
|
|
5
5
|
return (input, privateKey) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Transaction, FeeMarketEIP1559Transaction } from '@exodus/ethereumjs-tx'
|
|
2
|
+
import Common, { Hardfork } from '@exodus/ethereumjs-common'
|
|
3
3
|
|
|
4
4
|
export default function createEthereumJsTx(unsignedTx) {
|
|
5
5
|
const {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { toBuffer } from '@exodus/ethereumjs-util'
|
|
2
|
+
import { intToBuffer } from 'ethjs-util'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { isToken, currency2buffer } from '../utils'
|
|
5
|
+
import assert from 'minimalistic-assert'
|
|
5
6
|
|
|
6
7
|
export default function createUnsignedTxFactory({ chainId }) {
|
|
7
8
|
assert(typeof chainId === 'number', 'chainId is required')
|
package/src/unsigned-tx/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { default as createUnsignedTxFactory } from './create-unsigned-tx
|
|
2
|
-
export { default as parseUnsignedTx } from './parse-unsigned-tx
|
|
3
|
-
export { default as signUnsignedTx, signUnsignedTxWithSigner } from './sign-unsigned-tx
|
|
4
|
-
export { default as createAndSignTxFactory } from './create-and-sign-tx
|
|
5
|
-
export { default as createEthereumJsTx } from './create-ethereumjs-tx
|
|
6
|
-
export { signHardwareFactory } from './sign-hardware
|
|
1
|
+
export { default as createUnsignedTxFactory } from './create-unsigned-tx'
|
|
2
|
+
export { default as parseUnsignedTx } from './parse-unsigned-tx'
|
|
3
|
+
export { default as signUnsignedTx, signUnsignedTxWithSigner } from './sign-unsigned-tx'
|
|
4
|
+
export { default as createAndSignTxFactory } from './create-and-sign-tx'
|
|
5
|
+
export { default as createEthereumJsTx } from './create-ethereumjs-tx'
|
|
6
|
+
export { signHardwareFactory } from './sign-hardware'
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { buffer2currency, isToken } from '../utils/index.js'
|
|
1
|
+
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
2
|
+
import { isToken, buffer2currency } from '../utils'
|
|
4
3
|
|
|
5
4
|
export default function parseUnsignedTx(asset, unsignedTx) {
|
|
6
5
|
const { txData } = unsignedTx
|
|
7
6
|
const _isToken = isToken(asset)
|
|
8
7
|
const baseAsset = asset.baseAsset
|
|
9
8
|
const gasPrice = buffer2currency({ asset: baseAsset, value: txData.gasPrice })
|
|
10
|
-
const gasLimit = bufferToInt(txData.gasLimit)
|
|
9
|
+
const gasLimit = ethUtil.bufferToInt(txData.gasLimit)
|
|
11
10
|
|
|
12
11
|
let { to, data, value } = txData
|
|
13
12
|
let amount
|
|
@@ -16,7 +15,7 @@ export default function parseUnsignedTx(asset, unsignedTx) {
|
|
|
16
15
|
const { method, values } = asset.contract.decodeInput(data)
|
|
17
16
|
if (method === 'transfer' || method === 'approve') {
|
|
18
17
|
to = values[0]
|
|
19
|
-
amount = asset.currency.baseUnit(values[1])
|
|
18
|
+
amount = asset.currency.baseUnit(values[1]).toDefault()
|
|
20
19
|
} else {
|
|
21
20
|
to = values[0]
|
|
22
21
|
amount = asset.currency.ZERO
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import createEthereumJsTx from './create-ethereumjs-tx
|
|
1
|
+
import createEthereumJsTx from './create-ethereumjs-tx'
|
|
2
2
|
|
|
3
3
|
function prepareRawTx(signedTx) {
|
|
4
4
|
// serialize and get txId
|
|
@@ -11,12 +11,14 @@ export async function signUnsignedTxWithSigner(unsignedTx, signer) {
|
|
|
11
11
|
const tx = createEthereumJsTx(unsignedTx)
|
|
12
12
|
|
|
13
13
|
const ethSigner = async (data) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
enc: '
|
|
17
|
-
signatureType: 'ecdsa'
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
// temporarily support both function and object
|
|
15
|
+
const sig = await (typeof signer === 'function'
|
|
16
|
+
? signer({ data, ecOptions: { canonical: true }, enc: 'raw', signatureType: 'ecdsa' })
|
|
17
|
+
: signer.sign({ data, ecOptions: { canonical: true }, enc: 'raw', signatureType: 'ecdsa' }))
|
|
18
|
+
const signature = new Uint8Array(64)
|
|
19
|
+
signature.set(sig.r.toArrayLike(Uint8Array, 'be', 32), 0)
|
|
20
|
+
signature.set(sig.s.toArrayLike(Uint8Array, 'be', 32), 32)
|
|
21
|
+
return { signature, recid: sig.recoveryParam }
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
const signedTx = await tx.signWithSigner(ethSigner)
|
|
@@ -6,10 +6,5 @@ export default function ({ fee, balance, multiplier = defaultMultiplier }) {
|
|
|
6
6
|
if (typeof multiplier !== 'number' || multiplier < 1) multiplier = defaultMultiplier
|
|
7
7
|
if (balance.gt(fee)) return balance.unitType.ZERO
|
|
8
8
|
|
|
9
|
-
return fee
|
|
10
|
-
.mul(multiplier)
|
|
11
|
-
.sub(balance)
|
|
12
|
-
.toDefault() // ensure correct unit before `toFixed`
|
|
13
|
-
.toFixed(4, 'ceil')
|
|
14
|
-
.toDefaultString({ unit: true })
|
|
9
|
+
return fee.mul(multiplier).sub(balance).toDefault().toFixed(4, 'ceil').toString()
|
|
15
10
|
}
|
package/src/utils/index.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { FeeMarketEIP1559Transaction, Transaction } from '@exodus/ethereumjs/tx'
|
|
2
|
-
import { padToEven, toBuffer } from '@exodus/ethereumjs/util'
|
|
3
1
|
import baseX from 'base-x'
|
|
2
|
+
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
3
|
+
import { FeeMarketEIP1559Transaction, Transaction } from '@exodus/ethereumjs-tx'
|
|
4
|
+
import { uniq } from 'lodash'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
import { ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES } from '../constants.js'
|
|
7
|
-
|
|
8
|
-
export { default as calculateExtraEth } from './calculate-extra-eth.js'
|
|
6
|
+
export { default as calculateExtraEth } from './calculate-extra-eth'
|
|
9
7
|
|
|
10
8
|
const base10 = baseX('0123456789')
|
|
11
9
|
const base16 = baseX('0123456789abcdef')
|
|
@@ -61,7 +59,7 @@ export const isEthereumLikeByName = (assetName) => {
|
|
|
61
59
|
}
|
|
62
60
|
|
|
63
61
|
export function buffer2currency({ asset, value }) {
|
|
64
|
-
return asset.currency.baseUnit(base10.encode(value))
|
|
62
|
+
return asset.currency.baseUnit(base10.encode(value)).toDefault()
|
|
65
63
|
}
|
|
66
64
|
|
|
67
65
|
export function currency2buffer(value) {
|
|
@@ -75,7 +73,7 @@ export function currency2buffer(value) {
|
|
|
75
73
|
throw new RangeError(`${value.toBaseString()} can not be converted to Buffer`)
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
return Buffer.from(padToEven(hexValue), 'hex')
|
|
76
|
+
return Buffer.from(ethUtil.padToEven(hexValue), 'hex')
|
|
79
77
|
}
|
|
80
78
|
|
|
81
79
|
export function normalizeTxId(txId) {
|
|
@@ -92,7 +90,7 @@ const TRANSACTION_TYPE = 2
|
|
|
92
90
|
const TRANSACTION_TYPE_BUFFER = Buffer.from(TRANSACTION_TYPE.toString(16).padStart(2, '0'), 'hex')
|
|
93
91
|
|
|
94
92
|
export function deserialize(hex) {
|
|
95
|
-
const buf = toBuffer(hex)
|
|
93
|
+
const buf = ethUtil.toBuffer(hex)
|
|
96
94
|
return buf.slice(0, 1).equals(TRANSACTION_TYPE_BUFFER)
|
|
97
95
|
? FeeMarketEIP1559Transaction.fromSerializedTx(buf)
|
|
98
96
|
: Transaction.fromSerializedTx(buf)
|
|
@@ -160,8 +158,7 @@ export const isRpcBalanceAsset = (asset) =>
|
|
|
160
158
|
'steth',
|
|
161
159
|
'weth',
|
|
162
160
|
...customTokensWithRpcBalance,
|
|
163
|
-
|
|
164
|
-
].includes(asset.name) || ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES.includes(asset.baseAsset.name)
|
|
161
|
+
].includes(asset.name)
|
|
165
162
|
|
|
166
163
|
export const getAssetAddresses = (asset) => {
|
|
167
164
|
// It seems to be two schemas of assets. The original and the transformed by the client.
|
|
@@ -172,5 +169,5 @@ export const getAssetAddresses = (asset) => {
|
|
|
172
169
|
...(asset.addresses?.previous || []), // asset in wallets:
|
|
173
170
|
...(asset.contract?.previous || []), // asset in @exodus/assets-base:
|
|
174
171
|
]
|
|
175
|
-
return
|
|
172
|
+
return uniq(addresses.filter((a) => a && typeof a === 'string'))
|
|
176
173
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
-
|
|
6
|
-
## [5.8.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.8.0...@exodus/ethereum-lib@5.8.1) (2024-12-09)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
### Bug Fixes
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* fix: remove gasPriceEconomicalRate (#4659)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## [5.8.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.7.0...@exodus/ethereum-lib@5.8.0) (2024-12-09)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
### Features
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
* feat: migrate ethereum arbnova to be indexless (#4642)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
## [5.7.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.6.0...@exodus/ethereum-lib@5.7.0) (2024-10-29)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Features
|
|
30
|
-
|
|
31
|
-
* introduce exodus/ethereumjs ([#4339](https://github.com/ExodusMovement/assets/issues/4339)) ([e81d577](https://github.com/ExodusMovement/assets/commit/e81d5771c4956a22cfcf434a999310bbb5be81a3))
|
|
32
|
-
* load more imports from ethereumjs/util ([#4379](https://github.com/ExodusMovement/assets/issues/4379)) ([dead85c](https://github.com/ExodusMovement/assets/commit/dead85cfb55223c344af506d8d7ca7cf7eeb516c))
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
### Bug Fixes
|
|
36
|
-
|
|
37
|
-
* remove stray direct dependencies ([#4176](https://github.com/ExodusMovement/assets/issues/4176)) ([c4f93fa](https://github.com/ExodusMovement/assets/commit/c4f93fad5a930b40d326d7add1093b2d4f243f2a))
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
## [5.6.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.5.0...@exodus/ethereum-lib@5.6.0) (2024-10-04)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Features
|
|
45
|
-
|
|
46
|
-
* **ethereum-lib:** use 'sig,rec' keychain enc ([#4155](https://github.com/ExodusMovement/assets/issues/4155)) ([d928541](https://github.com/ExodusMovement/assets/commit/d92854184bd26380192a224564b6dca924504975))
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
## [5.5.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.4.0...@exodus/ethereum-lib@5.5.0) (2024-09-13)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
### Features
|
|
54
|
-
|
|
55
|
-
* use clarity polygon monitor ([#3113](https://github.com/ExodusMovement/assets/issues/3113)) ([89ad2b2](https://github.com/ExodusMovement/assets/commit/89ad2b29d29ba3f0d1454e7c21132659a3bf833d))
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
## [5.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.3.0...@exodus/ethereum-lib@5.4.0) (2024-09-11)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
### Features
|
|
63
|
-
|
|
64
|
-
* switch ethereum to ESM ([#3374](https://github.com/ExodusMovement/assets/issues/3374)) ([d3a86c3](https://github.com/ExodusMovement/assets/commit/d3a86c3202754a0e6ab988d454d3e006ec11d9e4))
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Bug Fixes
|
|
68
|
-
|
|
69
|
-
* lint for EVM assets ([#2969](https://github.com/ExodusMovement/assets/issues/2969)) ([16ca272](https://github.com/ExodusMovement/assets/commit/16ca272524ab1530800ca84f1df045293c08a3aa))
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
## [5.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.2.1...@exodus/ethereum-lib@5.3.0) (2024-06-23)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
### ⚠ BREAKING CHANGES
|
|
77
|
-
|
|
78
|
-
* remove assetType from ethereum-lib (#2415)
|
|
79
|
-
|
|
80
|
-
### Bug Fixes
|
|
81
|
-
|
|
82
|
-
* remove assetType from ethereum-lib ([#2415](https://github.com/ExodusMovement/assets/issues/2415)) ([98c2c01](https://github.com/ExodusMovement/assets/commit/98c2c018aa6328b21035afee848f431b349ab6ae))
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
## [5.2.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.2.0...@exodus/ethereum-lib@5.2.1) (2024-06-10)
|
|
87
|
-
|
|
88
|
-
**Note:** Version bump only for package @exodus/ethereum-lib
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
## [5.2.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.1.1...@exodus/ethereum-lib@5.2.0) (2024-05-23)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
### Features
|
|
98
|
-
|
|
99
|
-
* add arbone sepolia ([#2359](https://github.com/ExodusMovement/assets/issues/2359)) ([3056882](https://github.com/ExodusMovement/assets/commit/3056882cad08722fdad14ffdb2149208af469cdf))
|
|
100
|
-
* Mantle Sepolia support ([#2355](https://github.com/ExodusMovement/assets/issues/2355)) ([fff6710](https://github.com/ExodusMovement/assets/commit/fff6710a76cbac3f218a018090c210e03882439a))
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
## [5.1.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.1.0...@exodus/ethereum-lib@5.1.1) (2024-05-21)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
### Bug Fixes
|
|
108
|
-
|
|
109
|
-
* remove unused ethereum-lib prod deps ([#2339](https://github.com/ExodusMovement/assets/issues/2339)) ([3f02d06](https://github.com/ExodusMovement/assets/commit/3f02d06f34881bdbec8f7de9fbb2dd52d0e20547))
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
## [5.1.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.0.1...@exodus/ethereum-lib@5.1.0) (2024-05-20)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
### Features
|
|
117
|
-
|
|
118
|
-
* add Mantle EVM ([#2320](https://github.com/ExodusMovement/assets/issues/2320)) ([14ca748](https://github.com/ExodusMovement/assets/commit/14ca7486703bf4b1a16fa6af522e82a9e1309156))
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
## [5.0.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.0.0...@exodus/ethereum-lib@5.0.1) (2024-05-20)
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
### Bug Fixes
|
|
126
|
-
|
|
127
|
-
* gracefully handle different recovery param notations ([#2326](https://github.com/ExodusMovement/assets/issues/2326)) ([e7d0fbf](https://github.com/ExodusMovement/assets/commit/e7d0fbf389ace17b36e8792116df33b98fb872de))
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
## [5.0.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.9.0...@exodus/ethereum-lib@5.0.0) (2024-05-17)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
### ⚠ BREAKING CHANGES
|
|
135
|
-
|
|
136
|
-
* evm chain data to be factory params (#2115)
|
|
137
|
-
* chain id param in create and sign tx (#2282)
|
|
138
|
-
* moved fee data to each EVM plugin (#2233)
|
|
139
|
-
* evm useEip1191ChainIdChecksum param (#2110)
|
|
140
|
-
* clean up evms fee data monitors (#2230)
|
|
141
|
-
|
|
142
|
-
### Features
|
|
143
|
-
|
|
144
|
-
* demote USDC.e tokens ([#2300](https://github.com/ExodusMovement/assets/issues/2300)) ([17a51b3](https://github.com/ExodusMovement/assets/commit/17a51b3b2d42e70f55d41e8eb581e89cba19daed))
|
|
145
|
-
* evm chain data to be factory params ([#2115](https://github.com/ExodusMovement/assets/issues/2115)) ([a2aeec1](https://github.com/ExodusMovement/assets/commit/a2aeec1b4da177b1e1bb85f92e93115fc97d5377))
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
### Code Refactoring
|
|
149
|
-
|
|
150
|
-
* chain id param in create and sign tx ([#2282](https://github.com/ExodusMovement/assets/issues/2282)) ([4d915ac](https://github.com/ExodusMovement/assets/commit/4d915ac60e49ebe9d4e36d2fcecf7c17777f13b9))
|
|
151
|
-
* clean up evms fee data monitors ([#2230](https://github.com/ExodusMovement/assets/issues/2230)) ([4e7a18f](https://github.com/ExodusMovement/assets/commit/4e7a18f799e0800c01e07ca83ddaf6778ada23ce))
|
|
152
|
-
* evm useEip1191ChainIdChecksum param ([#2110](https://github.com/ExodusMovement/assets/issues/2110)) ([2169686](https://github.com/ExodusMovement/assets/commit/2169686cb4c11bb8f0691196b25002b6cf462e1e))
|
|
153
|
-
* moved fee data to each EVM plugin ([#2233](https://github.com/ExodusMovement/assets/issues/2233)) ([ec066c0](https://github.com/ExodusMovement/assets/commit/ec066c076bc36a4c7c05810e83cdd47a7a25384b))
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
## [4.9.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.8.0...@exodus/ethereum-lib@4.9.0) (2024-05-10)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
### Features
|
|
161
|
-
|
|
162
|
-
* pass `signatureType` to external signer for ethereum likes ([#2245](https://github.com/ExodusMovement/assets/issues/2245)) ([690593e](https://github.com/ExodusMovement/assets/commit/690593e3a17d8465a10d3b3b0f669742d60f7b15))
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
### Bug Fixes
|
|
166
|
-
|
|
167
|
-
* enable Base eip1559 ([#2210](https://github.com/ExodusMovement/assets/issues/2210)) ([8b7e807](https://github.com/ExodusMovement/assets/commit/8b7e807907e961aae47d3beb50cd69502e5a04e2))
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
## [4.8.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.8.0...@exodus/ethereum-lib@4.8.1) (2024-05-04)
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
### Bug Fixes
|
|
175
|
-
|
|
176
|
-
* enable Base eip1559 ([#2210](https://github.com/ExodusMovement/assets/issues/2210)) ([8b7e807](https://github.com/ExodusMovement/assets/commit/8b7e807907e961aae47d3beb50cd69502e5a04e2))
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
## [4.8.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.7.0...@exodus/ethereum-lib@4.8.0) (2024-05-02)
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
### Features
|
|
184
|
-
|
|
185
|
-
* export signMessageWithSigner from index ([#2162](https://github.com/ExodusMovement/assets/issues/2162)) ([5849688](https://github.com/ExodusMovement/assets/commit/5849688c64761dbfe00c3d47f0654dd23e1e9167))
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
## [4.7.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.6.0...@exodus/ethereum-lib@4.7.0) (2024-04-22)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
### Features
|
|
193
|
-
|
|
194
|
-
* allowXPUB in ethereum key-identifier ([#2136](https://github.com/ExodusMovement/assets/issues/2136)) ([308181c](https://github.com/ExodusMovement/assets/commit/308181cf602e433aa2ae1944663a01fc6c524b1a))
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
## [4.6.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.5.0...@exodus/ethereum-lib@4.6.0) (2024-04-17)
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
### Features
|
|
202
|
-
|
|
203
|
-
* **ethereum:** add `fromAddress` in `txMeta` ([#2106](https://github.com/ExodusMovement/assets/issues/2106)) ([451753e](https://github.com/ExodusMovement/assets/commit/451753ea85625c6ef4e17dcde8ed47186fe92a3e))
|
|
204
|
-
* expose signMessage & signHardware ([#2103](https://github.com/ExodusMovement/assets/issues/2103)) ([60ea167](https://github.com/ExodusMovement/assets/commit/60ea167283e2e4b82a69530ba156c56dead8812c))
|
|
205
|
-
* support signing messages with external signer ([#2105](https://github.com/ExodusMovement/assets/issues/2105)) ([88669f6](https://github.com/ExodusMovement/assets/commit/88669f6608b72eda2d16397ce808684ec07407e0))
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
## [4.5.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.4.0...@exodus/ethereum-lib@4.5.0) (2024-04-11)
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
### Features
|
|
213
|
-
|
|
214
|
-
* **ethereum:** add signMessage ([#1974](https://github.com/ExodusMovement/assets/issues/1974)) ([63c20f4](https://github.com/ExodusMovement/assets/commit/63c20f44b2348860687af01d81e27b5868c1a21a))
|
|
215
|
-
* new eth balances (EVM 1) ([#2013](https://github.com/ExodusMovement/assets/issues/2013)) ([5fa2375](https://github.com/ExodusMovement/assets/commit/5fa2375caccf957d2f10c76f279aa1fdc7597df1))
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
### Bug Fixes
|
|
219
|
-
|
|
220
|
-
* increase default Base gasPrice ([#2034](https://github.com/ExodusMovement/assets/issues/2034)) ([141960f](https://github.com/ExodusMovement/assets/commit/141960f2ec41d78720587e4e02f5b71bb48ddf0a))
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
## [4.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.3.0...@exodus/ethereum-lib@4.4.0) (2024-03-22)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
### Features
|
|
228
|
-
|
|
229
|
-
* **ETH:** add Sepolia testnet ([#1855](https://github.com/ExodusMovement/assets/issues/1855)) ([a2f7c07](https://github.com/ExodusMovement/assets/commit/a2f7c07a1068c8ee0c3646f4eda3b133266f518f))
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
### Bug Fixes
|
|
233
|
-
|
|
234
|
-
* ethereum Sepolia yarn ([#1872](https://github.com/ExodusMovement/assets/issues/1872)) ([96831f7](https://github.com/ExodusMovement/assets/commit/96831f747df3c5f13d08f20bce0050c99849fcfe))
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
# [4.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@4.2.7...@exodus/ethereum-lib@4.3.0) (2024-03-18)
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
### Features
|
|
242
|
-
|
|
243
|
-
* add support for external signer for ETH ([#1607](https://github.com/ExodusMovement/assets/issues/1607)) ([0323765](https://github.com/ExodusMovement/assets/commit/032376510205417cbbfe3ac0ea14ef203aa3823c))
|
|
244
|
-
* **ethereum:** ethereum tokens cleanup - part 2 ([#1573](https://github.com/ExodusMovement/assets/issues/1573)) ([85b5a10](https://github.com/ExodusMovement/assets/commit/85b5a10e958ba883dd9fbbfc521909a27ea05a12))
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
### Reverts
|
|
248
|
-
|
|
249
|
-
* Revert "Publish" ([adb8015](https://github.com/ExodusMovement/assets/commit/adb8015efd51a4fa36ad0c86c28cb2d94c52a578))
|
package/README.md
DELETED