Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .changeset/sweet-items-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

Respect supportedTokens override in PayEmbed
Original file line number Diff line number Diff line change
Expand Up @@ -932,13 +932,15 @@
payOptions: PayUIOptions,
supportedTokensOverrides?: SupportedTokens,
): SupportedTokens {
const tokens: SupportedTokens = {};
// dev override
if (supportedTokensOverrides) {
return supportedTokensOverrides;
}

Check warning on line 938 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx#L936-L938

Added lines #L936 - L938 were not covered by tests

const tokens: SupportedTokens = {};

Check warning on line 940 in packages/thirdweb/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx

View check run for this annotation

Codecov / codecov/patch

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

Added line #L940 was not covered by tests
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
Expand Down Expand Up @@ -966,19 +968,6 @@
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;
}

Expand Down
Loading