@pollar/react 0.10.1 → 0.11.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/dist/index.mjs CHANGED
@@ -1033,7 +1033,7 @@ var PollarModalFooter = () => {
1033
1033
  /* @__PURE__ */ jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
1034
1034
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
1035
1035
  "v",
1036
- "0.10.1"
1036
+ "0.11.0"
1037
1037
  ] })
1038
1038
  ] })
1039
1039
  ] });
@@ -3878,7 +3878,7 @@ function SendModal({ onClose }) {
3878
3878
  []
3879
3879
  );
3880
3880
  const balanceData = walletBalance.step === "loaded" ? walletBalance.data : null;
3881
- const allAssets = balanceData?.balances ?? [];
3881
+ const allAssets = (balanceData?.balances ?? []).filter((b) => b.chain === void 0 || b.chain === "STELLAR");
3882
3882
  const sortedAssets = [
3883
3883
  ...allAssets.filter((b) => b.enabledInApp),
3884
3884
  ...allAssets.filter((b) => !b.enabledInApp && (b.type === "native" || parseFloat(b.balance) > 0))
@@ -4383,7 +4383,9 @@ function SwapModal({ onClose }) {
4383
4383
  const balances = walletBalance.step === "loaded" ? walletBalance.data.balances : [];
4384
4384
  const assetRecords = enabledAssets.step === "loaded" ? enabledAssets.data.assets : [];
4385
4385
  const isLoadingData = walletBalance.step === "loading" || enabledAssets.step === "loading";
4386
- const sellOptions = balances.filter((b) => b.type === "native" || !b.trustlineRemoved).map((b) => ({ ref: toRef(b), code: b.code, issuer: b.issuer, available: b.available, enabledInApp: b.enabledInApp }));
4386
+ const sellOptions = balances.filter(
4387
+ (b) => b.type != null && (b.type === "native" || !b.trustlineRemoved)
4388
+ ).map((b) => ({ ref: toRef(b), code: b.code, issuer: b.issuer, available: b.available, enabledInApp: b.enabledInApp }));
4387
4389
  const buyKeyOfSell = selectedSell ? `${selectedSell.code}:${selectedSell.issuer ?? "native"}` : "";
4388
4390
  const optKey = (o) => `${o.code}:${o.issuer ?? "native"}`;
4389
4391
  const enabledBuy = assetRecords.map((a) => ({
@@ -5629,11 +5631,23 @@ function cropAddress2(address) {
5629
5631
  if (address.length <= 16) return address;
5630
5632
  return `${address.slice(0, 8)}...${address.slice(-8)}`;
5631
5633
  }
5632
- function BalanceItem({ record }) {
5634
+ var CHAIN_TAG = {
5635
+ STELLAR: { label: "Stellar", color: "#7d00ff" },
5636
+ POLYGON: { label: "Polygon", color: "#8247e5" },
5637
+ SOLANA: { label: "Solana", color: "#14f195" }
5638
+ };
5639
+ function ChainTag({ chain }) {
5640
+ const tag = CHAIN_TAG[chain] ?? { label: chain, color: "#6b7280" };
5641
+ return /* @__PURE__ */ jsx("span", { className: "pollar-bal-chain-tag", style: { "--pollar-chain-color": tag.color }, children: tag.label });
5642
+ }
5643
+ function BalanceItem({ record, showChain }) {
5633
5644
  const balanceDiffers = record.balance !== record.available;
5634
5645
  return /* @__PURE__ */ jsxs("div", { className: "pollar-bal-item", children: [
5635
5646
  /* @__PURE__ */ jsxs("div", { className: "pollar-bal-asset-info", children: [
5636
- /* @__PURE__ */ jsx("span", { className: "pollar-bal-asset", children: record.code }),
5647
+ /* @__PURE__ */ jsxs("span", { className: "pollar-bal-asset-code-row", children: [
5648
+ /* @__PURE__ */ jsx("span", { className: "pollar-bal-asset", children: record.code }),
5649
+ showChain && record.chain && /* @__PURE__ */ jsx(ChainTag, { chain: record.chain })
5650
+ ] }),
5637
5651
  record.issuer && /* @__PURE__ */ jsxs("span", { className: "pollar-bal-issuer", children: [
5638
5652
  /* @__PURE__ */ jsx("span", { className: "pollar-bal-issuer-addr", children: cropAddress2(record.issuer) }),
5639
5653
  /* @__PURE__ */ jsx(CopyButton, { value: record.issuer, label: "Copy issuer address", className: "pollar-copy-btn-sm" })
@@ -5730,7 +5744,7 @@ function WalletBalanceModalTemplate({
5730
5744
  "."
5731
5745
  ] }),
5732
5746
  data?.exists && data.balances.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No balances found." }),
5733
- data?.exists && data.balances.length > 0 && /* @__PURE__ */ jsx("div", { className: "pollar-bal-list", children: data.balances.map((b) => /* @__PURE__ */ jsx(BalanceItem, { record: b }, b.code + (b.issuer ?? ""))) }),
5747
+ data?.exists && data.balances.length > 0 && /* @__PURE__ */ jsx("div", { className: "pollar-bal-list", children: data.balances.map((b) => /* @__PURE__ */ jsx(BalanceItem, { record: b, showChain: data.multichain === true }, (b.chain ?? "") + b.code + (b.issuer ?? ""))) }),
5734
5748
  /* @__PURE__ */ jsx(PollarModalFooter, {})
5735
5749
  ] });
5736
5750
  }