UI - added disclaimer and slippage
This commit is contained in:
parent
e3ed8862fe
commit
409b4e0dfd
|
@ -70,7 +70,9 @@ export default function Settings({
|
||||||
type="number"
|
type="number"
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
onSlippageChange(
|
onSlippageChange(
|
||||||
clamp(parseFloat(event.target.value), 0, 100).toString()
|
event.target.value === ""
|
||||||
|
? ""
|
||||||
|
: clamp(parseFloat(event.target.value), 0, 100).toString()
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
></TextField>
|
></TextField>
|
||||||
|
@ -88,7 +90,9 @@ export default function Settings({
|
||||||
type="number"
|
type="number"
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
onDeadlineChange(
|
onDeadlineChange(
|
||||||
clamp(parseFloat(event.target.value), 1, 100).toString()
|
event.target.value === ""
|
||||||
|
? ""
|
||||||
|
: clamp(parseFloat(event.target.value), 1, 100).toString()
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
></TextField>
|
></TextField>
|
||||||
|
|
|
@ -313,10 +313,5 @@ export class UniswapToUniswapQuoter {
|
||||||
setDeadlines(deadline: string): void {
|
setDeadlines(deadline: string): void {
|
||||||
this.srcRouter.setDeadline(deadline);
|
this.srcRouter.setDeadline(deadline);
|
||||||
this.dstRouter.setDeadline(deadline);
|
this.dstRouter.setDeadline(deadline);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
estimateUstFee(gasPriceInNativeCurrency: string): string {
|
|
||||||
return "0";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -672,4 +672,26 @@ export class UniswapToUniswapExecutor {
|
||||||
this.isNative
|
this.isNative
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//getSwapResult(
|
||||||
|
// walletAddress: string,
|
||||||
|
// onSwapResult: (result: boolean) => void
|
||||||
|
//) {
|
||||||
|
// console.log(this.cachedExactInParams.dst.protocol);
|
||||||
|
// console.log(this.dstExecutionParams.crossChainSwap.address);
|
||||||
|
// const contract = makeCrossChainSwapContract(
|
||||||
|
// this.getDstProvider(),
|
||||||
|
// this.quoteType === QuoteType.ExactIn
|
||||||
|
// ? this.cachedExactInParams.dst.protocol
|
||||||
|
// : this.cachedExactOutParams.dst.protocol,
|
||||||
|
// this.dstExecutionParams.crossChainSwap.address
|
||||||
|
// );
|
||||||
|
// const filter = contract.filters.SwapResult(walletAddress);
|
||||||
|
// contract.once(
|
||||||
|
// filter,
|
||||||
|
// (recipient, tokenAddress, caller, amount, success) => {
|
||||||
|
// onSwapResult(success);
|
||||||
|
// }
|
||||||
|
// );
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ export default function Home() {
|
||||||
setSourceTokenInfo(MATIC_TOKEN_INFO);
|
setSourceTokenInfo(MATIC_TOKEN_INFO);
|
||||||
setTargetTokenInfo(ETH_TOKEN_INFO);
|
setTargetTokenInfo(ETH_TOKEN_INFO);
|
||||||
}
|
}
|
||||||
setAmountIn("0.0");
|
setAmountIn("");
|
||||||
setAmountOut("0.0");
|
setAmountOut("0.0");
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
@ -254,6 +254,7 @@ export default function Home() {
|
||||||
try {
|
try {
|
||||||
setIsSwapping(true);
|
setIsSwapping(true);
|
||||||
await switchProviderNetwork(provider, sourceTokenInfo.chainId);
|
await switchProviderNetwork(provider, sourceTokenInfo.chainId);
|
||||||
|
|
||||||
const sourceReceipt = await executor.approveAndSwap(signer);
|
const sourceReceipt = await executor.approveAndSwap(signer);
|
||||||
console.info(
|
console.info(
|
||||||
"firstSwapTransactionHash:",
|
"firstSwapTransactionHash:",
|
||||||
|
@ -270,7 +271,6 @@ export default function Home() {
|
||||||
executor.vaaSearchParams.emitterAddress,
|
executor.vaaSearchParams.emitterAddress,
|
||||||
executor.vaaSearchParams.sequence
|
executor.vaaSearchParams.sequence
|
||||||
);
|
);
|
||||||
// Check if the signedVAA has redeemed by the relayer
|
|
||||||
enqueueSnackbar(null, {
|
enqueueSnackbar(null, {
|
||||||
content: (
|
content: (
|
||||||
<Alert severity="info">
|
<Alert severity="info">
|
||||||
|
@ -278,6 +278,7 @@ export default function Home() {
|
||||||
</Alert>
|
</Alert>
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
// Check if the signedVAA has redeemed by the relayer
|
||||||
const isCompleted = await getIsTransferCompletedEvmWithRetry(
|
const isCompleted = await getIsTransferCompletedEvmWithRetry(
|
||||||
executor.dstExecutionParams.wormhole.tokenBridgeAddress,
|
executor.dstExecutionParams.wormhole.tokenBridgeAddress,
|
||||||
executor.quoter.dstProvider,
|
executor.quoter.dstProvider,
|
||||||
|
@ -309,6 +310,7 @@ export default function Home() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setIsSwapping(false);
|
setIsSwapping(false);
|
||||||
|
setAmountIn("");
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
provider,
|
provider,
|
||||||
|
@ -369,6 +371,7 @@ export default function Home() {
|
||||||
className={classes.numberField}
|
className={classes.numberField}
|
||||||
inputProps={{ readOnly: true }}
|
inputProps={{ readOnly: true }}
|
||||||
></TextField>
|
></TextField>
|
||||||
|
<Typography variant="subtitle2">{`Slippage tolerance: ${slippage}%`}</Typography>
|
||||||
{!isSwapping && <EthereumSignerKey />}
|
{!isSwapping && <EthereumSignerKey />}
|
||||||
<ButtonWithLoader
|
<ButtonWithLoader
|
||||||
disabled={!readyToSwap || isSwapping}
|
disabled={!readyToSwap || isSwapping}
|
||||||
|
@ -377,6 +380,10 @@ export default function Home() {
|
||||||
>
|
>
|
||||||
Swap
|
Swap
|
||||||
</ButtonWithLoader>
|
</ButtonWithLoader>
|
||||||
|
<div className={classes.spacer} />
|
||||||
|
<Typography variant="subtitle2" color="error">
|
||||||
|
WARNING: this is a Testnet release only
|
||||||
|
</Typography>
|
||||||
</Paper>
|
</Paper>
|
||||||
<div className={classes.spacer} />
|
<div className={classes.spacer} />
|
||||||
<Typography variant="subtitle1" color="textSecondary">
|
<Typography variant="subtitle1" color="textSecondary">
|
||||||
|
|
Loading…
Reference in New Issue