Skip to content

Commit

Permalink
update tx estimate formatting and cost for dex swap estimate (#1702)
Browse files Browse the repository at this point in the history
* update tx estimate formatting and cost for dex swap estimate

* remove unneeded formatting
  • Loading branch information
mholtzman authored Mar 5, 2024
1 parent 96bfd44 commit ac2dc93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions main/chains/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ class ChainConnection extends EventEmitter {
{
label: 'Dex Swap',
txExample: {
value: '0x13e1e16b2a10c9',
data: '0x049639fb0000000000000000000000000000000000000000000000000000000000000004000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000042000000000000000000000000000000000000420000000000000000000000000000000000000000000000000013e1e16b2a10c900000000000000000000000000000000000000000000000045575639011cb45400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000038812aa3caf000000000000000000000000b63aae6c353636d66df13b89ba4425cfe13d10ba00000000000000000000000042000000000000000000000000000000000000060000000000000000000000004200000000000000000000000000000000000042000000000000000000000000b63aae6c353636d66df13b89ba4425cfe13d10ba000000000000000000000000a7ca2c8673bcfa5a26d8ceec2887f2cc2b0db22a0000000000000000000000000000000000000000000000000013e1e16b2a10c900000000000000000000000000000000000000000000000045575639011cb455000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001f50000000000000000000000000000000000000000000000000000000001d700a007e5c0d20000000000000000000000000000000000000000000000000001b30001505126a132dab612db5cb9fc9ac426a0cc215a3423f9c942000000000000000000000000000000000000060004f41766d8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011edea400000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000b63aae6c353636d66df13b89ba4425cfe13d10ba0000000000000000000000000000000000000000000000000000000065e75a70000000000000000000000000000000000000000000000000000000000000000100000000000000000000000042000000000000000000000000000000000000060000000000000000000000007f5c764cbc14f9669b88837ca1490cca17c31607000000000000000000000000000000000000000000000000000000000000000102a000000000000000000000000000000000000000000000000045575639011cb455ee63c1e5801d751bc1a723accf1942122ca9aa82d49d08d2ae7f5c764cbc14f9669b88837ca1490cca17c316071111111254eeb25477b68fb85ed929f73a96058200000000000000000000000bd34b36000000000000000000000000000000000000000000000000',
value: '0x38d7ea4c68000',
data: '0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000065e7831900000000000000000000000000000000000000000000000000000000000000020b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000038d7ea4c680000000000000000000000000000000000000000000000000000b683f16dd057b6400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b42000000000000000000000000000000000000060001f44200000000000000000000000000000000000042000000000000000000000000000000000000000000',
gasLimit: addHexPrefix((200000).toString(16))
}
}
Expand Down
9 changes: 3 additions & 6 deletions resources/Components/Monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,8 @@ function levelDisplay(level) {
}

function toDisplayUSD(num) {
const bn = BigNumber(num)
if (num === 0) return '?'
return parseFloat(
num >= 1 ? bn.toFixed(0, BigNumber.ROUND_UP).toString() : bn.toFixed(2, BigNumber.ROUND_UP).toString()
)
if (!num || num === 0) return '?'
return BigNumber(num).toFixed(num >= 10 ? 0 : 2)
}

const GasFees = ({ gasPrice, color }) => (
Expand Down Expand Up @@ -180,7 +177,7 @@ class ChainSummaryComponent extends Component {
<span className='gasEstimateSymbol'>
{!cost || cost >= 0.01 || cost === '?' ? `$` : '<$'}
</span>
<span className='gasEstimateRangeLow'>{(cost && `${toDisplayUSD(cost)}`) || '?'}</span>
<span className='gasEstimateRangeLow'>{toDisplayUSD(cost)}</span>
</div>
<div className='gasEstimateLabel' style={{ color: this.props.color }}>
{label}
Expand Down

0 comments on commit ac2dc93

Please sign in to comment.