@stellar-expert/ui-framework 1.9.10 → 1.10.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/api/explorer-tx-api.js +28 -28
- package/contract/sc-val.scss +2 -2
- package/effect/effect-description.js +288 -288
- package/effect/op-effects.scss +7 -7
- package/interaction/accordion.js +35 -35
- package/interaction/accordion.scss +31 -31
- package/meta/page-meta-tags.js +228 -228
- package/module/dynamic-module.js +47 -47
- package/package.json +4 -4
- package/tx/op-accounting-changes.js +2 -2
- package/tx/parser/op-balance-changes.js +3 -2
package/module/dynamic-module.js
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import React, {useEffect, useState} from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import {withErrorBoundary} from '../errors/error-boundary'
|
|
4
|
-
|
|
5
|
-
const loadedModules = new Map()
|
|
6
|
-
|
|
7
|
-
export const DynamicModule = withErrorBoundary(
|
|
8
|
-
/**
|
|
9
|
-
* Dynamically loadable module
|
|
10
|
-
* @param {Function} load - Dynamic load function, e.g. ()=>import('./dynamic_module_import')
|
|
11
|
-
* @param {String} module - Module unique name for aching purpose
|
|
12
|
-
* @param {*} [otherProps]
|
|
13
|
-
* @constructor
|
|
14
|
-
*/
|
|
15
|
-
function DynamicModule({load, module, ...otherProps}) {
|
|
16
|
-
const [error, setError] = useState(undefined)
|
|
17
|
-
const key = module || load
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (loadedModules.get(key))
|
|
21
|
-
return //skip if module is already loaded
|
|
22
|
-
load()
|
|
23
|
-
.then(dynamicModule => {
|
|
24
|
-
//use default export for ES modules or top-level export for CJS
|
|
25
|
-
if (dynamicModule.__esModule) {
|
|
26
|
-
dynamicModule = dynamicModule.default
|
|
27
|
-
}
|
|
28
|
-
//add to cache
|
|
29
|
-
loadedModules.set(key, dynamicModule)
|
|
30
|
-
setError(null)
|
|
31
|
-
})
|
|
32
|
-
.catch(error => {
|
|
33
|
-
error.message = 'Failed to load module. ' + error.message
|
|
34
|
-
setError(error)
|
|
35
|
-
})
|
|
36
|
-
}, [module || load])
|
|
37
|
-
if (error)
|
|
38
|
-
throw error
|
|
39
|
-
const resolvedModule = loadedModules.get(key)
|
|
40
|
-
if (!resolvedModule)
|
|
41
|
-
return <div className="loader"/>
|
|
42
|
-
return React.createElement(resolvedModule, otherProps)
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
DynamicModule.propTypes = {
|
|
46
|
-
load: PropTypes.func.isRequired,
|
|
47
|
-
module: PropTypes.string
|
|
1
|
+
import React, {useEffect, useState} from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import {withErrorBoundary} from '../errors/error-boundary'
|
|
4
|
+
|
|
5
|
+
const loadedModules = new Map()
|
|
6
|
+
|
|
7
|
+
export const DynamicModule = withErrorBoundary(
|
|
8
|
+
/**
|
|
9
|
+
* Dynamically loadable module
|
|
10
|
+
* @param {Function} load - Dynamic load function, e.g. ()=>import('./dynamic_module_import')
|
|
11
|
+
* @param {String} module - Module unique name for aching purpose
|
|
12
|
+
* @param {*} [otherProps]
|
|
13
|
+
* @constructor
|
|
14
|
+
*/
|
|
15
|
+
function DynamicModule({load, module, ...otherProps}) {
|
|
16
|
+
const [error, setError] = useState(undefined)
|
|
17
|
+
const key = module || load
|
|
18
|
+
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (loadedModules.get(key))
|
|
21
|
+
return //skip if module is already loaded
|
|
22
|
+
load()
|
|
23
|
+
.then(dynamicModule => {
|
|
24
|
+
//use default export for ES modules or top-level export for CJS
|
|
25
|
+
if (dynamicModule.__esModule) {
|
|
26
|
+
dynamicModule = dynamicModule.default
|
|
27
|
+
}
|
|
28
|
+
//add to cache
|
|
29
|
+
loadedModules.set(key, dynamicModule)
|
|
30
|
+
setError(null)
|
|
31
|
+
})
|
|
32
|
+
.catch(error => {
|
|
33
|
+
error.message = 'Failed to load module. ' + error.message
|
|
34
|
+
setError(error)
|
|
35
|
+
})
|
|
36
|
+
}, [module || load])
|
|
37
|
+
if (error)
|
|
38
|
+
throw error
|
|
39
|
+
const resolvedModule = loadedModules.get(key)
|
|
40
|
+
if (!resolvedModule)
|
|
41
|
+
return <div className="loader"/>
|
|
42
|
+
return React.createElement(resolvedModule, otherProps)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
DynamicModule.propTypes = {
|
|
46
|
+
load: PropTypes.func.isRequired,
|
|
47
|
+
module: PropTypes.string
|
|
48
48
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stellar-expert/ui-framework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "StellarExpert shared UI components library",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -14,14 +14,14 @@
|
|
|
14
14
|
"author": "orbitlens <orbit@stellar.expert>",
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@stellar/stellar-base": "^
|
|
18
|
-
"@stellar/stellar-sdk": "^11.
|
|
17
|
+
"@stellar/stellar-base": "^11.0.0",
|
|
18
|
+
"@stellar/stellar-sdk": "^11.2.2",
|
|
19
19
|
"@stellar-expert/asset-descriptor": "^1.3.0",
|
|
20
20
|
"@stellar-expert/claimable-balance-utils": "^1.4.1",
|
|
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.0.1",
|
|
25
25
|
"classnames": ">=2",
|
|
26
26
|
"prop-types": ">=15",
|
|
27
27
|
"qrcode.react": "^3.1.0",
|
|
@@ -13,7 +13,7 @@ export function OpAccountingChanges({op}) {
|
|
|
13
13
|
{changes.map((ch, i) => <div key={op.txHash + op.order + i}
|
|
14
14
|
className={ch.type === 'accountDebited' ? 'dimmed' : 'color-success'}>
|
|
15
15
|
{ch.type === 'accountDebited' ? '-' : '+'}
|
|
16
|
-
<Amount amount={ch.amount} asset={ch.asset} issuer={false} icon={false}/>
|
|
16
|
+
<Amount amount={ch.amount} asset={ch.asset} issuer={false} icon={false} adjust/>
|
|
17
17
|
</div>)}
|
|
18
18
|
</div>
|
|
19
19
|
}
|
|
@@ -21,7 +21,7 @@ export function OpAccountingChanges({op}) {
|
|
|
21
21
|
export function TxFeeAccountingChanges({amount}) {
|
|
22
22
|
return <div className="accounting-effects condensed">
|
|
23
23
|
<div className="dimmed">
|
|
24
|
-
-<Amount amount={amount} asset="XLM" issuer={false} icon={false}/>
|
|
24
|
+
-<Amount amount={amount} asset="XLM" issuer={false} icon={false} adjust/>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
}
|
|
@@ -3,11 +3,11 @@ const manageOfferOpTypes = ['manageSellOffer', 'manageBuyOffer', 'createPassiveS
|
|
|
3
3
|
/**
|
|
4
4
|
* Calculate operation resulting balance changes
|
|
5
5
|
* @param {{}} op - Operation descriptor
|
|
6
|
-
* @return {
|
|
6
|
+
* @return {{amount: String, source: String, type: String, asset: String}[]}
|
|
7
7
|
*/
|
|
8
8
|
export function retrieveOpBalanceChanges(op) {
|
|
9
9
|
const account = op.tx?.context?.account
|
|
10
|
-
if (typeof account!=='string')
|
|
10
|
+
if (typeof account !== 'string')
|
|
11
11
|
return []
|
|
12
12
|
const {effects} = op.operation
|
|
13
13
|
const changes = effects.filter(e => e.source === account && (e.type === 'accountDebited' || e.type === 'accountCredited'))
|
|
@@ -58,6 +58,7 @@ export function retrieveOpBalanceChanges(op) {
|
|
|
58
58
|
}*/
|
|
59
59
|
return []
|
|
60
60
|
}
|
|
61
|
+
|
|
61
62
|
/*
|
|
62
63
|
|
|
63
64
|
function sumAmounts(amounts) {
|