Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
50c1a19
temp
MananTank Sep 12, 2025
c917607
screen cleanup
MananTank Sep 12, 2025
751bd0a
add success and error screens
MananTank Sep 12, 2025
ce099a3
resolve todo
MananTank Sep 12, 2025
ad7daa8
UI improvements
MananTank Sep 15, 2025
0b70ce8
Fix theme in select-sell ui
MananTank Sep 15, 2025
dbba64d
add JSdoc, export component
MananTank Sep 15, 2025
2fe8436
add swap widget in public token page
MananTank Sep 15, 2025
814acd6
padding changes
MananTank Sep 15, 2025
a630bc9
remove log
MananTank Sep 15, 2025
8513839
fix knip lint
MananTank Sep 15, 2025
7681650
show balance, show not enough balance error
MananTank Sep 15, 2025
a5011af
Fix notEnoughBalance
MananTank Sep 15, 2025
3d7fd1e
use Sell/prepare when selling
MananTank Sep 15, 2025
ebf6eef
Save token selection and amounts when going back
MananTank Sep 15, 2025
6fb8a4e
Merge branch 'main' into mnn/swap-ui
MananTank Sep 15, 2025
ae43ed5
Remove extra quote loading step
MananTank Sep 15, 2025
abf8eea
fix lint
MananTank Sep 15, 2025
2f2f8de
UI tweaks
MananTank Sep 15, 2025
8ff84b5
use quote when wallet is not connected
MananTank Sep 15, 2025
9d17bdc
combine owned tokens and all tokens
MananTank Sep 16, 2025
ed5ce8a
update
MananTank Sep 16, 2025
b2d6429
Fix buy widget showing payment method selection screen
MananTank Sep 16, 2025
2a78c45
ui improvements
MananTank Sep 16, 2025
654cc82
show quote error message
MananTank Sep 16, 2025
0349636
Add JSDoc, fix lint
MananTank Sep 16, 2025
1d98c3e
improve fiat onramp ui
MananTank Sep 16, 2025
8f75d50
ui updates in buy widget
MananTank Sep 16, 2025
9cf8688
better switch ux, swap label
MananTank Sep 16, 2025
b3fe76a
move token selection to modal
MananTank Sep 16, 2025
33fa31a
address comments
MananTank Sep 17, 2025
0d2d39d
pass quote to callbacks, add events
MananTank Sep 17, 2025
1405e11
add embed in chain, bridge page
MananTank Sep 17, 2025
f0c4fc8
cleanup
MananTank Sep 17, 2025
43b06e1
add changeset
MananTank Sep 17, 2025
d87c23b
fix build
MananTank Sep 17, 2025
b1f23a2
update changeset version
MananTank Sep 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/thirdweb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@
"test:ui": "NODE_OPTIONS=--max-old-space-size=8192 vitest dev -c ./test/vitest.config.ts --coverage --ui",
"test:watch": "vitest -c ./test/vitest.config.ts dev",
"typedoc": "node scripts/typedoc.mjs && node scripts/parse.mjs",
"typecheck": "tsc --project ./tsconfig.build.json --module nodenext --moduleResolution nodenext --noEmit",
"update-version": "node scripts/version.mjs"
},
"sideEffects": false,
Expand Down
2 changes: 2 additions & 0 deletions packages/thirdweb/src/bridge/types/Chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,5 @@ export interface Chain {
decimals: number;
};
}

export type BridgeChain = Chain;
46 changes: 29 additions & 17 deletions packages/thirdweb/src/pay/convert/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,34 @@
export type SupportedFiatCurrency = (typeof CURRENCIES)[number] | (string & {});

export function getFiatSymbol(showBalanceInFiat: SupportedFiatCurrency) {
switch (showBalanceInFiat) {
case "USD":
return "$";
case "CAD":
return "$";
case "GBP":
return "£";
case "EUR":
return "€";
case "JPY":
return "¥";
case "AUD":
return "$";
case "NZD":
return "$";
default:
return "$";
if (currencySymbol[showBalanceInFiat]) {
return currencySymbol[showBalanceInFiat];
}
return "$";

Check warning on line 33 in packages/thirdweb/src/pay/convert/type.ts

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/pay/convert/type.ts#L33

Added line #L33 was not covered by tests
}

const currencySymbol: Record<SupportedFiatCurrency, string> = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we actually use this? i think we can just use the built in currency formatter no?

Copy link
Member Author

@MananTank MananTank Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do that, but it's kinda more complicated because that requires creating a new instance for Intl.NumberFormat with given currency and then formatting the value and then slicing the symbol part. This is much simpler imo

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already have a utility for this i think? Check out formatCurrency()

Important to centralize these formatters/display helpers imo

Copy link
Member Author

@MananTank MananTank Sep 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I saw that, it formats the whole value as I mentioned above - but we only need the symbol here

USD: "$",
EUR: "€",
GBP: "£",
JPY: "¥",
KRW: "₩",
CNY: "¥",
INR: "₹",
NOK: "kr",
SEK: "kr",
CHF: "CHF",
AUD: "$",
CAD: "$",
NZD: "$",
MXN: "$",
BRL: "R$",
CLP: "$",
CZK: "Kč",
DKK: "kr",
HKD: "$",
HUF: "Ft",
IDR: "Rp",
ILS: "₪",
ISK: "kr",
};
3 changes: 2 additions & 1 deletion packages/thirdweb/src/react/core/design-system/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function createThemeObj(type: "dark" | "light", colors: ThemeColors): Theme {
selectedTextColor: colors.base1,

separatorLine: colors.base4,
skeletonBg: colors.base3,
skeletonBg: colors.base4,
success: colors.success,
tertiaryBg: colors.base2,

Expand Down Expand Up @@ -191,6 +191,7 @@ export const radius = {
xl: "20px",
xs: "4px",
xxl: "32px",
full: "9999px",
};

export const iconSize = {
Expand Down
2 changes: 1 addition & 1 deletion packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
</Container>

<Spacer y="md" />
<Text center color="secondaryText" size="xs">
<Text center color="secondaryText" size="xs" multiline>

Check warning on line 377 in packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/Bridge/StepRunner.tsx#L377

Added line #L377 was not covered by tests
Keep this window open until all
<br /> transactions are complete.
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function UnsupportedTokenScreen(props: UnsupportedTokenScreenProps) {
size="sm"
style={{ lineHeight: 1.5, maxWidth: "280px" }}
>
The Universal Bridge does not support testnets at this time.
Bridge does not support testnets at this time.
</Text>
</Container>
);
Expand Down Expand Up @@ -94,7 +94,7 @@ export function UnsupportedTokenScreen(props: UnsupportedTokenScreenProps) {
size="sm"
style={{ lineHeight: 1.5, maxWidth: "280px" }}
>
This token or chain is not supported by the Universal Bridge.
This token or chain is not supported by the Bridge
</Text>
</Container>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { MagnifyingGlassIcon } from "@radix-ui/react-icons";
import { iconSize, spacing } from "../../../../core/design-system/index.js";
import { Container } from "../../components/basic.js";
import { Input } from "../../components/formElements.js";

export function SearchInput(props: {
value: string;
onChange: (value: string) => void;
placeholder: string;
}) {
return (
<div
style={{
position: "relative",
}}
>
<Container color="secondaryText">
<MagnifyingGlassIcon
width={iconSize.md}
height={iconSize.md}
style={{
position: "absolute",
left: spacing.sm,
top: "50%",
transform: "translateY(-50%)",
}}
/>
</Container>

<Input
variant="outline"
placeholder={props.placeholder}
value={props.value}
style={{
paddingLeft: "44px",
}}
onChange={(e) => props.onChange(e.target.value)}
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { ChevronDownIcon } from "@radix-ui/react-icons";
import type { BridgeChain } from "../../../../../bridge/types/Chain.js";
import type { ThirdwebClient } from "../../../../../client/client.js";
import {
fontSize,
iconSize,
spacing,
} from "../../../../core/design-system/index.js";
import { Button } from "../../components/buttons.js";
import { Img } from "../../components/Img.js";
import { cleanedChainName } from "./utils.js";

export function SelectChainButton(props: {
selectedChain: BridgeChain;
client: ThirdwebClient;
onClick: () => void;
}) {
return (
<Button
variant="secondary"
fullWidth
style={{
justifyContent: "flex-start",
fontWeight: 500,
fontSize: fontSize.md,
padding: `${spacing.sm} ${spacing.sm}`,
minHeight: "48px",
}}
gap="sm"
onClick={props.onClick}
>
<Img
src={props.selectedChain.icon}
client={props.client}
width={iconSize.lg}
height={iconSize.lg}
/>
<span> {cleanedChainName(props.selectedChain.name)} </span>

<ChevronDownIcon
width={iconSize.sm}
height={iconSize.sm}
style={{ marginLeft: "auto" }}
/>
</Button>
);
}
Loading
Loading