Skip to content

Commit

Permalink
♻️ Refactor platfromType & deleted unused files
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPoblete committed Jun 24, 2024
1 parent 3471364 commit 396d162
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/components/Swap/AdvancedSwapDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function AdvancedSwapDetails({
useEffect(() => {
(async () => {
if (!trade?.path || isLoading) return;
if (trade.platform == PlatformType.SOROBAN) {
if (trade.platform == PlatformType.ROUTER) {
setPathTokensIsLoading(true);
const promises = trade.path.map(async (contract) => {
const asset = await findToken(contract, tokensAsMap, sorobanContext);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Swap/SwapModalFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function SwapModalFooter({
useEffect(() => {
(async () => {
if (!trade?.path || isLoading) return;
if (trade.platform == PlatformType.SOROBAN) {
if (trade.platform == PlatformType.ROUTER) {
setPathTokensIsLoading(true);
const promises = trade.path.map(async (contract) => {
const asset = await findToken(contract, tokensAsMap, sorobanContext);
Expand Down
50 changes: 0 additions & 50 deletions src/constants/tokens.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/functions/generateRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export const useRouterSDK = () => {
if(!res) return;
const response = {
...res,
platform: PlatformType.SOROBAN,
platform: PlatformType.ROUTER,
}
return response;
})
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useSwapCallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function useSwapCallback(
if (!trade.tradeType) throw new Error('tradeType must be defined');

switch (trade.platform) {
case PlatformType.SOROBAN:
case PlatformType.ROUTER:
const { amount0, amount1, routerMethod } = getSwapAmounts({
tradeType: trade.tradeType,
inputAmount: trade.inputAmount?.value as string,
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useSwapNetworkFees.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const useSwapNetworkFees = (trade: InterfaceTrade | undefined, currencies: Curre
},
path: result?.trade.path,
tradeType: TradeType.EXACT_INPUT,
platform: PlatformType.SOROBAN
platform: PlatformType.ROUTER
};

return trade;
Expand Down
2 changes: 1 addition & 1 deletion src/state/routing/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export enum TradeType {
}

export enum PlatformType {
SOROBAN = 'Soroban',
ROUTER = 'Soroswap Router',
STELLAR_CLASSIC = 'SDEX'
}

Expand Down

0 comments on commit 396d162

Please sign in to comment.