@gearbox-protocol/sdk 14.8.4 → 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.
|
@@ -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) {
|
|
@@ -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) {
|
|
@@ -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;
|