Constants
GET /explorer/constant/{hash}
Returns information about a Tezos smart contract global constant that can be used like a Macro to replace references in deployed contract code. It's a mechanism to deploy contracts larger than gas limit and re-use commonly needed code segments. Constants may be used in all parts of the contract script (code and types for params, storage and views), but cannot be used in calls. Constants may recursively include other constants.
- Schema
- Response
- Example
Field | Description |
---|---|
address hash | Constant address (expr-hash). |
creator hash | Creator account. |
height int64 | Block height when constant was registered. |
storage_size int64 | Storage size allocated in bytes. |
features array | Michelson features used by this contract. Any of account_factory , contract_factory , set_delegate , lambda , transfer_tokens , chain_id , ticket , sapling , global_constant , timelock , view . |
value object | Native Micheline value. |
{
"address": "exprteofHrmfpTEhdfQrQyt7LjVcYJfTsqgtPEQCT2kneXWm5DkH1m",
"creator": "tz1gt8TgBeWomA6dpqKeuzo8Umxfc78eS5Z6",
"height": 64862,
"time": "2021-11-19T12:20:52Z",
"storage_size": 2822,
"value": {
// ...
},
"features": [
"set_delegate",
"transfer_tokens"
]
}
curl "https://api.tzpro.io/explorer/constant/exprteofHrmfpTEhdfQrQyt7LjVcYJfTsqgtPEQCT2kneXWm5DkH1m"
import (
"context"
"github.com/trilitech/tzgo/tezos"
"github.com/trilitech/tzpro-go/tzpro"
)
// use default Mainnet client
contract, err := tzpro.DefaultClient.Contract.GetConstant(
context.Background(),
tezos.MustParseExprHash("exprteofHrmfpTEhdfQrQyt7LjVcYJfTsqgtPEQCT2kneXWm5DkH1m"),
tzpro.NoQuery,
)