- Contract / Module:
- free.util-chain-data
This modules contains some helpers to retrieve Chainweb environment variables. (ie: chain-data)
It helps to make the code more readable without the need to redefine theses function in each user module.
→ string
Retrieve the chain-id.
pact> (chain-id)
"2"
→ integer
Retrieve the block-height.
pact> (block-height)
6548432
→ time
Retrieve the block-time.
pact> (block-time)
"2022-12-04T14:54:24Z"
→ string
Retrieve the prev-block-hash.
pact> (prev-block-hash)
"2EoTAXJuUK1EKYwZbF3Q2cuYzbdCZRm_JdRERuMnuAk"
→ string
Retrieve the transaction sender.
pact> (sender)
"bob"
→ integer
Return the gas-limit from transactions Meta.
pact> (gas-limit)
1200
→ decimal
Return the gas-price from transactions Meta.
pact> (gas-price)
0.001
→ decimal
Return the total gas spendable for the transaction.
ie: the product of the gas-price by gas-limit
pact> (total-gas-limit)
1.2