Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove outdated chains on protocol contracts types #276

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 20 additions & 14 deletions lib/address.tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,17 @@ export declare type ZetaZEVMAddress =

export declare type ZetaProtocolTestNetwork =
| "amoy_testnet"
| "baobab_testnet"
| "bsc_testnet"
| "btc_testnet"
| "goerli_testnet"
| "mumbai_testnet"
| "sepolia_testnet"
| "zeta_testnet";

export const zetaProtocolTestNetworks: ZetaProtocolTestNetwork[] = [
"baobab_testnet",
"amoy_testnet",
"bsc_testnet",
"btc_testnet",
"goerli_testnet",
"sepolia_testnet",
"mumbai_testnet",
"zeta_testnet",
"amoy_testnet",
];

export declare type NonZetaAddress =
Expand All @@ -66,23 +60,35 @@ export const nonZetaAddress: NonZetaAddress[] = [
"weth9",
];

export declare type ZetaProtocolMainNetwork = "bsc_mainnet" | "eth_mainnet" | "zeta_mainnet" | "polygon_mainnet";
export const zetaProtocolMainNetworks: ZetaProtocolMainNetwork[] = ["eth_mainnet", "bsc_mainnet", "polygon_mainnet", "zeta_mainnet"];
export declare type ZetaProtocolMainNetwork =
| "bsc_mainnet"
| "btc_mainnet"
| "eth_mainnet"
| "polygon_mainnet"
| "zeta_mainnet";

export const zetaProtocolMainNetworks: ZetaProtocolMainNetwork[] = [
"bsc_mainnet",
"btc_mainnet",
"eth_mainnet",
"polygon_mainnet",
"zeta_mainnet",
];

export declare type ZetaProtocolNetwork = ZetaProtocolMainNetwork | ZetaProtocolTestNetwork;
export const zetaProtocolNetworks: ZetaProtocolNetwork[] = [...zetaProtocolTestNetworks, ...zetaProtocolMainNetworks];

export declare type ZetaProtocolEnviroment = "mainnet" | "testnet";
export declare type ZetaProtocolEnvironment = "mainnet" | "testnet";

export const isProtocolNetworkName = (str: string): str is ZetaProtocolNetwork =>
zetaProtocolNetworks.includes(str as ZetaProtocolNetwork);

export const isTestnetNetwork = (network: ZetaProtocolTestNetwork): boolean => {
return zetaProtocolTestNetworks.includes(network);
export const isTestnetNetwork = (network: string): boolean => {
return zetaProtocolTestNetworks.includes(network as ZetaProtocolTestNetwork);
};

export const isMainnetNetwork = (network: ZetaProtocolTestNetwork): boolean => {
return false;
export const isMainnetNetwork = (network: string): boolean => {
return zetaProtocolMainNetworks.includes(network as ZetaProtocolMainNetwork);
};

export const getZRC20Address = (network: ZetaProtocolNetwork): string => {
Expand Down
43 changes: 40 additions & 3 deletions lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,41 @@
export type ParamSymbol = "USDC.BSC" | "USDC.ETH" | "BTC.BTC" | "PEPE.ETH" | "BNB.BSC" | "SHIB.ETH" | "USDT.ETH" | "USDT.BSC" | "POL.POLYGON" | "DAI.ETH" | "ETH.ETH" | "sETH.SEPOLIA" | "USDC" | "gETH" | "tMATIC" | "tBTC" | "MATIC.AMOY" | "USDC.SEPOLIA" | "tBNB";
export type ParamChainName = "eth_mainnet" | "bsc_mainnet" | "polygon_mainnet" | "zeta_mainnet" | "btc_mainnet" | "bsc_testnet" | "zeta_testnet" | "btc_testnet" | "amoy_testnet" | "sepolia_testnet";
export type ParamType = "connector" | "erc20Custody" | "pauser" | "tss" | "tssUpdater" | "uniswapV2Factory" | "uniswapV2Router02" | "uniswapV3Factory" | "uniswapV3Router" | "weth9" | "zetaToken" | "fungibleModule" | "systemContract" | "zrc20" | "zetaTokenConsumerUniV3";
import { ZetaProtocolNetwork } from "./address.tools";

export type ParamSymbol =
| "BNB.BSC"
| "BTC.BTC"
| "DAI.ETH"
| "ETH.ETH"
| "gETH"
| "MATIC.AMOY"
| "PEPE.ETH"
| "POL.POLYGON"
| "sETH.SEPOLIA"
| "SHIB.ETH"
| "tBNB"
| "tBTC"
| "tMATIC"
| "USDC.BSC"
| "USDC.ETH"
| "USDC.SEPOLIA"
| "USDC"
| "USDT.BSC"
| "USDT.ETH";

export type ParamChainName = ZetaProtocolNetwork;

export type ParamType =
| "connector"
| "erc20Custody"
| "fungibleModule"
| "pauser"
| "systemContract"
| "tss"
| "tssUpdater"
| "uniswapV2Factory"
| "uniswapV2Router02"
| "uniswapV3Factory"
| "uniswapV3Router"
| "weth9"
| "zetaToken"
| "zetaTokenConsumerUniV3"
| "zrc20";
Loading