Skip to content

Commit 1c87e37

Browse files
docs: Migration docs (#1022)
Signed-off-by: gsstoykov <[email protected]> Co-authored-by: ivaylonikolov7 <[email protected]>
1 parent 63e9a17 commit 1c87e37

File tree

1 file changed

+194
-0
lines changed

1 file changed

+194
-0
lines changed

MIGRATION.md

Lines changed: 194 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,194 @@
1+
# Migration Guide: hedera → hiero
2+
3+
As part of the transition from the Hedera SDK to the new Hiero ecosystem, this Rust SDK will now be published under a new crate name:
4+
5+
-**hiero** will be the new crate name.
6+
- ⚠️ **hedera** is still maintained temporarily for backward compatibility, but will be deprecated in the future.
7+
8+
We encourage all users to migrate to **hiero** to receive future updates, features, and bug fixes.
9+
10+
## 🛠 How to Migrate
11+
12+
### 1. Update `Cargo.toml` (Manual)
13+
14+
Change your dependency from:
15+
16+
```toml
17+
name = "hedera"
18+
```
19+
20+
To:
21+
22+
```toml
23+
name = "hiero"
24+
```
25+
26+
Make sure to run `cargo build` or `cargo update` to apply the change. Keep in mind that right after the dual publishing
27+
starts the namespace will still remain `hedera`. We will start publishing the `hiero` new SDK crates with the updated `.toml`
28+
files.
29+
30+
### Import changes and other examples
31+
32+
If you're using the hedera crate:
33+
34+
```rust
35+
use hedera::{
36+
Client, AccountId, PrivateKey, TopicCreateTransaction, TopicMessageQuery, TopicMessageSubmitTransaction,
37+
};
38+
```
39+
40+
Change it to:
41+
42+
```rust
43+
use hiero::{
44+
Client, AccountId, PrivateKey, TopicCreateTransaction, TopicMessageQuery, TopicMessageSubmitTransaction,
45+
};
46+
```
47+
48+
Most APIs and types will remain identical between `hedera` and `hiero`. Keep in mind that right after the dual publishing
49+
starts the namespace will still remain `hedera`. We will put up a notice when the namespace change will be mandatory.
50+
51+
### Update Transaction and Query Usage
52+
53+
If you previously used transactions or queries like this:
54+
55+
```rust
56+
use hedera::{Client, AccountId, TransferTransaction};
57+
58+
let client = Client::for_testnet();
59+
let account_id = AccountId::from_string("0.0.1234");
60+
let tx = TransferTransaction::new()
61+
.add_hbar_transfer(account_id, 100)
62+
.add_hbar_transfer(AccountId::from_string("0.0.5678"), -100)
63+
.execute(&client)
64+
.await?;
65+
```
66+
67+
Change to:
68+
69+
```rust
70+
use hiero::{Client, AccountId, TransferTransaction};
71+
72+
let client = Client::for_testnet();
73+
let account_id = AccountId::from_string("0.0.1234");
74+
let tx = TransferTransaction::new()
75+
.add_hbar_transfer(account_id, 100)
76+
.add_hbar_transfer(AccountId::from_string("0.0.5678"), -100)
77+
.execute(&client)
78+
.await?;
79+
```
80+
81+
### Updating Key Generation
82+
83+
Old:
84+
85+
```rust
86+
use hedera::PrivateKey;
87+
88+
let private_key = PrivateKey::generate();
89+
```
90+
91+
New:
92+
93+
```rust
94+
use hiero::PrivateKey;
95+
96+
let private_key = PrivateKey::generate();
97+
```
98+
99+
### Working with Topics (HCS)
100+
101+
Old:
102+
103+
```rust
104+
use hedera::{TopicCreateTransaction, TopicMessageSubmitTransaction};
105+
106+
let topic = TopicCreateTransaction::new()
107+
.memo("My Topic")
108+
.execute(&client)
109+
.await?;
110+
```
111+
112+
New:
113+
114+
```rust
115+
use hiero::{TopicCreateTransaction, TopicMessageSubmitTransaction};
116+
117+
let topic = TopicCreateTransaction::new()
118+
.memo("My Topic")
119+
.execute(&client)
120+
.await?;
121+
```
122+
123+
### Querying Account Balance
124+
125+
Old:
126+
127+
```rust
128+
use hedera::{AccountBalanceQuery, AccountId};
129+
130+
let balance = AccountBalanceQuery::new()
131+
.account_id(AccountId::from_string("0.0.1234"))
132+
.execute(&client)
133+
.await?;
134+
```
135+
136+
New:
137+
138+
```rust
139+
use hiero::{AccountBalanceQuery, AccountId};
140+
141+
let balance = AccountBalanceQuery::new()
142+
.account_id(AccountId::from_string("0.0.1234"))
143+
.execute(&client)
144+
.await?;
145+
```
146+
147+
### Error Handling
148+
149+
If you previously matched errors from `hedera`:
150+
151+
```rust
152+
match result {
153+
Ok(value) => { /* ... */ }
154+
Err(hedera::Error::SomeError) => { /* ... */ }
155+
Err(e) => { /* ... */ }
156+
}
157+
```
158+
159+
Update to:
160+
161+
```rust
162+
match result {
163+
Ok(value) => { /* ... */ }
164+
Err(hiero::Error::SomeError) => { /* ... */ }
165+
Err(e) => { /* ... */ }
166+
}
167+
```
168+
169+
## 📦 Crate Availability
170+
171+
| Crate | Status | Description |
172+
| ------ | --------- | ------------------------------------------ |
173+
| hedera | ⌛ Legacy | Still works, but will be deprecated soon |
174+
| hiero | ✅ Active | New name, actively maintained and improved |
175+
176+
We are currently starting dual-publishing new versions to both crates, but this will change in a future releases where `hedera` will be marked as deprecated.
177+
178+
## 📅 Deprecation Timeline
179+
180+
We will continue to publish updates to both `hedera` and `hiero` for a short transition period. After that:
181+
182+
- Final `hedera` version will be published
183+
- Crate will be marked as deprecated on crates.io
184+
- All new development will occur under `hiero`
185+
186+
## 🗣 Support
187+
188+
If you have questions or issues migrating:
189+
190+
- Open an issue
191+
- Start a discussion
192+
- Visit our community Discord (link coming soon)
193+
194+
Thanks for growing with us, and welcome to Hiero. 🪐

0 commit comments

Comments
 (0)