@exodus/ethereum-lib 3.3.39 → 3.3.40

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": "3.3.39",
3
+ "version": "3.3.40",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -20,7 +20,6 @@
20
20
  "@exodus/avalanchec-meta": "^1.0.4",
21
21
  "@exodus/basemainnet-meta": "^1.0.3",
22
22
  "@exodus/basic-utils": "^0.7.0",
23
- "@exodus/bip32": "^1.1.2",
24
23
  "@exodus/bsc-meta": "^1.1.0",
25
24
  "@exodus/cronos-meta": "^1.0.4",
26
25
  "@exodus/ethereum-meta": "^1.1.0",
@@ -33,7 +32,7 @@
33
32
  "@exodus/ethereumjs-util": "^7.1.0-exodus.6",
34
33
  "@exodus/fantommainnet-meta": "^1.0.5",
35
34
  "@exodus/harmonymainnet-meta": "^1.0.0",
36
- "@exodus/key-utils": "^2.0.0",
35
+ "@exodus/key-utils": "^3.1.0",
37
36
  "@exodus/matic-meta": "^1.1.1",
38
37
  "@exodus/models": "^8.10.4",
39
38
  "@exodus/optimism-meta": "^1.2.6",
@@ -44,5 +43,5 @@
44
43
  "ms": "^2.1.1",
45
44
  "reselect": "~3.0.1"
46
45
  },
47
- "gitHead": "636b47ee5c92dedec19d5b6d6d37e126506bb95a"
46
+ "gitHead": "f70a8210fbdda74fdd23542faf4f8f124c3a6b4f"
48
47
  }
@@ -2,6 +2,7 @@
2
2
  // https://github.com/everstake/wallet-sdk/blob/037b081755ece3c9a5be162748cec5ea1125acdf/ethereum.js#L3-L7
3
3
 
4
4
  export default [
5
+ { inputs: [], stateMutability: 'nonpayable', type: 'constructor' },
5
6
  {
6
7
  inputs: [{ internalType: 'string', name: 'field', type: 'string' }],
7
8
  name: 'InvalidAmount',
@@ -42,6 +43,15 @@ export default [
42
43
  name: 'Initialized',
43
44
  type: 'event',
44
45
  },
46
+ {
47
+ anonymous: false,
48
+ inputs: [
49
+ { indexed: true, internalType: 'address', name: 'previousOwner', type: 'address' },
50
+ { indexed: true, internalType: 'address', name: 'newOwner', type: 'address' },
51
+ ],
52
+ name: 'OwnershipTransferStarted',
53
+ type: 'event',
54
+ },
45
55
  {
46
56
  anonymous: false,
47
57
  inputs: [
@@ -63,6 +73,21 @@ export default [
63
73
  name: 'PauseWithdraw',
64
74
  type: 'event',
65
75
  },
76
+ {
77
+ anonymous: false,
78
+ inputs: [
79
+ { indexed: false, internalType: 'bytes', name: 'oldPendingValidatorPubKey', type: 'bytes' },
80
+ { indexed: false, internalType: 'bytes', name: 'newPendingValidatorPubKey', type: 'bytes' },
81
+ ],
82
+ name: 'PendingValidatorReplaced',
83
+ type: 'event',
84
+ },
85
+ {
86
+ anonymous: false,
87
+ inputs: [{ indexed: false, internalType: 'uint256', name: '', type: 'uint256' }],
88
+ name: 'Restake',
89
+ type: 'event',
90
+ },
66
91
  {
67
92
  anonymous: false,
68
93
  inputs: [{ indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' }],
@@ -78,7 +103,7 @@ export default [
78
103
  {
79
104
  anonymous: false,
80
105
  inputs: [
81
- { indexed: false, internalType: 'address', name: 'staker', type: 'address' },
106
+ { indexed: true, internalType: 'address', name: 'staker', type: 'address' },
82
107
  { indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' },
83
108
  ],
84
109
  name: 'StakeActivated',
@@ -87,7 +112,7 @@ export default [
87
112
  {
88
113
  anonymous: false,
89
114
  inputs: [
90
- { indexed: false, internalType: 'address', name: 'staker', type: 'address' },
115
+ { indexed: true, internalType: 'address', name: 'staker', type: 'address' },
91
116
  { indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' },
92
117
  { indexed: false, internalType: 'uint64', name: 'source', type: 'uint64' },
93
118
  ],
@@ -112,13 +137,19 @@ export default [
112
137
  {
113
138
  anonymous: false,
114
139
  inputs: [
115
- { indexed: false, internalType: 'address', name: 'staker', type: 'address' },
140
+ { indexed: true, internalType: 'address', name: 'staker', type: 'address' },
116
141
  { indexed: false, internalType: 'uint256', name: 'value', type: 'uint256' },
117
142
  { indexed: false, internalType: 'uint64', name: 'source', type: 'uint64' },
118
143
  ],
119
144
  name: 'Unstake',
120
145
  type: 'event',
121
146
  },
147
+ {
148
+ anonymous: false,
149
+ inputs: [{ indexed: false, internalType: 'bytes', name: 'validator', type: 'bytes' }],
150
+ name: 'ValidatorMarkedAsExited',
151
+ type: 'event',
152
+ },
122
153
  {
123
154
  inputs: [],
124
155
  name: 'BEACON_AMOUNT',
@@ -126,6 +157,13 @@ export default [
126
157
  stateMutability: 'view',
127
158
  type: 'function',
128
159
  },
160
+ {
161
+ inputs: [],
162
+ name: 'acceptOwnership',
163
+ outputs: [],
164
+ stateMutability: 'nonpayable',
165
+ type: 'function',
166
+ },
129
167
  {
130
168
  inputs: [],
131
169
  name: 'governor',
@@ -140,6 +178,13 @@ export default [
140
178
  stateMutability: 'view',
141
179
  type: 'function',
142
180
  },
181
+ {
182
+ inputs: [],
183
+ name: 'pendingOwner',
184
+ outputs: [{ internalType: 'address', name: '', type: 'address' }],
185
+ stateMutability: 'view',
186
+ type: 'function',
187
+ },
143
188
  {
144
189
  inputs: [],
145
190
  name: 'renounceOwnership',
@@ -198,11 +243,11 @@ export default [
198
243
  {
199
244
  inputs: [
200
245
  { internalType: 'uint256', name: 'value', type: 'uint256' },
201
- { internalType: 'bool', name: 'isAllowedInterchange', type: 'bool' },
246
+ { internalType: 'uint16', name: 'allowedInterchangeNum', type: 'uint16' },
202
247
  { internalType: 'uint64', name: 'source', type: 'uint64' },
203
248
  ],
204
249
  name: 'unstake',
205
- outputs: [],
250
+ outputs: [{ internalType: 'uint256', name: 'unstakeFromPendingValue', type: 'uint256' }],
206
251
  stateMutability: 'nonpayable',
207
252
  type: 'function',
208
253
  },
@@ -295,6 +340,20 @@ export default [
295
340
  stateMutability: 'nonpayable',
296
341
  type: 'function',
297
342
  },
343
+ {
344
+ inputs: [{ internalType: 'uint256', name: 'index', type: 'uint256' }],
345
+ name: 'markValidatorAsExited',
346
+ outputs: [],
347
+ stateMutability: 'nonpayable',
348
+ type: 'function',
349
+ },
350
+ {
351
+ inputs: [],
352
+ name: 'reorderPending',
353
+ outputs: [],
354
+ stateMutability: 'nonpayable',
355
+ type: 'function',
356
+ },
298
357
  {
299
358
  inputs: [{ internalType: 'bool', name: 'pause', type: 'bool' }],
300
359
  name: 'pauseStaking',
@@ -1,36 +1,42 @@
1
1
  import assert from 'minimalistic-assert'
2
- import { assertKeyIdentifierParameters } from '@exodus/key-utils'
3
- import { unhardenDerivationIndex } from '@exodus/bip32/lib/derivation-path'
2
+ import { createGetKeyIdentifier, unhardenDerivationIndex } from '@exodus/key-utils'
4
3
 
5
- function createGetKeyIdentifier({ bip44, allowMetaMaskCompat = false }) {
6
- return (partialParams) => {
7
- const params = {
8
- purpose: 44,
9
- chainIndex: 0,
10
- accountIndex: 0,
11
- addressIndex: 0,
12
- ...partialParams,
13
- }
14
- assertKeyIdentifierParameters(params)
4
+ const createEthereumGetKeyIdentifier = ({
5
+ bip44,
6
+ assetName,
7
+ keyType = 'secp256k1',
8
+ allowMetaMaskCompat = false,
9
+ } = {}) => (partialParams = {}) => {
10
+ const params = {
11
+ purpose: 44,
12
+ chainIndex: 0,
13
+ accountIndex: 0,
14
+ addressIndex: 0,
15
+ ...partialParams,
16
+ }
15
17
 
16
- const { accountIndex, compatibilityMode, addressIndex } = params
17
- const unhardenedBip44 = unhardenDerivationIndex(bip44)
18
- const isMetaMask = allowMetaMaskCompat && compatibilityMode === 'metamask'
19
-
20
- if (isMetaMask) {
21
- assert(addressIndex === 0, 'MetaMask compatibility does not support setting an addressIndex')
22
- }
23
- // MetaMasks bumps addressIndex instead of accountIndex
24
- const pathMetaMask = `m/44'/${unhardenedBip44}'/0'/0/${accountIndex}`
25
- const pathExodus = `m/44'/${unhardenedBip44}'/${accountIndex}'/0/${addressIndex}`
26
- const derivationPath = isMetaMask ? pathMetaMask : pathExodus
18
+ const { accountIndex, compatibilityMode, addressIndex } = params
19
+ const unhardenedBip44 = unhardenDerivationIndex(bip44)
20
+ const isMetaMask = allowMetaMaskCompat && compatibilityMode === 'metamask'
27
21
 
22
+ if (isMetaMask) {
23
+ assert(addressIndex === 0, 'MetaMask compatibility does not support setting an addressIndex')
28
24
  return {
25
+ assetName,
29
26
  derivationAlgorithm: 'BIP32',
30
- derivationPath,
31
- keyType: 'secp256k1',
27
+ derivationPath: `m/44'/${unhardenedBip44}'/0'/0/${accountIndex}`,
28
+ keyType,
32
29
  }
33
30
  }
31
+
32
+ return createGetKeyIdentifier({
33
+ bip44,
34
+ assetName,
35
+ keyType,
36
+ validationRules: {
37
+ allowMultipleAddresses: true,
38
+ },
39
+ })(params)
34
40
  }
35
41
 
36
- export default createGetKeyIdentifier
42
+ export default createEthereumGetKeyIdentifier
@@ -114,38 +114,38 @@ export const isApproveTx = (tx) => tx?.data?.data?.startsWith(APPROVE_METHOD_ID)
114
114
  export const isFeePaymentTx = (tx) => tx?.data?.data?.startsWith(FEE_PAYMENT_PREFIX)
115
115
 
116
116
  const customTokensWithRpcBalance = [
117
- 'saitama_ethereum_5547ffb6',
118
- 'shiryoinu_ethereum_ff507c93',
119
- 'volt_bsc_bea66b91',
120
- 'volt_ethereum_9e0778ce',
121
- 'elephant_bsc_e879afb1',
122
- 'posi_bsc_9a2aa8c5',
123
117
  'ampl_ethereum_48428467',
124
- 'mark_ethereum_0d0c07dd',
118
+ 'babydoge_bsc_ee74eb55',
119
+ 'drb_bsc_8971f1e2',
120
+ 'elephant_bsc_e879afb1',
121
+ 'feg_bsc_48812e49',
122
+ 'feg_ethereum_ef42acf0',
125
123
  'floki_bsc_c4112b36',
126
124
  'floki_ethereum_4a3891a6',
127
- 'drb_bsc_8971f1e2',
125
+ 'mark_ethereum_0d0c07dd',
128
126
  'move_bsc_4b4012e3',
129
- 'feg_ethereum_ef42acf0',
130
- 'feg_bsc_48812e49',
131
127
  'opt2_matic_2bb66719',
132
- 'babydoge_bsc_ee74eb55',
128
+ 'posi_bsc_9a2aa8c5',
129
+ 'saitama_ethereum_5547ffb6',
130
+ 'shiryoinu_ethereum_ff507c93',
131
+ 'volt_bsc_bea66b91',
132
+ 'volt_ethereum_9e0778ce',
133
+ 'wavax_avalanchec_635505b3',
134
+ 'wbnb_bsc_7329a389',
135
+ 'wftm_fantommainnet_7edc4949',
136
+ 'wmatic_matic_424fae45',
133
137
  ]
134
138
 
135
139
  export const isRpcBalanceAsset = (asset) =>
136
140
  [
137
141
  'bsc',
142
+ 'ethereumarbone',
143
+ 'fantommainnet',
138
144
  'matic',
145
+ 'optimism',
139
146
  'ousd_ethereum_48fcf72d',
140
147
  'steth',
141
148
  'weth',
142
- 'wmatic_matic_424fae45',
143
- 'wbnb_bsc_7329a389',
144
- 'wavax_avalanchec_635505b3',
145
- 'wftm_fantommainnet_7edc4949',
146
- 'fantommainnet',
147
- 'ethereumarbone',
148
- 'optimism',
149
149
  ...customTokensWithRpcBalance,
150
150
  ].includes(asset.name) || ETHEREUM_LIKE_NO_HISTORY_ASSET_NAMES.includes(asset.baseAsset.name)
151
151