Skip to content

Commit c1c4f94

Browse files
authored
feat: add eth network ink & mova (#384)
* feat: add eth network ink & mova * refact: version update * fix: text for ai code gen
1 parent eede6d6 commit c1c4f94

File tree

7 files changed

+201
-92
lines changed

7 files changed

+201
-92
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/anychain-ethereum/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "anychain-ethereum"
33
description = "A Rust library for Ethereum-focused cryptocurrency wallets, enabling seamless transactions on the Ethereum blockchain"
4-
version = "0.1.33"
4+
version = "0.1.34"
55
keywords = ["blockchain", "crypto", "ethereum", "wallet"]
66
categories = ["cryptography::cryptocurrencies"]
77

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
mainnet:
2+
Ethereum = 1
3+
EthereumClassic = 61
4+
Polygon = 137
5+
Arbitrum = 42161
6+
Avalanche = 43114
7+
Base = 8453
8+
BinanceSmartChain = 56
9+
HuobiEco = 128
10+
Okex = 66
11+
OpBnb = 204
12+
Optimism = 10
13+
Linea = 59144
14+
Xlayer = 196
15+
Sei = 1329
16+
Cro = 25
17+
Mova = 61900
18+
Ink = 57073
19+
20+
testnet:
21+
Sepolia = 11155111 // ETH testnet
22+
Goerli = 5 // ETH testnet
23+
Kotti = 6 // ETC testnet
24+
Mumbai = 80001 // Polygon testnet
25+
Amoy = 80002 // Polygon testnet
26+
ArbitrumGoerli = 421613 // Arbitrum testnet
27+
AvalancheTestnet = 43113
28+
BaseGoerli = 84531
29+
BinanceSmartChainTestnet = 97
30+
HuobiEcoTestnet = 256
31+
OkexTestnet = 65
32+
OpBnbTestnet = 5611
33+
OptimismGoerli = 420
34+
LineaSepolia = 59141
35+
XlayerTestnet = 195
36+
SeiTestnet = 1328
37+
CroTestnet = 338
38+
MovaTestnet = 10323
39+
InkTestnet = 763373
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
generating rust code from a provided item:
2+
3+
{
4+
item:
5+
HuobiEco = 128
6+
7+
code:
8+
#[derive(Copy, Clone, Debug)]
9+
pub struct HuobiEco;
10+
11+
impl EthereumNetwork for HuobiEco {
12+
const CHAIN_ID: u32 = 128;
13+
}
14+
}
15+
16+
generating rust code from a provided item with annotation:
17+
18+
{
19+
item:
20+
Kotti = 6 // ETC testnet
21+
22+
code:
23+
#[derive(Copy, Clone, Debug)]
24+
pub struct Kotti; // ETC testnet
25+
26+
// ETC testnet
27+
impl EthereumNetwork for Goerli {
28+
const CHAIN_ID: u32 = 5;
29+
}
30+
}

crates/anychain-ethereum/src/network/mainnet.rs

Lines changed: 56 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,104 +3,118 @@ use super::EthereumNetwork;
33
#[derive(Copy, Clone, Debug)]
44
pub struct Ethereum;
55

6-
#[derive(Copy, Clone, Debug)]
7-
pub struct EthereumClassic;
8-
9-
#[derive(Copy, Clone, Debug)]
10-
pub struct Polygon;
11-
12-
#[derive(Copy, Clone, Debug)]
13-
pub struct Arbitrum;
14-
15-
#[derive(Copy, Clone, Debug)]
16-
pub struct Avalanche;
17-
18-
#[derive(Copy, Clone, Debug)]
19-
pub struct Base;
20-
21-
#[derive(Copy, Clone, Debug)]
22-
pub struct BinanceSmartChain;
23-
24-
#[derive(Copy, Clone, Debug)]
25-
pub struct HuobiEco;
26-
27-
#[derive(Copy, Clone, Debug)]
28-
pub struct Okex;
29-
30-
#[derive(Copy, Clone, Debug)]
31-
pub struct OpBnb;
32-
33-
#[derive(Copy, Clone, Debug)]
34-
pub struct Optimism;
35-
36-
#[derive(Copy, Clone, Debug)]
37-
pub struct Linea;
38-
39-
#[derive(Copy, Clone, Debug)]
40-
pub struct Xlayer;
41-
42-
#[derive(Copy, Clone, Debug)]
43-
pub struct Sei;
44-
45-
#[derive(Copy, Clone, Debug)]
46-
pub struct Cro;
47-
486
impl EthereumNetwork for Ethereum {
497
const CHAIN_ID: u32 = 1;
508
}
519

10+
#[derive(Copy, Clone, Debug)]
11+
pub struct EthereumClassic;
12+
5213
impl EthereumNetwork for EthereumClassic {
5314
const CHAIN_ID: u32 = 61;
5415
}
5516

17+
#[derive(Copy, Clone, Debug)]
18+
pub struct Polygon;
19+
5620
impl EthereumNetwork for Polygon {
5721
const CHAIN_ID: u32 = 137;
5822
}
5923

24+
#[derive(Copy, Clone, Debug)]
25+
pub struct Arbitrum;
26+
6027
impl EthereumNetwork for Arbitrum {
6128
const CHAIN_ID: u32 = 42161;
6229
}
6330

31+
#[derive(Copy, Clone, Debug)]
32+
pub struct Avalanche;
33+
6434
impl EthereumNetwork for Avalanche {
6535
const CHAIN_ID: u32 = 43114;
6636
}
6737

38+
#[derive(Copy, Clone, Debug)]
39+
pub struct Base;
40+
6841
impl EthereumNetwork for Base {
6942
const CHAIN_ID: u32 = 8453;
7043
}
7144

45+
#[derive(Copy, Clone, Debug)]
46+
pub struct BinanceSmartChain;
47+
7248
impl EthereumNetwork for BinanceSmartChain {
7349
const CHAIN_ID: u32 = 56;
7450
}
7551

52+
#[derive(Copy, Clone, Debug)]
53+
pub struct HuobiEco;
54+
7655
impl EthereumNetwork for HuobiEco {
7756
const CHAIN_ID: u32 = 128;
7857
}
7958

59+
#[derive(Copy, Clone, Debug)]
60+
pub struct Okex;
61+
8062
impl EthereumNetwork for Okex {
8163
const CHAIN_ID: u32 = 66;
8264
}
8365

66+
#[derive(Copy, Clone, Debug)]
67+
pub struct OpBnb;
68+
8469
impl EthereumNetwork for OpBnb {
8570
const CHAIN_ID: u32 = 204;
8671
}
8772

73+
#[derive(Copy, Clone, Debug)]
74+
pub struct Optimism;
75+
8876
impl EthereumNetwork for Optimism {
8977
const CHAIN_ID: u32 = 10;
9078
}
9179

80+
#[derive(Copy, Clone, Debug)]
81+
pub struct Linea;
82+
9283
impl EthereumNetwork for Linea {
9384
const CHAIN_ID: u32 = 59144;
9485
}
9586

87+
#[derive(Copy, Clone, Debug)]
88+
pub struct Xlayer;
89+
9690
impl EthereumNetwork for Xlayer {
9791
const CHAIN_ID: u32 = 196;
9892
}
9993

94+
#[derive(Copy, Clone, Debug)]
95+
pub struct Sei;
96+
10097
impl EthereumNetwork for Sei {
10198
const CHAIN_ID: u32 = 1329;
10299
}
103100

101+
#[derive(Copy, Clone, Debug)]
102+
pub struct Cro;
103+
104104
impl EthereumNetwork for Cro {
105105
const CHAIN_ID: u32 = 25;
106106
}
107+
108+
#[derive(Copy, Clone, Debug)]
109+
pub struct Mova;
110+
111+
impl EthereumNetwork for Mova {
112+
const CHAIN_ID: u32 = 61900;
113+
}
114+
115+
#[derive(Copy, Clone, Debug)]
116+
pub struct Ink;
117+
118+
impl EthereumNetwork for Ink {
119+
const CHAIN_ID: u32 = 57073;
120+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Delete mainnet.rs and testnet.rs
2+
3+
See the mainnet part and the testnet part of the chain_id.txt file?
4+
5+
I want you to generate a mainnet.rs file and a testnet.rs file according
6+
to the items in the mainnet part and in the testnet part respectively.
7+
8+
The rule for generating code from one item is in the item_gen.txt file.
9+
10+
You should always write "use super::EthereumNetwork;" in the first line
11+
of each .rs file.

0 commit comments

Comments
 (0)