# Transactions

# Fee

jigu.core.StdFee

A transaction must include a fee, otherwise it will be rejected.

# Attributes

int
gas

Gas limit.

Coins
amount

Fee amount to be paid to validator.

# Convenient factory method

StdFee.make(gas, **denoms)

You can specify the fee amount through direct assignment of the Coin amount using the denomination in the keyword arguments.

# The following are the same
A = StdFee(gas=100000, amount=Coins(uluna=1000, ukrw=1000000))
B = StdFee.make(gas=100000, uluna=1000, ukrw=1000000)
A == B # True

# Parameters

int
gas

Gas limit.


int | Dec
**denoms
optional

Coin amount to use for denomination.


# Get minimum gas prices

StdFee.min_gas_prices

Minimum gas prices equal gas limit divided by fee amount for each denomination.

fee = StdFee.make(gas=250000, ukrw=5000000, uluna=1000000)
fee.min_gas_prices # -> Coins(ukrw=Dec("0.05"), uluna=Dec("0.25"))

# Property Value

Coins

Minimum gas values for the fee

# Sign Message

jigu.core.StdSignMsg

A sign message is a data structure that is used to create a StdSignature to be later appended to the list of signatures in an StdTx. Essentially, it contains all the information needed to sign and build a transaction, and can be described as an "unsigned transaction."

from jigu.core import StdSignMsg

StdSignMsg(
    chain_id="columbus-3", # use mainnet
    account_number=1293872, # pulled off blockchain
    sequence=32, # 32 transactions have already been submitted
    fee=StdFee(...),
    msgs=[...],
    memo="Hello Jigu!"
)

# Attributes

str
chain_id

ID of blockchain to submit transaction to.

int
account_number

Account number on blockchain.

int
sequence

Sequence number (nonce), number of signed previous transactions by account included on the blockchain at time of broadcast.

StdFee
fee

Transaction fee.

StdMsg[]
msgs

List of messages to include.

str
memo

Optional note.

# Get transaction

You can get the StdTx value from a StdSignMsg.

ssm = StdSignMsg(...)
tx = ssm.to_tx() # -> StdTx
ssm.msgs == tx.msgs # -> True

# Returns

StdTx

Corresponding transaction, with an empty list for signatures.

# Signature

jigu.core.StdSignature

A signature consists of a message signature with a public key to verify its validity. You likely will not need to work with StdSignature objects directly as they are automatically created for you.

# Attributes

str
signature

Message signature string (base64-encoded).

PublicKey
pub_key

Public key.

# Verify message

StdSignature.verify_message(message)

If you have a signature, you can check that a message corresponds to it.

WARNING

Not yet implemented.

# Transaction

jigu.core.StdTx

The StdTx data structure contains the signatures from StdSignMsg with the same information, and can be broadcasted to the node to be included in a block. You likely will not need to create your own StdTx objects manually.

NOTE

The account responsible for the first signature in signatures will pay the fee.

from jigu.core import StdTx

StdTx(
    fee=StdFee(...),
    msg=[MsgSend(...)],
    signatures=[StdSignature(...)],
    memo="..."
)

# Attributes

StdFee
fee

Transaction fee.

StdMsg[]
msg

List of messages to include.

NOTE

The field name is singular but its content is plural, which contrasts with StdSignMsg. This inconsistency was inherited from Cosmos SDK.

StdSignature[]
signatures

List of signatures.

str
memo

Optional note.

# Transaction Info

jigu.core.TxInfo

A TxInfo data structure is used to capture information from a transaction lookup for a transaction already included in a block.

# Attributes

int
height

Height of the block in which the transaction was included.

str
txhash

Transaction's hash.

int
gas_wanted

Gas limit that was submitted in the fee.

int
gas_used

Actual gas consumption.

Timestamp
timestamp

Time the transaction was included.

StdFee
fee

Transaction fee.

StdSignature[]
signatures

List of signatures.

str
memo

Optional note.

MsgInfo[]
msg

Messages (with logs and events) of the transaction.

# Convenient message info query

TxInfo.msgs

We recommend using the msgs property, which creates a convenient query object around the msg attribute. In addition, it resolves the plurality inconsistency with Cosmos SDK.

# get all events...
txinfo.msgs.events

# get all swap messages
txinfo.msgs.swap

# Returns

MsgInfosQuery

Query object for MsgInfo[].

# TX Broadcast Result

jigu.core.TxBroadcastResult

# Attributes

int
height

Height of the block in which the transaction broadcasted was included. It may be 0 if it cannot be determined, such as broadcast mode async or sync was used.

str
txhash

Transaction's hash.

str
raw_log

Raw content of the logs.

int
gas_wanted

Gas limit requested.

int
gas_used

Actual gas used.

MsgInfosQuery
msgs

Querier around the messages (with logs and events) of the transaction.

Updated on: 3/10/2020, 12:51:48 PM