@exodus/ethereum-lib 2.22.2 → 2.24.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": "2.22.2",
3
+ "version": "2.24.0",
4
4
  "description": "Ethereum Library",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -21,11 +21,11 @@
21
21
  "@exodus/ethereumjs-tx": "^3.3.0-exodus.6",
22
22
  "@exodus/ethereumjs-util": "^7.1.0-exodus.6",
23
23
  "@exodus/models": "^8.10.4",
24
- "@exodus/solidity-contract": "^0.1.3",
24
+ "@exodus/solidity-contract": "^1.1.3",
25
25
  "base-x": "^3.0.2",
26
26
  "lodash": "^4.17.15",
27
27
  "ms": "^2.1.1",
28
28
  "reselect": "~3.0.1"
29
29
  },
30
- "gitHead": "0fefa0bb464c8abb4cc510090fb7b8a5a4c68dfd"
30
+ "gitHead": "835e8e4b0197268cf458c971c38920de96e3b9f2"
31
31
  }
package/src/constants.js CHANGED
@@ -28,7 +28,7 @@ const CHAIN_DATA = {
28
28
  matic: {
29
29
  chainId: 137,
30
30
  serverUrl: 'https://polygon.a.exodus.io/wallet/v1/',
31
- confirmationsNumber: 355,
31
+ confirmationsNumber: 50,
32
32
  tokenType: 'MATIC_ERC20',
33
33
  },
34
34
  avalanchec: {
@@ -9,27 +9,27 @@ export default function createContract(address, contractName) {
9
9
  // case 'cdai':
10
10
  // return new SolidityContract(ABI.cdai, address)
11
11
  case 'augurv2':
12
- return new SolidityContract(ABI.repv2, address)
12
+ return new SolidityContract(ABI.repv2, address, true)
13
13
  case 'aragon':
14
- return new SolidityContract(ABI.ant, address)
14
+ return new SolidityContract(ABI.ant, address, true)
15
15
  case 'golem':
16
- return new SolidityContract(ABI.gnt, address)
16
+ return new SolidityContract(ABI.gnt, address, true)
17
17
  case 'loomv2Swap':
18
- return new SolidityContract(ABI.loomv2Swap, address)
18
+ return new SolidityContract(ABI.loomv2Swap, address, true)
19
19
  case 'kyberv2':
20
- return new SolidityContract(ABI.kyberv2, address)
20
+ return new SolidityContract(ABI.kyberv2, address, true)
21
21
  case 'maticValidatorShare':
22
- return new SolidityContract(ABI.maticValidatorShare, address)
22
+ return new SolidityContract(ABI.maticValidatorShare, address, true)
23
23
  case 'maticStakingManager':
24
- return new SolidityContract(ABI.maticStakingManager, address)
24
+ return new SolidityContract(ABI.maticStakingManager, address, true)
25
25
  case 'fantomSfc':
26
- return new SolidityContract(ABI.fantomSfc, address)
26
+ return new SolidityContract(ABI.fantomSfc, address, true)
27
27
  case 'ensResolver':
28
- return new SolidityContract(ABI.ensResolver, address)
28
+ return new SolidityContract(ABI.ensResolver, address, true)
29
29
  case 'ensRegistry':
30
- return new SolidityContract(ABI.ensRegistry, address)
30
+ return new SolidityContract(ABI.ensRegistry, address, true)
31
31
  case 'erc721':
32
- return new SolidityContract(ABI.erc721, address)
32
+ return new SolidityContract(ABI.erc721, address, true)
33
33
  default:
34
34
  return SolidityContract.erc20(address)
35
35
  }
@@ -160,7 +160,7 @@ export default (
160
160
  getIsEnoughBalanceToAccelerateSelector,
161
161
  getTxLogSelector,
162
162
  getIsExchangeTxSelector,
163
- assets
163
+ assetsSelector
164
164
  ) =>
165
165
  createSelector(
166
166
  getFeeDataSelector,
@@ -171,6 +171,7 @@ export default (
171
171
  getIsEnoughBalanceToAccelerateSelector,
172
172
  getTxLogSelector,
173
173
  getIsExchangeTxSelector,
174
+ assetsSelector,
174
175
  (
175
176
  getFeeData,
176
177
  getFee,
@@ -179,7 +180,8 @@ export default (
179
180
  getIsRbfEnabled,
180
181
  getIsEnoughBalanceToAccelerate,
181
182
  getTxLog,
182
- getIsExchangeTx
183
+ getIsExchangeTx,
184
+ assets
183
185
  ) => (tx) =>
184
186
  canAccelerateTx({
185
187
  tx,
@@ -44,8 +44,8 @@ export default function createUnsignedTx({
44
44
 
45
45
  const txData = {
46
46
  nonce: nonce === 0 ? Buffer.alloc(0) : intToBuffer(nonce),
47
- gasPrice: currency2buffer(gasPrice.toBase()),
48
- tipGasPrice: tipGasPrice ? currency2buffer(tipGasPrice.toBase()) : undefined,
47
+ gasPrice: currency2buffer(gasPrice),
48
+ tipGasPrice: tipGasPrice ? currency2buffer(tipGasPrice) : undefined,
49
49
  gasLimit: intToBuffer(gasLimit),
50
50
  to,
51
51
  value,
@@ -57,7 +57,7 @@ export default function createUnsignedTx({
57
57
  assetName: asset.name,
58
58
  // TODO: We should move away from putting the PK into txMeta, it is a bad practice. It is a potential PK exposure risk if the wrong PK gets included here.
59
59
  privateKey, // Used for importing private key
60
- fee: baseAsset.currency.baseUnit(gasPrice.toBase().toNumber() * gasLimit),
60
+ fee: baseAsset.currency.baseUnit(gasPrice.toBaseNumber() * gasLimit),
61
61
  eip1559Enabled: !!eip1559Enabled,
62
62
  }
63
63
 
@@ -35,17 +35,14 @@ export function buffer2currency({ asset, value }) {
35
35
  }
36
36
 
37
37
  export function currency2buffer(value) {
38
- const b10Value = value
39
- .toBase()
40
- .floor() // probably not necessary, but to be safe
41
- .toString({ unit: false })
38
+ const b10Value = value.toBaseString()
42
39
 
43
40
  // Desktop: const hexValue = value.toBase()._number.toString(16)
44
41
  const hexValue = base16.encode(base10.decode(b10Value))
45
42
 
46
43
  if (hexValue.includes('.')) {
47
44
  // <-- probably not necessary anymore
48
- throw new RangeError(`${value.toBase().toString()} can not be converted to Buffer`)
45
+ throw new RangeError(`${value.toBaseString()} can not be converted to Buffer`)
49
46
  }
50
47
 
51
48
  return Buffer.from(ethUtil.padToEven(hexValue), 'hex')