diff --git a/src/components/SendDialog.js b/src/components/SendDialog.js
index 767de84..e0bc089 100644
--- a/src/components/SendDialog.js
+++ b/src/components/SendDialog.js
@@ -43,12 +43,10 @@ const WUSDC_MINT = new PublicKey(
const USDC_MINT = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
const WUSDT_MINT = new PublicKey(
- 'BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4'
+ 'BQcdHdAQW1hczDbBi9hiegXAR7A98Q9jx3X3iBBBDiq4',
);
-const USDT_MINT = new PublicKey(
- 'Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB'
-);
+const USDT_MINT = new PublicKey('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB');
export default function SendDialog({ open, onClose, publicKey, balanceInfo }) {
const isProdNetwork = useIsProdNetwork();
@@ -68,40 +66,34 @@ export default function SendDialog({ open, onClose, publicKey, balanceInfo }) {
if (mint?.equals(WUSDC_MINT)) {
return [
,
- ,
+ ,
,
- ]
+ ];
} else if (mint?.equals(WUSDT_MINT)) {
return [
,
- ,
+ ,
,
- ]
+ ];
+ } else if (localStorage.getItem('sollet-private') && mint?.equals(USDC_MINT)) {
+ return [
+ ,
+ ,
+ ,
+ ];
} else {
return [
+ ,
,
- ,
- ]
+ ];
}
- }
+ };
return (
<>
@@ -160,6 +152,16 @@ export default function SendDialog({ open, onClose, publicKey, balanceInfo }) {
onSubmitRef={onSubmitRef}
wusdtToSplUsdt
/>
+ ) : tab === 'usdcToSplWUsdc' ? (
+
) : (
{
if (wusdcToSplUsdc && splUsdcWalletAddress) {
setDestinationAddress(splUsdcWalletAddress);
} else if (wusdtToSplUsdt && splUsdtWalletAddress) {
setDestinationAddress(splUsdtWalletAddress);
+ } else if (usdcToSplWUsdc && splWUsdcWalletAddress) {
+ setDestinationAddress(splWUsdcWalletAddress);
}
- }, [setDestinationAddress, wusdcToSplUsdc, splUsdcWalletAddress, wusdtToSplUsdt, splUsdtWalletAddress]);
+ }, [
+ setDestinationAddress,
+ wusdcToSplUsdc,
+ splUsdcWalletAddress,
+ wusdtToSplUsdt,
+ splUsdtWalletAddress,
+ usdcToSplWUsdc,
+ splWUsdcWalletAddress,
+ ]);
async function makeTransaction() {
let amount = Math.round(parseFloat(transferAmountString) * 10 ** decimals);
@@ -387,6 +404,11 @@ function SendSwapDialog({
}
if (mint?.equals(WUSDC_MINT)) {
params.wusdcToUsdc = true;
+ } else if (mint?.equals(USDC_MINT)) {
+ if (usdcToSplWUsdc) {
+ params.usdcToWUsdc = true;
+ params.coin = WUSDC_MINT.toString();
+ }
} else if (mint?.equals(WUSDT_MINT)) {
params.wusdtToUsdt = true;
}
@@ -399,6 +421,7 @@ function SendSwapDialog({
new PublicKey(swapInfo.address),
amount,
balanceInfo.mint,
+ decimals,
swapInfo.memo,
);
}
diff --git a/src/utils/swap/api.js b/src/utils/swap/api.js
index 37c985b..022f0ee 100644
--- a/src/utils/swap/api.js
+++ b/src/utils/swap/api.js
@@ -22,6 +22,7 @@ export async function swapApiRequest(
headers['Content-Type'] = 'application/json';
params.body = JSON.stringify(body);
}
+
let resp = await fetch(`https://swap.sollet.io/api/${path}`, params);
return await handleSwapApiResponse(resp, ignoreUserErrors);
}