Codec
Construct and serialize Tezos operations
Visit the Go Doc docu or read the source code on Github.
The codec
package can produce compliant binary encodings of all Tezos operation types and for different protocols. The default setting will always use the most recent Mainnet protocol as defined in tezos.DefaultParams
. If necessary for use with a sandbox or an old testnet, you can use one of the alternative testnet params or even define your own and use them in op.WithParams()
Assembling Operations
Codec defines a list of helpers to simplify the creation, configuration and concatenation of operation groups. The canonical way to use this package is to
Create a new operation group container
NewOp()
Add contents, i.e. concrete operations
WithContents()
adds a generic operation at the endWithContentsFront()
adds a generic operation at the front (useful for reveal)WithTransfer()
adds a tez transferWithCall()
/WithCallExt()
adds a contract callWithOrigination()
/WithOriginationExt()
adds a contract originationWithDelegation()
/WithUndelegation()
/WithRegisterBaker()
adds a delegationWithRegisterConstant()
adds a constant registration
Add configuration options
WithParams()
defines protocol and network to use for encodingWithTTL()
defines a maximum TTLWithBranch()
adds a branch for direct TTL controlWithSource()
sets a common source for all manager operations
Read and apply limits from simulation
Limits()
returns an array or current limits for each contained manager operationWithLimits()
adds gas/storage/fee limits to manager operations
Sign the operation group
Sign()
to directly sign the operation with a provided private key, orDigest()
to get watermarked bytes for external signingWithSignature()
to add the externally created signature
Get signed data for injection
Bytes()
returns encoded content of an unsigned or signed operation
For maximum control, all operation types can be constructed by allocating and filling their respective structs, then adding them as pointer to op.WithContents()
.
Last updated