Skip to content

Commit 5a08176

Browse files
[thirdweb] fix: Respect supportedTokens override in PayEmbed (#6283)
1 parent 647c285 commit 5a08176

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

.changeset/sweet-items-compare.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Respect supportedTokens override in PayEmbed

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -932,13 +932,15 @@ function createSupportedTokens(
932932
payOptions: PayUIOptions,
933933
supportedTokensOverrides?: SupportedTokens,
934934
): SupportedTokens {
935-
const tokens: SupportedTokens = {};
935+
// dev override
936+
if (supportedTokensOverrides) {
937+
return supportedTokensOverrides;
938+
}
936939

940+
const tokens: SupportedTokens = {};
937941
const isBuyWithFiatDisabled = payOptions.buyWithFiat === false;
938942
const isBuyWithCryptoDisabled = payOptions.buyWithCrypto === false;
939943

940-
// FIXME (pay) when buywithFiat is disabled, missing a bunch of tokens on base??
941-
942944
for (const x of data) {
943945
tokens[x.chain.id] = x.tokens.filter((t) => {
944946
// for source tokens, data is not provided, so we include all of them
@@ -966,19 +968,6 @@ function createSupportedTokens(
966968
return true; // include the token
967969
});
968970
}
969-
970-
// override with props.supportedTokens
971-
if (supportedTokensOverrides) {
972-
for (const k in supportedTokensOverrides) {
973-
const key = Number(k);
974-
const tokenList = supportedTokensOverrides[key];
975-
976-
if (tokenList) {
977-
tokens[key] = tokenList;
978-
}
979-
}
980-
}
981-
982971
return tokens;
983972
}
984973

0 commit comments

Comments
 (0)