Skip to content

Commit

Permalink
🔥Removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPoblete committed Jun 19, 2024
1 parent 54d4a2c commit cfd2fa4
Showing 1 changed file with 4 additions and 38 deletions.
42 changes: 4 additions & 38 deletions src/hooks/useSwapCallback.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TxResponse } from '@soroban-react/contracts';
import { useSorobanReact } from '@soroban-react/core';
import { SorobanContextType, useSorobanReact } from '@soroban-react/core';
import BigNumber from 'bignumber.js';
import { DEFAULT_SLIPPAGE_INPUT_VALUE } from 'components/Settings/MaxSlippageSettings';
import { AppContext, SnackbarIconType } from 'contexts';
Expand All @@ -15,6 +15,8 @@ import * as StellarSdk from '@stellar/stellar-sdk';
import { useSWRConfig } from 'swr';
import { RouterMethod, useRouterCallback } from './useRouterCallback';



// Returns a function that will execute a swap, if the parameters are all valid
// and the user has approved the slippage adjusted input amount for the trade

Expand Down Expand Up @@ -93,49 +95,13 @@ export function useSwapCallback(
// allowedSlippage: Percent, // in bips
// permitSignature: PermitSignature | undefined
) {
console.log(trade?.path)
const { SnackbarContext } = useContext(AppContext);
const sorobanContext = useSorobanReact();
const { activeChain, address, serverHorizon } = sorobanContext;
const { activeChain, address } = sorobanContext;
const routerCallback = useRouterCallback();
const allowedSlippage = useUserSlippageToleranceWithDefault(DEFAULT_SLIPPAGE_INPUT_VALUE);

const { mutate } = useSWRConfig();

const calculateHorizonStrictSendPath = async (assetFrom?: StellarSdk.Asset, assetTo?: StellarSdk.Asset[], amount?: string) => {
if (!activeChain?.networkUrl || !serverHorizon) {
return
}
if (!assetFrom || !assetTo || !amount) {
console.error('Missing params')
return
}
const horizonPath = await serverHorizon?.strictSendPaths(
assetFrom,
amount,
assetTo
).call()
if (!horizonPath) return
return horizonPath.records
}

const calculateHorizonStrictReceivePath = async (assetFrom?: StellarSdk.Asset[], assetTo?: StellarSdk.Asset, amount?: string) => {
if (!activeChain?.networkUrl || !serverHorizon) {
return
}
if (!assetFrom || !assetTo || !amount) {
console.error('Missing params')
return
}
const horizonPath = await serverHorizon?.strictReceivePaths(
assetFrom,
assetTo,
amount
).call()
if (!horizonPath) return
return horizonPath.records
}

const doSwap = async (
simulation?: boolean,
): Promise<SuccessfullSwapResponse | StellarSdk.SorobanRpc.Api.GetTransactionResponse> => {
Expand Down

0 comments on commit cfd2fa4

Please sign in to comment.