@exodus/ethereum-lib 5.3.0 → 5.5.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 +15 -15
- package/src/abi/index.js +19 -19
- package/src/account-state/index.js +1 -1
- package/src/account-state/parse-legacy-balances.js +3 -1
- package/src/constants.js +2 -1
- package/src/create-contract/index.js +2 -1
- package/src/index.js +11 -11
- package/src/key-identifier.js +1 -1
- package/src/selectors/get-can-accelerate-tx-factory.js +4 -3
- package/src/selectors/index.js +2 -2
- package/src/sign-message.js +9 -8
- package/src/unsigned-tx/create-and-sign-tx.js +2 -2
- package/src/unsigned-tx/create-ethereumjs-tx.js +4 -2
- package/src/unsigned-tx/create-unsigned-tx.js +2 -2
- package/src/unsigned-tx/index.js +6 -6
- package/src/unsigned-tx/parse-unsigned-tx.js +2 -1
- package/src/unsigned-tx/sign-hardware.js +2 -1
- package/src/unsigned-tx/sign-unsigned-tx.js +1 -1
- package/src/utils/index.js +10 -7
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
|
+
## [5.5.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.4.0...@exodus/ethereum-lib@5.5.0) (2024-09-13)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* use clarity polygon monitor ([#3113](https://github.com/ExodusMovement/assets/issues/3113)) ([89ad2b2](https://github.com/ExodusMovement/assets/commit/89ad2b29d29ba3f0d1454e7c21132659a3bf833d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
## [5.4.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.3.0...@exodus/ethereum-lib@5.4.0) (2024-09-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* switch ethereum to ESM ([#3374](https://github.com/ExodusMovement/assets/issues/3374)) ([d3a86c3](https://github.com/ExodusMovement/assets/commit/d3a86c3202754a0e6ab988d454d3e006ec11d9e4))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* lint for EVM assets ([#2969](https://github.com/ExodusMovement/assets/issues/2969)) ([16ca272](https://github.com/ExodusMovement/assets/commit/16ca272524ab1530800ca84f1df045293c08a3aa))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
6
29
|
## [5.3.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-lib@5.2.1...@exodus/ethereum-lib@5.3.0) (2024-06-23)
|
|
7
30
|
|
|
8
31
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "Ethereum Library",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "src/index.js",
|
|
6
7
|
"files": [
|
|
7
8
|
"src",
|
|
@@ -15,20 +16,19 @@
|
|
|
15
16
|
"access": "restricted"
|
|
16
17
|
},
|
|
17
18
|
"scripts": {
|
|
18
|
-
"test": "run -T jest",
|
|
19
|
-
"lint": "run -T
|
|
19
|
+
"test": "run -T exodus-test --jest",
|
|
20
|
+
"lint": "run -T eslintc .",
|
|
20
21
|
"lint:fix": "yarn lint --fix"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
|
-
"@exodus/
|
|
24
|
-
"@exodus/
|
|
25
|
-
"@exodus/
|
|
26
|
-
"@exodus/ethereum-meta": "^1.5.1",
|
|
24
|
+
"@exodus/basic-utils": "^3.0.1",
|
|
25
|
+
"@exodus/currency": "^5.0.2",
|
|
26
|
+
"@exodus/ethereum-meta": "^2.0.0",
|
|
27
27
|
"@exodus/ethereumjs-common": "^2.4.0-exodus.6",
|
|
28
28
|
"@exodus/ethereumjs-tx": "^3.3.0-exodus.7",
|
|
29
29
|
"@exodus/ethereumjs-util": "^7.1.0-exodus.7",
|
|
30
30
|
"@exodus/key-utils": "^3.1.0",
|
|
31
|
-
"@exodus/models": "^
|
|
31
|
+
"@exodus/models": "^12.0.1",
|
|
32
32
|
"@exodus/solidity-contract": "^1.1.3",
|
|
33
33
|
"@metamask/eth-sig-util": "^4.0.1",
|
|
34
34
|
"base-x": "^3.0.2",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"reselect": "^3.0.1"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@exodus/assets": "^
|
|
43
|
-
"@exodus/bitcoin-meta": "^
|
|
44
|
-
"@exodus/bsc-meta": "^
|
|
42
|
+
"@exodus/assets": "^11.0.0",
|
|
43
|
+
"@exodus/bitcoin-meta": "^2.0.0",
|
|
44
|
+
"@exodus/bsc-meta": "^2.0.0",
|
|
45
45
|
"@exodus/elliptic": "^6.5.4-precomputed",
|
|
46
|
-
"@exodus/ethereumclassic-meta": "^
|
|
47
|
-
"@exodus/fantommainnet-meta": "^
|
|
48
|
-
"@exodus/matic-meta": "^
|
|
46
|
+
"@exodus/ethereumclassic-meta": "^2.0.0",
|
|
47
|
+
"@exodus/fantommainnet-meta": "^2.0.0",
|
|
48
|
+
"@exodus/matic-meta": "^2.0.0"
|
|
49
49
|
},
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Aethereum-lib"
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"type": "git",
|
|
55
55
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "476cff14cc4c30ee72c85b3d265055771b48c1d1"
|
|
58
58
|
}
|
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
|
|
1
|
+
import ant from './ant.js'
|
|
2
|
+
import cdai from './cdai.js'
|
|
3
|
+
import dai from './dai.js'
|
|
4
|
+
import ensRegistry from './ens-registry.js'
|
|
5
|
+
import ensResolver from './ens-resolver.js'
|
|
6
|
+
import erc721 from './erc721.js'
|
|
7
|
+
import ethStakingAccounting from './eth-staking-accounting.js'
|
|
8
|
+
import ethStakingPool from './eth-staking-pool.js'
|
|
9
|
+
import fantomSfc from './fantom-sfc.js'
|
|
10
|
+
import gnt from './gnt.js'
|
|
11
|
+
import erc20BytesParams from './ierc20-bytes-params.js'
|
|
12
|
+
import erc20 from './ierc20-extended.js'
|
|
10
13
|
import kyberv2 from './kyberv2.js'
|
|
11
|
-
import loomv2Swap from './loomv2-swap'
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import maticValidatorShare from './matic-validator-share'
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import ensRegistry from './ens-registry'
|
|
19
|
-
import ensResolver from './ens-resolver'
|
|
20
|
-
import optimismGasOracle from './optimism-gas-oracle'
|
|
14
|
+
import loomv2Swap from './loomv2-swap.js'
|
|
15
|
+
import matic from './matic.js'
|
|
16
|
+
import maticStakingManager from './matic-staking-manager.js'
|
|
17
|
+
import maticValidatorShare from './matic-validator-share.js'
|
|
18
|
+
import optimismGasOracle from './optimism-gas-oracle.js'
|
|
19
|
+
import repv2 from './repv2.js'
|
|
20
|
+
import scdMcdMigration from './scd-mcd-migration.js'
|
|
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.js'
|
|
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 = {} }) {
|
package/src/constants.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from './encode'
|
|
2
|
-
export * from './unsigned-tx'
|
|
3
|
-
export * from './utils'
|
|
4
|
-
export * from './constants'
|
|
5
|
-
export * from './selectors'
|
|
6
|
-
export { signMessage, signMessageWithSigner } from './sign-message'
|
|
7
|
-
export { default as createGetKeyIdentifier } from './key-identifier'
|
|
8
|
-
export { default as createEthereumLikeAccountState } from './account-state'
|
|
1
|
+
export * from './encode.js'
|
|
2
|
+
export * from './unsigned-tx/index.js'
|
|
3
|
+
export * from './utils/index.js'
|
|
4
|
+
export * from './constants.js'
|
|
5
|
+
export * from './selectors/index.js'
|
|
6
|
+
export { signMessage, signMessageWithSigner } from './sign-message.js'
|
|
7
|
+
export { default as createGetKeyIdentifier } from './key-identifier.js'
|
|
8
|
+
export { default as createEthereumLikeAccountState } from './account-state/index.js'
|
|
9
9
|
|
|
10
|
-
export { default as createContract } from './create-contract'
|
|
11
|
-
export { default as ABI } from './abi'
|
|
12
|
-
export { ethStakeAccountState } from './account-state/staking-data'
|
|
10
|
+
export { default as createContract } from './create-contract/index.js'
|
|
11
|
+
export { default as ABI } from './abi/index.js'
|
|
12
|
+
export { ethStakeAccountState } from './account-state/staking-data.js'
|
package/src/key-identifier.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import assert from 'minimalistic-assert'
|
|
2
1
|
import { createGetKeyIdentifier, unhardenDerivationIndex } from '@exodus/key-utils'
|
|
2
|
+
import assert from 'minimalistic-assert'
|
|
3
3
|
|
|
4
4
|
const createEthereumGetKeyIdentifier =
|
|
5
5
|
({ bip44, assetName, keyType = 'secp256k1', allowMetaMaskCompat = false } = {}) =>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { createSelector } from 'reselect'
|
|
2
1
|
import ms from 'ms'
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { createSelector } from 'reselect'
|
|
3
|
+
|
|
4
|
+
import { BUMP_RATE } from '../constants.js'
|
|
5
|
+
import { isEthereumLike } from '../utils/index.js'
|
|
5
6
|
|
|
6
7
|
const MINUTE = ms('1m')
|
|
7
8
|
const BumpType = {
|
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.js'
|
|
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.js'
|
package/src/sign-message.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { hashPersonalMessage, toBuffer } from '@exodus/ethereumjs-util'
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
typedSignatureHash,
|
|
5
|
-
TypedDataUtils,
|
|
3
|
+
concatSig,
|
|
6
4
|
personalSign,
|
|
7
5
|
signTypedData,
|
|
8
|
-
|
|
6
|
+
SignTypedDataVersion,
|
|
7
|
+
TypedDataUtils,
|
|
8
|
+
typedSignatureHash,
|
|
9
9
|
} from '@metamask/eth-sig-util'
|
|
10
|
-
import
|
|
11
|
-
|
|
10
|
+
import assert from 'minimalistic-assert'
|
|
11
|
+
|
|
12
|
+
import { normalizeRecoveryParam } from './utils/ecdsa.js'
|
|
12
13
|
|
|
13
14
|
function hex0xStringToBuffer(hex) {
|
|
14
15
|
// Remove the 0x
|
|
@@ -68,7 +69,7 @@ export const signMessage = async ({ privateKey, message }) => {
|
|
|
68
69
|
* @param {object} params
|
|
69
70
|
* @param {{rawMessage: Buffer, EIP712Message: any}} params.message
|
|
70
71
|
* @param {Signer} signer
|
|
71
|
-
* @
|
|
72
|
+
* @returns {Promise<string>}
|
|
72
73
|
*/
|
|
73
74
|
export async function signMessageWithSigner({ message, signer }) {
|
|
74
75
|
const { rawMessage, EIP712Message } = 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.js'
|
|
2
|
+
import signUnsignedTx from './sign-unsigned-tx.js'
|
|
3
3
|
|
|
4
4
|
export default function createAndSignTxFactory({ chainId }) {
|
|
5
5
|
return (input, privateKey) => {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import CommonCJS, { Hardfork } from '@exodus/ethereumjs-common'
|
|
2
|
+
import { FeeMarketEIP1559Transaction, Transaction } from '@exodus/ethereumjs-tx'
|
|
3
|
+
|
|
4
|
+
const Common = CommonCJS.default || CommonCJS
|
|
3
5
|
|
|
4
6
|
export default function createEthereumJsTx(unsignedTx) {
|
|
5
7
|
const {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { toBuffer } from '@exodus/ethereumjs-util'
|
|
2
2
|
import { intToBuffer } from 'ethjs-util'
|
|
3
|
-
|
|
4
|
-
import { isToken, currency2buffer } from '../utils'
|
|
5
3
|
import assert from 'minimalistic-assert'
|
|
6
4
|
|
|
5
|
+
import { currency2buffer, isToken } from '../utils/index.js'
|
|
6
|
+
|
|
7
7
|
export default function createUnsignedTxFactory({ chainId }) {
|
|
8
8
|
assert(typeof chainId === 'number', 'chainId is required')
|
|
9
9
|
return ({
|
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.js'
|
|
2
|
+
export { default as parseUnsignedTx } from './parse-unsigned-tx.js'
|
|
3
|
+
export { default as signUnsignedTx, signUnsignedTxWithSigner } from './sign-unsigned-tx.js'
|
|
4
|
+
export { default as createAndSignTxFactory } from './create-and-sign-tx.js'
|
|
5
|
+
export { default as createEthereumJsTx } from './create-ethereumjs-tx.js'
|
|
6
|
+
export { signHardwareFactory } from './sign-hardware.js'
|
package/src/utils/index.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import baseX from 'base-x'
|
|
2
|
-
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
3
|
-
// eslint-disable-next-line import/no-deprecated
|
|
4
|
-
import { ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES } from '../constants'
|
|
5
1
|
import { FeeMarketEIP1559Transaction, Transaction } from '@exodus/ethereumjs-tx'
|
|
6
|
-
import
|
|
2
|
+
import * as ethUtil from '@exodus/ethereumjs-util'
|
|
3
|
+
import baseX from 'base-x'
|
|
4
|
+
import lodash from 'lodash'
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @exodus/import/no-deprecated
|
|
7
|
+
import { ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES } from '../constants.js'
|
|
8
|
+
|
|
9
|
+
const { uniq } = lodash
|
|
7
10
|
|
|
8
|
-
export { default as calculateExtraEth } from './calculate-extra-eth'
|
|
11
|
+
export { default as calculateExtraEth } from './calculate-extra-eth.js'
|
|
9
12
|
|
|
10
13
|
const base10 = baseX('0123456789')
|
|
11
14
|
const base16 = baseX('0123456789abcdef')
|
|
@@ -160,7 +163,7 @@ export const isRpcBalanceAsset = (asset) =>
|
|
|
160
163
|
'steth',
|
|
161
164
|
'weth',
|
|
162
165
|
...customTokensWithRpcBalance,
|
|
163
|
-
// eslint-disable-next-line import/no-deprecated
|
|
166
|
+
// eslint-disable-next-line @exodus/import/no-deprecated
|
|
164
167
|
].includes(asset.name) || ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES.includes(asset.baseAsset.name)
|
|
165
168
|
|
|
166
169
|
export const getAssetAddresses = (asset) => {
|