@gearbox-protocol/sdk 14.8.3 → 14.8.5
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/README.md +2 -0
- package/dist/cjs/common-utils/charts/token-data.js +1 -1
- package/dist/cjs/dev/isTransientError.js +3 -1
- package/dist/esm/common-utils/charts/token-data.js +1 -1
- package/dist/esm/dev/isTransientError.js +3 -1
- package/dist/types/common-utils/charts/token-data.d.ts +25 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ class TokenData {
|
|
|
78
78
|
this.symbol = payload.symbol;
|
|
79
79
|
this.name = payload.name;
|
|
80
80
|
this.decimals = payload.decimals;
|
|
81
|
-
this.icon = TokenData.getTokenIcon(payload.symbol);
|
|
81
|
+
this.icon = payload.icon ?? TokenData.getTokenIcon(payload.symbol);
|
|
82
82
|
this.isPhantom = payload.isPhantom ?? false;
|
|
83
83
|
}
|
|
84
84
|
static getTokenIcon(symbol) {
|
|
@@ -61,7 +61,9 @@ const TRANSIENT_PATTERNS = [
|
|
|
61
61
|
// sometimes happens on DRPC: "GRPC Context cancellation"
|
|
62
62
|
/context cancel/i,
|
|
63
63
|
// DRPC error: Can't route your request to suitable provider, if you specified certain providers revise the list
|
|
64
|
-
/suitable provider/i
|
|
64
|
+
/suitable provider/i,
|
|
65
|
+
// DRPC error: Temporary internal error. Please retry, trace-id: xxx
|
|
66
|
+
/temporary internal error/i
|
|
65
67
|
];
|
|
66
68
|
function isTransientError(e) {
|
|
67
69
|
if (e instanceof import_viem.BaseError) {
|
|
@@ -55,7 +55,7 @@ class TokenData {
|
|
|
55
55
|
this.symbol = payload.symbol;
|
|
56
56
|
this.name = payload.name;
|
|
57
57
|
this.decimals = payload.decimals;
|
|
58
|
-
this.icon = TokenData.getTokenIcon(payload.symbol);
|
|
58
|
+
this.icon = payload.icon ?? TokenData.getTokenIcon(payload.symbol);
|
|
59
59
|
this.isPhantom = payload.isPhantom ?? false;
|
|
60
60
|
}
|
|
61
61
|
static getTokenIcon(symbol) {
|
|
@@ -38,7 +38,9 @@ const TRANSIENT_PATTERNS = [
|
|
|
38
38
|
// sometimes happens on DRPC: "GRPC Context cancellation"
|
|
39
39
|
/context cancel/i,
|
|
40
40
|
// DRPC error: Can't route your request to suitable provider, if you specified certain providers revise the list
|
|
41
|
-
/suitable provider/i
|
|
41
|
+
/suitable provider/i,
|
|
42
|
+
// DRPC error: Temporary internal error. Please retry, trace-id: xxx
|
|
43
|
+
/temporary internal error/i
|
|
42
44
|
];
|
|
43
45
|
function isTransientError(e) {
|
|
44
46
|
if (e instanceof BaseError) {
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
+
export type TokenIconLayerSource = {
|
|
3
|
+
type: "symbol";
|
|
4
|
+
symbol: string;
|
|
5
|
+
} | {
|
|
6
|
+
type: "url";
|
|
7
|
+
url: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Named layout presets for composite icons. Pixel layout lives in UI-kit (TokenIcon), not in API payloads.
|
|
11
|
+
*/
|
|
12
|
+
export type TokenIconCompositePreset =
|
|
13
|
+
/** Background full size; foreground centered at ~65% (e.g. token on plate). */
|
|
14
|
+
"centered_foreground";
|
|
15
|
+
/**
|
|
16
|
+
* Client-composed token icon: multiple layers by preset.
|
|
17
|
+
*/
|
|
18
|
+
export type IconComposite = {
|
|
19
|
+
kind: "composite";
|
|
20
|
+
preset: TokenIconCompositePreset;
|
|
21
|
+
scaleFactor?: number;
|
|
22
|
+
/** Exactly two layers (bottom then top). */
|
|
23
|
+
layers: readonly [TokenIconLayerSource, TokenIconLayerSource];
|
|
24
|
+
};
|
|
2
25
|
export interface TokenDataPayload {
|
|
3
26
|
addr: Address;
|
|
4
27
|
symbol: string;
|
|
@@ -6,6 +29,7 @@ export interface TokenDataPayload {
|
|
|
6
29
|
name: string;
|
|
7
30
|
decimals: number;
|
|
8
31
|
isPhantom: boolean;
|
|
32
|
+
icon?: string | IconComposite;
|
|
9
33
|
}
|
|
10
34
|
export declare class TokenData {
|
|
11
35
|
readonly address: Address;
|
|
@@ -13,7 +37,7 @@ export declare class TokenData {
|
|
|
13
37
|
readonly symbol: string;
|
|
14
38
|
readonly name: string;
|
|
15
39
|
readonly decimals: number;
|
|
16
|
-
readonly icon: string;
|
|
40
|
+
readonly icon: string | IconComposite;
|
|
17
41
|
readonly isPhantom: boolean;
|
|
18
42
|
constructor(payload: TokenDataPayload);
|
|
19
43
|
static getTokenIcon(symbol: string): string;
|