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: add iotex #102

Merged
merged 1 commit into from
Oct 19, 2024
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
12 changes: 12 additions & 0 deletions assets/chains.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions src/named.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ pub enum NamedChain {
#[strum(to_string = "world-sepolia")]
#[cfg_attr(feature = "serde", serde(alias = "worldchain-sepolia", alias = "world-sepolia"))]
WorldSepolia = 4801,
Iotex = 4689,
}

// This must be implemented manually so we avoid a conflict with `TryFromPrimitive` where it treats
Expand Down Expand Up @@ -620,6 +621,8 @@ impl NamedChain {

World | WorldSepolia => 2_000,

Iotex => 5_000,

Morden | Ropsten | Rinkeby | Goerli | Kovan | Sepolia | Holesky | MantleTestnet
| Moonbase | MoonbeamDev | OptimismKovan | Poa | Sokol | Rsk | EmeraldTestnet
| Boba | ZkSync | ZkSyncTestnet | PolygonZkEvm | PolygonZkEvmTestnet | Metis
Expand Down Expand Up @@ -748,7 +751,7 @@ impl NamedChain {
// Unknown / not applicable, default to false for backwards compatibility.
Dev | AnvilHardhat | Morden | Ropsten | Rinkeby | Cronos | CronosTestnet | Kovan
| Sokol | Poa | Moonbeam | MoonbeamDev | Moonriver | Moonbase | Evmos
| EvmosTestnet | Aurora | AuroraTestnet | Canto | CantoTestnet => false,
| EvmosTestnet | Aurora | AuroraTestnet | Canto | CantoTestnet | Iotex => false,
}
}

Expand Down Expand Up @@ -824,6 +827,7 @@ impl NamedChain {
| SoneiumMinatoTestnet
| World
| WorldSepolia
| Iotex
)
}

Expand Down Expand Up @@ -908,7 +912,7 @@ impl NamedChain {
| Emerald | FilecoinMainnet | Avalanche | Celo | Aurora | Canto | Boba | Base
| Fraxtal | Linea | ZkSync | Mantle | GravityAlphaMainnet | Xai | Zora | Pgn | Mode
| Viction | Elastos | Degen | OpBNBMainnet | Ronin | Taiko | Flare | Acala | Karura
| Darwinia | Cfx | Crab | Pulsechain | Etherlink | Immutable | World => false,
| Darwinia | Cfx | Crab | Pulsechain | Etherlink | Immutable | World | Iotex => false,
}
}

Expand Down Expand Up @@ -954,6 +958,8 @@ impl NamedChain {

World | WorldSepolia => "WRLD",

Iotex => "IOTX",

_ => return None,
})
}
Expand Down Expand Up @@ -1200,7 +1206,8 @@ impl NamedChain {

Elastos => ("https://esc.elastos.io/api", "https://esc.elastos.io"),

AnvilHardhat | Dev | Morden | MoonbeamDev | FilecoinMainnet | AutonomysNovaTestnet => {
AnvilHardhat | Dev | Morden | MoonbeamDev | FilecoinMainnet | AutonomysNovaTestnet
| Iotex => {
return None;
}
KakarotSepolia => {
Expand Down Expand Up @@ -1389,7 +1396,8 @@ impl NamedChain {
| CfxTestnet
| Pulsechain
| PulsechainTestnet
| AutonomysNovaTestnet => return None,
| AutonomysNovaTestnet
| Iotex => return None,
};

Some(api_key_name)
Expand Down Expand Up @@ -1470,6 +1478,7 @@ impl NamedChain {
Avalanche => address!("b31f66aa3c1e785363f0875a1b74e27b85fd66c7"),
Polygon => address!("0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"),
Fantom => address!("21be370d5312f44cb42ce377bc9b8a0cef1a4c83"),
Iotex => address!("a00744882684c3e4747faefd68d283ea44099d03"),
_ => return None,
};

Expand Down
Loading