Skip to content

Commit

Permalink
feat: add isTestnet to curve lite networks
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSchiavini committed Dec 3, 2024
1 parent 5a3a257 commit 7351dfd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curvefi/api",
"version": "2.65.17",
"version": "2.65.18",
"description": "JavaScript library for curve.fi",
"main": "lib/index.js",
"author": "Macket",
Expand Down
36 changes: 16 additions & 20 deletions src/external-api.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import axios from "axios";
import memoize from "memoizee";
import {
IExtendedPoolDataFromApi,
ICurveLiteNetwork,
IDaoProposal,
IDaoProposalListItem,
IDict,
IExtendedPoolDataFromApi,
IGaugesDataFromApi,
INetworkName,
IPoolType,
IGaugesDataFromApi,
IDaoProposal,
IDaoProposalListItem,
IVolumeAndAPYs,
ICurveLiteNetwork,
} from "./interfaces";


Expand Down Expand Up @@ -317,24 +317,20 @@ export const _getCurveLiteNetworks = memoize(
}

const { platforms, platformsMetadata } = response.data.data;

const networks: ICurveLiteNetwork[] = Object.entries(platforms)
.map(([platformId, _factories]) => {
const metadata = platformsMetadata[platformId];
if (!metadata) return null;

return Object.keys(platforms)
.map(id => {

Check failure on line 321 in src/external-api.ts

View workflow job for this annotation

GitHub Actions / test

Expected parentheses around arrow function argument
const {explorerBaseUrl, name, rpcUrl, nativeCurrencySymbol, isMainnet, chainId} = platformsMetadata[id];
return {
id: platformId,
name: metadata.name,
rpcUrl: metadata.rpcUrl,
chainId: metadata.chainId,
explorerUrl: metadata.explorerBaseUrl,
nativeCurrencySymbol: metadata.nativeCurrencySymbol,
id,
name,
rpcUrl,
chainId,
explorerUrl: explorerBaseUrl,
nativeCurrencySymbol,
isTestnet: !isMainnet,
};
})
.filter((network): network is ICurveLiteNetwork => network !== null);

return networks;
.filter(({ name }) => name);
},
{
promise: true,
Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ export interface ICurveLiteNetwork {
rpcUrl: string
explorerUrl: string
nativeCurrencySymbol: string
isTestnet: boolean
}

export type TVoteType = "PARAMETER" | "OWNERSHIP"
Expand Down

0 comments on commit 7351dfd

Please sign in to comment.