@stellar-expert/ui-framework 1.12.4 → 1.12.6
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.
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {formatWithPrecision} from '@stellar-expert/formatter'
|
|
2
|
+
import {formatWithAutoPrecision, formatWithPrecision} from '@stellar-expert/formatter'
|
|
3
3
|
import './soroban-tx-metrics.scss'
|
|
4
4
|
|
|
5
5
|
export default function SorobanTxMetricsView({metrics}) {
|
|
6
6
|
if (!metrics)
|
|
7
7
|
return null
|
|
8
|
+
const parsedMetrics = parseMetrics(metrics)
|
|
8
9
|
return <div className="soroban-tx-metrics-info row micro-space text-tiny text-monospace condensed">
|
|
9
|
-
{Object.entries(
|
|
10
|
+
{Object.entries(parsedMetrics).map(([key, value]) => <div key={key} className="column column-25">
|
|
10
11
|
<span className="dimmed">{key}: </span><MetricValue value={value}/>
|
|
11
12
|
</div>)}
|
|
13
|
+
{!!metrics.fee && <div className="column">
|
|
14
|
+
<span className="dimmed">Fees: </span>
|
|
15
|
+
{metrics.fee.refundable} <span className="dimmed">refundable, </span>
|
|
16
|
+
{metrics.fee.nonrefundable} <span className="dimmed">nonrefundable, </span>
|
|
17
|
+
{metrics.fee.rent} <span className="dimmed">rent</span>
|
|
18
|
+
</div>}
|
|
12
19
|
</div>
|
|
13
20
|
}
|
|
14
21
|
|
|
@@ -19,6 +26,8 @@ const MetricValue = React.memo(function ({value}) {
|
|
|
19
26
|
return <>{value}</>
|
|
20
27
|
})
|
|
21
28
|
|
|
29
|
+
//TODO: add descriptions (see https://github.com/stellar/stellar-core/blob/master/docs/metrics.md)
|
|
30
|
+
|
|
22
31
|
function parseMetrics(metrics) {
|
|
23
32
|
const res = {}
|
|
24
33
|
for (const [key, value] of Object.entries(metrics)) {
|
|
@@ -32,7 +41,7 @@ function parseMetrics(metrics) {
|
|
|
32
41
|
}
|
|
33
42
|
break
|
|
34
43
|
case 'invoke_time_nsecs':
|
|
35
|
-
res['Invoke time'] =
|
|
44
|
+
res['Invoke time'] = formatWithAutoPrecision(value / 1000) + 'µs'
|
|
36
45
|
break
|
|
37
46
|
case 'mem_byte':
|
|
38
47
|
res['Memory usage'] = formatBytes(value)
|
|
@@ -105,5 +114,5 @@ function parseMetrics(metrics) {
|
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
function formatBytes(value) {
|
|
108
|
-
return formatWithPrecision(value,
|
|
117
|
+
return formatWithPrecision(value, 0) + 'B'
|
|
109
118
|
}
|
package/package.json
CHANGED
|
@@ -133,7 +133,7 @@ function PathPaymentDescriptionView({op, compact}) {
|
|
|
133
133
|
const changeEffect = effects.find(e => e.source === source && e.asset === destAssetId && (e.type === 'accountCredited' || e.type === 'accountDebited'))
|
|
134
134
|
if (changeEffect) { //arbitrage successful, otherwise src = dst and no account changes happened
|
|
135
135
|
const change = BigInt(changeEffect.amount)
|
|
136
|
-
dst = fromStroops(toStroops(
|
|
136
|
+
dst = fromStroops(toStroops(sendAmount) + (changeEffect.type === 'accountCredited' ? change : -change))
|
|
137
137
|
}
|
|
138
138
|
} else {
|
|
139
139
|
const creditedEffect = effects.find(e => e.source === destination && e.type === 'accountCredited' && e.asset === destAssetId)
|