@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.
Files changed (78) hide show
  1. package/CLAUDE.md +35 -0
  2. package/README.md +1125 -3
  3. package/account/account-address.js +127 -127
  4. package/account/available-balance.js +22 -22
  5. package/account/identicon.js +90 -90
  6. package/account/signer-key.js +65 -64
  7. package/api/explorer-api-hooks.js +209 -202
  8. package/api/explorer-api-paginated-list-hooks.js +441 -440
  9. package/api/explorer-batch-info-loader.js +111 -85
  10. package/api/explorer-tx-api.js +28 -28
  11. package/api/ledger-stream.js +15 -0
  12. package/asset/amount.js +56 -56
  13. package/asset/asset-icon.js +41 -41
  14. package/asset/asset-issuer.js +21 -21
  15. package/asset/asset-link.js +107 -107
  16. package/asset/asset-list-hooks.js +59 -59
  17. package/asset/asset-meta-hooks.js +88 -88
  18. package/asset/asset-selector.js +72 -71
  19. package/claimable-balance/claimable-balance-claimants.js +23 -18
  20. package/contract/contract-api.js +15 -0
  21. package/contract/invocation-info-view.js +10 -2
  22. package/contract/sc-val.js +131 -107
  23. package/controls/button-group.js +25 -19
  24. package/controls/button.js +93 -78
  25. package/controls/code-block.js +42 -34
  26. package/controls/dropdown.js +318 -287
  27. package/controls/external-link.js +10 -4
  28. package/controls/info-tooltip.js +23 -16
  29. package/controls/slider.js +29 -19
  30. package/controls/tabs.js +94 -94
  31. package/controls/tooltip.js +244 -240
  32. package/controls/update-highlighter.js +32 -27
  33. package/date/date-selector.js +56 -54
  34. package/date/elapsed-time.js +28 -21
  35. package/dex/price-dynamic.js +53 -44
  36. package/directory/directory-hooks.js +109 -97
  37. package/effect/effect-description.js +346 -344
  38. package/errors/error-boundary.js +110 -97
  39. package/horizon/horizon-account-helpers.js +104 -104
  40. package/horizon/horizon-ledger-helpers.js +35 -35
  41. package/horizon/horizon-trades-helper.js +88 -88
  42. package/horizon/horizon-transaction-helpers.js +36 -36
  43. package/index.d.ts +1241 -0
  44. package/interaction/accordion.js +43 -35
  45. package/interaction/autofocus.js +13 -9
  46. package/interaction/block-select.js +64 -53
  47. package/interaction/copy-to-clipboard.js +25 -18
  48. package/interaction/inline-progress.js +20 -15
  49. package/interaction/qr-code.js +34 -34
  50. package/interaction/responsive.js +20 -20
  51. package/interaction/spoiler.js +52 -39
  52. package/interaction/theme-selector.js +13 -10
  53. package/ledger/ledger-entry-href-formatter.js +27 -26
  54. package/ledger/ledger-entry-link.js +93 -58
  55. package/ledger/ledger-info-parser.js +46 -18
  56. package/meta/page-meta-tags.js +243 -238
  57. package/module/dynamic-module.js +47 -47
  58. package/package.json +41 -40
  59. package/state/on-screen-hooks.js +22 -22
  60. package/state/page-visibility-helpers.js +29 -16
  61. package/state/page-visibility-hooks.js +13 -11
  62. package/state/screen-orientation-hooks.js +19 -15
  63. package/state/state-hooks.js +76 -76
  64. package/state/stellar-network-hooks.js +56 -44
  65. package/state/theme.js +29 -28
  66. package/stellar/key-type.js +92 -91
  67. package/stellar/ledger-generic-id.js +39 -39
  68. package/stellar/signature-hint-utils.js +65 -65
  69. package/toast/toast-notifications-block.js +59 -59
  70. package/tx/op-description-view.js +945 -942
  71. package/tx/op-icon.js +98 -98
  72. package/tx/parser/op-balance-changes.js +66 -66
  73. package/tx/parser/op-descriptor.js +51 -48
  74. package/tx/parser/tx-details-parser.js +81 -81
  75. package/tx/parser/tx-matcher.js +371 -371
  76. package/tx/parser/type-filter-matcher.js +126 -126
  77. package/tx/tx-list-hooks.js +32 -18
  78. package/tx/tx-operations-list.js +117 -116
@@ -1,89 +1,89 @@
1
- import {AssetDescriptor} from '@stellar-expert/asset-descriptor'
2
- import {initHorizon, applyListQueryParameters} from './horizon-client-helpers'
3
-
4
- /**
5
- * Load offer from Horizon for the particular account
6
- * @param {AssetDescriptor} baseAsset - Base asset descriptor
7
- * @param {AssetDescriptor} counterAsset - Counter asset descriptor
8
- * @param {ListQueryParams} [queryParams] - Query parameters (optional)
9
- * @return {Promise<Array<Object>>}
10
- */
11
- export function loadMarketTrades(baseAsset, counterAsset, queryParams = null) {
12
- const q = initHorizon().trades()
13
- .forAssetPair(baseAsset.toAsset(), counterAsset.toAsset())
14
- const query = applyListQueryParameters(q, queryParams)
15
- return query.call()
16
- .then(r=>r.records)
17
- }
18
-
19
-
20
- /**
21
- * Stream trades from Horizon
22
- * @param {String} cursor - Cursor to start from
23
- * @param {AssetDescriptor} baseAsset - Base asset descriptor
24
- * @param {AssetDescriptor} counterAsset - Counter asset descriptor
25
- * @param {Function} onNewTrade - Callback to invoke when new trade arrives
26
- * @return {Function}
27
- */
28
- export function streamMarketTrades(cursor, baseAsset, counterAsset, onNewTrade) {
29
- return initHorizon().trades()
30
- .forAssetPair(baseAsset.toAsset(), counterAsset.toAsset())
31
- .order('asc')
32
- .cursor(cursor || 'now')
33
- .stream({onmessage: op => onNewTrade(op)})
34
- }
35
-
36
-
37
- /**
38
- * Stream all trades from Horizon
39
- * @param {String} cursor - Cursor to start from
40
- * @param {Function} onNewTrade - Callback to invoke when new trade arrives
41
- * @return {Function}
42
- */
43
- export function streamTrades(cursor, onNewTrade) {
44
- return initHorizon().trades()
45
- .order('asc')
46
- .cursor(cursor || 'now')
47
- .limit(200)
48
- .stream({onmessage: op => onNewTrade(op)})
49
- }
50
-
51
-
52
- /**
53
- *
54
- * @param {String|AssetDescriptor|Asset} base - Base asset
55
- * @param {String|AssetDescriptor|Asset} counter - Counter asset
56
- * @param {('5m'|'15m'|'1h'|'1d'|'1w')} resolution - Segment duration
57
- * @param {Number} period - Period in days
58
- * @param {Number} [limit] - Max number of records to fetch
59
- * @return {Promise<TradeAggregationRecord>}
60
- */
61
- export function loadTradesAggregation({base, counter, resolution, period, limit = 200}) {
62
- let res
63
- switch (resolution) {
64
- case '5m':
65
- res = 300000
66
- break
67
- case '15m':
68
- res = 900000
69
- break
70
- case '1h':
71
- res = 3600000
72
- break
73
- case '1d':
74
- res = 86400000
75
- break
76
- case '1w':
77
- res = 604800000
78
- break
79
- default:
80
- throw new Error(`Not supported trades aggregation resolution: ${resolution}`)
81
- }
82
- const endTime = new Date().getTime(),
83
- startTime = endTime - period * 24 * 60 * 60 * 1000
84
-
85
- return initHorizon()
86
- .tradeAggregation(AssetDescriptor.parse(base).toAsset(), AssetDescriptor.parse(counter).toAsset(), startTime, endTime, res, 0)
87
- .limit(limit)
88
- .call()
1
+ import {AssetDescriptor} from '@stellar-expert/asset-descriptor'
2
+ import {initHorizon, applyListQueryParameters} from './horizon-client-helpers'
3
+
4
+ /**
5
+ * Load offer from Horizon for the particular account
6
+ * @param {AssetDescriptor} baseAsset - Base asset descriptor
7
+ * @param {AssetDescriptor} counterAsset - Counter asset descriptor
8
+ * @param {ListQueryParams} [queryParams] - Query parameters (optional)
9
+ * @return {Promise<Array<Object>>}
10
+ */
11
+ export function loadMarketTrades(baseAsset, counterAsset, queryParams = null) {
12
+ const q = initHorizon().trades()
13
+ .forAssetPair(baseAsset.toAsset(), counterAsset.toAsset())
14
+ const query = applyListQueryParameters(q, queryParams)
15
+ return query.call()
16
+ .then(r=>r.records)
17
+ }
18
+
19
+
20
+ /**
21
+ * Stream trades from Horizon
22
+ * @param {string} cursor - Cursor to start from
23
+ * @param {AssetDescriptor} baseAsset - Base asset descriptor
24
+ * @param {AssetDescriptor} counterAsset - Counter asset descriptor
25
+ * @param {function} onNewTrade - Callback to invoke when new trade arrives
26
+ * @return {function}
27
+ */
28
+ export function streamMarketTrades(cursor, baseAsset, counterAsset, onNewTrade) {
29
+ return initHorizon().trades()
30
+ .forAssetPair(baseAsset.toAsset(), counterAsset.toAsset())
31
+ .order('asc')
32
+ .cursor(cursor || 'now')
33
+ .stream({onmessage: op => onNewTrade(op)})
34
+ }
35
+
36
+
37
+ /**
38
+ * Stream all trades from Horizon
39
+ * @param {string} cursor - Cursor to start from
40
+ * @param {function} onNewTrade - Callback to invoke when new trade arrives
41
+ * @return {function}
42
+ */
43
+ export function streamTrades(cursor, onNewTrade) {
44
+ return initHorizon().trades()
45
+ .order('asc')
46
+ .cursor(cursor || 'now')
47
+ .limit(200)
48
+ .stream({onmessage: op => onNewTrade(op)})
49
+ }
50
+
51
+
52
+ /**
53
+ *
54
+ * @param {string|AssetDescriptor|Asset} base - Base asset
55
+ * @param {string|AssetDescriptor|Asset} counter - Counter asset
56
+ * @param {('5m'|'15m'|'1h'|'1d'|'1w')} resolution - Segment duration
57
+ * @param {number} period - Period in days
58
+ * @param {number} [limit] - Max number of records to fetch
59
+ * @return {Promise<TradeAggregationRecord>}
60
+ */
61
+ export function loadTradesAggregation({base, counter, resolution, period, limit = 200}) {
62
+ let res
63
+ switch (resolution) {
64
+ case '5m':
65
+ res = 300000
66
+ break
67
+ case '15m':
68
+ res = 900000
69
+ break
70
+ case '1h':
71
+ res = 3600000
72
+ break
73
+ case '1d':
74
+ res = 86400000
75
+ break
76
+ case '1w':
77
+ res = 604800000
78
+ break
79
+ default:
80
+ throw new Error(`Not supported trades aggregation resolution: ${resolution}`)
81
+ }
82
+ const endTime = new Date().getTime(),
83
+ startTime = endTime - period * 24 * 60 * 60 * 1000
84
+
85
+ return initHorizon()
86
+ .tradeAggregation(AssetDescriptor.parse(base).toAsset(), AssetDescriptor.parse(counter).toAsset(), startTime, endTime, res, 0)
87
+ .limit(limit)
88
+ .call()
89
89
  }
@@ -1,36 +1,36 @@
1
- import {initHorizon, applyListQueryParameters} from './horizon-client-helpers'
2
-
3
- /**
4
- * Load transactions from Horizon
5
- * @param {ListQueryParams} [queryParams] - Query parameters (optional)
6
- * @return {Promise<Array<Object>>}
7
- */
8
- export function loadTransactions(queryParams = null) {
9
- const query = applyListQueryParameters(initHorizon().transactions().includeFailed(queryParams && !!queryParams.includeFailed), queryParams)
10
- return query.call()
11
- .then(r => r.records)
12
- }
13
-
14
- /**
15
- * Stream operations from Horizon
16
- * @param {String} cursor - Cursor to start from
17
- * @param {Function} onNewTx - Callback to invoke when new operation arrives
18
- * @param {Boolean} includeFailed - Include failed transactions into the stream
19
- * @return {Function}
20
- */
21
- export function streamTransactions(cursor, onNewTx, includeFailed) {
22
- return initHorizon().transactions().includeFailed(!!includeFailed)
23
- .order('asc')
24
- .cursor(cursor || 'now')
25
- .stream({onmessage: op => onNewTx(op)})
26
- }
27
-
28
- /**
29
- * Submit transaction to Horizon
30
- * @param {Transaction} tx
31
- * @returns {Promise<Horizon.SubmitTransactionResponse>}
32
- */
33
- export function submitTransaction(tx) {
34
- return initHorizon()
35
- .submitTransaction(tx)
36
- }
1
+ import {initHorizon, applyListQueryParameters} from './horizon-client-helpers'
2
+
3
+ /**
4
+ * Load transactions from Horizon
5
+ * @param {ListQueryParams} [queryParams] - Query parameters (optional)
6
+ * @return {Promise<Array<Object>>}
7
+ */
8
+ export function loadTransactions(queryParams = null) {
9
+ const query = applyListQueryParameters(initHorizon().transactions().includeFailed(queryParams && !!queryParams.includeFailed), queryParams)
10
+ return query.call()
11
+ .then(r => r.records)
12
+ }
13
+
14
+ /**
15
+ * Stream operations from Horizon
16
+ * @param {string} cursor - Cursor to start from
17
+ * @param {function} onNewTx - Callback to invoke when new operation arrives
18
+ * @param {boolean} includeFailed - Include failed transactions into the stream
19
+ * @return {function}
20
+ */
21
+ export function streamTransactions(cursor, onNewTx, includeFailed) {
22
+ return initHorizon().transactions().includeFailed(!!includeFailed)
23
+ .order('asc')
24
+ .cursor(cursor || 'now')
25
+ .stream({onmessage: op => onNewTx(op)})
26
+ }
27
+
28
+ /**
29
+ * Submit transaction to Horizon
30
+ * @param {Transaction} tx
31
+ * @returns {Promise<Horizon.SubmitTransactionResponse>}
32
+ */
33
+ export function submitTransaction(tx) {
34
+ return initHorizon()
35
+ .submitTransaction(tx)
36
+ }