@gibs/bridge-sdk 1.9.1 → 1.12.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/package.json +12 -5
- package/src/abis.ts +3 -70
- package/src/chain-info.test.ts +968 -0
- package/src/chain-info.ts +161 -127
- package/src/chains.test.ts +123 -0
- package/src/chains.ts +5 -5
- package/src/config.test.ts +679 -0
- package/src/config.ts +138 -118
- package/src/fee-type.test.ts +45 -0
- package/src/fee-type.ts +2 -2
- package/src/image-links.test.ts +160 -0
- package/src/image-links.ts +20 -16
- package/src/index.ts +8 -8
- package/src/settings.test.ts +2754 -0
- package/src/settings.ts +356 -334
- package/src/types.ts +25 -25
- package/tsconfig.json +2 -1
- package/vitest.config.ts +13 -0
- package/dist/src/abis.d.ts +0 -384
- package/dist/src/abis.js +0 -68
- package/dist/src/chain-info.d.ts +0 -130
- package/dist/src/chain-info.js +0 -350
- package/dist/src/chains.d.ts +0 -6
- package/dist/src/chains.js +0 -86
- package/dist/src/config.d.ts +0 -136
- package/dist/src/config.js +0 -386
- package/dist/src/fee-type.d.ts +0 -10
- package/dist/src/fee-type.js +0 -9
- package/dist/src/image-links.d.ts +0 -41
- package/dist/src/image-links.js +0 -45
- package/dist/src/index.d.ts +0 -8
- package/dist/src/index.js +0 -8
- package/dist/src/settings.d.ts +0 -341
- package/dist/src/settings.js +0 -614
- package/dist/src/types.d.ts +0 -44
- package/dist/src/types.js +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/src/image-links.ts
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { getAddress } from 'viem'
|
|
1
|
+
import { getAddress } from 'viem';
|
|
2
2
|
|
|
3
|
-
let imageRoot = 'https://gib.show'
|
|
3
|
+
let imageRoot = 'https://gib.show';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Sets the image root for the bridge
|
|
7
7
|
* @param root - the root
|
|
8
8
|
*/
|
|
9
9
|
export const setImageRoot = (root: string) => {
|
|
10
|
-
imageRoot = root
|
|
11
|
-
}
|
|
10
|
+
imageRoot = root;
|
|
11
|
+
};
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Returns the image root for the bridge
|
|
15
15
|
* @returns the image root
|
|
16
16
|
*/
|
|
17
|
-
export const getImageRoot = () => imageRoot
|
|
17
|
+
export const getImageRoot = () => imageRoot;
|
|
18
18
|
|
|
19
19
|
/** The minimal token info */
|
|
20
20
|
interface MinimalTokenInfo {
|
|
21
|
-
chainId: number
|
|
22
|
-
address: string
|
|
23
|
-
logoURI?: string | null
|
|
21
|
+
chainId: number;
|
|
22
|
+
address: string;
|
|
23
|
+
logoURI?: string | null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -29,20 +29,24 @@ interface MinimalTokenInfo {
|
|
|
29
29
|
* @returns the list image
|
|
30
30
|
*/
|
|
31
31
|
export const list = (path: string) => {
|
|
32
|
-
return `${imageRoot}/list${path}
|
|
33
|
-
}
|
|
32
|
+
return `${imageRoot}/list${path}`;
|
|
33
|
+
};
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Returns the network image for the given chain id
|
|
37
37
|
* @param chainId - the chain id
|
|
38
38
|
* @returns the network image
|
|
39
39
|
*/
|
|
40
|
+
const isTest =
|
|
41
|
+
typeof process !== 'undefined' &&
|
|
42
|
+
(process.env.VITEST === 'true' || process.env.NODE_ENV === 'test');
|
|
43
|
+
|
|
40
44
|
export const network = (chainId: number) => {
|
|
41
|
-
if (!chainId) {
|
|
42
|
-
console.trace('network image')
|
|
45
|
+
if (!chainId && !isTest) {
|
|
46
|
+
console.trace('network image');
|
|
43
47
|
}
|
|
44
|
-
return `${imageRoot}/image/${Number(chainId)}
|
|
45
|
-
}
|
|
48
|
+
return `${imageRoot}/image/${Number(chainId)}`;
|
|
49
|
+
};
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* Returns the image url for the given token info
|
|
@@ -50,7 +54,7 @@ export const network = (chainId: number) => {
|
|
|
50
54
|
* @returns the image url
|
|
51
55
|
*/
|
|
52
56
|
export const image = (t: MinimalTokenInfo) =>
|
|
53
|
-
t.logoURI || `${network(t.chainId)}/${getAddress(t.address)}
|
|
57
|
+
t.logoURI || `${network(t.chainId)}/${getAddress(t.address)}`;
|
|
54
58
|
|
|
55
59
|
/**
|
|
56
60
|
* Returns a url that will lookup all sources for the given array
|
|
@@ -58,4 +62,4 @@ export const image = (t: MinimalTokenInfo) =>
|
|
|
58
62
|
* @returns the images
|
|
59
63
|
*/
|
|
60
64
|
export const images = (sources: string[]) =>
|
|
61
|
-
`${imageRoot}/image/?${sources.map((s) => `i=${s}`).join('&')}
|
|
65
|
+
`${imageRoot}/image/?${sources.map((s) => `i=${s}`).join('&')}`;
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
3
|
-
export * from './
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './image-links.js'
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
1
|
+
export * from './abis.js';
|
|
2
|
+
export * from './chain-info.js';
|
|
3
|
+
export * from './chains.js';
|
|
4
|
+
export * from './config.js';
|
|
5
|
+
export * from './fee-type.js';
|
|
6
|
+
export * from './image-links.js';
|
|
7
|
+
export * from './settings.js';
|
|
8
|
+
export * from './types.js';
|