Skip to content

Commit 36e29d8

Browse files
committed
Update code examples in README.
[skip ci]
1 parent dd54b7a commit 36e29d8

File tree

1 file changed

+35
-31
lines changed

1 file changed

+35
-31
lines changed

README.md

+35-31
Original file line numberDiff line numberDiff line change
@@ -5,141 +5,145 @@ Python client library for interacting with LTO Network
55
## Accounts
66

77
### 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
99

1010
```python
11-
from lto.accounts.account_factory import AccountFactory
11+
from lto.accounts.ed25519 import AccountFactory
1212

1313
account = AccountFactory(chain_id).create()
1414
```
1515
### Create an account from seed
1616

1717
```python
18-
from lto.accounts.account_factory import AccountFactory
18+
from lto.accounts.ed25519 import AccountFactory
1919

2020
account = AccountFactory(chain_id).create_from_seed(seed)
2121
```
2222

2323
### Create an account from public key
2424

2525
```python
26-
from lto.accounts.account_factory import AccountFactory
26+
from lto.accounts.ed25519 import AccountFactory
2727

2828
account = AccountFactory(chain_id).create_from_public_key(public_key)
2929
```
3030

3131
### Create an account from private key
3232

3333
```python
34-
from lto.accounts.account_factory import AccountFactory
34+
from lto.accounts.ed25519 import AccountFactory
3535

3636
account = AccountFactory(chain_id).create_from_private_key(private_key)
3737
```
3838

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
4345
from src.LTO.Transactions.Transfer import Transfer
4446
transaction = Transfer(recipient, amount)
4547
```
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).
4848

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
5154
transaction.sign_with(account)
5255
```
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
5557

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
5761
from src.LTO.PublicNode import PublicNode
5862
node = PublicNode(url)
5963
```
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
6165

62-
https://nodes.lto.network <br/>
63-
https://testnet.lto.network
66+
* https://nodes.lto.network
67+
* https://testnet.lto.network
6468

65-
### Ex of broadcasting a transaction
66-
```
69+
```python
6770
transaction.broadcast_to(node)
6871
```
6972

7073
## Transactions
74+
7175
### Transfer Transaction
7276

7377
```python
74-
from src.lto.transactions.transfer import Transfer
78+
from lto.transactions import Transfer
7579

7680
transaction = Transfer(recipient, amount)
7781
```
7882

7983
### Mass Transfer Transaction
8084

8185
```python
82-
from src.lto.transactions.mass_transfer import MassTransfer
86+
from lto.transactions import MassTransfer
8387

8488
transaction = MassTransfer(transfers)
8589
```
8690
### Anchor Transaction
8791

8892
```python
89-
import Anchor
93+
from lto.transactions import Anchor
9094

9195
transaction = Anchor(anchor)
9296
```
9397
### Lease Transaction
9498

9599
```python
96-
from src.lto.transactions.lease import Lease
100+
from lto.transactions import Lease
97101

98102
transaction = Lease(recipient, amount)
99103
```
100104
### Cancel Lease Transaction
101105

102106
```python
103-
from src.lto.transactions.cancel_lease import CancelLease
107+
from lto.transactions import CancelLease
104108

105109
transaction = CancelLease(lease_id)
106110
```
107111

108112
### SetScript Transaction
109113

110114
```python
111-
from src.lto.transactions.set_script import SetScript
115+
from lto.transactions import SetScript
112116

113117
transaction = SetScript(script)
114118
```
115119

116120
### Sponsorship transaction
117121

118122
```python
119-
from src.lto.transactions.sponsorship import Sponsorship
123+
from lto.transactions import Sponsorship
120124

121125
transaction = Sponsorship(recipient)
122126
```
123127

124128
### Cancel Sponsorship transaction
125129

126130
```python
127-
from src.lto.transactions.cancel_sponsorship import CancelSponsorship
131+
from lto.transactions import CancelSponsorship
128132

129133
transaction = CancelSponsorship(recipient)
130134
```
131135

132136
### Association transaction
133137

134138
```python
135-
from src.lto.transactions.association import Association
139+
from lto.transactions import Association
136140

137141
transaction = Association(recipient, association_type, anchor)
138142
```
139143
### Revoke Association transaction
140144

141145
```python
142-
from src.lto.transactions.revoke_association import RevokeAssociation
146+
from lto.transactions import RevokeAssociation
143147

144148
transaction = RevokeAssociation(recipient, association_type, anchor)
145149
```

0 commit comments

Comments
 (0)