Skip to content

Commit 579d3a5

Browse files
authored
feat: only return 1 step swap/bridge if safe (#2854)
1 parent 6c96f8e commit 579d3a5

4 files changed

Lines changed: 20 additions & 2 deletions

File tree

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM node:22-bookworm AS builder
1+
FROM node:22-alpine AS builder
2+
3+
RUN apk add --no-cache ca-certificates openssl python3 make g++ libc6-compat
24

35
ARG ENV_NAME
46
ENV ENV_NAME=$ENV_NAME
@@ -38,6 +40,8 @@ RUN corepack enable && corepack install -g pnpm@$PNPM_VERSION
3840
#NOTE: Make sure to put the following en variable after setting up corepack
3941
ENV NODE_ENV=production
4042

43+
RUN apk add --no-cache ca-certificates openssl
44+
4145
RUN addgroup --system --gid 1001 nodejs
4246
RUN adduser --system --uid 1001 nextjs
4347

src/components/Widgets/Widget.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import dynamic from 'next/dynamic';
66
import { usePathname, useRouter } from 'next/navigation';
77
import { useEffect, useMemo, useRef, useState } from 'react';
88
import { useBridgeConditions } from 'src/hooks/useBridgeConditions';
9+
import { useMultisig } from 'src/hooks/useMultisig';
910
import { useWelcomeScreen } from 'src/hooks/useWelcomeScreen';
1011
import { useActiveTabStore } from 'src/stores/activeTab';
1112
import { useContributionStore } from 'src/stores/contribution/ContributionStore';
@@ -55,6 +56,7 @@ export function Widget({
5556
const pathname = usePathname();
5657
const { account } = useAccount();
5758
const isConnectedAGW = account?.connector?.name === 'Abstract';
59+
const { isSafe } = useMultisig();
5860

5961
const { activeTab } = useActiveTabStore();
6062
const partnerName = configTheme?.uid ?? 'default';
@@ -135,6 +137,7 @@ export function Widget({
135137
allowToChains,
136138
bridgeConditions,
137139
isConnectedAGW,
140+
isSafeContext: isSafe,
138141
}),
139142
[
140143
starterVariant,
@@ -144,6 +147,7 @@ export function Widget({
144147
allowToChains,
145148
bridgeConditions,
146149
isConnectedAGW,
150+
isSafe,
147151
integratorStringByType,
148152
],
149153
);

src/components/Widgets/variants/widgetConfig/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export interface MainWidgetContext extends CommonWidgetContext {
7171
toAddress?: string;
7272
};
7373
isConnectedAGW?: boolean;
74+
isSafeContext?: boolean;
7475
}
7576

7677
export interface MissionWidgetContext extends CommonWidgetContext {

src/components/Widgets/variants/widgetConfig/useMainWidgetConfig.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,15 @@ export function useMainWidgetConfig(
118118
config.hiddenUI = [...(config.hiddenUI || []), HiddenUI.ToAddress];
119119
}
120120

121-
if (!context.isConnectedAGW) {
121+
if (context.isSafeContext) {
122+
config.sdkConfig = {
123+
...config.sdkConfig,
124+
routeOptions: {
125+
...config.sdkConfig?.routeOptions,
126+
allowSwitchChain: false,
127+
},
128+
};
129+
} else if (!context.isConnectedAGW) {
122130
config.sdkConfig = {
123131
...config.sdkConfig,
124132
routeOptions: {
@@ -137,6 +145,7 @@ export function useMainWidgetConfig(
137145
context.allowFromChains,
138146
context.allowToChains,
139147
context.isConnectedAGW,
148+
context.isSafeContext,
140149
context.bridgeConditions,
141150
deps.theme,
142151
memeListTokens,

0 commit comments

Comments
 (0)