@@ -5,141 +5,145 @@ Python client library for interacting with LTO Network
5
5
## Accounts
6
6
7
7
### Create an account
8
- The chain_id is 'L' for the MainNet and 'T' TestNet
8
+ The chain_id is 'L' for the mainnet and 'T' testnet
9
9
10
10
``` python
11
- from lto.accounts.account_factory import AccountFactory
11
+ from lto.accounts.ed25519 import AccountFactory
12
12
13
13
account = AccountFactory(chain_id).create()
14
14
```
15
15
### Create an account from seed
16
16
17
17
``` python
18
- from lto.accounts.account_factory import AccountFactory
18
+ from lto.accounts.ed25519 import AccountFactory
19
19
20
20
account = AccountFactory(chain_id).create_from_seed(seed)
21
21
```
22
22
23
23
### Create an account from public key
24
24
25
25
``` python
26
- from lto.accounts.account_factory import AccountFactory
26
+ from lto.accounts.ed25519 import AccountFactory
27
27
28
28
account = AccountFactory(chain_id).create_from_public_key(public_key)
29
29
```
30
30
31
31
### Create an account from private key
32
32
33
33
``` python
34
- from lto.accounts.account_factory import AccountFactory
34
+ from lto.accounts.ed25519 import AccountFactory
35
35
36
36
account = AccountFactory(chain_id).create_from_private_key(private_key)
37
37
```
38
38
39
- ## Executing Transactions:
40
- First a transaction needs to be created:
41
- ### Ex Transfer Transaction
42
- ```
39
+ ## Executing Transactions
40
+
41
+ ### Create transaction
42
+ First a transaction needs to be created.
43
+
44
+ ``` python
43
45
from src.LTO .Transactions.Transfer import Transfer
44
46
transaction = Transfer(recipient, amount)
45
47
```
46
- The Transaction needs then to be signed. <br />
47
- In order to sign a transaction an account is needed (check at the beginning of the page the steps to create an account).
48
48
49
- ### Ex of signinig a transaction
50
- ```
49
+ The Transaction needs then to be signed. In order to sign a transaction an account is needed.
50
+
51
+ ### Sign transaction
52
+
53
+ ``` python
51
54
transaction.sign_with(account)
52
55
```
53
- For last the transaction needs to be broadcasted to the node. <br />
54
- In order to do so we need to connect to the node using the PublicNode class.
56
+ ### Broadcast transaction
55
57
56
- ```
58
+ For last the transaction needs to be broadcasted to the node. In order to do so we need to connect to the node using the PublicNode class.
59
+
60
+ ``` python
57
61
from src.LTO .PublicNode import PublicNode
58
62
node = PublicNode(url)
59
63
```
60
- The url refers to the node, there are many nodes available, here there are two examples, one for the MainNet and one for the TestNet < br />
64
+ The url refers to the node, there are many nodes available, here there are two examples, one for the mainnet and one for the testnet
61
65
62
- https://nodes.lto.network < br />
63
- https://testnet.lto.network
66
+ * https://nodes.lto.network
67
+ * https://testnet.lto.network
64
68
65
- ### Ex of broadcasting a transaction
66
- ```
69
+ ``` python
67
70
transaction.broadcast_to(node)
68
71
```
69
72
70
73
## Transactions
74
+
71
75
### Transfer Transaction
72
76
73
77
``` python
74
- from src. lto.transactions.transfer import Transfer
78
+ from lto.transactions import Transfer
75
79
76
80
transaction = Transfer(recipient, amount)
77
81
```
78
82
79
83
### Mass Transfer Transaction
80
84
81
85
``` python
82
- from src. lto.transactions.mass_transfer import MassTransfer
86
+ from lto.transactions import MassTransfer
83
87
84
88
transaction = MassTransfer(transfers)
85
89
```
86
90
### Anchor Transaction
87
91
88
92
``` python
89
- import Anchor
93
+ from lto.transactions import Anchor
90
94
91
95
transaction = Anchor(anchor)
92
96
```
93
97
### Lease Transaction
94
98
95
99
``` python
96
- from src. lto.transactions.lease import Lease
100
+ from lto.transactions import Lease
97
101
98
102
transaction = Lease(recipient, amount)
99
103
```
100
104
### Cancel Lease Transaction
101
105
102
106
``` python
103
- from src. lto.transactions.cancel_lease import CancelLease
107
+ from lto.transactions import CancelLease
104
108
105
109
transaction = CancelLease(lease_id)
106
110
```
107
111
108
112
### SetScript Transaction
109
113
110
114
``` python
111
- from src. lto.transactions.set_script import SetScript
115
+ from lto.transactions import SetScript
112
116
113
117
transaction = SetScript(script)
114
118
```
115
119
116
120
### Sponsorship transaction
117
121
118
122
``` python
119
- from src. lto.transactions.sponsorship import Sponsorship
123
+ from lto.transactions import Sponsorship
120
124
121
125
transaction = Sponsorship(recipient)
122
126
```
123
127
124
128
### Cancel Sponsorship transaction
125
129
126
130
``` python
127
- from src. lto.transactions.cancel_sponsorship import CancelSponsorship
131
+ from lto.transactions import CancelSponsorship
128
132
129
133
transaction = CancelSponsorship(recipient)
130
134
```
131
135
132
136
### Association transaction
133
137
134
138
``` python
135
- from src. lto.transactions.association import Association
139
+ from lto.transactions import Association
136
140
137
141
transaction = Association(recipient, association_type, anchor)
138
142
```
139
143
### Revoke Association transaction
140
144
141
145
``` python
142
- from src. lto.transactions.revoke_association import RevokeAssociation
146
+ from lto.transactions import RevokeAssociation
143
147
144
148
transaction = RevokeAssociation(recipient, association_type, anchor)
145
149
```
0 commit comments