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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! # shuttle-core
//!
//! The `shuttle-core` crate provides an high-level library to read, write and
//! sign the XDR structures used in the Stellar Network Protocol.
//!
//! ## KeyPair, PublicKey, and Account
//!
//! In `shuttle-core` there are three structures that represent accounts:
//!
//! - `KeyPair` contains both public and secret keys and they are used for signing
//! transactions
//! - `PublicKey` represents an account public key, that is the addrress starting
//! with `G`
//! - `Account` is a public key with the associated sequence number.
//!
//! ```ignore
//! let random_keypair = KeyPair::random().unwrap();
//! let keypair = KeyPair::from_secret("SDFRU2NGDPXYIY67BVS6L6W4OY33HCFCEJQ73TZZPR3IDYVVI7BVPV5Q").unwrap();
//! let public_key = keypair.public_key();
//!
//! // Create public key only
//! let address = PublicKey::from_account_id("GBR6A7TTX6MUYO6WZXZFAX3L2QSLYIHIGKN52EBNVKKB4AN4B6CRD22T").unwrap();
//!
//! // Create account
//! let account = Account::new(address, 0);
//! ```
//!
//! ## Asset and Amount
//!
//! The Stellar Network has two different types of assets: native and credit assets.
//! You can create them with `Asset::native` and `Asset::credit`.
//!
//! `Amount` represent an amount of the native asset, a.k.a. Lumens.
//!
//! ```ignore
//! let xlm = Asset::native();
//! let btc = Asset::credit("BTC", issuer_key).unwrap();
//!
//! // Parse string as amount, will error if more than 7 digits
//! let amount = Amount::from_str("123.4567").unwrap();
//! ```
//!
//!
//! ## Creating Transactions
//!
//! `shuttle-core` uses the builder pattern for transactions and operations.
//! Once you have a `SignedTransaction` you can serialize it to the base64 representation
//! of the transaction envelope and submit it to the network.
//! Alternatively, you can inspect it in the [Stellar Laboraty](https://www.stellar.org/laboratory/).
//!
//! ```ignore
//! let tx = TransactionBuilder::new(&mut source_account)
//! .operation(
//! OperationBuilder::payment(destination_address, asset, amount).build()
//! )
//! .with_memo(memo)
//! .build();
//! let signed_tx = tx.sign(&source_keypair, &network).unwrap();
//! let encoded = signed_tx.to_base64().unwrap();
//!
//! // You can decode a transaction as well
//! let new_signed_tx = SignedTransaction::from_base64(&encode).unwrap();
//! ```
extern crate base32;
extern crate base64;
extern crate bigdecimal;
extern crate byteorder;
extern crate crc16;
extern crate num_bigint;
extern crate num_traits;
extern crate sodiumoxide;
extern crate serde;
extern crate serde_bytes;
extern crate serde_derive;
extern crate serde_xdr;
pub use ;
pub use ;
pub use ;
pub use Account;
pub use ;
pub use Memo;
pub use Network;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use TransactionBuilder;
pub use ;