@stellar-expert/ui-framework 1.16.8 → 1.17.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/CLAUDE.md +35 -0
- package/README.md +1125 -3
- package/account/account-address.js +127 -127
- package/account/available-balance.js +22 -22
- package/account/identicon.js +90 -90
- package/account/signer-key.js +65 -64
- package/api/explorer-api-hooks.js +209 -202
- package/api/explorer-api-paginated-list-hooks.js +441 -440
- package/api/explorer-batch-info-loader.js +111 -85
- package/api/explorer-tx-api.js +28 -28
- package/api/ledger-stream.js +15 -0
- package/asset/amount.js +56 -56
- package/asset/asset-icon.js +41 -41
- package/asset/asset-issuer.js +21 -21
- package/asset/asset-link.js +107 -107
- package/asset/asset-list-hooks.js +59 -59
- package/asset/asset-meta-hooks.js +88 -88
- package/asset/asset-selector.js +72 -71
- package/claimable-balance/claimable-balance-claimants.js +23 -18
- package/contract/contract-api.js +15 -0
- package/contract/invocation-info-view.js +10 -2
- package/contract/sc-val.js +131 -107
- package/controls/button-group.js +25 -19
- package/controls/button.js +93 -78
- package/controls/code-block.js +42 -34
- package/controls/dropdown.js +318 -287
- package/controls/external-link.js +10 -4
- package/controls/info-tooltip.js +23 -16
- package/controls/slider.js +29 -19
- package/controls/tabs.js +94 -94
- package/controls/tooltip.js +244 -240
- package/controls/update-highlighter.js +32 -27
- package/date/date-selector.js +56 -54
- package/date/elapsed-time.js +28 -21
- package/dex/price-dynamic.js +53 -44
- package/directory/directory-hooks.js +109 -97
- package/effect/effect-description.js +346 -344
- package/errors/error-boundary.js +110 -97
- package/horizon/horizon-account-helpers.js +104 -104
- package/horizon/horizon-ledger-helpers.js +35 -35
- package/horizon/horizon-trades-helper.js +88 -88
- package/horizon/horizon-transaction-helpers.js +36 -36
- package/index.d.ts +1241 -0
- package/interaction/accordion.js +43 -35
- package/interaction/autofocus.js +13 -9
- package/interaction/block-select.js +64 -53
- package/interaction/copy-to-clipboard.js +25 -18
- package/interaction/inline-progress.js +20 -15
- package/interaction/qr-code.js +34 -34
- package/interaction/responsive.js +20 -20
- package/interaction/spoiler.js +52 -39
- package/interaction/theme-selector.js +13 -10
- package/ledger/ledger-entry-href-formatter.js +27 -26
- package/ledger/ledger-entry-link.js +93 -58
- package/ledger/ledger-info-parser.js +46 -18
- package/meta/page-meta-tags.js +243 -238
- package/module/dynamic-module.js +47 -47
- package/package.json +41 -40
- package/state/on-screen-hooks.js +22 -22
- package/state/page-visibility-helpers.js +29 -16
- package/state/page-visibility-hooks.js +13 -11
- package/state/screen-orientation-hooks.js +19 -15
- package/state/state-hooks.js +76 -76
- package/state/stellar-network-hooks.js +56 -44
- package/state/theme.js +29 -28
- package/stellar/key-type.js +92 -91
- package/stellar/ledger-generic-id.js +39 -39
- package/stellar/signature-hint-utils.js +65 -65
- package/toast/toast-notifications-block.js +59 -59
- package/tx/op-description-view.js +945 -942
- package/tx/op-icon.js +98 -98
- package/tx/parser/op-balance-changes.js +66 -66
- package/tx/parser/op-descriptor.js +51 -48
- package/tx/parser/tx-details-parser.js +81 -81
- package/tx/parser/tx-matcher.js +371 -371
- package/tx/parser/type-filter-matcher.js +126 -126
- package/tx/tx-list-hooks.js +32 -18
- package/tx/tx-operations-list.js +117 -116
|
@@ -1,59 +1,94 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
|
-
import {formatExplorerLink} from './ledger-entry-href-formatter'
|
|
4
|
-
import {useStellarNetwork} from '../state/stellar-network-hooks'
|
|
5
|
-
|
|
6
|
-
function LedgerEntryLink({type, id, network, children}) {
|
|
7
|
-
const globallySetNetwork = useStellarNetwork()
|
|
8
|
-
return <a href={formatExplorerLink(type, id, network || globallySetNetwork)} target="_blank">{children || id}</a>
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import {formatExplorerLink} from './ledger-entry-href-formatter'
|
|
4
|
+
import {useStellarNetwork} from '../state/stellar-network-hooks'
|
|
5
|
+
|
|
6
|
+
function LedgerEntryLink({type, id, network, children}) {
|
|
7
|
+
const globallySetNetwork = useStellarNetwork()
|
|
8
|
+
return <a href={formatExplorerLink(type, id, network || globallySetNetwork)} target="_blank">{children || id}</a>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Link to a transaction on StellarExpert
|
|
13
|
+
* @param {Object} props
|
|
14
|
+
* @param {string} props.tx - Transaction hash
|
|
15
|
+
* @param {string} [props.network] - Stellar network override
|
|
16
|
+
* @param {*} [props.children] - Custom link content (defaults to the tx hash)
|
|
17
|
+
*/
|
|
18
|
+
export const TxLink = React.memo(function TxLink({tx, network, children}) {
|
|
19
|
+
return React.createElement(LedgerEntryLink, {type: 'tx', id: tx, network, children})
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
TxLink.propTypes = {
|
|
23
|
+
tx: PropTypes.string.isRequired,
|
|
24
|
+
network: PropTypes.string,
|
|
25
|
+
children: PropTypes.any
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Link to an operation on StellarExpert
|
|
30
|
+
* @param {Object} props
|
|
31
|
+
* @param {string} props.op - Operation ID
|
|
32
|
+
* @param {string} [props.network] - Stellar network override
|
|
33
|
+
* @param {*} [props.children] - Custom link content
|
|
34
|
+
*/
|
|
35
|
+
export const OpLink = React.memo(function OpLink({op, network, children}) {
|
|
36
|
+
return React.createElement(LedgerEntryLink, {type: 'op', id: op, network, children})
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
OpLink.propTypes = {
|
|
40
|
+
op: PropTypes.string.isRequired,
|
|
41
|
+
network: PropTypes.string,
|
|
42
|
+
children: PropTypes.any
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Link to a ledger on StellarExpert
|
|
47
|
+
* @param {Object} props
|
|
48
|
+
* @param {number} props.sequence - Ledger sequence number
|
|
49
|
+
* @param {string} [props.network] - Stellar network override
|
|
50
|
+
* @param {*} [props.children] - Custom link content
|
|
51
|
+
*/
|
|
52
|
+
export const LedgerLink = React.memo(function LedgerLink({sequence, network, children}) {
|
|
53
|
+
return React.createElement(LedgerEntryLink, {type: 'ledger', id: sequence, network, children})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
LedgerLink.propTypes = {
|
|
57
|
+
sequence: PropTypes.number.isRequired,
|
|
58
|
+
network: PropTypes.string,
|
|
59
|
+
children: PropTypes.any
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Link to a DEX offer on StellarExpert
|
|
64
|
+
* @param {Object} props
|
|
65
|
+
* @param {string} props.offer - Offer ID
|
|
66
|
+
* @param {string} [props.network] - Stellar network override
|
|
67
|
+
* @param {*} [props.children] - Custom link content
|
|
68
|
+
*/
|
|
69
|
+
export const OfferLink = React.memo(function OfferLink({offer, network, children}) {
|
|
70
|
+
return React.createElement(LedgerEntryLink, {type: 'offer', id: offer, network, children})
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
OfferLink.propTypes = {
|
|
74
|
+
offer: PropTypes.string.isRequired,
|
|
75
|
+
network: PropTypes.string,
|
|
76
|
+
children: PropTypes.any
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Link to a liquidity pool on StellarExpert
|
|
81
|
+
* @param {Object} props
|
|
82
|
+
* @param {string} props.pool - Pool ID
|
|
83
|
+
* @param {string} [props.network] - Stellar network override
|
|
84
|
+
* @param {*} [props.children] - Custom link content
|
|
85
|
+
*/
|
|
86
|
+
export const PoolLink = React.memo(function PoolLink({pool, network, children}) {
|
|
87
|
+
return React.createElement(LedgerEntryLink, {type: 'pool', id: pool, network, children})
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
PoolLink.propTypes = {
|
|
91
|
+
pool: PropTypes.string.isRequired,
|
|
92
|
+
network: PropTypes.string,
|
|
93
|
+
children: PropTypes.any
|
|
59
94
|
}
|
|
@@ -1,18 +1,46 @@
|
|
|
1
|
-
import {xdr} from '@stellar/stellar-base'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import {xdr} from '@stellar/stellar-base'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} LedgerInfo
|
|
5
|
+
* @property {number} sequence - Ledger sequence number
|
|
6
|
+
* @property {number} ts - Ledger close timestamp
|
|
7
|
+
* @property {number} protocol - Protocol version
|
|
8
|
+
* @property {number} operations - number of successful operations
|
|
9
|
+
* @property {number} failedOperations - number of failed operations
|
|
10
|
+
* @property {number} txSuccess - number of successful transactions
|
|
11
|
+
* @property {number} txFailed - number of failed transactions
|
|
12
|
+
* @property {bigint} xlm - Total lumens in circulation
|
|
13
|
+
* @property {bigint} feePool - Fee pool amount
|
|
14
|
+
* @property {number} baseFee - Base fee in stroops
|
|
15
|
+
* @property {number} baseReserve - Base reserve in stroops
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Parse raw ledger data including XDR header into structured ledger info
|
|
20
|
+
* @param {Object} data - Raw ledger data from the API
|
|
21
|
+
* @param {string} data.xdr - Base64-encoded XDR ledger header
|
|
22
|
+
* @param {number} data.sequence - Ledger sequence number
|
|
23
|
+
* @param {number} data.ts - Ledger close timestamp
|
|
24
|
+
* @param {number} data.protocol - Protocol version
|
|
25
|
+
* @param {number} [data.successful_operations] - Successful operation count
|
|
26
|
+
* @param {number} [data.failed_operations] - Failed operation count
|
|
27
|
+
* @param {number} [data.successful_transactions] - Successful transaction count
|
|
28
|
+
* @param {number} [data.failed_transactions] - Failed transaction count
|
|
29
|
+
* @return {LedgerInfo}
|
|
30
|
+
*/
|
|
31
|
+
export function retrieveLedgerInfo(data) {
|
|
32
|
+
const parsed = xdr.LedgerHeader.fromXDR(data.xdr, 'base64')
|
|
33
|
+
return {
|
|
34
|
+
sequence: data.sequence,
|
|
35
|
+
ts: data.ts,
|
|
36
|
+
protocol: data.protocol,
|
|
37
|
+
operations: data.successful_operations || 0,
|
|
38
|
+
failedOperations: data.failed_operations || 0,
|
|
39
|
+
txSuccess: data.successful_transactions,
|
|
40
|
+
txFailed: data.failed_transactions,
|
|
41
|
+
xlm: parsed.totalCoins().toBigInt(),
|
|
42
|
+
feePool: parsed.feePool().toBigInt(),
|
|
43
|
+
baseFee: parsed.baseFee(),
|
|
44
|
+
baseReserve: parsed.baseReserve()
|
|
45
|
+
}
|
|
46
|
+
}
|