@stellar-expert/ui-framework 1.10.3 → 1.10.5
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.
|
@@ -2,7 +2,7 @@ import {useEffect, useState} from 'react'
|
|
|
2
2
|
import isEqual from 'react-fast-compare'
|
|
3
3
|
import {stringifyQuery} from '@stellar-expert/navigation'
|
|
4
4
|
import {addVisibilityChangeListener, isDocumentVisible} from '../state/page-visibility-helpers'
|
|
5
|
-
import {
|
|
5
|
+
import {useStellarNetwork} from '../state/stellar-network-hooks'
|
|
6
6
|
import {fetchExplorerApi} from './explorer-api-call'
|
|
7
7
|
import apiCache from './api-cache'
|
|
8
8
|
|
|
@@ -148,7 +148,8 @@ export function fetchData(url, ttl, processResult) {
|
|
|
148
148
|
* @return {ExplorerApiResult}
|
|
149
149
|
*/
|
|
150
150
|
export function useExplorerApi(apiEndpoint, {refreshInterval, ttl = 60, processResult, allowStaleDataTransition = false} = {}) {
|
|
151
|
-
const
|
|
151
|
+
const network = useStellarNetwork()
|
|
152
|
+
const endpointWithQuery = `${network}/${apiEndpoint}`
|
|
152
153
|
const [apiResponseData, updateApiResponseData] = useState(buildApiResult(endpointWithQuery))
|
|
153
154
|
useEffect(() => {
|
|
154
155
|
let componentUnmounted = false
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {useRef} from 'react'
|
|
2
2
|
import isEqual from 'react-fast-compare'
|
|
3
3
|
import {parseQuery, stringifyQuery, navigation} from '@stellar-expert/navigation'
|
|
4
|
-
import {getCurrentStellarNetwork} from '../state/stellar-network-hooks'
|
|
4
|
+
import {getCurrentStellarNetwork, useStellarNetwork} from '../state/stellar-network-hooks'
|
|
5
5
|
import {useDependantState} from '../state/state-hooks'
|
|
6
6
|
import {fetchExplorerApi} from './explorer-api-call'
|
|
7
7
|
import apiCache from './api-cache'
|
|
@@ -397,6 +397,7 @@ export function useExplorerPaginatedApi(apiEndpoint,
|
|
|
397
397
|
dependencies = []) {
|
|
398
398
|
if (!apiEndpoint)
|
|
399
399
|
throw new Error(`Invalid API endpoint: ${apiEndpoint}`)
|
|
400
|
+
const network = useStellarNetwork()
|
|
400
401
|
const pinRef = useRef(null)
|
|
401
402
|
if (typeof apiEndpoint === 'string') {
|
|
402
403
|
const [path, query] = apiEndpoint.split('?')
|
|
@@ -408,7 +409,7 @@ export function useExplorerPaginatedApi(apiEndpoint,
|
|
|
408
409
|
if (defaultQueryParams.order) {
|
|
409
410
|
defaultSortOrder = defaultQueryParams.order
|
|
410
411
|
}
|
|
411
|
-
const endpoint = includeNetwork ? `${
|
|
412
|
+
const endpoint = includeNetwork ? `${network}/${apiEndpoint.path}` : apiEndpoint.path
|
|
412
413
|
|
|
413
414
|
const [apiResponseData, updateApiResponseData] = useDependantState(() => {
|
|
414
415
|
const res = new PaginatedListViewModel(endpoint, {
|
package/errors/error-boundary.js
CHANGED
|
@@ -57,7 +57,7 @@ ${navigator.userAgent}`
|
|
|
57
57
|
<BlockSelect as="div">
|
|
58
58
|
<div className="micro-space">{text}</div>
|
|
59
59
|
<div className="text-tiny">
|
|
60
|
-
<pre>{stack}</pre>
|
|
60
|
+
<pre style={{whiteSpace: 'pre-wrap'}}>{stack}</pre>
|
|
61
61
|
<div>{navigator.userAgent}</div>
|
|
62
62
|
</div>
|
|
63
63
|
</BlockSelect>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stellar-expert/ui-framework",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.5",
|
|
4
4
|
"description": "StellarExpert shared UI components library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"@stellar-expert/client-cache": "github:stellar-expert/client-cache",
|
|
22
22
|
"@stellar-expert/formatter": "^2.3.0",
|
|
23
23
|
"@stellar-expert/navigation": "github:stellar-expert/navigation#v1.0.2",
|
|
24
|
-
"@stellar-expert/tx-meta-effects-parser": "^5.0
|
|
24
|
+
"@stellar-expert/tx-meta-effects-parser": "^5.2.0",
|
|
25
25
|
"classnames": ">=2",
|
|
26
26
|
"prop-types": ">=15",
|
|
27
27
|
"qrcode.react": "^3.1.0",
|
|
@@ -117,8 +117,10 @@ function PathPaymentDescriptionView({op, compact}) {
|
|
|
117
117
|
if (sendMax !== undefined) {
|
|
118
118
|
if (isSwap && sendAssetId === destAssetId && effects.length) { //circular trades yield accountCredited/Debited effect
|
|
119
119
|
const changeEffect = effects.find(e => e.source === source && e.asset === sendAssetId && (e.type === 'accountCredited' || e.type === 'accountDebited'))
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
if (changeEffect) { //arbitrage successful, otherwise src = dst and no account changes happened
|
|
121
|
+
const change = BigInt(changeEffect.amount)
|
|
122
|
+
src = fromStroops(toStroops(destAmount) + (changeEffect.type === 'accountCredited' ? -change : change))
|
|
123
|
+
}
|
|
122
124
|
} else {
|
|
123
125
|
const debitedEffect = effects.find(e => e.source === source && e.type === 'accountDebited' && e.asset === sendAssetId)
|
|
124
126
|
if (debitedEffect) {
|
|
@@ -129,8 +131,10 @@ function PathPaymentDescriptionView({op, compact}) {
|
|
|
129
131
|
if (destMin !== undefined) {
|
|
130
132
|
if (isSwap && sendAssetId === destAssetId && effects.length) { //circular trades yield accountCredited/Debited effect
|
|
131
133
|
const changeEffect = effects.find(e => e.source === source && e.asset === destAssetId && (e.type === 'accountCredited' || e.type === 'accountDebited'))
|
|
132
|
-
|
|
133
|
-
|
|
134
|
+
if (changeEffect) { //arbitrage successful, otherwise src = dst and no account changes happened
|
|
135
|
+
const change = BigInt(changeEffect.amount)
|
|
136
|
+
dst = fromStroops(toStroops(destAmount) + (changeEffect.type === 'accountCredited' ? change : -change))
|
|
137
|
+
}
|
|
134
138
|
} else {
|
|
135
139
|
const creditedEffect = effects.find(e => e.source === destination && e.type === 'accountCredited' && e.asset === destAssetId)
|
|
136
140
|
if (creditedEffect) {
|