@exodus/ethereum-lib 2.24.4-alpha.0 → 2.26.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 +5 -3
- package/src/constants.js +5 -0
- package/src/fee-data/optimism.js +16 -0
- package/src/index.js +1 -0
- package/src/key-identifier.js +35 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.26.0",
|
|
4
4
|
"description": "Ethereum Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,11 +15,13 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@exodus/asset-lib": "^3.7.1",
|
|
18
|
-
"@exodus/assets": "
|
|
18
|
+
"@exodus/assets": "8.0.81",
|
|
19
19
|
"@exodus/basic-utils": "^0.7.0",
|
|
20
|
+
"@exodus/bip32": "^1.0.0",
|
|
20
21
|
"@exodus/ethereumjs-common": "^2.4.0-exodus.6",
|
|
21
22
|
"@exodus/ethereumjs-tx": "^3.3.0-exodus.6",
|
|
22
23
|
"@exodus/ethereumjs-util": "^7.1.0-exodus.6",
|
|
24
|
+
"@exodus/key-utils": "^1.0.0",
|
|
23
25
|
"@exodus/models": "^8.10.4",
|
|
24
26
|
"@exodus/solidity-contract": "^1.1.3",
|
|
25
27
|
"base-x": "^3.0.2",
|
|
@@ -27,5 +29,5 @@
|
|
|
27
29
|
"ms": "^2.1.1",
|
|
28
30
|
"reselect": "~3.0.1"
|
|
29
31
|
},
|
|
30
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "df2b99d7026e8804622b8ac3410c7f009bd3adc8"
|
|
31
33
|
}
|
package/src/constants.js
CHANGED
|
@@ -59,6 +59,11 @@ const CHAIN_DATA = {
|
|
|
59
59
|
serverUrl: 'https://arbitrum-one-clarity-d.a.exodus.io',
|
|
60
60
|
confirmationsNumber: 3,
|
|
61
61
|
},
|
|
62
|
+
optimism: {
|
|
63
|
+
chainId: 10,
|
|
64
|
+
serverUrl: 'https://optimism-clarity-d.a.exodus.io',
|
|
65
|
+
confirmationsNumber: 3,
|
|
66
|
+
},
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
export const DEFAULT_SERVER_URLS = mapValues(CHAIN_DATA, ({ serverUrl }) => serverUrl)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FeeData } from '@exodus/asset-lib'
|
|
2
|
+
import assets from '@exodus/assets'
|
|
3
|
+
|
|
4
|
+
export default new FeeData({
|
|
5
|
+
config: {
|
|
6
|
+
gasPrice: '0.001 Gwei',
|
|
7
|
+
max: '5 Gwei',
|
|
8
|
+
min: '0.0001 Gwei',
|
|
9
|
+
fuelThreshold: '25 Gwei',
|
|
10
|
+
gasPriceEconomicalRate: 0.7,
|
|
11
|
+
gasPriceMinimumRate: 0.5,
|
|
12
|
+
eip1559Enabled: false,
|
|
13
|
+
},
|
|
14
|
+
mainKey: 'gasPrice',
|
|
15
|
+
currency: assets.optimism.currency,
|
|
16
|
+
})
|
package/src/index.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import assert from 'minimalistic-assert'
|
|
2
|
+
import { assertKeyIdentifierParameters, unhardenDerivationIndex } from '@exodus/key-utils'
|
|
3
|
+
|
|
4
|
+
function createGetKeyIdentifier({ bip44, allowMetaMaskCompat = false }) {
|
|
5
|
+
return (partialParams) => {
|
|
6
|
+
const params = {
|
|
7
|
+
purpose: 44,
|
|
8
|
+
chainIndex: 0,
|
|
9
|
+
accountIndex: 0,
|
|
10
|
+
addressIndex: 0,
|
|
11
|
+
...partialParams,
|
|
12
|
+
}
|
|
13
|
+
assertKeyIdentifierParameters(params)
|
|
14
|
+
|
|
15
|
+
const { accountIndex, compatibilityMode, addressIndex } = params
|
|
16
|
+
const unhardenedBip44 = unhardenDerivationIndex(bip44)
|
|
17
|
+
const isMetaMask = allowMetaMaskCompat && compatibilityMode === 'metamask'
|
|
18
|
+
|
|
19
|
+
if (isMetaMask) {
|
|
20
|
+
assert(addressIndex === 0, 'MetaMask compatibility does not support setting an addressIndex')
|
|
21
|
+
}
|
|
22
|
+
// MetaMasks bumps addressIndex instead of accountIndex
|
|
23
|
+
const pathMetaMask = `m/44'/${unhardenedBip44}'/0'/0/${accountIndex}`
|
|
24
|
+
const pathExodus = `m/44'/${unhardenedBip44}'/${accountIndex}'/0/${addressIndex}`
|
|
25
|
+
const derivationPath = isMetaMask ? pathMetaMask : pathExodus
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
derivationAlgorithm: 'BIP32',
|
|
29
|
+
derivationPath,
|
|
30
|
+
keyType: 'secp256k1',
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default createGetKeyIdentifier
|