@exodus/ethereum-lib 4.8.0 → 4.9.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/ethereum-lib",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.9.0",
|
|
4
4
|
"description": "Ethereum Library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
"@exodus/bnbmainnet-meta": "^1.0.0",
|
|
61
61
|
"@exodus/elliptic": "^6.5.4-precomputed"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "9322a03c6b00b6dc765356309b3e8f1e1f27df41"
|
|
64
64
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { AccountState } from '@exodus/models'
|
|
2
2
|
|
|
3
3
|
import { parseLegacyBalances } from './parse-legacy-balances'
|
|
4
|
-
import getAssetStakingData from './staking-data'
|
|
5
4
|
|
|
6
5
|
// `assets` are only needed for chains that may need legacy parsing and staking support
|
|
7
|
-
export default function createEthereumLikeAccountState({ asset, assets = {} }) {
|
|
6
|
+
export default function createEthereumLikeAccountState({ asset, extraData = {}, assets = {} }) {
|
|
8
7
|
return class EthereumLikeAccountState extends AccountState {
|
|
9
8
|
static defaults = {
|
|
10
9
|
startblock: 0, // deprecated. It seems not used anymore. Remove when it's safe
|
|
@@ -12,7 +11,7 @@ export default function createEthereumLikeAccountState({ asset, assets = {} }) {
|
|
|
12
11
|
balance: asset.currency.ZERO,
|
|
13
12
|
tokenBalances: {},
|
|
14
13
|
index: 0,
|
|
15
|
-
...
|
|
14
|
+
...extraData,
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
// legacy -- this should have no effect on Ethereum-like assets that do not have legacy account state
|
|
@@ -1,56 +1,13 @@
|
|
|
1
|
-
const ethStakeAccountState = ({ currency }) =>
|
|
2
|
-
|
|
3
|
-
isUndelegateInProgress: false,
|
|
4
|
-
canClaimUndelegatedBalance: false,
|
|
5
|
-
minDelegateAmount: currency.defaultUnit(0.1),
|
|
6
|
-
delegatedBalance: currency.ZERO,
|
|
7
|
-
rewardsBalance: currency.ZERO,
|
|
8
|
-
unclaimedUndelegatedBalance: currency.ZERO,
|
|
9
|
-
totalRewardsReceived: currency.ZERO,
|
|
10
|
-
lastStakingTxProcessed: '',
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
const assetStakingData = {
|
|
14
|
-
polygon: ({ currency }) => ({
|
|
1
|
+
export const ethStakeAccountState = ({ currency }) => {
|
|
2
|
+
return {
|
|
15
3
|
isDelegating: false,
|
|
16
|
-
// Unstaking takes ~3-4 days, after that, user needs to
|
|
17
|
-
// claim the unstaked amount (initial staked amount)
|
|
18
4
|
isUndelegateInProgress: false,
|
|
19
5
|
canClaimUndelegatedBalance: false,
|
|
20
|
-
|
|
21
|
-
minDelegateAmount: currency.defaultUnit(1),
|
|
22
|
-
unclaimedUndelegatedBalance: currency.ZERO,
|
|
6
|
+
minDelegateAmount: currency.defaultUnit(0.1),
|
|
23
7
|
delegatedBalance: currency.ZERO,
|
|
24
8
|
rewardsBalance: currency.ZERO,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ethereum: ethStakeAccountState,
|
|
29
|
-
ethereumgoerli: ethStakeAccountState,
|
|
30
|
-
ethereumholesky: ethStakeAccountState,
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const getAssetStakingData = ({ assetName, assets }) => {
|
|
34
|
-
const stakingAssetsForAsset = {
|
|
35
|
-
ethereum: ['ethereum', 'polygon'],
|
|
36
|
-
ethereumgoerli: ['ethereumgoerli'],
|
|
37
|
-
ethereumholesky: ['ethereumholesky'],
|
|
9
|
+
unclaimedUndelegatedBalance: currency.ZERO,
|
|
10
|
+
totalRewardsReceived: currency.ZERO,
|
|
11
|
+
lastStakingTxProcessed: '',
|
|
38
12
|
}
|
|
39
|
-
|
|
40
|
-
const stakingAssetsNames = stakingAssetsForAsset[assetName]
|
|
41
|
-
|
|
42
|
-
if (!stakingAssetsNames) return {}
|
|
43
|
-
|
|
44
|
-
const stakingData = stakingAssetsNames.reduce((allStakingData, stakeAssetName) => {
|
|
45
|
-
const { currency } = assets[stakeAssetName]
|
|
46
|
-
const assetStakeData = assetStakingData[stakeAssetName]({
|
|
47
|
-
currency,
|
|
48
|
-
})
|
|
49
|
-
allStakingData[stakeAssetName] = assetStakeData
|
|
50
|
-
return allStakingData
|
|
51
|
-
}, {})
|
|
52
|
-
|
|
53
|
-
return { staking: stakingData }
|
|
54
13
|
}
|
|
55
|
-
|
|
56
|
-
export default getAssetStakingData
|
|
@@ -4,12 +4,14 @@ import { asset } from '@exodus/basemainnet-meta'
|
|
|
4
4
|
export default new FeeData({
|
|
5
5
|
config: {
|
|
6
6
|
gasPrice: '0.2 Gwei',
|
|
7
|
+
baseFeePerGas: '0.2 Gwei',
|
|
8
|
+
tipGasPrice: '0.02 Gwei',
|
|
7
9
|
max: '1 Gwei',
|
|
8
10
|
min: '0.001 Gwei',
|
|
9
11
|
fuelThreshold: '750000 Gwei',
|
|
10
12
|
gasPriceEconomicalRate: 0.8,
|
|
11
13
|
gasPriceMinimumRate: 0.6,
|
|
12
|
-
eip1559Enabled:
|
|
14
|
+
eip1559Enabled: true,
|
|
13
15
|
},
|
|
14
16
|
mainKey: 'gasPrice',
|
|
15
17
|
currency: asset.currency,
|
package/src/index.js
CHANGED
|
@@ -12,3 +12,4 @@ export { default as createEthereumLikeAccountState } from './account-state'
|
|
|
12
12
|
export { default as createContract } from './create-contract'
|
|
13
13
|
export * as feeData from './fee-data'
|
|
14
14
|
export { default as ABI } from './abi'
|
|
15
|
+
export { ethStakeAccountState } from './account-state/staking-data'
|
package/src/sign-message.js
CHANGED
|
@@ -13,8 +13,8 @@ export async function signUnsignedTxWithSigner(unsignedTx, signer) {
|
|
|
13
13
|
const ethSigner = async (data) => {
|
|
14
14
|
// temporarily support both function and object
|
|
15
15
|
const sig = await (typeof signer === 'function'
|
|
16
|
-
? signer({ data, ecOptions: { canonical: true }, enc: 'raw' })
|
|
17
|
-
: signer.sign({ data, ecOptions: { canonical: true }, enc: 'raw' }))
|
|
16
|
+
? signer({ data, ecOptions: { canonical: true }, enc: 'raw', signatureType: 'ecdsa' })
|
|
17
|
+
: signer.sign({ data, ecOptions: { canonical: true }, enc: 'raw', signatureType: 'ecdsa' }))
|
|
18
18
|
const signature = new Uint8Array(64)
|
|
19
19
|
signature.set(sig.r.toArrayLike(Uint8Array, 'be', 32), 0)
|
|
20
20
|
signature.set(sig.s.toArrayLike(Uint8Array, 'be', 32), 32)
|