@stellar-expert/ui-framework 1.16.1 → 1.16.2

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.
@@ -7,6 +7,14 @@ import {ExplorerBatchInfoLoader} from '../api/explorer-batch-info-loader'
7
7
 
8
8
  const cache = new InMemoryClientCache({})
9
9
 
10
+ function isValidAddress(address) {
11
+ if (!address)
12
+ return false
13
+ if (!StrKey.isValidEd25519PublicKey(address) && !StrKey.isValidContract(address))
14
+ return false
15
+ return true
16
+ }
17
+
10
18
  const loader = new ExplorerBatchInfoLoader(batch => {
11
19
  return fetchExplorerApi('directory' + stringifyQuery({address: batch}))
12
20
  }, entry => {
@@ -17,7 +25,8 @@ const loader = new ExplorerBatchInfoLoader(batch => {
17
25
  export async function getDirectoryEntry(address, options) {
18
26
  const {forceRefresh = false, extended = false} = options || {}
19
27
  //ignore invalid addresses
20
- if (!address || !StrKey.isValidEd25519PublicKey(address)) return null
28
+ if (!isValidAddress(address))
29
+ return null
21
30
  if (extended) {
22
31
  return fetchExplorerApi(`directory/${address}` + stringifyQuery({
23
32
  extended: true,
@@ -48,7 +57,7 @@ export function useDirectory(address, options) {
48
57
  const [directoryInfo, setDirectoryInfo] = useState(null)
49
58
  let unloaded = false
50
59
  useEffect(function () {
51
- if (!address || !(StrKey.isValidEd25519PublicKey(address) || StrKey.isValidContract(address)))
60
+ if (!isValidAddress(address))
52
61
  return
53
62
  if (!forceRefresh) {
54
63
  const cachedEntry = cache.get(address)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stellar-expert/ui-framework",
3
- "version": "1.16.1",
3
+ "version": "1.16.2",
4
4
  "description": "StellarExpert shared UI components library",
5
5
  "main": "index.js",
6
6
  "module": "./index.js",