kaleido-ui 0.1.10 → 0.1.12

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.
@@ -5402,7 +5402,9 @@ function DepositPreGeneration({
5402
5402
  amount,
5403
5403
  handleAmountChange,
5404
5404
  getUnitLabel,
5405
- generateInvoice
5405
+ generateInvoice,
5406
+ needsColorableUtxos = false,
5407
+ onOpenCreateUtxos
5406
5408
  }) {
5407
5409
  const method = METHOD_META2[currentMethod];
5408
5410
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "space-y-3", children: [
@@ -5507,18 +5509,41 @@ function DepositPreGeneration({
5507
5509
  }
5508
5510
  )
5509
5511
  ] }),
5510
- !isAutoGenerate && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Button, { variant: "cta", size: "cta", onClick: generateInvoice, disabled: loading, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
5512
+ needsColorableUtxos && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(AlertBanner, { variant: "warning", children: [
5513
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "mb-0.5 text-xs font-bold text-warning", children: "Colorable UTXOs Required" }),
5514
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-tiny text-warning/70", children: "To receive RGB assets on-chain you need at least one uncolored UTXO. Create some now and the invoice will be generated automatically." })
5515
+ ] }),
5516
+ !isAutoGenerate && (needsColorableUtxos && onOpenCreateUtxos ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Button, { variant: "cta", size: "cta", onClick: onOpenCreateUtxos, disabled: loading, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
5517
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "material-symbols-outlined text-icon-md", children: "add_circle" }),
5518
+ "Create Colorable UTXOs"
5519
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Button, { variant: "cta", size: "cta", onClick: generateInvoice, disabled: loading, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
5511
5520
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "material-symbols-outlined animate-spin text-icon-md", children: "progress_activity" }),
5512
5521
  "Generating..."
5513
5522
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [
5514
5523
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "material-symbols-outlined text-icon-md", children: "qr_code_2" }),
5515
5524
  "Generate Address"
5516
- ] }) })
5525
+ ] }) }))
5517
5526
  ] });
5518
5527
  }
5519
5528
 
5520
5529
  // src/web/components/deposit-asset-selection.tsx
5530
+ var import_react14 = require("react");
5521
5531
  var import_jsx_runtime58 = require("react/jsx-runtime");
5532
+ var PROTOCOL_BADGE = {
5533
+ RGB: { label: "RGB", className: "bg-network-rgb-chip text-network-rgb-text" },
5534
+ SPARK: { label: "Spark", className: "bg-network-spark-chip text-network-spark-text" },
5535
+ ARKADE: { label: "Arkade", className: "bg-network-arkade-chip text-network-arkade-text" }
5536
+ };
5537
+ function formatAssetBalance(asset) {
5538
+ const raw = asset.balance ?? 0;
5539
+ if (raw === 0) return "0";
5540
+ const precision = asset.precision ?? 0;
5541
+ const value = raw / Math.pow(10, precision);
5542
+ return value.toLocaleString("en-US", {
5543
+ minimumFractionDigits: 0,
5544
+ maximumFractionDigits: Math.min(precision, 8)
5545
+ });
5546
+ }
5522
5547
  function NetBadge({ icon, className }) {
5523
5548
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: cn("inline-flex items-center justify-center rounded border px-1.5 py-0.5", className), children: icon });
5524
5549
  }
@@ -5539,8 +5564,15 @@ function DepositAssetSelection({
5539
5564
  isArkadeConnected
5540
5565
  }) {
5541
5566
  const btcAsset = filteredAssets.find((asset) => asset.ticker === "BTC");
5542
- const rgbAssets = filteredAssets.filter((asset) => asset.ticker !== "BTC");
5567
+ const ownedAssets = filteredAssets.filter((asset) => asset.ticker !== "BTC").slice().sort((a, b) => (b.balance ?? 0) - (a.balance ?? 0));
5568
+ const ownedAssetsCount = ownedAssets.length;
5543
5569
  const noResults = filteredAssets.length === 0 && !!searchQuery;
5570
+ const isSearching = !!searchQuery;
5571
+ const [assetsExpanded, setAssetsExpanded] = (0, import_react14.useState)(false);
5572
+ (0, import_react14.useEffect)(() => {
5573
+ if (isSearching) setAssetsExpanded(true);
5574
+ }, [isSearching]);
5575
+ const showOwnedAssets = isSearching ? true : assetsExpanded;
5544
5576
  const newAssetOptions = [
5545
5577
  {
5546
5578
  account: "RGB",
@@ -5654,42 +5686,66 @@ function DepositAssetSelection({
5654
5686
  'No assets match "',
5655
5687
  searchQuery,
5656
5688
  '"'
5657
- ] }) : rgbAssets.map((asset) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
5658
- "button",
5659
- {
5660
- type: "button",
5661
- className: "group flex w-full items-center gap-3 rounded-2xl border border-white/8 bg-white/3 px-4 py-3 text-sm transition-all hover:border-border hover:bg-accent",
5662
- onClick: () => onSelectAsset(asset),
5663
- children: [
5664
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "relative flex-shrink-0", children: [
5665
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AssetIcon, { ticker: asset.ticker, size: 40 }),
5666
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "absolute -bottom-1 -right-1 flex size-4 items-center justify-center rounded-full border bg-card", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("img", { src: "/icons/rgb/rgb-logo.svg", className: "block h-2.5 w-2.5 object-contain", alt: "RGB" }) })
5667
- ] }),
5668
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "min-w-0 flex-1 text-left", children: [
5669
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "font-bold tracking-wide text-white transition-colors group-hover:text-primary/90", children: asset.ticker }),
5670
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "mt-0.5 truncate text-xs text-white/40", children: asset.name ?? "RGB Asset" })
5671
- ] }),
5672
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-shrink-0 gap-1", children: [
5673
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5674
- NetBadge,
5675
- {
5676
- className: "border-network-bitcoin/20 bg-network-bitcoin/15",
5677
- icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "material-symbols-outlined leading-none text-network-bitcoin", style: { fontSize: 10 }, children: "link" })
5678
- }
5679
- ),
5680
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5681
- NetBadge,
5682
- {
5683
- className: "border-warning/20 bg-warning/15",
5684
- icon: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("img", { src: "/icons/lightning/lightning.svg", className: "h-2.5 w-2.5", alt: "" })
5685
- }
5686
- )
5687
- ] }),
5688
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "material-symbols-outlined flex-shrink-0 text-icon-md text-white/20 transition-colors group-hover:text-white/50", children: "arrow_forward" })
5689
- ]
5690
- },
5691
- asset.asset_id
5692
- )),
5689
+ ] }) : ownedAssetsCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "space-y-1.5 pt-1", children: [
5690
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
5691
+ "button",
5692
+ {
5693
+ type: "button",
5694
+ "data-testid": "deposit-toggle-owned-assets",
5695
+ onClick: () => !isSearching && setAssetsExpanded((value) => !value),
5696
+ disabled: isSearching,
5697
+ className: cn(
5698
+ "flex w-full items-center gap-2 rounded-2xl border px-4 py-2.5 transition-all",
5699
+ showOwnedAssets ? "border-white/10 bg-white/4" : "border-white/8 bg-white/3 hover:border-border hover:bg-accent",
5700
+ isSearching && "cursor-default"
5701
+ ),
5702
+ children: [
5703
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-xxs font-bold uppercase tracking-[0.18em] text-white/55", children: "Your assets" }),
5704
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "rounded-full bg-white/10 px-1.5 py-0.5 text-tiny font-bold text-white/70", children: ownedAssetsCount }),
5705
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex-1" }),
5706
+ !isSearching && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "material-symbols-outlined text-icon-md text-white/40", children: showOwnedAssets ? "expand_less" : "expand_more" })
5707
+ ]
5708
+ }
5709
+ ),
5710
+ showOwnedAssets && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "space-y-1.5 duration-200 animate-in fade-in slide-in-from-top-1", children: ownedAssets.map((asset) => {
5711
+ const protocolBadge = asset.accountId ? PROTOCOL_BADGE[asset.accountId] : null;
5712
+ const balance = asset.balance ?? 0;
5713
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
5714
+ "button",
5715
+ {
5716
+ type: "button",
5717
+ "data-testid": `deposit-asset-${asset.asset_id}`,
5718
+ className: "group flex w-full items-center gap-3 rounded-2xl border border-white/8 bg-white/3 px-4 py-3 text-sm transition-all hover:border-border hover:bg-accent",
5719
+ onClick: () => onSelectAsset(asset),
5720
+ children: [
5721
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(AssetIcon, { ticker: asset.ticker, size: 40, className: "flex-shrink-0" }),
5722
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "min-w-0 flex-1 text-left", children: [
5723
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center gap-1.5", children: [
5724
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "truncate font-bold tracking-wide text-white transition-colors group-hover:text-primary/90", children: asset.ticker }),
5725
+ protocolBadge && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5726
+ "span",
5727
+ {
5728
+ className: cn(
5729
+ "shrink-0 rounded-full px-1.5 py-0.5 text-tiny font-bold uppercase tracking-wider",
5730
+ protocolBadge.className
5731
+ ),
5732
+ children: protocolBadge.label
5733
+ }
5734
+ )
5735
+ ] }),
5736
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "mt-0.5 truncate text-xs text-white/40", children: asset.name ?? "Asset" })
5737
+ ] }),
5738
+ balance > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex-shrink-0 text-right", children: [
5739
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "font-mono text-xs font-bold text-white", children: formatAssetBalance(asset) }),
5740
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "mt-0.5 text-tiny uppercase tracking-wider text-white/35", children: asset.ticker })
5741
+ ] }),
5742
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "material-symbols-outlined flex-shrink-0 text-icon-sm text-white/20 transition-colors group-hover:text-white/50", children: "arrow_forward" })
5743
+ ]
5744
+ },
5745
+ asset.asset_id
5746
+ );
5747
+ }) })
5748
+ ] }) : null,
5693
5749
  !searchQuery && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "pb-1 pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
5694
5750
  "button",
5695
5751
  {
@@ -5846,7 +5902,9 @@ function DepositInvoiceGeneration({
5846
5902
  arkSubMode,
5847
5903
  setArkSubMode,
5848
5904
  btcSelectedAccount,
5849
- gen
5905
+ gen,
5906
+ needsColorableUtxos,
5907
+ onOpenCreateUtxos
5850
5908
  }) {
5851
5909
  const {
5852
5910
  amount,
@@ -6067,7 +6125,9 @@ function DepositInvoiceGeneration({
6067
6125
  amount,
6068
6126
  handleAmountChange,
6069
6127
  getUnitLabel,
6070
- generateInvoice
6128
+ generateInvoice,
6129
+ needsColorableUtxos,
6130
+ onOpenCreateUtxos
6071
6131
  }
6072
6132
  ) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
6073
6133
  DepositGeneratedView,
@@ -1163,14 +1163,25 @@ interface DepositPreGenerationProps {
1163
1163
  handleAmountChange: (event: ChangeEvent<HTMLInputElement>) => void;
1164
1164
  getUnitLabel: () => string;
1165
1165
  generateInvoice: () => Promise<void>;
1166
+ /**
1167
+ * RGB on-chain only: true when the user needs to create at least one
1168
+ * uncolored UTXO before an invoice can be generated.
1169
+ */
1170
+ needsColorableUtxos?: boolean;
1171
+ /** Invoked by the inline "Create Colorable UTXOs" CTA. */
1172
+ onOpenCreateUtxos?: () => void;
1166
1173
  }
1167
- declare function DepositPreGeneration({ selectedAsset, isBtc, network, net, selectedAccount, currentMethod, channelsLoading, showChannelWarning, showLiquidityWarning, isAutoGenerate, loading, usePrivacy, setUsePrivacy, amount, handleAmountChange, getUnitLabel, generateInvoice, }: DepositPreGenerationProps): react_jsx_runtime.JSX.Element;
1174
+ declare function DepositPreGeneration({ selectedAsset, isBtc, network, net, selectedAccount, currentMethod, channelsLoading, showChannelWarning, showLiquidityWarning, isAutoGenerate, loading, usePrivacy, setUsePrivacy, amount, handleAmountChange, getUnitLabel, generateInvoice, needsColorableUtxos, onOpenCreateUtxos, }: DepositPreGenerationProps): react_jsx_runtime.JSX.Element;
1168
1175
 
1169
1176
  interface DepositSelectionAsset {
1170
1177
  asset_id: string;
1171
1178
  ticker: string;
1172
1179
  name?: string;
1173
1180
  precision?: number;
1181
+ /** Account/protocol the asset lives on — drives the protocol badge in "Your assets". */
1182
+ accountId?: DepositAccountId;
1183
+ /** Spendable balance in raw (smallest) units; used for sorting and the right-aligned amount. */
1184
+ balance?: number;
1174
1185
  }
1175
1186
  interface DepositAssetSelectionProps<TView extends string = string> {
1176
1187
  setCurrentView: (view: TView) => void;
@@ -1242,8 +1253,15 @@ interface DepositInvoiceGenerationProps {
1242
1253
  setArkSubMode: (mode: 'ark' | 'boarding') => void;
1243
1254
  btcSelectedAccount: DepositAccountId;
1244
1255
  gen: DepositGenerationController;
1256
+ /**
1257
+ * RGB on-chain only: when true, the pre-generation step shows a warning
1258
+ * banner and swaps the Generate CTA for "Create Colorable UTXOs". Wire
1259
+ * `onOpenCreateUtxos` to open your own RGB UTXO creation modal.
1260
+ */
1261
+ needsColorableUtxos?: boolean;
1262
+ onOpenCreateUtxos?: () => void;
1245
1263
  }
1246
- declare function DepositInvoiceGeneration({ handleBack, handleDone, selectedAsset, selectedAssetId, isNewAsset, channelsLoading, channels, network, setNetwork, isLightningAvailable, isRgbConnected, isSparkConnected, isArkadeConnected, isSparkLightning, maxDepositAmount, usePrivacy, setUsePrivacy, walletChoice, setWalletChoice, arkSubMode, setArkSubMode, btcSelectedAccount, gen, }: DepositInvoiceGenerationProps): react_jsx_runtime.JSX.Element;
1264
+ declare function DepositInvoiceGeneration({ handleBack, handleDone, selectedAsset, selectedAssetId, isNewAsset, channelsLoading, channels, network, setNetwork, isLightningAvailable, isRgbConnected, isSparkConnected, isArkadeConnected, isSparkLightning, maxDepositAmount, usePrivacy, setUsePrivacy, walletChoice, setWalletChoice, arkSubMode, setArkSubMode, btcSelectedAccount, gen, needsColorableUtxos, onOpenCreateUtxos, }: DepositInvoiceGenerationProps): react_jsx_runtime.JSX.Element;
1247
1265
 
1248
1266
  type ToasterToast = ToastProps & {
1249
1267
  id: string;
@@ -1163,14 +1163,25 @@ interface DepositPreGenerationProps {
1163
1163
  handleAmountChange: (event: ChangeEvent<HTMLInputElement>) => void;
1164
1164
  getUnitLabel: () => string;
1165
1165
  generateInvoice: () => Promise<void>;
1166
+ /**
1167
+ * RGB on-chain only: true when the user needs to create at least one
1168
+ * uncolored UTXO before an invoice can be generated.
1169
+ */
1170
+ needsColorableUtxos?: boolean;
1171
+ /** Invoked by the inline "Create Colorable UTXOs" CTA. */
1172
+ onOpenCreateUtxos?: () => void;
1166
1173
  }
1167
- declare function DepositPreGeneration({ selectedAsset, isBtc, network, net, selectedAccount, currentMethod, channelsLoading, showChannelWarning, showLiquidityWarning, isAutoGenerate, loading, usePrivacy, setUsePrivacy, amount, handleAmountChange, getUnitLabel, generateInvoice, }: DepositPreGenerationProps): react_jsx_runtime.JSX.Element;
1174
+ declare function DepositPreGeneration({ selectedAsset, isBtc, network, net, selectedAccount, currentMethod, channelsLoading, showChannelWarning, showLiquidityWarning, isAutoGenerate, loading, usePrivacy, setUsePrivacy, amount, handleAmountChange, getUnitLabel, generateInvoice, needsColorableUtxos, onOpenCreateUtxos, }: DepositPreGenerationProps): react_jsx_runtime.JSX.Element;
1168
1175
 
1169
1176
  interface DepositSelectionAsset {
1170
1177
  asset_id: string;
1171
1178
  ticker: string;
1172
1179
  name?: string;
1173
1180
  precision?: number;
1181
+ /** Account/protocol the asset lives on — drives the protocol badge in "Your assets". */
1182
+ accountId?: DepositAccountId;
1183
+ /** Spendable balance in raw (smallest) units; used for sorting and the right-aligned amount. */
1184
+ balance?: number;
1174
1185
  }
1175
1186
  interface DepositAssetSelectionProps<TView extends string = string> {
1176
1187
  setCurrentView: (view: TView) => void;
@@ -1242,8 +1253,15 @@ interface DepositInvoiceGenerationProps {
1242
1253
  setArkSubMode: (mode: 'ark' | 'boarding') => void;
1243
1254
  btcSelectedAccount: DepositAccountId;
1244
1255
  gen: DepositGenerationController;
1256
+ /**
1257
+ * RGB on-chain only: when true, the pre-generation step shows a warning
1258
+ * banner and swaps the Generate CTA for "Create Colorable UTXOs". Wire
1259
+ * `onOpenCreateUtxos` to open your own RGB UTXO creation modal.
1260
+ */
1261
+ needsColorableUtxos?: boolean;
1262
+ onOpenCreateUtxos?: () => void;
1245
1263
  }
1246
- declare function DepositInvoiceGeneration({ handleBack, handleDone, selectedAsset, selectedAssetId, isNewAsset, channelsLoading, channels, network, setNetwork, isLightningAvailable, isRgbConnected, isSparkConnected, isArkadeConnected, isSparkLightning, maxDepositAmount, usePrivacy, setUsePrivacy, walletChoice, setWalletChoice, arkSubMode, setArkSubMode, btcSelectedAccount, gen, }: DepositInvoiceGenerationProps): react_jsx_runtime.JSX.Element;
1264
+ declare function DepositInvoiceGeneration({ handleBack, handleDone, selectedAsset, selectedAssetId, isNewAsset, channelsLoading, channels, network, setNetwork, isLightningAvailable, isRgbConnected, isSparkConnected, isArkadeConnected, isSparkLightning, maxDepositAmount, usePrivacy, setUsePrivacy, walletChoice, setWalletChoice, arkSubMode, setArkSubMode, btcSelectedAccount, gen, needsColorableUtxos, onOpenCreateUtxos, }: DepositInvoiceGenerationProps): react_jsx_runtime.JSX.Element;
1247
1265
 
1248
1266
  type ToasterToast = ToastProps & {
1249
1267
  id: string;
package/dist/web/index.js CHANGED
@@ -5247,7 +5247,9 @@ function DepositPreGeneration({
5247
5247
  amount,
5248
5248
  handleAmountChange,
5249
5249
  getUnitLabel,
5250
- generateInvoice
5250
+ generateInvoice,
5251
+ needsColorableUtxos = false,
5252
+ onOpenCreateUtxos
5251
5253
  }) {
5252
5254
  const method = METHOD_META2[currentMethod];
5253
5255
  return /* @__PURE__ */ jsxs44("div", { className: "space-y-3", children: [
@@ -5352,18 +5354,41 @@ function DepositPreGeneration({
5352
5354
  }
5353
5355
  )
5354
5356
  ] }),
5355
- !isAutoGenerate && /* @__PURE__ */ jsx57(Button, { variant: "cta", size: "cta", onClick: generateInvoice, disabled: loading, children: loading ? /* @__PURE__ */ jsxs44("span", { className: "flex items-center justify-center gap-2", children: [
5357
+ needsColorableUtxos && /* @__PURE__ */ jsxs44(AlertBanner, { variant: "warning", children: [
5358
+ /* @__PURE__ */ jsx57("p", { className: "mb-0.5 text-xs font-bold text-warning", children: "Colorable UTXOs Required" }),
5359
+ /* @__PURE__ */ jsx57("p", { className: "text-tiny text-warning/70", children: "To receive RGB assets on-chain you need at least one uncolored UTXO. Create some now and the invoice will be generated automatically." })
5360
+ ] }),
5361
+ !isAutoGenerate && (needsColorableUtxos && onOpenCreateUtxos ? /* @__PURE__ */ jsx57(Button, { variant: "cta", size: "cta", onClick: onOpenCreateUtxos, disabled: loading, children: /* @__PURE__ */ jsxs44("span", { className: "flex items-center justify-center gap-2", children: [
5362
+ /* @__PURE__ */ jsx57("span", { className: "material-symbols-outlined text-icon-md", children: "add_circle" }),
5363
+ "Create Colorable UTXOs"
5364
+ ] }) }) : /* @__PURE__ */ jsx57(Button, { variant: "cta", size: "cta", onClick: generateInvoice, disabled: loading, children: loading ? /* @__PURE__ */ jsxs44("span", { className: "flex items-center justify-center gap-2", children: [
5356
5365
  /* @__PURE__ */ jsx57("span", { className: "material-symbols-outlined animate-spin text-icon-md", children: "progress_activity" }),
5357
5366
  "Generating..."
5358
5367
  ] }) : /* @__PURE__ */ jsxs44("span", { className: "flex items-center justify-center gap-2", children: [
5359
5368
  /* @__PURE__ */ jsx57("span", { className: "material-symbols-outlined text-icon-md", children: "qr_code_2" }),
5360
5369
  "Generate Address"
5361
- ] }) })
5370
+ ] }) }))
5362
5371
  ] });
5363
5372
  }
5364
5373
 
5365
5374
  // src/web/components/deposit-asset-selection.tsx
5375
+ import { useEffect as useEffect7, useState as useState13 } from "react";
5366
5376
  import { Fragment as Fragment13, jsx as jsx58, jsxs as jsxs45 } from "react/jsx-runtime";
5377
+ var PROTOCOL_BADGE = {
5378
+ RGB: { label: "RGB", className: "bg-network-rgb-chip text-network-rgb-text" },
5379
+ SPARK: { label: "Spark", className: "bg-network-spark-chip text-network-spark-text" },
5380
+ ARKADE: { label: "Arkade", className: "bg-network-arkade-chip text-network-arkade-text" }
5381
+ };
5382
+ function formatAssetBalance(asset) {
5383
+ const raw = asset.balance ?? 0;
5384
+ if (raw === 0) return "0";
5385
+ const precision = asset.precision ?? 0;
5386
+ const value = raw / Math.pow(10, precision);
5387
+ return value.toLocaleString("en-US", {
5388
+ minimumFractionDigits: 0,
5389
+ maximumFractionDigits: Math.min(precision, 8)
5390
+ });
5391
+ }
5367
5392
  function NetBadge({ icon, className }) {
5368
5393
  return /* @__PURE__ */ jsx58("span", { className: cn("inline-flex items-center justify-center rounded border px-1.5 py-0.5", className), children: icon });
5369
5394
  }
@@ -5384,8 +5409,15 @@ function DepositAssetSelection({
5384
5409
  isArkadeConnected
5385
5410
  }) {
5386
5411
  const btcAsset = filteredAssets.find((asset) => asset.ticker === "BTC");
5387
- const rgbAssets = filteredAssets.filter((asset) => asset.ticker !== "BTC");
5412
+ const ownedAssets = filteredAssets.filter((asset) => asset.ticker !== "BTC").slice().sort((a, b) => (b.balance ?? 0) - (a.balance ?? 0));
5413
+ const ownedAssetsCount = ownedAssets.length;
5388
5414
  const noResults = filteredAssets.length === 0 && !!searchQuery;
5415
+ const isSearching = !!searchQuery;
5416
+ const [assetsExpanded, setAssetsExpanded] = useState13(false);
5417
+ useEffect7(() => {
5418
+ if (isSearching) setAssetsExpanded(true);
5419
+ }, [isSearching]);
5420
+ const showOwnedAssets = isSearching ? true : assetsExpanded;
5389
5421
  const newAssetOptions = [
5390
5422
  {
5391
5423
  account: "RGB",
@@ -5499,42 +5531,66 @@ function DepositAssetSelection({
5499
5531
  'No assets match "',
5500
5532
  searchQuery,
5501
5533
  '"'
5502
- ] }) : rgbAssets.map((asset) => /* @__PURE__ */ jsxs45(
5503
- "button",
5504
- {
5505
- type: "button",
5506
- className: "group flex w-full items-center gap-3 rounded-2xl border border-white/8 bg-white/3 px-4 py-3 text-sm transition-all hover:border-border hover:bg-accent",
5507
- onClick: () => onSelectAsset(asset),
5508
- children: [
5509
- /* @__PURE__ */ jsxs45("div", { className: "relative flex-shrink-0", children: [
5510
- /* @__PURE__ */ jsx58(AssetIcon, { ticker: asset.ticker, size: 40 }),
5511
- /* @__PURE__ */ jsx58("div", { className: "absolute -bottom-1 -right-1 flex size-4 items-center justify-center rounded-full border bg-card", children: /* @__PURE__ */ jsx58("img", { src: "/icons/rgb/rgb-logo.svg", className: "block h-2.5 w-2.5 object-contain", alt: "RGB" }) })
5512
- ] }),
5513
- /* @__PURE__ */ jsxs45("div", { className: "min-w-0 flex-1 text-left", children: [
5514
- /* @__PURE__ */ jsx58("div", { className: "font-bold tracking-wide text-white transition-colors group-hover:text-primary/90", children: asset.ticker }),
5515
- /* @__PURE__ */ jsx58("div", { className: "mt-0.5 truncate text-xs text-white/40", children: asset.name ?? "RGB Asset" })
5516
- ] }),
5517
- /* @__PURE__ */ jsxs45("div", { className: "flex flex-shrink-0 gap-1", children: [
5518
- /* @__PURE__ */ jsx58(
5519
- NetBadge,
5520
- {
5521
- className: "border-network-bitcoin/20 bg-network-bitcoin/15",
5522
- icon: /* @__PURE__ */ jsx58("span", { className: "material-symbols-outlined leading-none text-network-bitcoin", style: { fontSize: 10 }, children: "link" })
5523
- }
5524
- ),
5525
- /* @__PURE__ */ jsx58(
5526
- NetBadge,
5527
- {
5528
- className: "border-warning/20 bg-warning/15",
5529
- icon: /* @__PURE__ */ jsx58("img", { src: "/icons/lightning/lightning.svg", className: "h-2.5 w-2.5", alt: "" })
5530
- }
5531
- )
5532
- ] }),
5533
- /* @__PURE__ */ jsx58("span", { className: "material-symbols-outlined flex-shrink-0 text-icon-md text-white/20 transition-colors group-hover:text-white/50", children: "arrow_forward" })
5534
- ]
5535
- },
5536
- asset.asset_id
5537
- )),
5534
+ ] }) : ownedAssetsCount > 0 ? /* @__PURE__ */ jsxs45("div", { className: "space-y-1.5 pt-1", children: [
5535
+ /* @__PURE__ */ jsxs45(
5536
+ "button",
5537
+ {
5538
+ type: "button",
5539
+ "data-testid": "deposit-toggle-owned-assets",
5540
+ onClick: () => !isSearching && setAssetsExpanded((value) => !value),
5541
+ disabled: isSearching,
5542
+ className: cn(
5543
+ "flex w-full items-center gap-2 rounded-2xl border px-4 py-2.5 transition-all",
5544
+ showOwnedAssets ? "border-white/10 bg-white/4" : "border-white/8 bg-white/3 hover:border-border hover:bg-accent",
5545
+ isSearching && "cursor-default"
5546
+ ),
5547
+ children: [
5548
+ /* @__PURE__ */ jsx58("span", { className: "text-xxs font-bold uppercase tracking-[0.18em] text-white/55", children: "Your assets" }),
5549
+ /* @__PURE__ */ jsx58("span", { className: "rounded-full bg-white/10 px-1.5 py-0.5 text-tiny font-bold text-white/70", children: ownedAssetsCount }),
5550
+ /* @__PURE__ */ jsx58("div", { className: "flex-1" }),
5551
+ !isSearching && /* @__PURE__ */ jsx58("span", { className: "material-symbols-outlined text-icon-md text-white/40", children: showOwnedAssets ? "expand_less" : "expand_more" })
5552
+ ]
5553
+ }
5554
+ ),
5555
+ showOwnedAssets && /* @__PURE__ */ jsx58("div", { className: "space-y-1.5 duration-200 animate-in fade-in slide-in-from-top-1", children: ownedAssets.map((asset) => {
5556
+ const protocolBadge = asset.accountId ? PROTOCOL_BADGE[asset.accountId] : null;
5557
+ const balance = asset.balance ?? 0;
5558
+ return /* @__PURE__ */ jsxs45(
5559
+ "button",
5560
+ {
5561
+ type: "button",
5562
+ "data-testid": `deposit-asset-${asset.asset_id}`,
5563
+ className: "group flex w-full items-center gap-3 rounded-2xl border border-white/8 bg-white/3 px-4 py-3 text-sm transition-all hover:border-border hover:bg-accent",
5564
+ onClick: () => onSelectAsset(asset),
5565
+ children: [
5566
+ /* @__PURE__ */ jsx58(AssetIcon, { ticker: asset.ticker, size: 40, className: "flex-shrink-0" }),
5567
+ /* @__PURE__ */ jsxs45("div", { className: "min-w-0 flex-1 text-left", children: [
5568
+ /* @__PURE__ */ jsxs45("div", { className: "flex items-center gap-1.5", children: [
5569
+ /* @__PURE__ */ jsx58("span", { className: "truncate font-bold tracking-wide text-white transition-colors group-hover:text-primary/90", children: asset.ticker }),
5570
+ protocolBadge && /* @__PURE__ */ jsx58(
5571
+ "span",
5572
+ {
5573
+ className: cn(
5574
+ "shrink-0 rounded-full px-1.5 py-0.5 text-tiny font-bold uppercase tracking-wider",
5575
+ protocolBadge.className
5576
+ ),
5577
+ children: protocolBadge.label
5578
+ }
5579
+ )
5580
+ ] }),
5581
+ /* @__PURE__ */ jsx58("div", { className: "mt-0.5 truncate text-xs text-white/40", children: asset.name ?? "Asset" })
5582
+ ] }),
5583
+ balance > 0 && /* @__PURE__ */ jsxs45("div", { className: "flex-shrink-0 text-right", children: [
5584
+ /* @__PURE__ */ jsx58("div", { className: "font-mono text-xs font-bold text-white", children: formatAssetBalance(asset) }),
5585
+ /* @__PURE__ */ jsx58("div", { className: "mt-0.5 text-tiny uppercase tracking-wider text-white/35", children: asset.ticker })
5586
+ ] }),
5587
+ /* @__PURE__ */ jsx58("span", { className: "material-symbols-outlined flex-shrink-0 text-icon-sm text-white/20 transition-colors group-hover:text-white/50", children: "arrow_forward" })
5588
+ ]
5589
+ },
5590
+ asset.asset_id
5591
+ );
5592
+ }) })
5593
+ ] }) : null,
5538
5594
  !searchQuery && /* @__PURE__ */ jsx58("div", { className: "pb-1 pt-2", children: /* @__PURE__ */ jsxs45(
5539
5595
  "button",
5540
5596
  {
@@ -5691,7 +5747,9 @@ function DepositInvoiceGeneration({
5691
5747
  arkSubMode,
5692
5748
  setArkSubMode,
5693
5749
  btcSelectedAccount,
5694
- gen
5750
+ gen,
5751
+ needsColorableUtxos,
5752
+ onOpenCreateUtxos
5695
5753
  }) {
5696
5754
  const {
5697
5755
  amount,
@@ -5912,7 +5970,9 @@ function DepositInvoiceGeneration({
5912
5970
  amount,
5913
5971
  handleAmountChange,
5914
5972
  getUnitLabel,
5915
- generateInvoice
5973
+ generateInvoice,
5974
+ needsColorableUtxos,
5975
+ onOpenCreateUtxos
5916
5976
  }
5917
5977
  ) : /* @__PURE__ */ jsx59(
5918
5978
  DepositGeneratedView,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaleido-ui",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "KaleidoSwap shared UI library — design tokens, web components (Tailwind + Radix), and React Native components extending WDK UI Kit",
5
5
  "license": "MIT",
6
6
  "type": "module",