@gibs/bridge-sdk 1.6.36 → 1.7.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.
@@ -2,22 +2,41 @@ import { getAddress } from 'viem'
2
2
 
3
3
  let imageRoot = 'https://gib.show'
4
4
 
5
+ /**
6
+ * Sets the image root for the bridge
7
+ * @param root - the root
8
+ */
5
9
  export const setImageRoot = (root: string) => {
6
10
  imageRoot = root
7
11
  }
8
12
 
13
+ /**
14
+ * Returns the image root for the bridge
15
+ * @returns the image root
16
+ */
9
17
  export const getImageRoot = () => imageRoot
10
18
 
19
+ /** The minimal token info */
11
20
  interface MinimalTokenInfo {
12
21
  chainId: number
13
22
  address: string
14
23
  logoURI?: string | null
15
24
  }
16
25
 
26
+ /**
27
+ * Returns the list image for the given path
28
+ * @param path - the path
29
+ * @returns the list image
30
+ */
17
31
  export const list = (path: string) => {
18
32
  return `${imageRoot}/list${path}`
19
33
  }
20
34
 
35
+ /**
36
+ * Returns the network image for the given chain id
37
+ * @param chainId - the chain id
38
+ * @returns the network image
39
+ */
21
40
  export const network = (chainId: number) => {
22
41
  if (!chainId) {
23
42
  console.trace('network image')
@@ -25,8 +44,18 @@ export const network = (chainId: number) => {
25
44
  return `${imageRoot}/image/${Number(chainId)}`
26
45
  }
27
46
 
47
+ /**
48
+ * Returns the image url for the given token info
49
+ * @param t - the token info
50
+ * @returns the image url
51
+ */
28
52
  export const image = (t: MinimalTokenInfo) =>
29
53
  t.logoURI || `${network(t.chainId)}/${getAddress(t.address)}`
30
54
 
55
+ /**
56
+ * Returns a url that will lookup all sources for the given array
57
+ * @param sources - the sources
58
+ * @returns the images
59
+ */
31
60
  export const images = (sources: string[]) =>
32
61
  `${imageRoot}/image/?${sources.map((s) => `i=${s}`).join('&')}`
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export * from './chains.js'
5
5
  export * from './types.js'
6
6
  export * from './image-links.js'
7
7
  export * from './fee-type.js'
8
+ export * from './settings.js'