diff --git a/packages/apps/src/bridges/base.ts b/packages/apps/src/bridges/base.ts
index 222e0d87b..31ed00b21 100644
--- a/packages/apps/src/bridges/base.ts
+++ b/packages/apps/src/bridges/base.ts
@@ -94,6 +94,22 @@ export abstract class BaseBridge {
return this.contract;
}
+ getSourceToken() {
+ return this.sourceToken;
+ }
+
+ getTargetToken() {
+ return this.targetToken;
+ }
+
+ getSourceChain() {
+ return this.sourceChain;
+ }
+
+ getTargetChain() {
+ return this.targetChain;
+ }
+
getEstimateTime() {
return this.estimateTime;
}
diff --git a/packages/apps/src/components/cross-chain-info.tsx b/packages/apps/src/components/cross-chain-info.tsx
index 2d3aa01c1..fac6121d2 100644
--- a/packages/apps/src/components/cross-chain-info.tsx
+++ b/packages/apps/src/components/cross-chain-info.tsx
@@ -10,11 +10,25 @@ import { Subscription, from } from "rxjs";
interface Props {
fee: { loading: boolean; value: bigint; token?: Token } | undefined;
bridge: BaseBridge | undefined;
+ maxMargin: string | undefined;
+ isLoadingMaxMargin: boolean;
}
-export default function CrossChainInfo({ fee, bridge }: Props) {
+export default function CrossChainInfo({ fee, bridge, maxMargin, isLoadingMaxMargin }: Props) {
+ const [transferLimit, setTransferLimit] = useState<{ token: Token; value: bigint }>();
const [dailyLimit, setDailyLimit] = useState<{ loading: boolean; limit: bigint; spent: bigint; token: Token }>();
+ useEffect(() => {
+ if (!isLoadingMaxMargin) {
+ const token = bridge?.getSourceToken();
+ if (maxMargin && token) {
+ setTransferLimit({ token, value: BigInt(maxMargin) });
+ } else {
+ setTransferLimit(undefined);
+ }
+ }
+ }, [bridge, maxMargin, isLoadingMaxMargin]);
+
useEffect(() => {
let sub$$: Subscription | undefined;
if (bridge) {
@@ -54,6 +68,14 @@ export default function CrossChainInfo({ fee, bridge }: Props) {
)}
+ {!!transferLimit && (
+ -
+ Transfer Limit
+
+ {formatBalance(transferLimit.value, transferLimit.token.decimals)} {transferLimit.token.symbol}
+
+
+ )}
{!!dailyLimit && (
-
Daily Limit
diff --git a/packages/apps/src/components/transfer.tsx b/packages/apps/src/components/transfer.tsx
index d7b7419e8..7e15e8172 100644
--- a/packages/apps/src/components/transfer.tsx
+++ b/packages/apps/src/components/transfer.tsx
@@ -317,6 +317,8 @@ export default function Transfer() {