@gearbox-protocol/ui-kit 4.0.2 → 4.1.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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),c=require("react"),I=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/onchain");require("../../utils/z-index.cjs");const L=require("../../utils/internal/static.cjs");function S(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const T=S(c),g=L.getStatic("/tokens/default.svg"),m=new Map;function f(e){return m.get(e)?g:e}const b=T.forwardRef(({className:e,size:r,rounded:n=!0,style:o,src:s,defaultIcon:p=g,fit:y="cover",...R},a)=>{const[j,l]=c.useState(void 0),[h,u]=c.useState(!1),i=c.useRef(!1),d=c.useRef(null),v=t=>{d.current=t,typeof a=="function"?a(t):a&&(a.current=t),t?.complete&&t.naturalWidth>0&&u(!0)};c.useEffect(()=>{f(s),l(void 0),i.current=!1;const t=d.current;u(!!t?.complete&&t.naturalWidth>0)},[s]);const O=t=>{i.current||(i.current=!0,m.set(t.currentTarget.src,!0),l(p))},_=()=>{u(!0)};return q.jsx("img",{ref:v,src:j||f(s),alt:"",className:I.cn(y==="cover"?"object-cover":"object-contain object-center",n&&"rounded-full",!h&&"bg-gray-90 dark:bg-gray-110 rounded-full",e),style:{width:r,height:r,...o},loading:"lazy",decoding:"async",onError:O,onLoad:_,...R})});b.displayName="RoundedImage";exports.RoundedImage=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const q=require("react/jsx-runtime"),c=require("react"),I=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/onchain");require("../../utils/z-index.cjs");const L=require("../../utils/internal/static.cjs");function S(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const w=S(c),g=L.getStatic("/tokens/default.svg"),m=new Map;function f(e){return m.get(e)?g:e}const b=w.forwardRef(({className:e,size:r,rounded:n=!0,style:a,src:s,defaultIcon:p=g,fit:y="cover",...R},o)=>{const[j,l]=c.useState(void 0),[h,u]=c.useState(!1),i=c.useRef(!1),d=c.useRef(null),v=t=>{d.current=t,typeof o=="function"?o(t):o&&(o.current=t),t?.complete&&t.naturalWidth>0&&u(!0)};c.useEffect(()=>{f(s),l(void 0),i.current=!1;const t=d.current;u(!!t?.complete&&t.naturalWidth>0)},[s]);const O=t=>{i.current||(i.current=!0,m.set(t.currentTarget.src,!0),l(p))},_=()=>{u(!0)};return q.jsx("img",{ref:v,src:j||f(s),alt:"",className:I.cn(y==="cover"?"object-cover":"object-contain object-center",n&&"rounded-full",!h&&"bg-gray-90 dark:bg-gray-110 rounded-full",e),style:{width:r,height:r,...a},loading:"lazy",decoding:"async",onError:O,onLoad:_,...R})});b.displayName="RoundedImage";exports.RoundedImage=b;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../utils/internal/static.cjs"),c=o.getStatic("/tokens/templates/diesel.svg"),u=o.getStatic("/logo/logo_symbol.png"),n=/V\d+$/,s="_OLD",f=[{prefix:"farmd",requiresVersion:!1},{prefix:"wd",requiresVersion:!1},{prefix:"sd",requiresVersion:!0},{prefix:"d",requiresVersion:!0}];function l(e){for(const{prefix:t,requiresVersion:i}of f){if(!e.startsWith(t))continue;let r=e.slice(t.length);if(r.endsWith(s)&&(r=r.slice(0,-s.length)),n.test(r))r=r.replace(n,"");else if(i)continue;if(r)return r}}function d(e){return{kind:"composite",preset:"centered_foreground",scaleFactor:.74,layers:[{type:"url",url:c},{type:"symbol",symbol:e}]}}function a(e){if(e===void 0)return;const t=typeof e=="string"?e:e.symbol;if(!t)return;if(t==="GEAR")return{icon:u};const i=l(t);return i?d(i):t}exports.getTokenIcon=a;exports.parseShareTokenUnderlying=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("../../utils/internal/static.cjs"),e=d.getStatic("/tokens/default.svg"),r=d.getStatic("/logo/logo_symbol.png");function u(t){return t.replaceAll("/","").replaceAll(" ","").toLowerCase()}const w={"crvusdfrax-f":"crvusdfrax","crvusdusdc-f":"crvusdusdc","crvusdusdt-f":"crvusdusdt","cvxcrvusdfrax-f":"cvxcrvusdfrax","cvxcrvusdusdc-f":"cvxcrvusdusdc","cvxcrvusdusdt-f":"cvxcrvusdusdt","stkcvxcrvusdfrax-f":"stkcvxcrvusdfrax","stkcvxcrvusdusdc-f":"stkcvxcrvusdusdc","stkcvxcrvusdusdt-f":"stkcvxcrvusdusdt","wdwsteth[cp0xlrt]":"wdwsteth","wdwsteth[pzeth]":"wdwsteth","wdwsteth[re7lrt]":"wdwsteth","wdwsteth[rsteth]":"wdwsteth","wdwsteth[steaklrt]":"wdwsteth",wdiusd:"iusd",wdrseth:"rseth","dwbtc-v3-0":"dwbtcv3","dwethv3-cp0x":"dwethv3",fweth:"weth",fwsteth:"wsteth",kpkfrxusd:"frxusd",kpkweth:"weth",kpkwsteth:"wsteth",stkrlusdusdc:"rlusdusdc",syusd:"yusd",xtz:"wxtz","cyb-cbbtc":"cbbtc","cyb-tbtc":"tbtc","cyb-wbtc":"wbtc",re7tbtc:"tbtc",re7usdc:"usdc"};function v(t){const s=typeof t=="string"?t:t?.symbol;if(!s)return e;if(s==="GEAR")return r;const c=u(s);return c?d.getStatic(`/tokens/${w[c]??c}.svg`):e}exports.getTokenIconUrl=v;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),j=require("react"),h=require("./token-icon-source.cjs"),y=require("../../utils/cn.cjs");require("@gearbox-protocol/sdk/onchain");require("../../utils/z-index.cjs");const p=require("../../utils/internal/static.cjs"),d=require("../rounded-image/rounded-image.cjs"),f=p.getStatic("/tokens/default.svg");function x(e){return e.replace("/","").replace(" ","").replace("-f","").replace("-","_").toLowerCase()}function w(e){return typeof e=="object"&&e!==null&&"icon"in e&&!("kind"in e)}function S(e){return typeof e=="object"&&e!==null&&"kind"in e&&e.kind==="composite"}function T(e){if(e.type==="url")return e.url;const n=x(e.symbol);return n?p.getStatic(`/tokens/${n}.svg`):f}function N(e){if(!e||S(e))return f;if(w(e))return e.icon;const n=x(e);return n?p.getStatic(`/tokens/${n}.svg`):f}const C=.65;function U(e,n){return e!==void 0?h.getTokenIcon(e):typeof n=="string"?h.getTokenIcon(n):n}const _=j.forwardRef(function({token:n,symbol:r,size:o=48,fit:c="contain",rounded:i=!1,className:a,...u},l){const s=U(n,r);if(S(s))return t.jsx(b,{ref:l,composite:s,size:o,fit:c,rounded:i,className:a});const m=N(s);return t.jsx(d.RoundedImage,{ref:l,className:a,src:m,alt:"",rounded:i,fit:c,width:o,height:o,size:o,...u})}),b=j.forwardRef(function({composite:n,size:r,fit:o,rounded:c,className:i},a){const{preset:u,layers:l,scaleFactor:s=C}=n,[m,R]=l,k=T(m),q=T(R),g=Math.round(r*s);let I;switch(u){case"centered_foreground":I=t.jsxs(t.Fragment,{children:[t.jsx(d.RoundedImage,{className:"absolute inset-0",style:{zIndex:0},src:k,alt:"background",rounded:c,fit:o,size:r}),t.jsx("div",{className:y.cn("absolute left-1/2 top-1/2 z-[1] -translate-x-1/2 -translate-y-1/2","flex items-center justify-center"),style:{width:g,height:g},children:t.jsx(d.RoundedImage,{src:q,alt:"foreground",rounded:c,fit:o,size:g})})]});break;default:return console.error("Unknown TokenIcon composite preset",u),t.jsx(d.RoundedImage,{src:k,alt:"error",rounded:c,fit:o,size:r})}return t.jsx("div",{ref:a,className:y.cn("relative inline-block shrink-0",i),style:{width:r,height:r},children:I})});b.displayName="TokenIconComposite";_.displayName="TokenIcon";exports.TokenIcon=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),i=require("react"),I=require("./token-icon-source.cjs"),m=require("../rounded-image/rounded-image.cjs"),n=i.forwardRef(function({token:o,symbol:t,size:e=48,fit:c="contain",rounded:r=!1,className:u,...a},s){return d.jsx(m.RoundedImage,{ref:s,className:u,src:I.getTokenIconUrl(o??t),alt:"",rounded:r,fit:c,width:e,height:e,size:e,...a})});n.displayName="TokenIcon";exports.TokenIcon=n;
@@ -1,15 +1,15 @@
1
- import { jsx as E } from "react/jsx-runtime";
2
- import * as k from "react";
3
- import { useState as i, useRef as l, useEffect as w } from "react";
4
- import { cn as N } from "../../utils/cn.js";
1
+ import { jsx as I } from "react/jsx-runtime";
2
+ import * as w from "react";
3
+ import { useState as i, useRef as f, useEffect as N } from "react";
4
+ import { cn as k } from "../../utils/cn.js";
5
5
  import "@gearbox-protocol/sdk/onchain";
6
6
  import "../../utils/z-index.js";
7
- import { getStatic as T } from "../../utils/internal/static.js";
8
- const u = T("/tokens/default.svg"), m = /* @__PURE__ */ new Map();
9
- function f(t) {
7
+ import { getStatic as x } from "../../utils/internal/static.js";
8
+ const u = x("/tokens/default.svg"), m = /* @__PURE__ */ new Map();
9
+ function l(t) {
10
10
  return m.get(t) ? u : t;
11
11
  }
12
- const U = k.forwardRef(
12
+ const C = w.forwardRef(
13
13
  ({
14
14
  className: t,
15
15
  size: c,
@@ -20,26 +20,26 @@ const U = k.forwardRef(
20
20
  fit: R = "cover",
21
21
  ...y
22
22
  }, r) => {
23
- const [v, s] = i(void 0), [b, n] = i(!1), a = l(!1), d = l(null), I = (e) => {
24
- d.current = e, typeof r == "function" ? r(e) : r && (r.current = e), e?.complete && e.naturalWidth > 0 && n(!0);
23
+ const [v, s] = i(void 0), [b, a] = i(!1), n = f(!1), d = f(null), L = (e) => {
24
+ d.current = e, typeof r == "function" ? r(e) : r && (r.current = e), e?.complete && e.naturalWidth > 0 && a(!0);
25
25
  };
26
- w(() => {
27
- f(o), s(void 0), a.current = !1;
26
+ N(() => {
27
+ l(o), s(void 0), n.current = !1;
28
28
  const e = d.current;
29
- n(!!e?.complete && e.naturalWidth > 0);
29
+ a(!!e?.complete && e.naturalWidth > 0);
30
30
  }, [o]);
31
- const L = (e) => {
32
- a.current || (a.current = !0, m.set(e.currentTarget.src, !0), s(h));
33
- }, j = () => {
34
- n(!0);
31
+ const j = (e) => {
32
+ n.current || (n.current = !0, m.set(e.currentTarget.src, !0), s(h));
33
+ }, E = () => {
34
+ a(!0);
35
35
  };
36
- return /* @__PURE__ */ E(
36
+ return /* @__PURE__ */ I(
37
37
  "img",
38
38
  {
39
- ref: I,
40
- src: v || f(o),
39
+ ref: L,
40
+ src: v || l(o),
41
41
  alt: "",
42
- className: N(
42
+ className: k(
43
43
  R === "cover" ? "object-cover" : "object-contain object-center",
44
44
  g && "rounded-full",
45
45
  !b && "bg-gray-90 dark:bg-gray-110 rounded-full",
@@ -52,14 +52,14 @@ const U = k.forwardRef(
52
52
  },
53
53
  loading: "lazy",
54
54
  decoding: "async",
55
- onError: L,
56
- onLoad: j,
55
+ onError: j,
56
+ onLoad: E,
57
57
  ...y
58
58
  }
59
59
  );
60
60
  }
61
61
  );
62
- U.displayName = "RoundedImage";
62
+ C.displayName = "RoundedImage";
63
63
  export {
64
- U as RoundedImage
64
+ C as RoundedImage
65
65
  };
@@ -1,48 +1,55 @@
1
- import { getStatic as s } from "../../utils/internal/static.js";
2
- const f = s("/tokens/templates/diesel.svg"), l = s("/logo/logo_symbol.png"), n = /V\d+$/, o = "_OLD", u = [
3
- { prefix: "farmd", requiresVersion: !1 },
4
- { prefix: "wd", requiresVersion: !1 },
5
- { prefix: "sd", requiresVersion: !0 },
6
- { prefix: "d", requiresVersion: !0 }
7
- ];
8
- function c(e) {
9
- for (const { prefix: i, requiresVersion: t } of u) {
10
- if (!e.startsWith(i)) continue;
11
- let r = e.slice(i.length);
12
- if (r.endsWith(o) && (r = r.slice(0, -o.length)), n.test(r))
13
- r = r.replace(n, "");
14
- else if (t)
15
- continue;
16
- if (r) return r;
17
- }
1
+ import { getStatic as d } from "../../utils/internal/static.js";
2
+ const r = d("/tokens/default.svg"), u = d("/logo/logo_symbol.png");
3
+ function e(t) {
4
+ return t.replaceAll("/", "").replaceAll(" ", "").toLowerCase();
18
5
  }
19
- function d(e) {
20
- return {
21
- kind: "composite",
22
- preset: "centered_foreground",
23
- scaleFactor: 0.74,
24
- layers: [
25
- {
26
- type: "url",
27
- url: f
28
- },
29
- {
30
- type: "symbol",
31
- symbol: e
32
- }
33
- ]
34
- };
35
- }
36
- function g(e) {
37
- if (e === void 0) return;
38
- const i = typeof e == "string" ? e : e.symbol;
39
- if (!i) return;
40
- if (i === "GEAR")
41
- return { icon: l };
42
- const t = c(i);
43
- return t ? d(t) : i;
6
+ const w = {
7
+ // Curve factory pools, on the base pool's icon.
8
+ "crvusdfrax-f": "crvusdfrax",
9
+ "crvusdusdc-f": "crvusdusdc",
10
+ "crvusdusdt-f": "crvusdusdt",
11
+ "cvxcrvusdfrax-f": "cvxcrvusdfrax",
12
+ "cvxcrvusdusdc-f": "cvxcrvusdusdc",
13
+ "cvxcrvusdusdt-f": "cvxcrvusdusdt",
14
+ "stkcvxcrvusdfrax-f": "stkcvxcrvusdfrax",
15
+ "stkcvxcrvusdusdc-f": "stkcvxcrvusdusdc",
16
+ "stkcvxcrvusdusdt-f": "stkcvxcrvusdusdt",
17
+ // Mellow withdrawal phantoms. The SDK reports all of them as one `wdwstETH`;
18
+ // only the backend tells the vaults apart, and the icon never did.
19
+ "wdwsteth[cp0xlrt]": "wdwsteth",
20
+ "wdwsteth[pzeth]": "wdwsteth",
21
+ "wdwsteth[re7lrt]": "wdwsteth",
22
+ "wdwsteth[rsteth]": "wdwsteth",
23
+ "wdwsteth[steaklrt]": "wdwsteth",
24
+ // Withdrawal phantoms of a single asset.
25
+ wdiusd: "iusd",
26
+ wdrseth: "rseth",
27
+ // Curator variants of a pool share token.
28
+ "dwbtc-v3-0": "dwbtcv3",
29
+ "dwethv3-cp0x": "dwethv3",
30
+ // Wrappers and staked versions, on the asset they hold.
31
+ fweth: "weth",
32
+ fwsteth: "wsteth",
33
+ kpkfrxusd: "frxusd",
34
+ kpkweth: "weth",
35
+ kpkwsteth: "wsteth",
36
+ stkrlusdusdc: "rlusdusdc",
37
+ syusd: "yusd",
38
+ xtz: "wxtz",
39
+ // Curated vaults, on their underlying.
40
+ "cyb-cbbtc": "cbbtc",
41
+ "cyb-tbtc": "tbtc",
42
+ "cyb-wbtc": "wbtc",
43
+ re7tbtc: "tbtc",
44
+ re7usdc: "usdc"
45
+ };
46
+ function f(t) {
47
+ const s = typeof t == "string" ? t : t?.symbol;
48
+ if (!s) return r;
49
+ if (s === "GEAR") return u;
50
+ const c = e(s);
51
+ return c ? d(`/tokens/${w[c] ?? c}.svg`) : r;
44
52
  }
45
53
  export {
46
- g as getTokenIcon,
47
- c as parseShareTokenUnderlying
54
+ f as getTokenIconUrl
48
55
  };
@@ -1,143 +1,35 @@
1
- import { jsx as r, jsxs as x, Fragment as R } from "react/jsx-runtime";
2
- import b from "react";
3
- import { getTokenIcon as I } from "./token-icon-source.js";
4
- import { cn as y } from "../../utils/cn.js";
5
- import "@gearbox-protocol/sdk/onchain";
6
- import "../../utils/z-index.js";
7
- import { getStatic as k } from "../../utils/internal/static.js";
8
- import { RoundedImage as m } from "../rounded-image/rounded-image.js";
9
- const u = k("/tokens/default.svg");
10
- function w(t) {
11
- return t.replace("/", "").replace(" ", "").replace("-f", "").replace("-", "_").toLowerCase();
12
- }
13
- function _(t) {
14
- return typeof t == "object" && t !== null && "icon" in t && !("kind" in t);
15
- }
16
- function N(t) {
17
- return typeof t == "object" && t !== null && "kind" in t && t.kind === "composite";
18
- }
19
- function T(t) {
20
- if (t.type === "url") return t.url;
21
- const e = w(t.symbol);
22
- return e ? k(`/tokens/${e}.svg`) : u;
23
- }
24
- function j(t) {
25
- if (!t || N(t))
26
- return u;
27
- if (_(t))
28
- return t.icon;
29
- const e = w(t);
30
- return e ? k(`/tokens/${e}.svg`) : u;
31
- }
32
- const F = 0.65;
33
- function L(t, e) {
34
- return t !== void 0 ? I(t) : typeof e == "string" ? I(e) : e;
35
- }
36
- const v = b.forwardRef(function({
37
- token: e,
38
- symbol: n,
39
- size: o = 48,
40
- fit: c = "contain",
41
- rounded: s = !1,
42
- className: a,
43
- ...l
44
- }, f) {
45
- const i = L(e, n);
46
- if (N(i))
47
- return /* @__PURE__ */ r(
48
- C,
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import i from "react";
3
+ import { getTokenIconUrl as d } from "./token-icon-source.js";
4
+ import { RoundedImage as p } from "../rounded-image/rounded-image.js";
5
+ const l = i.forwardRef(
6
+ function({
7
+ token: n,
8
+ symbol: r,
9
+ size: o = 48,
10
+ fit: t = "contain",
11
+ rounded: e = !1,
12
+ className: m,
13
+ ...a
14
+ }, c) {
15
+ return /* @__PURE__ */ f(
16
+ p,
49
17
  {
50
- ref: f,
51
- composite: i,
18
+ ref: c,
19
+ className: m,
20
+ src: d(n ?? r),
21
+ alt: "",
22
+ rounded: e,
23
+ fit: t,
24
+ width: o,
25
+ height: o,
52
26
  size: o,
53
- fit: c,
54
- rounded: s,
55
- className: a
27
+ ...a
56
28
  }
57
29
  );
58
- const p = j(i);
59
- return /* @__PURE__ */ r(
60
- m,
61
- {
62
- ref: f,
63
- className: a,
64
- src: p,
65
- alt: "",
66
- rounded: s,
67
- fit: c,
68
- width: o,
69
- height: o,
70
- size: o,
71
- ...l
72
- }
73
- );
74
- }), C = b.forwardRef(function({ composite: e, size: n, fit: o, rounded: c, className: s }, a) {
75
- const { preset: l, layers: f, scaleFactor: i = F } = e, [p, S] = f, g = T(p), U = T(S), d = Math.round(n * i);
76
- let h;
77
- switch (l) {
78
- case "centered_foreground":
79
- h = /* @__PURE__ */ x(R, { children: [
80
- /* @__PURE__ */ r(
81
- m,
82
- {
83
- className: "absolute inset-0",
84
- style: { zIndex: 0 },
85
- src: g,
86
- alt: "background",
87
- rounded: c,
88
- fit: o,
89
- size: n
90
- }
91
- ),
92
- /* @__PURE__ */ r(
93
- "div",
94
- {
95
- className: y(
96
- "absolute left-1/2 top-1/2 z-[1] -translate-x-1/2 -translate-y-1/2",
97
- "flex items-center justify-center"
98
- ),
99
- style: {
100
- width: d,
101
- height: d
102
- },
103
- children: /* @__PURE__ */ r(
104
- m,
105
- {
106
- src: U,
107
- alt: "foreground",
108
- rounded: c,
109
- fit: o,
110
- size: d
111
- }
112
- )
113
- }
114
- )
115
- ] });
116
- break;
117
- default:
118
- return console.error("Unknown TokenIcon composite preset", l), /* @__PURE__ */ r(
119
- m,
120
- {
121
- src: g,
122
- alt: "error",
123
- rounded: c,
124
- fit: o,
125
- size: n
126
- }
127
- );
128
30
  }
129
- return /* @__PURE__ */ r(
130
- "div",
131
- {
132
- ref: a,
133
- className: y("relative inline-block shrink-0", s),
134
- style: { width: n, height: n },
135
- children: h
136
- }
137
- );
138
- });
139
- C.displayName = "TokenIconComposite";
140
- v.displayName = "TokenIcon";
31
+ );
32
+ l.displayName = "TokenIcon";
141
33
  export {
142
- v as TokenIcon
34
+ l as TokenIcon
143
35
  };
@@ -1,32 +1,3 @@
1
- /** One layer of a composite icon: a token symbol to resolve, or a ready URL. */
2
- export type TokenIconLayerSource = {
3
- type: "symbol";
4
- symbol: string;
5
- } | {
6
- type: "url";
7
- url: string;
8
- };
9
- /**
10
- * Named layout preset for a composite icon. The pixel layout is `TokenIcon`'s,
11
- * never an API payload's — which is why these types live here and not in the
12
- * SDK read model.
13
- *
14
- * `centered_foreground`: background full size, foreground centered at ~65%
15
- * (a token on a plate).
16
- */
17
- export type TokenIconCompositePreset = "centered_foreground";
18
- /** Client-composed token icon: layers stacked by preset. */
19
- export type IconComposite = {
20
- kind: "composite";
21
- preset: TokenIconCompositePreset;
22
- scaleFactor?: number;
23
- /** Exactly two layers (bottom then top). */
24
- layers: readonly [TokenIconLayerSource, TokenIconLayerSource];
25
- };
26
- /** Same shape as `TokenIcon`'s `symbol` prop — kept here to avoid a cycle. */
27
- export type TokenIconSource = string | {
28
- icon: string;
29
- } | IconComposite;
30
1
  /**
31
2
  * Everything the resolver needs from a token. Structural on purpose so the SDK
32
3
  * read-model `Token`, the `TokenData` class, and bare metadata all fit without
@@ -36,17 +7,8 @@ export interface TokenIconInput {
36
7
  symbol: string;
37
8
  }
38
9
  /**
39
- * Underlying symbol of a pool share token, or `undefined` when the symbol is
40
- * an ordinary token. Falling through is safe: the caller then uses the token's
41
- * own CDN asset.
42
- */
43
- export declare function parseShareTokenUnderlying(symbol: string): string | undefined;
44
- /**
45
- * Resolve a token (or bare symbol) into the value `TokenIcon` renders.
46
- *
47
- * Pure front-end concern: share token composites and the GEAR logo special
48
- * case are derived from the symbol alone — callers must not pre-bake `icon` /
49
- * `iconUrl`, and should hand the token to `TokenIcon` rather than calling this
50
- * directly.
10
+ * CDN asset for a token (or bare symbol). Every symbol maps to its own file —
11
+ * share tokens included, the CDN ships `dusdcv3.svg`, `sdwethv3.svg`,
12
+ * `wdwsteth.svg` and friends.
51
13
  */
52
- export declare function getTokenIcon(token: TokenIconInput | string | undefined): TokenIconSource | undefined;
14
+ export declare function getTokenIconUrl(token: TokenIconInput | string | undefined): string;
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { IconComposite, TokenIconInput } from './token-icon-source';
2
+ import { TokenIconInput } from './token-icon-source';
3
3
  import { RoundedImageProps } from '../rounded-image/rounded-image';
4
4
  /**
5
5
  * TokenIcon — component for displaying token/asset icons.
@@ -10,9 +10,8 @@ import { RoundedImageProps } from '../rounded-image/rounded-image';
10
10
  *
11
11
  * Props:
12
12
  * - `token` — token as it comes from the SDK/backend, or a bare symbol (preferred).
13
- * The component resolves the icon itself via `getTokenIcon`, so callers never
14
- * pass a pre-baked URL.
15
- * - `symbol` — already-resolved source: direct icon URL or `IconComposite` (legacy).
13
+ * The component resolves the CDN url itself, so callers never pass one.
14
+ * - `symbol` — bare symbol, same thing for call sites that have no token object.
16
15
  * - `size` — icon size in pixels (defaults to 48).
17
16
  *
18
17
  * Note: Fetches icon from Gearbox static CDN based on symbol.
@@ -20,26 +19,16 @@ import { RoundedImageProps } from '../rounded-image/rounded-image';
20
19
  * Symbol is normalized (removes "/", spaces, "-f", converts "-" to "_", lowercased).
21
20
  * Icon displays in its original shape (not clipped).
22
21
  *
23
- * **Ref behavior:** In the default single-image mode, `ref` is attached to the underlying `<img>`.
24
- * In composite mode, `ref` is attached to the outer wrapper `div` (see `TokenIconProps` / `forwardRef` generic).
25
- *
26
22
  * Do NOT use TokenIcon:
27
23
  * - for address identifiers (use Identicon component).
28
24
  * - for custom images or logos (use Image component).
29
25
  */
30
- type DirectIcon = {
31
- icon: string;
32
- };
33
- export type SymbolOrIcon = string | DirectIcon | IconComposite;
34
26
  export interface TokenIconProps extends Omit<RoundedImageProps, "src" | "size"> {
35
- /**
36
- * Token (or bare symbol). When set, takes precedence over `symbol` and is
37
- * resolved via `getTokenIcon` (diesel composites, GEAR logo, etc.).
38
- */
27
+ /** Token (or bare symbol). Takes precedence over `symbol` when both are set. */
39
28
  token?: TokenIconInput | string;
40
- symbol?: SymbolOrIcon | undefined;
29
+ symbol?: string | undefined;
41
30
  size?: number;
42
31
  className?: string;
43
32
  }
44
- declare const TokenIcon: React.ForwardRefExoticComponent<TokenIconProps & React.RefAttributes<HTMLDivElement | HTMLImageElement>>;
33
+ declare const TokenIcon: React.ForwardRefExoticComponent<TokenIconProps & React.RefAttributes<HTMLImageElement>>;
45
34
  export { TokenIcon };
@@ -9,7 +9,7 @@ declare const tokenSymbolVariants: (props?: ({
9
9
  export interface TokenSymbolProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">, VariantProps<typeof tokenSymbolVariants> {
10
10
  /**
11
11
  * SDK `Token`, `TokenMetaInfo`, or bare symbol string. Passed straight to
12
- * `TokenIcon`, which resolves the icon via `getTokenIcon`.
12
+ * `TokenIcon`, which resolves the CDN url from the symbol.
13
13
  */
14
14
  token?: Token | TokenMetaInfo | string;
15
15
  /**
@@ -2,7 +2,7 @@ import { Address } from 'viem';
2
2
  /**
3
3
  * Token metadata as it arrives from the SDK or backend. Deliberately carries no
4
4
  * icon field: icons are a front-end concern resolved from the symbol by
5
- * `getTokenIcon` inside `TokenIcon`.
5
+ * `getTokenIconUrl` inside `TokenIcon`.
6
6
  */
7
7
  export type TokenMetaInfo = {
8
8
  symbol: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/ui-kit",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Internal UI components",
5
5
  "repository": {
6
6
  "type": "git",