Skip to content

Commit

Permalink
[NO CHANGELOG] [Commerce Widget] fix:Set toProvider (#2420)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyounglee authored Nov 26, 2024
1 parent c82b87b commit 675f001
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,16 +245,14 @@ export default function CommerceWidget(props: CommerceWidgetInputs) {
/>
)}
{/* --- Widgets that require providers context --- */}
{shouldWrapWithProvidersContext && (
<ProvidersContextProvider initialState={{ checkout }}>
{view.type === CommerceFlowType.ADD_TOKENS && (
<AddTokensWidget
config={widgetsConfig}
{...(view.data.params || {})}
{...(view.data.config || {})}
showBackButton={showBackButton}
/>
)}
{shouldWrapWithProvidersContext && view.type === CommerceFlowType.ADD_TOKENS && (
<ProvidersContextProvider initialState={{ checkout, toProvider: view.data.params.toProvider }}>
<AddTokensWidget
config={widgetsConfig}
{...(view.data.params || {})}
{...(view.data.config || {})}
showBackButton={showBackButton}
/>
</ProvidersContextProvider>
)}
{/* --- Widgets that require connect loader --- */}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ export class CommerceWidgetRoot extends Base<WidgetType.IMMUTABLE_COMMERCE> {
validatedParams.toTokenAddress = '';
}

if (!params.toProvider?.provider) {
// eslint-disable-next-line no-console
console.warn('[IMTBL]: invalid "toProvider" widget input');
validatedParams.toProvider = undefined;
}

return validatedParams;
}

Expand Down

0 comments on commit 675f001

Please sign in to comment.