Skip to content

Commit 0d3376a

Browse files
Added doc for transaction mod
1 parent 8cd2c38 commit 0d3376a

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

src/transaction/data_entry.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
use std::fmt;
22

33
/// Structure that sets key and value of account data storage entry.
4+
///
5+
/// Account data storage is a key-value storage associated with an account.
6+
///
7+
/// The key of each entry is a unique string.
8+
///
9+
/// The value is the data of one of the types:
10+
///
11+
/// * string
12+
/// * boolean
13+
/// * integral
14+
/// * array of bytes
15+
///
16+
/// The size of an account data storage is unlimited.
417
#[derive(Debug, Eq, PartialEq)]
518
pub enum DataEntry<'a> {
619
Integer(&'a str, u64),

src/transaction/hash.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
use base58::{FromBase58, ToBase58};
22
use std::fmt;
33

4+
/// The Transaction ID is a [`struct@Hash`]
45
pub type TransactionId = Hash;
6+
/// The Asset ID is a [`struct@Hash`]
57
pub type Asset = Hash;
68

79
pub(crate) const HASH_LENGTH: usize = 32;
810

11+
/// The [`struct@Hash`] struct is a representation of hashes.
12+
///
13+
/// Example hash:
14+
/// ```plain_text
15+
/// YwVPf35VckF4Yu5XwF18P9VwWwfQVGAQmqDp4bpgtuV
16+
/// ```
917
#[derive(Debug, Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1018
pub struct Hash([u8; HASH_LENGTH]); //// converge w/ Address using macro
1119

1220
impl Hash {
21+
/// Decode an [`struct@Hash`] from base58 to an inner byte value.
1322
pub fn to_bytes(&self) -> [u8; HASH_LENGTH] {
1423
self.0
1524
}
1625

26+
/// Create an [`struct@Hash`] from inner byte value.
1727
pub fn new(bytes: [u8; HASH_LENGTH]) -> Hash {
1828
Hash(bytes)
1929
}
2030

31+
/// Create an [`struct@Hash`] from the base58 string.
2132
pub fn from_string(base58: &str) -> Asset {
2233
let mut bytes = [0u8; HASH_LENGTH];
2334
bytes.copy_from_slice(base58.from_base58().unwrap().as_slice()); ////map unwrap, handle bad length

src/transaction/type_id.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
11
use std::fmt;
22

33
/// Transaction type
4+
///
5+
/// There are various types of transactions implemented on the Waves blockchain.
6+
///
7+
/// Transaction is an action on the blockchain on behalf of an account.
8+
///
9+
/// The Waves blockchain provides various types of transactions. For example:
10+
///
11+
/// * Data transaction writes data to the account data storage,
12+
/// * Transfer transaction sends a certain amount of token to another account.
13+
///
14+
/// Content of transaction depends on its type.
415
#[derive(Debug, Eq, PartialEq)]
516
pub enum Type {
17+
/// Issue Transaction
618
Issue = 3,
19+
/// Transfer Transaction
720
Transfer = 4,
21+
/// Reissue Transaction
822
Reissue = 5,
23+
/// Burn Transaction
924
Burn = 6,
25+
/// Lease Transaction
1026
Lease = 8,
27+
/// Lease Cancel Transaction
1128
LeaseCancel = 9,
29+
/// Create Alias Transaction
1230
Alias = 10,
31+
/// Mass Transfer Transaction
1332
MassTransfer = 11,
33+
/// Data Transaction
1434
Data = 12,
35+
/// Set Script Transaction
1536
SetScript = 13,
37+
/// Sponsor Fee Transaction
1638
Sponsor = 14,
39+
/// Set Asset Script Transaction
1740
SetAssetScript = 15,
1841
}
1942

0 commit comments

Comments
 (0)