Skip to content

Commit 11e831e

Browse files
committed
nit: adjust chain icon position
1 parent a906c6e commit 11e831e

File tree

4 files changed

+77
-35
lines changed

4 files changed

+77
-35
lines changed

packages/thirdweb/src/react/core/hooks/usePaymentMethods.ts

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { routes } from "../../../bridge/Routes.js";
33
import type { Token } from "../../../bridge/types/Token.js";
44
import { getCachedChain } from "../../../chains/utils.js";
55
import type { ThirdwebClient } from "../../../client/client.js";
6-
import { NATIVE_TOKEN_ADDRESS } from "../../../constants/addresses.js";
76
import { isInsightEnabled } from "../../../insight/common.js";
87
import { getOwnedTokens } from "../../../insight/get-tokens.js";
98
import { toTokens } from "../../../utils/units.js";
@@ -199,36 +198,3 @@ export function usePaymentMethods(options: {
199198
refetch: routesQuery.refetch,
200199
};
201200
}
202-
203-
function sortOwnedTokens(
204-
owned: OwnedTokenWithQuote[],
205-
destinationToken: Token,
206-
) {
207-
return [
208-
...owned.filter((t) => t.originToken.chainId === destinationToken.chainId),
209-
...owned.filter(
210-
(t) =>
211-
t.originToken.chainId !== destinationToken.chainId &&
212-
t.originToken.address.toLowerCase() ===
213-
NATIVE_TOKEN_ADDRESS.toLowerCase(),
214-
),
215-
...owned.filter(
216-
(t) =>
217-
t.originToken.chainId !== destinationToken.chainId &&
218-
t.originToken.symbol === "USDC",
219-
),
220-
...owned.filter(
221-
(t) =>
222-
t.originToken.chainId !== destinationToken.chainId &&
223-
t.originToken.symbol === "USDT",
224-
),
225-
...owned.filter(
226-
(t) =>
227-
t.originToken.chainId !== destinationToken.chainId &&
228-
t.originToken.address.toLowerCase() !==
229-
NATIVE_TOKEN_ADDRESS.toLowerCase() &&
230-
t.originToken.symbol !== "USDC" &&
231-
t.originToken.symbol !== "USDT",
232-
),
233-
];
234-
}

packages/thirdweb/src/react/web/ui/Bridge/TokenAndChain.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function TokenAndChain({
5656
style={{
5757
position: "absolute",
5858
bottom: "-2px",
59-
right: "-2px",
59+
right: "-6px",
6060
width: size === "lg" || size === "xl" ? iconSize.sm : iconSize.xs,
6161
height:
6262
size === "lg" || size === "xl" ? iconSize.sm : iconSize.xs,

packages/thirdweb/src/stories/Bridge/RoutePreview.stories.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
STORY_MOCK_WALLET,
1111
buyWithApprovalQuote,
1212
complexBuyQuote,
13+
longTokenNameBuyQuote,
1314
onrampWithSwapsQuote,
1415
simpleBuyQuote,
1516
simpleOnrampQuote,
@@ -219,6 +220,23 @@ export const BuySimpleLight: Story = {
219220
},
220221
};
221222

223+
export const BuyWithLongTokenName: Story = {
224+
args: {
225+
theme: "dark",
226+
preparedQuote: longTokenNameBuyQuote,
227+
paymentMethod: ethCryptoPaymentMethod,
228+
client: storyClient,
229+
},
230+
parameters: {
231+
backgrounds: { default: "dark" },
232+
docs: {
233+
description: {
234+
story: "Simple buy quote with a single transaction (light theme).",
235+
},
236+
},
237+
},
238+
};
239+
222240
export const BuyWithApproval: Story = {
223241
args: {
224242
theme: "dark",

packages/thirdweb/src/stories/Bridge/fixtures.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,64 @@ export const simpleBuyQuote: BridgePrepareResult = JSON.parse(
273273
}),
274274
);
275275

276+
export const longTokenNameBuyQuote: BridgePrepareResult = JSON.parse(
277+
stringify({
278+
type: "buy",
279+
originAmount: 1000000000000000000n, // 1 ETH
280+
destinationAmount: 100000000n, // 100 USDC
281+
timestamp: Date.now(),
282+
estimatedExecutionTimeMs: 60000,
283+
steps: [
284+
{
285+
originToken: {
286+
chainId: 1,
287+
address: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
288+
name: "Ethereum",
289+
symbol: "ETH",
290+
decimals: 18,
291+
priceUsd: 2500.0,
292+
iconUri:
293+
"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
294+
},
295+
destinationToken: {
296+
chainId: 42793,
297+
address: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
298+
name: "USD Coin (USDC.e on Etherlink)",
299+
symbol: "USDC.e",
300+
decimals: 6,
301+
priceUsd: 1.0,
302+
iconUri:
303+
"https://assets.coingecko.com/coins/images/6319/large/USD_Coin_icon.png",
304+
},
305+
originAmount: 1000000000000000000n,
306+
destinationAmount: 100000000n,
307+
estimatedExecutionTimeMs: 60000,
308+
transactions: [
309+
{
310+
action: "buy",
311+
id: "0xsingle123",
312+
to: "0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45",
313+
data: "0x472b43f3",
314+
value: 1000000000000000000n,
315+
chainId: 1,
316+
client: storyClient,
317+
chain: defineChain(1),
318+
},
319+
],
320+
},
321+
],
322+
intent: {
323+
originChainId: 1,
324+
originTokenAddress: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
325+
destinationChainId: 1,
326+
destinationTokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
327+
amount: 100000000n,
328+
sender: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
329+
receiver: "0xa3841994009B4fEabb01ebcC62062F9E56F701CD",
330+
},
331+
}),
332+
);
333+
276334
// Buy quote with approval + buy in single step
277335
export const buyWithApprovalQuote: BridgePrepareResult = JSON.parse(
278336
stringify({

0 commit comments

Comments
 (0)