@swype-org/react-sdk 0.1.202 → 0.1.205

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.d.cts CHANGED
@@ -807,8 +807,10 @@ interface TokenPickerScreenProps {
807
807
  depositAmount?: number;
808
808
  /** Currently selected token symbol, e.g. "USDC" or "USDT" */
809
809
  selectedTokenSymbol?: string;
810
+ /** Currently selected wallet ID so we can identify the active token across chains */
811
+ selectedWalletId?: string;
810
812
  }
811
- declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, onLogout, depositAmount, selectedTokenSymbol, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
813
+ declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, onLogout, depositAmount, selectedTokenSymbol, selectedWalletId, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
812
814
 
813
815
  type FlowPhase = 'link' | 'deposit';
814
816
 
package/dist/index.d.ts CHANGED
@@ -807,8 +807,10 @@ interface TokenPickerScreenProps {
807
807
  depositAmount?: number;
808
808
  /** Currently selected token symbol, e.g. "USDC" or "USDT" */
809
809
  selectedTokenSymbol?: string;
810
+ /** Currently selected wallet ID so we can identify the active token across chains */
811
+ selectedWalletId?: string;
810
812
  }
811
- declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, onLogout, depositAmount, selectedTokenSymbol, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
813
+ declare function TokenPickerScreen({ account, chains, onSelectAuthorized, onAuthorizeToken, onBack, onLogout, depositAmount, selectedTokenSymbol, selectedWalletId, }: TokenPickerScreenProps): react_jsx_runtime.JSX.Element;
812
814
 
813
815
  type FlowPhase = 'link' | 'deposit';
814
816
 
package/dist/index.js CHANGED
@@ -3636,16 +3636,10 @@ function SetupScreen({
3636
3636
  onClick: onAdvanced,
3637
3637
  style: tokenIconButtonStyle(!!onAdvanced),
3638
3638
  children: [
3639
- /* @__PURE__ */ jsxs("div", { style: tokenIconWrapStyle, children: [
3640
- selectedTokenSymbol && TOKEN_LOGOS[selectedTokenSymbol] ? /* @__PURE__ */ jsx("img", { src: TOKEN_LOGOS[selectedTokenSymbol], alt: selectedTokenSymbol, width: 36, height: 36, style: { borderRadius: "50%" } }) : /* @__PURE__ */ jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
3641
- /* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
3642
- /* @__PURE__ */ jsx("text", { x: "18", y: "23", textAnchor: "middle", fontSize: "18", fill: "#fff", fontWeight: "700", children: "$" })
3643
- ] }),
3644
- /* @__PURE__ */ jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", style: checkBadgeStyle, children: [
3645
- /* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "8", fill: "#2775CA" }),
3646
- /* @__PURE__ */ jsx("path", { d: "M5 8l2 2 4-4", stroke: "#fff", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round" })
3647
- ] })
3648
- ] }),
3639
+ /* @__PURE__ */ jsx("div", { style: tokenIconWrapStyle, children: selectedTokenSymbol && TOKEN_LOGOS[selectedTokenSymbol] ? /* @__PURE__ */ jsx("img", { src: TOKEN_LOGOS[selectedTokenSymbol], alt: selectedTokenSymbol, width: 36, height: 36, style: { borderRadius: "50%" } }) : /* @__PURE__ */ jsxs("svg", { width: "36", height: "36", viewBox: "0 0 36 36", fill: "none", children: [
3640
+ /* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "18", fill: "#2DB84B" }),
3641
+ /* @__PURE__ */ jsx("text", { x: "18", y: "23", textAnchor: "middle", fontSize: "18", fill: "#fff", fontWeight: "700", children: "$" })
3642
+ ] }) }),
3649
3643
  /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", style: { opacity: 0.5 }, children: /* @__PURE__ */ jsx("path", { d: "M6 9l6 6 6-6", stroke: tokens.textMuted, strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round" }) })
3650
3644
  ]
3651
3645
  }
@@ -3744,11 +3738,6 @@ var tokenIconWrapStyle = {
3744
3738
  width: 36,
3745
3739
  height: 36
3746
3740
  };
3747
- var checkBadgeStyle = {
3748
- position: "absolute",
3749
- bottom: -1,
3750
- right: -3
3751
- };
3752
3741
  var presetsRowStyle = {
3753
3742
  display: "flex",
3754
3743
  gap: 10,
@@ -4556,7 +4545,7 @@ function SelectSourceScreen({
4556
4545
  /* @__PURE__ */ jsxs("div", { style: optionContentStyle, children: [
4557
4546
  /* @__PURE__ */ jsxs("span", { style: optionNameStyle(tokens.text), children: [
4558
4547
  chain.chainName,
4559
- isRecommended && /* @__PURE__ */ jsx("span", { style: recommendedBadgeStyle(tokens.accent), children: " recommended" })
4548
+ isRecommended && /* @__PURE__ */ jsx("span", { style: recommendedBadgeStyle(tokens.textMuted), children: " recommended" })
4560
4549
  ] }),
4561
4550
  /* @__PURE__ */ jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
4562
4551
  "$",
@@ -4573,6 +4562,7 @@ function SelectSourceScreen({
4573
4562
  /* @__PURE__ */ jsx("label", { style: labelStyle4(tokens.textSecondary), children: "Token" }),
4574
4563
  /* @__PURE__ */ jsx("div", { style: optionListStyle, children: tokenChoices.map((token) => {
4575
4564
  const isSelected = token.tokenSymbol === selectedTokenSymbol;
4565
+ const tokenLogo = TOKEN_LOGOS[token.tokenSymbol];
4576
4566
  return /* @__PURE__ */ jsxs(
4577
4567
  "button",
4578
4568
  {
@@ -4580,11 +4570,14 @@ function SelectSourceScreen({
4580
4570
  onClick: () => onTokenChange(token.tokenSymbol),
4581
4571
  style: optionButtonStyle(tokens, isSelected),
4582
4572
  children: [
4583
- /* @__PURE__ */ jsxs("div", { style: optionContentStyle, children: [
4584
- /* @__PURE__ */ jsx("span", { style: optionNameStyle(tokens.text), children: token.tokenSymbol }),
4585
- /* @__PURE__ */ jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
4586
- "$",
4587
- token.balance.toFixed(2)
4573
+ /* @__PURE__ */ jsxs("div", { style: optionMainStyle, children: [
4574
+ /* @__PURE__ */ jsx("div", { style: tokenIconCircleStyle(tokens, !!tokenLogo), children: tokenLogo ? /* @__PURE__ */ jsx("img", { src: tokenLogo, alt: token.tokenSymbol, style: tokenLogoImgStyle }) : /* @__PURE__ */ jsx("span", { style: tokenIconTextStyle(tokens.textMuted), children: "$" }) }),
4575
+ /* @__PURE__ */ jsxs("div", { style: optionContentStyle, children: [
4576
+ /* @__PURE__ */ jsx("span", { style: optionNameStyle(tokens.text), children: token.tokenSymbol }),
4577
+ /* @__PURE__ */ jsxs("span", { style: optionBalanceStyle(tokens.textMuted), children: [
4578
+ "$",
4579
+ token.balance.toFixed(2)
4580
+ ] })
4588
4581
  ] })
4589
4582
  ] }),
4590
4583
  /* @__PURE__ */ jsx("div", { style: radioStyle(tokens, isSelected), children: isSelected && /* @__PURE__ */ jsx("div", { style: radioDotStyle(tokens.accent) }) })
@@ -4637,6 +4630,11 @@ var optionContentStyle = {
4637
4630
  flexDirection: "column",
4638
4631
  gap: 2
4639
4632
  };
4633
+ var optionMainStyle = {
4634
+ display: "flex",
4635
+ alignItems: "center",
4636
+ gap: 12
4637
+ };
4640
4638
  var optionNameStyle = (color) => ({
4641
4639
  fontSize: "0.9rem",
4642
4640
  fontWeight: 600,
@@ -4652,6 +4650,28 @@ var optionBalanceStyle = (color) => ({
4652
4650
  fontSize: "0.78rem",
4653
4651
  color
4654
4652
  });
4653
+ var tokenIconCircleStyle = (tokens, hasLogo) => ({
4654
+ width: 36,
4655
+ height: 36,
4656
+ borderRadius: "50%",
4657
+ border: hasLogo ? "none" : `1.5px solid ${tokens.border}`,
4658
+ display: "flex",
4659
+ alignItems: "center",
4660
+ justifyContent: "center",
4661
+ flexShrink: 0,
4662
+ overflow: "hidden"
4663
+ });
4664
+ var tokenLogoImgStyle = {
4665
+ width: 36,
4666
+ height: 36,
4667
+ borderRadius: "50%",
4668
+ objectFit: "cover"
4669
+ };
4670
+ var tokenIconTextStyle = (color) => ({
4671
+ fontSize: "1rem",
4672
+ fontWeight: 700,
4673
+ color
4674
+ });
4655
4675
  var radioStyle = (tokens, selected) => ({
4656
4676
  width: 20,
4657
4677
  height: 20,
@@ -5223,7 +5243,8 @@ function TokenPickerScreen({
5223
5243
  onBack,
5224
5244
  onLogout,
5225
5245
  depositAmount,
5226
- selectedTokenSymbol
5246
+ selectedTokenSymbol,
5247
+ selectedWalletId
5227
5248
  }) {
5228
5249
  const { tokens: t } = useSwypeConfig();
5229
5250
  const entries = [];
@@ -5279,6 +5300,7 @@ function TokenPickerScreen({
5279
5300
  /* @__PURE__ */ jsx("div", { style: sectionLabelStyle(t.textMuted), children: "Choose token" }),
5280
5301
  /* @__PURE__ */ jsx("div", { style: tokenListStyle2, children: entries.map((entry) => {
5281
5302
  const authorized = entry.status === "AUTHORIZED";
5303
+ const isSelected = entry.walletId === selectedWalletId && entry.tokenSymbol === selectedTokenSymbol;
5282
5304
  return /* @__PURE__ */ jsxs(
5283
5305
  "button",
5284
5306
  {
@@ -5286,7 +5308,7 @@ function TokenPickerScreen({
5286
5308
  onClick: () => handleSelect(entry),
5287
5309
  style: tokenRowStyle2(t),
5288
5310
  children: [
5289
- /* @__PURE__ */ jsx("div", { style: tokenIconCircleStyle(t, !!TOKEN_LOGOS[entry.tokenSymbol]), children: TOKEN_LOGOS[entry.tokenSymbol] ? /* @__PURE__ */ jsx("img", { src: TOKEN_LOGOS[entry.tokenSymbol], alt: entry.tokenSymbol, style: tokenLogoImgStyle }) : /* @__PURE__ */ jsx("span", { style: tokenIconTextStyle(t.textMuted), children: "$" }) }),
5311
+ /* @__PURE__ */ jsx("div", { style: tokenIconCircleStyle2(t, !!TOKEN_LOGOS[entry.tokenSymbol]), children: TOKEN_LOGOS[entry.tokenSymbol] ? /* @__PURE__ */ jsx("img", { src: TOKEN_LOGOS[entry.tokenSymbol], alt: entry.tokenSymbol, style: tokenLogoImgStyle2 }) : /* @__PURE__ */ jsx("span", { style: tokenIconTextStyle2(t.textMuted), children: "$" }) }),
5290
5312
  /* @__PURE__ */ jsxs("div", { style: tokenInfoStyle2, children: [
5291
5313
  /* @__PURE__ */ jsxs("div", { style: tokenNameRowStyle, children: [
5292
5314
  /* @__PURE__ */ jsx("span", { style: tokenSymbolTextStyle(t.text), children: entry.tokenSymbol }),
@@ -5301,7 +5323,7 @@ function TokenPickerScreen({
5301
5323
  !authorized && /* @__PURE__ */ jsx("span", { style: notAuthorizedStyle(t.textMuted), children: "Not authorized" })
5302
5324
  ] })
5303
5325
  ] }),
5304
- /* @__PURE__ */ jsx("div", { style: authorized ? selectCircleSelectedStyle(t.accent) : selectCircleStyle(t.border), children: authorized && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) })
5326
+ /* @__PURE__ */ jsx("div", { style: isSelected ? selectCircleSelectedStyle(t.accent) : selectCircleStyle(t.border), children: isSelected && /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ jsx("path", { d: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z", fill: "#fff" }) }) })
5305
5327
  ]
5306
5328
  },
5307
5329
  `${entry.walletId}-${entry.tokenSymbol}-${entry.chainName}`
@@ -5366,7 +5388,7 @@ var tokenRowStyle2 = (tokens) => ({
5366
5388
  textAlign: "left",
5367
5389
  width: "100%"
5368
5390
  });
5369
- var tokenIconCircleStyle = (tokens, hasLogo) => ({
5391
+ var tokenIconCircleStyle2 = (tokens, hasLogo) => ({
5370
5392
  width: 36,
5371
5393
  height: 36,
5372
5394
  borderRadius: "50%",
@@ -5377,13 +5399,13 @@ var tokenIconCircleStyle = (tokens, hasLogo) => ({
5377
5399
  flexShrink: 0,
5378
5400
  overflow: "hidden"
5379
5401
  });
5380
- var tokenLogoImgStyle = {
5402
+ var tokenLogoImgStyle2 = {
5381
5403
  width: 36,
5382
5404
  height: 36,
5383
5405
  borderRadius: "50%",
5384
5406
  objectFit: "cover"
5385
5407
  };
5386
- var tokenIconTextStyle = (color) => ({
5408
+ var tokenIconTextStyle2 = (color) => ({
5387
5409
  fontSize: "1rem",
5388
5410
  fontWeight: 700,
5389
5411
  color
@@ -5647,7 +5669,7 @@ function StepRendererContent({
5647
5669
  selectedSourceLabel: effectiveSourceLabel,
5648
5670
  loading: savingOneTapLimit,
5649
5671
  error: state.error,
5650
- selectedTokenSymbol: selectedSource?.token.symbol
5672
+ selectedTokenSymbol: selectedSource?.token.symbol ?? selectSourceTokenSymbol
5651
5673
  }
5652
5674
  );
5653
5675
  }
@@ -5710,7 +5732,8 @@ function StepRendererContent({
5710
5732
  onBack: () => handlers.onNavigate(state.previousStep === "setup" ? "setup" : "deposit"),
5711
5733
  onLogout: handlers.onLogout,
5712
5734
  depositAmount: depositAmount ?? void 0,
5713
- selectedTokenSymbol: selectedSource?.token.symbol
5735
+ selectedTokenSymbol: selectedSource?.token.symbol,
5736
+ selectedWalletId: state.selectedWalletId
5714
5737
  }
5715
5738
  );
5716
5739
  }
@@ -7280,7 +7303,7 @@ function usePaymentEffects(deps) {
7280
7303
  accounts: accts,
7281
7304
  chains: chn,
7282
7305
  defaults,
7283
- resolvedStep: correctableSteps.includes(state.step) ? resolved.step : void 0,
7306
+ resolvedStep: correctableSteps.includes(state.step) && !state.creatingTransfer ? resolved.step : void 0,
7284
7307
  clearMobileState: resolved.clearPersistedFlow
7285
7308
  });
7286
7309
  if (resolved.clearPersistedFlow) clearMobileFlowState();