@exodus/ethereum-api 3.3.2-alpha.0 → 3.3.4-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 +5 -3
- package/src/exodus-eth-server/clarity.js +2 -10
- package/src/fee-monitor/ethereumarbnova.js +15 -0
- package/src/fee-monitor/ethereumarbone.js +15 -0
- package/src/fee-monitor/index.js +2 -0
- package/src/index.js +1 -0
- package/src/key-identifier.js +35 -0
- package/src/simulate-tx/fetch-tx-preview.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4-alpha.0",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,10 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@exodus/asset-lib": "^3.7.1",
|
|
18
|
+
"@exodus/bip32": "^1.0.0",
|
|
18
19
|
"@exodus/crypto": "^1.0.0-rc.0",
|
|
19
|
-
"@exodus/ethereum-lib": "^2.24.0",
|
|
20
|
+
"@exodus/ethereum-lib": "^2.24.3-alpha.0",
|
|
20
21
|
"@exodus/ethereumjs-util": "^7.1.0-exodus.6",
|
|
21
22
|
"@exodus/fetch": "^1.2.1",
|
|
23
|
+
"@exodus/key-utils": "^1.0.0",
|
|
22
24
|
"@exodus/simple-retry": "^0.0.6",
|
|
23
25
|
"@exodus/solidity-contract": "^1.1.3",
|
|
24
26
|
"bn.js": "^5.2.1",
|
|
@@ -36,5 +38,5 @@
|
|
|
36
38
|
"devDependencies": {
|
|
37
39
|
"@exodus/models": "^8.10.4"
|
|
38
40
|
},
|
|
39
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "1309eea2af6fa13a3e9e36e6aa615f863ab73012"
|
|
40
42
|
}
|
|
@@ -2,22 +2,14 @@ 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
|
-
|
|
6
|
-
const assetNameMap = {
|
|
7
|
-
bsc: 'bsc',
|
|
8
|
-
ethereum: 'ethereum',
|
|
9
|
-
ethereumarbone: 'arbitrum-one',
|
|
10
|
-
ethereumarbnova: 'arbitrum-nova',
|
|
11
|
-
fantommainnet: 'fantom',
|
|
12
|
-
matic: 'polygon',
|
|
13
|
-
}
|
|
5
|
+
import { ASSET_NAMESPACES } from '@exodus/ethereum-lib'
|
|
14
6
|
|
|
15
7
|
export default class ClarityServer extends EventEmitter {
|
|
16
8
|
constructor({ baseAssetName, uri }) {
|
|
17
9
|
super()
|
|
18
10
|
this.baseAssetName = baseAssetName
|
|
19
11
|
this.uri = uri
|
|
20
|
-
this.baseNamespace = `/v1/${
|
|
12
|
+
this.baseNamespace = `/v1/${ASSET_NAMESPACES[this.baseAssetName]}`
|
|
21
13
|
this.sockets = {}
|
|
22
14
|
this.id = 0
|
|
23
15
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EthereumLikeFeeMonitor } from '@exodus/ethereum-lib'
|
|
2
|
+
import { getServerByName } from '../exodus-eth-server'
|
|
3
|
+
|
|
4
|
+
const assetName = 'ethereumarbnova'
|
|
5
|
+
|
|
6
|
+
export class EthereumArbnovaFeeMonitor extends EthereumLikeFeeMonitor {
|
|
7
|
+
constructor({ updateFee, interval }) {
|
|
8
|
+
super({
|
|
9
|
+
updateFee,
|
|
10
|
+
assetName,
|
|
11
|
+
getGasPrice: async () => (await getServerByName(assetName).getFee())?.gasPrice,
|
|
12
|
+
interval,
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { EthereumLikeFeeMonitor } from '@exodus/ethereum-lib'
|
|
2
|
+
import { getServerByName } from '../exodus-eth-server'
|
|
3
|
+
|
|
4
|
+
const assetName = 'ethereumarbone'
|
|
5
|
+
|
|
6
|
+
export class EthereumArboneFeeMonitor extends EthereumLikeFeeMonitor {
|
|
7
|
+
constructor({ updateFee, interval }) {
|
|
8
|
+
super({
|
|
9
|
+
updateFee,
|
|
10
|
+
assetName,
|
|
11
|
+
getGasPrice: async () => (await getServerByName(assetName).getFee())?.gasPrice,
|
|
12
|
+
interval,
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/fee-monitor/index.js
CHANGED
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
|