forked from iotaledger/iota.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_parent.rs
36 lines (29 loc) · 953 Bytes
/
custom_parent.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Copyright 2021 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
//! cargo run --example custom_parent --release
use iota_client::{bee_message::MessageId, Client};
use std::str::FromStr;
/// In this example we will define a custom message parent which be used for promoting
#[tokio::main]
async fn main() {
// Create a client instance
let iota = Client::builder()
.with_node("https://api.lb-0.testnet.chrysalis2.com") // Insert your node URL here
.unwrap()
.finish()
.await
.unwrap();
let custom_parent =
MessageId::from_str("b5634e05a7c665d7f87330a53633f001a5d1d96b346dc98dc225c4d6c204f23b").unwrap();
let message = iota
.message()
.with_parents(vec![custom_parent])
.unwrap()
.finish()
.await
.unwrap();
println!(
"Empty message sent: https://explorer.iota.org/testnet/message/{}",
message.id().0
);
}