Skip to content

Commit d2939a2

Browse files
authored
Merge pull request #615 from pendulum-chain/staging
Create new production release
2 parents bedec0f + 8edf28f commit d2939a2

File tree

10 files changed

+50
-20
lines changed

10 files changed

+50
-20
lines changed

api/src/api/services/phases/handlers/brla-teleport-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class BrlaTeleportPhaseHandler extends BasePhaseHandler {
6363

6464
// Add delay to ensure the transaction is settled
6565
await new Promise((resolve) => setTimeout(resolve, 12000)); // 12 seconds, 2 moonbeam blocks.
66-
66+
6767
} catch (balanceCheckError) {
6868
if (balanceCheckError instanceof Error) {
6969
if (balanceCheckError.message === 'Balance did not meet the limit within the specified time') {

api/src/api/services/ramp/quote.service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ import { calculateTotalReceive, calculateTotalReceiveOnramp } from '../../helper
2222
import { createOnrampRouteParams, getRoute } from '../transactions/squidrouter/route';
2323
import { parseContractBalanceResponse, stringifyBigWithSignificantDecimals } from '../../helpers/contracts';
2424
import { MOONBEAM_EPHEMERAL_STARTING_BALANCE_UNITS, MOONBEAM_EPHEMERAL_STARTING_BALANCE_UNITS_ETHEREUM } from '../../../constants/constants';
25-
import { multiplyByPowerOfTen } from '../../services/pendulum/helpers';
25+
import { multiplyByPowerOfTen } from "../pendulum/helpers";
2626
/**
2727
* Trims trailing zeros from a decimal string, keeping at least two decimal places.
2828
* @param decimalString - The decimal string to format
2929
* @returns Formatted string with unnecessary trailing zeros removed but at least two decimal places
3030
*/
3131
function trimTrailingZeros(decimalString: string): string {
32-
if (!decimalString.includes('.')) {
32+
if (!decimalString?.includes('.')) {
3333
return `${decimalString}.00`;
3434
}
3535

frontend/src/components/AssetNumericInput/index.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface AssetNumericInputProps {
1212
onChange?: (e: ChangeEvent) => void;
1313
disabled?: boolean;
1414
readOnly?: boolean;
15+
loading?: boolean;
1516
registerInput: UseFormRegisterReturn<keyof RampFormValues>;
1617
id: string;
1718
}
@@ -35,10 +36,14 @@ export const AssetNumericInput: FC<AssetNumericInputProps> = ({
3536
<AssetButton disabled={rest.disabled} assetIcon={assetIcon} tokenSymbol={tokenSymbol} onClick={onClick} />
3637
</div>
3738

38-
<NumericInput
39-
register={registerInput}
40-
additionalStyle={cn('text-right text-lg', rest.readOnly && 'text-xl')}
41-
{...rest}
42-
/>
39+
{rest.loading ? (
40+
<div className="loading loading-bars loading-md ml-auto mr-4"></div>
41+
) : (
42+
<NumericInput
43+
register={registerInput}
44+
additionalStyle={cn('text-right text-lg', rest.readOnly && 'text-xl')}
45+
{...rest}
46+
/>
47+
)}
4348
</div>
4449
);

frontend/src/components/Ramp/Offramp/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { RampSubmitButtons } from '../../RampSubmitButtons';
2424
import { useQuoteService } from '../../../hooks/ramp/useQuoteService';
2525
import { useTranslation } from 'react-i18next';
2626
import { useInitializeFailedMessage } from '../../../stores/rampStore';
27+
import { useQuoteLoading } from '../../../stores/ramp/useQuoteStore';
2728

2829
export const Offramp = () => {
2930
const { t } = useTranslation();
@@ -37,6 +38,8 @@ export const Offramp = () => {
3738
const debouncedInputAmount = useDebouncedValue(inputAmount, 1000);
3839
const { outputAmount: toAmount } = useQuoteService(debouncedInputAmount, onChainToken, fiatToken);
3940

41+
const quoteLoading = useQuoteLoading();
42+
4043
// TODO: This is a hack to get the output amount to the form
4144
useEffect(() => {
4245
form.setValue('outputAmount', toAmount?.toString() || '0');
@@ -96,13 +99,14 @@ export const Offramp = () => {
9699
assetIcon={toToken.fiat.assetIcon}
97100
tokenSymbol={toToken.fiat.symbol}
98101
onClick={() => openTokenSelectModal('to')}
102+
loading={quoteLoading}
99103
registerInput={form.register('outputAmount')}
100104
disabled={!toAmount}
101105
readOnly={true}
102106
id="outputAmount"
103107
/>
104108
),
105-
[toToken.fiat.assetIcon, toToken.fiat.symbol, form, toAmount, openTokenSelectModal],
109+
[toToken.fiat.assetIcon, toToken.fiat.symbol, quoteLoading, form, toAmount, openTokenSelectModal],
106110
);
107111

108112
const handleConfirm = useCallback(() => {

frontend/src/components/Ramp/Onramp/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { useInputAmount, useOnChainToken, useFiatToken } from '../../../stores/r
2323
import { RampFeeCollapse } from '../../RampFeeCollapse';
2424
import { RampSubmitButtons } from '../../RampSubmitButtons';
2525
import { useInitializeFailedMessage } from '../../../stores/rampStore';
26+
import { useQuoteLoading } from '../../../stores/ramp/useQuoteStore';
2627

2728
export const Onramp = () => {
2829
const { t } = useTranslation();
@@ -33,6 +34,7 @@ export const Onramp = () => {
3334
const inputAmount = useInputAmount();
3435
const onChainToken = useOnChainToken();
3536
const fiatToken = useFiatToken();
37+
const quoteLoading = useQuoteLoading();
3638

3739
const debouncedInputAmount = useDebouncedValue(inputAmount, 1000);
3840

@@ -95,12 +97,13 @@ export const Onramp = () => {
9597
tokenSymbol={toToken.assetSymbol}
9698
onClick={() => openTokenSelectModal('to')}
9799
registerInput={form.register('outputAmount')}
100+
loading={quoteLoading}
98101
disabled={!toAmount}
99102
readOnly={true}
100103
id="outputAmount"
101104
/>
102105
),
103-
[toToken, form, toAmount, openTokenSelectModal],
106+
[toToken.networkAssetIcon, toToken.assetSymbol, form, quoteLoading, toAmount, openTokenSelectModal],
104107
);
105108

106109
const handleConfirm = useCallback(() => {

frontend/src/components/RampSubmitButtons/index.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import { useRampDirection } from '../../stores/rampDirectionStore';
1010
import { RampDirection } from '../RampToggle';
1111
import { useTranslation } from 'react-i18next';
1212
import { useWidgetMode } from '../../hooks/useWidgetMode';
13+
import { useQuoteStore } from '../../stores/ramp/useQuoteStore';
14+
1315

1416
interface RampSubmitButtonsProps {
1517
toAmount?: Big;
@@ -24,12 +26,16 @@ export const RampSubmitButtons: FC<RampSubmitButtonsProps> = ({ toAmount }) => {
2426
const executionInput = useRampExecutionInput()
2527
const initializeFailedMessage = useInitializeFailedMessage();
2628
const isRampSummaryDialogVisible = useRampSummaryVisible();
27-
const inputAmount = useInputAmount();
2829
const fiatToken = useFiatToken();
2930
const onChainToken = useOnChainToken();
3031
const rampDirection = useRampDirection();
3132
const isWidgetMode = useWidgetMode();
3233

34+
35+
const inputAmount = useInputAmount();
36+
const { quote } = useQuoteStore();
37+
const quoteInputAmount = quote?.inputAmount;
38+
3339
const handleCompareFeesClick = useCallback(
3440
(e: React.MouseEvent) => {
3541
e.preventDefault();
@@ -55,8 +61,9 @@ export const RampSubmitButtons: FC<RampSubmitButtonsProps> = ({ toAmount }) => {
5561
return t('components.swapSubmitButton.confirm');
5662
};
5763

58-
const isSubmitButtonDisabled = Boolean(getCurrentErrorMessage()) || !toAmount || !!initializeFailedMessage;
59-
const isSubmitButtonPending = isRampSummaryDialogVisible || Boolean(executionInput);
64+
const isQuoteOutdated = !!quoteInputAmount && !!inputAmount && !(Big(quoteInputAmount).eq(Big(inputAmount)))
65+
const isSubmitButtonDisabled = Boolean(getCurrentErrorMessage()) || !toAmount || !!initializeFailedMessage || isQuoteOutdated;
66+
const isSubmitButtonPending = isRampSummaryDialogVisible || Boolean(executionInput) || isQuoteOutdated;
6067

6168
return (
6269
<div className="flex gap-3 mt-5">

frontend/src/hooks/ramp/useRampValidation.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@ function validateOfframp(
136136
function validateTokenAvailability(
137137
t: TFunction<'translation', undefined>,
138138
fiatToken: FiatToken,
139-
trackEvent: (event: TrackableEvent) => void
139+
trackEvent: (event: TrackableEvent) => void,
140140
): string | null {
141141
if (isFiatTokenDisabled(fiatToken)) {
142142
const reason = getTokenDisabledReason(fiatToken);
143143
trackEvent({
144144
event: 'token_unavailable',
145145
token: fiatToken,
146146
});
147-
return t(reason)
147+
return t(reason);
148148
}
149149
return null;
150150
}
@@ -201,13 +201,11 @@ export const useRampValidation = () => {
201201
}
202202

203203
if (validationError) return validationError;
204-
if (quoteLoading) return t('components.swap.validation.calculatingQuote');
205204

206205
return null;
207206
}, [
208207
isDisconnected,
209208
isOnramp,
210-
quoteLoading,
211209
t,
212210
inputAmount,
213211
fromToken,

frontend/src/sections/FeeComparison/index.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
1-
import { useTranslation, Trans } from 'react-i18next';
1+
import { Trans, useTranslation } from 'react-i18next';
22

33
import { FeeComparisonTable } from './FeeComparisonTable';
44

55
import { useFeeComparisonStore } from '../../stores/feeComparison';
66
import { useEffect, useRef } from 'react';
7+
import { useRampDirection } from '../../stores/rampDirectionStore';
8+
import { RampDirection } from '../../components/RampToggle';
79

810
export const FeeComparison = () => {
911
const ref = useRef<HTMLDivElement>(null);
1012
const { t } = useTranslation();
1113
const { setFeeComparisonRef } = useFeeComparisonStore();
14+
const rampDirecton = useRampDirection();
1215

1316
useEffect(() => {
1417
setFeeComparisonRef(ref);
1518
}, [setFeeComparisonRef]);
1619

20+
if (rampDirecton === RampDirection.ONRAMP) {
21+
// We don't want to show the fee comparison section on the onramp page for now
22+
return (
23+
<section
24+
ref={ref}
25+
className="py-4 mt-10 mb-24 bg-[radial-gradient(at_74%_98%,theme(colors.blue.900),theme(colors.blue.950),theme(colors.blue.950))]"
26+
/>
27+
);
28+
}
29+
1730
return (
1831
<section
1932
ref={ref}

frontend/src/translations/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
"components": {
182182
"airdropBanner": {
183183
"title": "Special offer",
184-
"description": "Deposit R$5 or €10 to Get 20 USDT for FREE!",
184+
"description": "Buy or Sell just R$5 or €10 - get 20 USDT for FREE",
185185
"button": "More info",
186186
"list": {
187187
"1": "Buy or sell from just R$5 (PIX) or €10 (SEPA) - quick, easy, and no hidden fees.",

frontend/src/translations/pt.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
"components": {
182182
"airdropBanner": {
183183
"title": "Oferta especial",
184-
"description": "Deposite R$5 ou €10 para receber 20 USDT de graça!",
184+
"description": "Compre ou venda apenas R$5 ou €10 - receba 20 USDT de graça!",
185185
"button": "Mais informações",
186186
"list": {
187187
"1": "Compre ou venda de R$5 (PIX) ou €10 (SEPA) - rápido, fácil e sem taxas ocultas.",

0 commit comments

Comments
 (0)