@exodus/ethereum-api 2.1.3 → 2.1.4
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-api",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"author": "Exodus Movement, Inc.",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"access": "restricted"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@exodus/ethereum-lib": "^2.3.
|
|
13
|
+
"@exodus/ethereum-lib": "^2.3.1",
|
|
14
14
|
"@exodus/simple-retry": "^0.0.6",
|
|
15
15
|
"fetchival": "0.3.3",
|
|
16
16
|
"lodash": "^4.17.11",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"url-join": "4.0.0",
|
|
21
21
|
"ws": "6.1.0"
|
|
22
22
|
},
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "92d4717b906fd92d37c90d8ba41f3c314cd65534"
|
|
24
24
|
}
|
package/src/eth-like-util.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { get } from 'lodash'
|
|
2
|
-
import { eth, etc } from './exodus-eth-server'
|
|
2
|
+
import { eth, etc, quorum } from './exodus-eth-server'
|
|
3
3
|
|
|
4
4
|
export async function isContract(assetName, address) {
|
|
5
|
-
const server = assetName === 'ethereumclassic' ? etc : eth
|
|
5
|
+
const server = assetName === 'ethereumclassic' ? etc : assetName === 'quorum' ? quorum : eth
|
|
6
6
|
return server.isContract(address)
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export async function getNonce({ asset, address, tag = 'latest' }) {
|
|
10
|
-
if (!['ethereum', 'ethereumclassic'].includes(asset.name)) return
|
|
11
|
-
const server = asset.name === 'ethereumclassic' ? etc : eth
|
|
10
|
+
if (!['ethereum', 'ethereumclassic', 'quorum'].includes(asset.name)) return
|
|
11
|
+
const server = asset.name === 'ethereumclassic' ? etc : asset.name === 'quorum' ? quorum : eth
|
|
12
12
|
const nonce = await server.getTransactionCount(address, tag)
|
|
13
13
|
return parseInt(nonce, 16)
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export async function estimateGas({ asset, ...args }) {
|
|
17
|
-
const server = asset.name === 'ethereumclassic' ? etc : eth
|
|
17
|
+
const server = asset.name === 'ethereumclassic' ? etc : asset.name === 'quorum' ? quorum : eth
|
|
18
18
|
return server.estimateGas(args)
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -28,20 +28,31 @@ const fetchEthereumClassicBalance = async (address) => {
|
|
|
28
28
|
return get(balances, 'confirmed.value', '0')
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
const fetchQuorumBalance = async (address, balanceField = 'value') => {
|
|
32
|
+
const balances = await quorum.getBalance(address)
|
|
33
|
+
return get(balances, ['confirmed', balanceField], '0')
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
// Only Ethereum and Ethereumclassic, not ERC20
|
|
32
37
|
export async function getBalance({ asset, address }) {
|
|
33
38
|
const _getBalance =
|
|
34
|
-
asset.name === 'ethereumclassic'
|
|
39
|
+
asset.name === 'ethereumclassic'
|
|
40
|
+
? fetchEthereumClassicBalance
|
|
41
|
+
: asset.name === 'quorum'
|
|
42
|
+
? fetchQuorumBalance
|
|
43
|
+
: fetchEthereumBalance
|
|
35
44
|
return _getBalance(address)
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
// Only Ethereum ERC20, not Ethereumclassic
|
|
39
48
|
export async function getTokenBalance({ asset, address }) {
|
|
40
|
-
return
|
|
49
|
+
return asset.name === 'quorum'
|
|
50
|
+
? fetchQuorumBalance(address, asset.contract.address.toLowerCase())
|
|
51
|
+
: fetchEthereumBalance(address, asset.contract.address.toLowerCase())
|
|
41
52
|
}
|
|
42
53
|
|
|
43
54
|
// Returns function for supplied asset
|
|
44
55
|
export function sendRawTransaction(asset) {
|
|
45
|
-
const server = asset.name === 'ethereumclassic' ? etc : eth
|
|
56
|
+
const server = asset.name === 'ethereumclassic' ? etc : asset.name === 'quorum' ? quorum : eth
|
|
46
57
|
return server.sendRawTransaction
|
|
47
58
|
}
|
|
@@ -2,8 +2,10 @@ import { create } from './api'
|
|
|
2
2
|
|
|
3
3
|
const EXODUS_ETH_SERVER_URL = 'https://geth.a.exodus.io/wallet/v1/'
|
|
4
4
|
const EXODUS_ETC_SERVER_URL = 'https://getc.a.exodus.io/wallet/v1/'
|
|
5
|
+
const EXODUS_QUORUM_SERVER_URL = 'https://geth-quorum-d.a.exodus.io/wallet/v1'
|
|
5
6
|
|
|
6
7
|
// allow self-signed certs
|
|
7
8
|
// process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'
|
|
8
9
|
export const eth = create(EXODUS_ETH_SERVER_URL)
|
|
9
10
|
export const etc = create(EXODUS_ETC_SERVER_URL)
|
|
11
|
+
export const quorum = create(EXODUS_QUORUM_SERVER_URL)
|