Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/bridge-v2' into tmp/20241108
Browse files Browse the repository at this point in the history
  • Loading branch information
dmy147 committed Nov 11, 2024
2 parents 4ac6f8c + 1ff0092 commit 85640b1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
4 changes: 3 additions & 1 deletion src/ui/views/Bridge/Component/BridgeContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const BridgeContent = () => {
setFetchingBridgeQuote(true);
const { tx } = await pRetry(
() =>
wallet.openapi.getBridgeQuote({
wallet.openapi.getBridgeQuoteTxV2({
aggregator_id: selectedBridgeQuote.aggregator.id,
bridge_id: selectedBridgeQuote.bridge_id,
from_token_id: fromToken.id,
Expand All @@ -156,6 +156,7 @@ export const BridgeContent = () => {
.toString(),
to_chain_id: toToken.chain,
to_token_id: toToken.id,
slippage: new BigNumber(slippageState).div(100).toString(10),
}),
{ retries: 1 }
);
Expand Down Expand Up @@ -233,6 +234,7 @@ export const BridgeContent = () => {
wallet,
amount,
rbiSource,
slippageState,
]);

const buildTxs = useMemoizedFn(async () => {
Expand Down
1 change: 1 addition & 0 deletions src/ui/views/Bridge/Component/BridgeSlippage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const SlippageItem = styled.div`
background: var(--r-neutral-card-1, #fff);
border-radius: 6px;
overflow: hidden;
color: var(--r-neutral-title1, #192945);
&.input-wrapper {
border: 1px solid var(--r-neutral-line, #e0e5ec);
Expand Down
27 changes: 18 additions & 9 deletions src/ui/views/Bridge/Component/BridgeToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,26 +83,24 @@ export const BridgeToken = ({
const supportedChains = useRabbySelector((s) => s.bridge.supportedChains);

const isFromToken = type === 'from';
const isToken = type === 'to';

const name = type === 'from' ? t('page.bridge.From') : t('page.bridge.To');
const name = isFromToken ? t('page.bridge.From') : t('page.bridge.To');
const chainObj = findChainByEnum(chain);

const openFeePopup = useSetSettingVisible();

const inputRef = useRef<Input>();

useLayoutEffect(() => {
if (type === 'from') {
if (isFromToken) {
if (document?.activeElement !== inputRef.current?.input) {
inputRef.current?.focus();
}
}
}, [value]);

const showNoQuote = useMemo(() => type === 'to' && !!noQuote, [
type,
noQuote,
]);
const showNoQuote = useMemo(() => isToken && !!noQuote, [type, noQuote]);

const useValue = useMemo(() => {
if (token && value) {
Expand Down Expand Up @@ -174,7 +172,7 @@ export const BridgeToken = ({
ref={inputRef as any}
/>
)}
{type === 'to' ? (
{isToken ? (
<BridgeToTokenSelect
drawerHeight={540}
fromChainId={fromChainId!}
Expand Down Expand Up @@ -207,8 +205,19 @@ export const BridgeToken = ({
)}
>
<div className="flex items-center gap-2">
<span>{useValue}</span>
{type === 'to' && !!value && (
{valueLoading ? (
<SkeletonInput
active
className="rounded-[4px]"
style={{
width: 36,
height: 16,
}}
/>
) : (
<span>{useValue}</span>
)}
{isToken && !!value && (
<RcIconInfoCC
onClick={() => openFeePopup(true)}
viewBox="0 0 14 14"
Expand Down

0 comments on commit 85640b1

Please sign in to comment.