@exodus/ethereum-api 6.3.9 → 6.3.11
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": "6.3.
|
|
3
|
+
"version": "6.3.11",
|
|
4
4
|
"description": "Ethereum Api",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@exodus/asset-lib": "^3.7.1",
|
|
18
18
|
"@exodus/crypto": "^1.0.0-rc.0",
|
|
19
|
-
"@exodus/ethereum-lib": "^3.3.
|
|
19
|
+
"@exodus/ethereum-lib": "^3.3.30",
|
|
20
20
|
"@exodus/ethereumjs-util": "^7.1.0-exodus.6",
|
|
21
21
|
"@exodus/fetch": "^1.3.0-beta.4",
|
|
22
22
|
"@exodus/simple-retry": "^0.0.6",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@exodus/models": "^8.10.4"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "45dc3b2f0d2b7ac87c5bd490c5e568bab7a0cb6e"
|
|
38
38
|
}
|
|
@@ -150,6 +150,7 @@ export default class ClarityServer extends EventEmitter {
|
|
|
150
150
|
|
|
151
151
|
async sendBatchRequest(batch) {
|
|
152
152
|
const responses = await this.sendRpcRequest(batch)
|
|
153
|
+
// FIXME: this falls apart if responses is not an array
|
|
153
154
|
const isValid = responses.every((response) => {
|
|
154
155
|
return !isNaN(response?.id) && response?.result
|
|
155
156
|
})
|
|
@@ -6,20 +6,21 @@ const DELEGATE = '0x3a29dbae'
|
|
|
6
6
|
const UNSTAKE_PENDING = '0xed0723d4'
|
|
7
7
|
|
|
8
8
|
// unstake(uint256 amount)
|
|
9
|
-
const UNSTAKE = '
|
|
9
|
+
const UNSTAKE = '0x215f826b'
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const STAKING_MANAGER_CONTRACTS = [
|
|
12
|
+
EthereumStaking.addresses.ethereum.EVERSTAKE_ADDRESS_CONTRACT_POOL.toLowerCase(),
|
|
13
|
+
EthereumStaking.addresses.ethereumgoerli.EVERSTAKE_ADDRESS_CONTRACT_POOL.toLowerCase(),
|
|
14
|
+
]
|
|
12
15
|
|
|
13
|
-
export const
|
|
16
|
+
export const isEthereumStakingTx = ({ coinName }) =>
|
|
17
|
+
['ethereum', 'ethereumgoerli'].includes(coinName)
|
|
14
18
|
export const isEthereumDelegate = (tx) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
tx.data &&
|
|
20
|
-
tx.data.methodId === UNSTAKE
|
|
19
|
+
isEthereumStakingTx(tx) &&
|
|
20
|
+
STAKING_MANAGER_CONTRACTS.includes(tx.to) &&
|
|
21
|
+
tx.data?.methodId === DELEGATE
|
|
22
|
+
export const isEthereumUndelegate = (tx) => isEthereumStakingTx(tx) && tx.data?.methodId === UNSTAKE
|
|
21
23
|
export const isEthereumClaimUndelegate = (tx) =>
|
|
22
|
-
|
|
23
|
-
tx.from[0]
|
|
24
|
-
tx.data
|
|
25
|
-
tx.data.methodId === UNSTAKE_PENDING
|
|
24
|
+
isEthereumStakingTx(tx) &&
|
|
25
|
+
STAKING_MANAGER_CONTRACTS.includes(tx.from[0]) &&
|
|
26
|
+
tx.data?.methodId === UNSTAKE_PENDING
|
|
@@ -137,7 +137,7 @@ export class EthereumStaking {
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
async unstake({ address, amount }) {
|
|
140
|
+
async unstake({ address, amount, isAllowedInterchange = false, source = '0' }) {
|
|
141
141
|
const amountWei = amount.toBaseString()
|
|
142
142
|
const balance = await this.autocompoundBalanceOf(address)
|
|
143
143
|
|
|
@@ -145,7 +145,9 @@ export class EthereumStaking {
|
|
|
145
145
|
return {
|
|
146
146
|
to: this.poolAddress,
|
|
147
147
|
amount: this.asset.currency.ZERO,
|
|
148
|
-
data: bufferToHex(
|
|
148
|
+
data: bufferToHex(
|
|
149
|
+
this.buildTxData(this.contractPool, 'unstake', amountWei, isAllowedInterchange, source)
|
|
150
|
+
),
|
|
149
151
|
}
|
|
150
152
|
} else {
|
|
151
153
|
throw new Error(`Max Amount for unstake ${balance}`)
|
|
@@ -27,6 +27,8 @@ export default function getLogItemsFromServerTx({
|
|
|
27
27
|
const tokenTransfersByTokenName = getTransfersByTokenName(serverTx.erc20 || [], tokensByAddress)
|
|
28
28
|
const toAddress = tryFindExternalRecipient(ethereumTransfers, ourWalletAddress)
|
|
29
29
|
const ourWalletWasSender = serverTx.from === ourWalletAddress
|
|
30
|
+
const METHOD_ID_LENGTH = 10
|
|
31
|
+
const methodId = serverTx.data && { methodId: serverTx.data.substring(0, METHOD_ID_LENGTH) }
|
|
30
32
|
|
|
31
33
|
const logItemCommonProperties = {
|
|
32
34
|
confirmations,
|
|
@@ -61,6 +63,7 @@ export default function getLogItemsFromServerTx({
|
|
|
61
63
|
data: serverTx.data || '0x',
|
|
62
64
|
nonce,
|
|
63
65
|
gasLimit,
|
|
66
|
+
...methodId,
|
|
64
67
|
},
|
|
65
68
|
...(ourWalletWasSender
|
|
66
69
|
? { from: [], to: toAddress, feeAmount, feeCoinName: asset.feeAsset.name }
|
|
@@ -106,9 +109,6 @@ export default function getLogItemsFromServerTx({
|
|
|
106
109
|
receivingTransferPresent,
|
|
107
110
|
})
|
|
108
111
|
|
|
109
|
-
const METHOD_ID_LENGTH = 10
|
|
110
|
-
const methodId = serverTx.data && { methodId: serverTx.data.substring(0, METHOD_ID_LENGTH) }
|
|
111
|
-
|
|
112
112
|
logItemsForServerTxEntries.push([
|
|
113
113
|
tokenName,
|
|
114
114
|
{
|