Skip to content

Commit

Permalink
Merge pull request #552 from soroswap/feat/upgrade-sdk-1.3.0
Browse files Browse the repository at this point in the history
Feat/upgrade sdk 1.4.0
  • Loading branch information
esteblock authored Oct 1, 2024
2 parents 4698833 + f1e8682 commit 9e375d9
Show file tree
Hide file tree
Showing 7 changed files with 584 additions and 402 deletions.
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
"@scio-labs/use-inkathon": "^0.8.1",
"@soroban-react/chains": "9.1.13",
"@soroban-react/connect-button": "9.1.13",
"@soroban-react/contracts": "9.2.2",
"@soroban-react/core": "9.1.13",
"@soroban-react/events": "9.1.13",
"@soroban-react/contracts": "9.3.0",
"@soroban-react/core": "9.3.0",
"@soroban-react/events": "9.3.0",
"@soroban-react/freighter": "9.1.13",
"@soroban-react/hana": "9.1.13",
"@soroban-react/lobstr": "9.1.13",
"@soroban-react/types": "9.1.13",
"@soroban-react/utils": "9.1.13",
"@soroban-react/wallet-data": "9.1.13",
"@soroban-react/xbull": "9.1.13",
"@soroban-react/wallet-data": "9.3.0",
"@soroban-react/xbull": "9.3.0",
"@stellar/freighter-api": "1.7.1",
"@stellar/stellar-sdk": "12.2.0",
"@types/qs": "^6.9.7",
Expand Down Expand Up @@ -72,7 +72,7 @@
"react-virtualized-auto-sizer": "^1.0.20",
"react-window": "^1.8.9",
"redux": "^4.2.1",
"soroswap-router-sdk": "^1.2.13",
"soroswap-router-sdk": "^1.4.0",
"soroswap-ui": "^1.0.0",
"swr": "^2.2.0",
"typescript": "5.3.3",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Providers/ContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useMemo, useState } from 'react';
import MainLayout from '../Layout/MainLayout';
import { useSorobanReact } from '@soroban-react/core';
import config from 'configs/protocols.config.json'
import { Protocols } from 'soroswap-router-sdk';
import { Protocol } from 'soroswap-router-sdk';
import { PlatformType } from 'state/routing/types';
import { useAggregator } from 'hooks/useAggregator';

Expand Down Expand Up @@ -68,10 +68,10 @@ export default function ContextProvider({
if (isAggregator === false) {
switch (activeChain?.id) {
case 'testnet':
protocols = protocols.filter((protocol) => protocol.key == Protocols.SOROSWAP);
protocols = protocols.filter((protocol) => protocol.key == Protocol.SOROSWAP);
break;
case 'mainnet':
protocols = protocols.filter((protocol) => protocol.key == Protocols.SOROSWAP || protocol.key == PlatformType.STELLAR_CLASSIC);
protocols = protocols.filter((protocol) => protocol.key == Protocol.SOROSWAP || protocol.key == PlatformType.STELLAR_CLASSIC);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Settings/ProtocolsSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const ProtocolsSettings = () => {
onToggle={() => setIsOpen(!isOpen)}
header={
<Row width="auto">
<Typography color={theme.palette.secondary.main}>Protocols</Typography>
<Typography color={theme.palette.secondary.main}>Protocol</Typography>
<QuestionHelper
text={
<div>
Expand Down
4 changes: 2 additions & 2 deletions src/contexts/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Protocols } from 'soroswap-router-sdk';
import { Protocol } from 'soroswap-router-sdk';
import { PlatformType } from 'state/routing/types';

type ConnectWalletModalType = {
Expand All @@ -16,7 +16,7 @@ export enum SnackbarIconType {
}

export interface ProtocolsStatus {
key: Protocols | PlatformType;
key: Protocol | PlatformType;
value: boolean;
}

Expand Down
18 changes: 9 additions & 9 deletions src/functions/generateRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
CurrencyAmount,
Networks,
Percent,
Protocols,
Protocol,
Route,
Router,
Token,
Expand Down Expand Up @@ -64,14 +64,14 @@ export const useRouterSDK = () => {

const getPairsFns = useMemo(() => {
const routerProtocols = []
if(!shouldUseBackend) return undefined
// here you should add your new supported aggregator protocols
if(shouldUseBackend) return undefined
// here you should add your new supported aggregator protocols
for(let protocol of protocolsStatus){
if(protocol.key === Protocols.SOROSWAP && protocol.value === true){
routerProtocols.push({protocol: Protocols.SOROSWAP, fn: async () => fetchAllSoroswapPairs(network)});
if(protocol.key === Protocol.SOROSWAP && protocol.value === true){
routerProtocols.push({protocol: Protocol.SOROSWAP, fn: async () => fetchAllSoroswapPairs(network)});
}
if(protocol.key === Protocols.PHOENIX && protocol.value === true){
routerProtocols.push({protocol: Protocols.PHOENIX, fn: async () => fetchAllPhoenixPairs(network)});
if(protocol.key === Protocol.PHOENIX && protocol.value === true){
routerProtocols.push({protocol: Protocol.PHOENIX, fn: async () => fetchAllPhoenixPairs(network)});
}
}
return routerProtocols;
Expand All @@ -84,7 +84,7 @@ export const useRouterSDK = () => {
newProtocols.push(protocol.key);
}
}
return newProtocols as Protocols[];
return newProtocols as Protocol[];
},[protocolsStatus]);

const router = useMemo(() => {
Expand Down Expand Up @@ -126,7 +126,7 @@ export const useRouterSDK = () => {

const isHorizonEnabled = currentProtocolsStatus.find((p) => p.key === PlatformType.STELLAR_CLASSIC)?.value;

const isSoroswapEnabled = currentProtocolsStatus.find((p) => p.key === Protocols.SOROSWAP)?.value;
const isSoroswapEnabled = currentProtocolsStatus.find((p) => p.key === Protocol.SOROSWAP)?.value;

const horizonProps = {
assetFrom: amountAsset.currency,
Expand Down
Loading

0 comments on commit 9e375d9

Please sign in to comment.