-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic pools fetcher, refactor some util functions
- Loading branch information
1 parent
7e9fd2a
commit ac7a326
Showing
6 changed files
with
492 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
GqlChain, | ||
GqlPoolMinimalType, | ||
} from '@/services/api/graphql/generated/api-types'; | ||
import { Network } from '@/lib/config'; | ||
import { PoolType } from '@/services/pool/types'; | ||
|
||
export function mapApiChain( | ||
apiChain: GqlChain | 'SEPOLIA' | 'GOERLI' | ||
): Network { | ||
switch (apiChain) { | ||
case GqlChain.Arbitrum: | ||
return Network.ARBITRUM; | ||
case GqlChain.Avalanche: | ||
return Network.AVALANCHE; | ||
case GqlChain.Gnosis: | ||
return Network.GNOSIS; | ||
case GqlChain.Fantom: | ||
return Network.FANTOM; | ||
case GqlChain.Optimism: | ||
return Network.OPTIMISM; | ||
case GqlChain.Polygon: | ||
return Network.POLYGON; | ||
case GqlChain.Mainnet: | ||
return Network.MAINNET; | ||
case GqlChain.Zkevm: | ||
return Network.ZKEVM; | ||
case 'SEPOLIA': | ||
return Network.SEPOLIA; | ||
case 'GOERLI': | ||
return Network.GOERLI; | ||
|
||
default: | ||
throw new Error(`Unexpected API chain: ${apiChain}`); | ||
} | ||
} | ||
|
||
export function mapApiPoolType( | ||
apiPoolType: GqlPoolMinimalType | ||
): PoolType | null { | ||
switch (apiPoolType) { | ||
case GqlPoolMinimalType.Element: | ||
return PoolType.Element; | ||
case GqlPoolMinimalType.Gyro3: | ||
return PoolType.Gyro3; | ||
case GqlPoolMinimalType.Gyroe: | ||
return PoolType.GyroE; | ||
case GqlPoolMinimalType.Investment: | ||
return PoolType.Investment; | ||
case GqlPoolMinimalType.Linear: | ||
return PoolType.Linear; | ||
case GqlPoolMinimalType.LiquidityBootstrapping: | ||
return PoolType.LiquidityBootstrapping; | ||
case GqlPoolMinimalType.MetaStable: | ||
return PoolType.MetaStable; | ||
case GqlPoolMinimalType.PhantomStable: | ||
return PoolType.StablePhantom; | ||
case GqlPoolMinimalType.Stable: | ||
return PoolType.Stable; | ||
case GqlPoolMinimalType.Weighted: | ||
return PoolType.Weighted; | ||
default: | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.