diff --git a/.changeset/sweet-items-compare.md b/.changeset/sweet-items-compare.md new file mode 100644 index 00000000000..17487083708 --- /dev/null +++ b/.changeset/sweet-items-compare.md @@ -0,0 +1,5 @@ +--- +"thirdweb": patch +--- + +Respect supportedTokens override in PayEmbed diff --git a/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx b/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx index bc6a6a7e26d..331ce36c61d 100644 --- a/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +++ b/packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx @@ -932,13 +932,15 @@ function createSupportedTokens( payOptions: PayUIOptions, supportedTokensOverrides?: SupportedTokens, ): SupportedTokens { - const tokens: SupportedTokens = {}; + // dev override + if (supportedTokensOverrides) { + return supportedTokensOverrides; + } + const tokens: SupportedTokens = {}; const isBuyWithFiatDisabled = payOptions.buyWithFiat === false; const isBuyWithCryptoDisabled = payOptions.buyWithCrypto === false; - // FIXME (pay) when buywithFiat is disabled, missing a bunch of tokens on base?? - for (const x of data) { tokens[x.chain.id] = x.tokens.filter((t) => { // for source tokens, data is not provided, so we include all of them @@ -966,19 +968,6 @@ function createSupportedTokens( return true; // include the token }); } - - // override with props.supportedTokens - if (supportedTokensOverrides) { - for (const k in supportedTokensOverrides) { - const key = Number(k); - const tokenList = supportedTokensOverrides[key]; - - if (tokenList) { - tokens[key] = tokenList; - } - } - } - return tokens; }