Quick start
Simple template
At first you have to import Client from litewax
from litewax import Client
Then you have to initialize Client with private key or session_token from Wax Cloud Wallet.
Initialize Client with private key:
# Create a client with a private key
client = Client(private_key="5K...")
Initialize Client with session_token:
# Create a client with a session token from https://wallet.wax.io/. Guide: https://litewax.readthedocs.io/en/latest/other/get_token_session.html
client = Client(cookie="V5cS...vhF3")
Next step: Create you first Transaction. For example, transfer tokens.
# to - the account send the tokens to
to = "abuztradewax"
# Create a eosio.token contract object
contract = client.Contract("eosio.token")
# Create a transaction object
trx = client.Transaction(
contract.transfer(
_from=client.name,
to=to,
quantity="1.00000000 WAX",
memo="Test send"
)
)
Last step: Push Transaction to the blockchain.
# Push the transaction
r = trx.push()
print(r)
Summary
1from litewax import Client
2
3# Create a client with a private key
4client = Client(private_key="5K...")
5
6# to - the account send the tokens to
7to = "abuztradewax"
8
9# Create a eosio.token contract object
10contract = client.Contract("eosio.token")
11
12# Create a transaction object
13trx = client.Transaction(
14 contract.transfer(
15 _from=client.name,
16 to=to,
17 quantity="1.00000000 WAX",
18 memo="Test send"
19 )
20)
21
22# Push the transaction
23r = trx.push()
24
25print(r)