@exodus/ethereum-api 8.7.0 → 8.7.1

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/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.7.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.7.0...@exodus/ethereum-api@8.7.1) (2024-06-25)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * get fee async txInput ([#2665](https://github.com/ExodusMovement/assets/issues/2665)) ([20f9358](https://github.com/ExodusMovement/assets/commit/20f93587ade7291aff6a44872cbaead93b80d1f3))
12
+
13
+
14
+
6
15
  ## [8.7.0](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.6.0...@exodus/ethereum-api@8.7.0) (2024-06-21)
7
16
 
8
17
 
@@ -45,6 +54,15 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
45
54
 
46
55
 
47
56
 
57
+ ## 8.4.1-exodus.0
58
+
59
+
60
+ ### Bug Fixes
61
+
62
+ * send fromAddress when approving tokens ([#2600](https://github.com/ExodusMovement/assets/pull/2600) )
63
+
64
+
65
+
48
66
  ## [8.4.1](https://github.com/ExodusMovement/assets/compare/@exodus/ethereum-api@8.4.0...@exodus/ethereum-api@8.4.1) (2024-06-13)
49
67
 
50
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/ethereum-api",
3
- "version": "8.7.0",
3
+ "version": "8.7.1",
4
4
  "description": "Ethereum Api",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -66,5 +66,5 @@
66
66
  "type": "git",
67
67
  "url": "git+https://github.com/ExodusMovement/assets.git"
68
68
  },
69
- "gitHead": "685abde3787a364cdd00a675e95fe4dfa9053d96"
69
+ "gitHead": "0ff8ab06fea52301cc926c2b78ab812992cc5692"
70
70
  }
@@ -38,6 +38,14 @@ export async function estimateGasLimit(
38
38
  .toNumber()
39
39
  }
40
40
 
41
+ export function resolveDefaultTxInput({ asset, toAddress, amount }) {
42
+ return isEthereumLikeToken(asset)
43
+ ? ethUtil.bufferToHex(
44
+ asset.contract.transfer.build(toAddress.toLowerCase(), amount.toBaseString())
45
+ )
46
+ : '0x'
47
+ }
48
+
41
49
  export async function fetchGasLimit({
42
50
  asset,
43
51
  fromAddress,
@@ -53,22 +61,14 @@ export async function fetchGasLimit({
53
61
 
54
62
  if (!amount) amount = asset.currency.ZERO
55
63
 
56
- const isToken = isEthereumLikeToken(asset)
57
-
58
- const txInput =
59
- providedTxInput ||
60
- (isToken
61
- ? ethUtil.bufferToHex(
62
- asset.contract.transfer.build(toAddress.toLowerCase(), amount.toBaseString())
63
- )
64
- : '0x')
64
+ const txInput = providedTxInput || resolveDefaultTxInput({ asset, toAddress, amount })
65
65
 
66
66
  const defaultGasLimit = () =>
67
67
  asset.gasLimit + GAS_PER_NON_ZERO_BYTE * ethUtil.toBuffer(txInput).length
68
68
 
69
69
  const isContract = await isContractAddressCached({ asset, address: toAddress })
70
70
 
71
- if (isToken) {
71
+ if (isEthereumLikeToken(asset)) {
72
72
  amount = asset.baseAsset.currency.ZERO
73
73
  toAddress = asset.contract.address
74
74
  } else if (
@@ -1,5 +1,5 @@
1
1
  import assert from 'minimalistic-assert'
2
- import { fetchGasLimit } from './gas-estimation'
2
+ import { fetchGasLimit, resolveDefaultTxInput } from './gas-estimation'
3
3
  import { isForwarderContractCached } from './eth-like-util'
4
4
  import { getFeeFactory } from './get-fee'
5
5
  import { getNftArguments } from './nft-utils'
@@ -52,13 +52,14 @@ const getFeeAsyncFactory = ({
52
52
  return getNftArguments({ asset, nft, fromAddress, toAddress })
53
53
  }
54
54
 
55
+ if (!amount) amount = asset.currency.ZERO
55
56
  const extraPercentage = await resolveExtraPercentage({ asset, toAddress })
56
- const txInput = txInputPram ?? '0x'
57
+ const txInput = txInputPram || resolveDefaultTxInput({ asset, toAddress, amount })
57
58
  const gasLimit = await fetchGasLimit({
58
59
  asset,
59
60
  fromAddress,
60
61
  toAddress,
61
- txInput, // default value is '0x'
62
+ txInput,
62
63
  amount,
63
64
  bip70,
64
65
  extraPercentage,
@@ -104,7 +105,6 @@ const getFeeAsyncFactory = ({
104
105
  fee: fee.add(l1DataFee),
105
106
  optimismL1DataFee,
106
107
  gasLimit,
107
- txInput,
108
108
  ...rest,
109
109
  }
110
110
  }