Jigu (지구)
The Python SDK for Terra.
Docs | Examples | Contributing
Installation
Jigu requires Python 3.7+. Install the latest version of Jigu with pip on PyPI:
$ pip install -U jigu
Pretty Printing
Many objects in Jigu are pretty-printable by their ._pp property.
Python 3.7.6 (default, Dec 30 2019, 19:38:26) >>> from jigu import Terra >>> terra = Terra("columbus-3", "https://lcd.terra.dev/") >>> terra.market.params()._pp ╒═════════════════════════╤═════════════════╕ │ pool_recovery_period │ 14400 │ ├─────────────────────────┼─────────────────┤ │ base_pool │ 250000000000 │ ├─────────────────────────┼─────────────────┤ │ min_spread │ 0.02 │ ├─────────────────────────┼─────────────────┤ │ tobin_tax │ 0.0025 │ ├─────────────────────────┼─────────────────┤ │ illiquid_tobin_tax_list │ ╒══════╤══════╕ │ │ │ │ umnt │ 0.02 │ │ │ │ ╘══════╧══════╛ │ ╘═════════════════════════╧═════════════════╛
works by default in Jupyter ...
My First Transaction
Connect to Soju testnet
Once you've installed Jigu, fire up an interactive Python shell and connect to the Soju testnet using the official Soju node provided by Terraform Labs.
from jigu import Terra
soju = Terra("soju-0013", "https://soju-lcd.terra.dev")
assert soju.is_connected()
Create an account
Before we can make any transactions, we have to have an account. Enter in the above to create an account and print its account address.
from jigu.key.mnemonic import MnemonicKey
wallet = soju.wallet(MnemonicKey.generate())
wallet.address
# terra17w4ppj92dwdf93jjtply08nav2ldzw3z2l3wzl
Top off with testnet funds
Great, now that we have an address, let's get some testnet funds. Head over to the Soju Faucet and top off some Luna.
After that's done, you should have 10,000 LUNA in your account. To confirm this, you can enter the following:
wallet.balance("uluna")
# Coin('uluna', 10000000000)
Create a transaction
Let's send 23 Testnet Luna to your friend at the following address:
terra1wg2mlrxdmnnkkykgqg4znky86nyrtc45q336yv
We'll need to create a transaction containing a MsgSend alongside a short memo (note) "Hello Jigu!" -- our version of Hello World.
from jigu.core import Coins, StdFee
from jigu.core.msg import MsgSend
send = MsgSend(
from_address=wallet.address,
to_address="terra1wg2mlrxdmnnkkykgqg4znky86nyrtc45q336yv",
amount=Coins(uluna=23_000_000)
)
fee = StdFee.make(50000, uluna=1000) # include a small fee..
tx = wallet.create_and_sign_tx(send, memo="Hello Jigu!", fee=fee)
res = wallet.broadcast(tx)
See it on the blockchain
It should take around 6 seconds to finalize. If everything went well, you should get a result object with the height and TX hash after about 6 seconds.
print(f"TX Hash: {res.txhash}")
# TX Hash: 82D5440A4C4CAB5B74EE3C98CE7F755372CD92E945425A572654179A4A0EE678
Copy the TX hash and enter it on Finder, selecting the chain soju-0013.
Learn more
Check out the official documentation at https://jigu.terra.money.
License
This software is licensed under the MIT license. See LICENSE for full disclosure.
© 2020 Terraform Labs, PTE.
Version Changelog
0.1.4 (2020-04-11)
- Fixed
SlashingAPI.signing_info_by_addressdefault argument function due to missingNone-check.
0.1.3 (2020-04-11)
- Remove debug print statement in
GovernanceAPI.proposals()
0.1.2 (2020-03-20)
- Fix
Decpretty-printing issue on Jupyter - Add
MsgInfosQuery.__contains__support for Message classes
0.1.1 (2020-03-09)
- Option to change coin type other than LUNA for MnemonicKey
- Add
ParamChangesto facilitate construction ofParameterChangeProposals.
0.1.0 (2020-03-03)
- Hello Jigu!
- Let there be light
0.0.1 - 0.0.18 (2020-01-23)
- Interface ideation
- Primordial world
Metadata
Release files for jigu 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jigu-0.1.4.tar.gz | 426.1 kB | Without provenance | Details for jigu-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jigu-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for jigu-0.1.4-py3-none-any.whl |
Total release size: 507.6 kB
Release files / jigu-0.1.4.tar.gz
| Download URL | jigu-0.1.4.tar.gz |
|---|---|
| Size | 426.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
92036333617508bcb6a2afef19999ce297f03ed71ab314bd239101a9e7b19228
|
|
BLAKE2b-256 checksum How to use checksums |
6941b4d6ecdb504aafaf078115b969d4e2714792fc4b14a3b7e7a7537493c9de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5
|
Release files / jigu-0.1.4-py3-none-any.whl
| Download URL | jigu-0.1.4-py3-none-any.whl |
|---|---|
| Size | 81.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f162db762f64fa7a66e39634bc558b45937b1113972c8dc2b49bb9fbfa362c3b
|
|
BLAKE2b-256 checksum How to use checksums |
db85d5f7b9433a3ce22703c142f6e980f079b5b79e4bdf55c4ac1217a15f3ee9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.14.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5
|
Security for jigu 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.