types

package
v2.0.2-beta1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 1

README

This package contains declaration of casper types and base functions to construct them. (See documentation for more information.)

Documentation

Index

Constants

View Source
const (
	TransactionRuntimeTagVmCasperV1 = iota
	TransactionRuntimeTagVmCasperV2
)
View Source
const (
	PricingModeClassicTag = iota
	PricingModeFixedTag
	PricingModeReservedTag
)
View Source
const (
	TransactionEntryPointCustom             = "Custom"
	TransactionEntryPointTransfer           = "Transfer"
	TransactionEntryPointAddBid             = "AddBid"
	TransactionEntryPointWithdrawBid        = "WithdrawBid"
	TransactionEntryPointDelegate           = "Delegate"
	TransactionEntryPointUndelegate         = "Undelegate"
	TransactionEntryPointRedelegate         = "Redelegate"
	TransactionEntryPointActivateBid        = "ActivateBid"
	TransactionEntryPointChangeBidPublicKey = "ChangeBidPublicKey"
	TransactionEntryPointCall               = "Call"
)
View Source
const (
	TransactionEntryPointCustomTag = iota
	TransactionEntryPointTransferTag
	TransactionEntryPointAddBidTag
	TransactionEntryPointWithdrawBidTag
	TransactionEntryPointDelegateTag
	TransactionEntryPointUndelegateTag
	TransactionEntryPointRedelegateTag
	TransactionEntryPointActivateBidTag
	TransactionEntryPointChangeBidPublicKeyTag
	TransactionEntryPointCallTag
)
View Source
const (
	TransactionSchedulingNativeTag = iota
	TransactionSchedulingFutureEraTag
	TransactionSchedulingFutureTimestampTag
)
View Source
const (
	TransactionTargetTypeNative = iota
	TransactionTargetTypeStored
	TransactionTargetTypeSession
)
View Source
const (
	InvocationTargetTagByHash = iota
	InvocationTargetTagByName
	InvocationTargetTagByPackageHash
	InvocationTargetTagByPackageName
)

Variables

View Source
var (
	ErrInvalidBodyHash          = errors.New("invalid body hash")
	ErrInvalidTransactionHash   = errors.New("invalid transaction hash")
	ErrInvalidApprovalSignature = errors.New("invalid approval signature")
)
View Source
var ErrArgumentNotFound = errors.New("argument is not found")
View Source
var (
	ErrInvalidDeployHash = errors.New("invalid deploy hash")
)
View Source
var ErrNamedKeyNotFound = errors.New("NamedKey not found")

Functions

func ArgsFromRawJson

func ArgsFromRawJson(raw json.RawMessage) (clvalue.CLValue, error)

Types

type Account

type Account struct {
	// AccountHash is an Account's identity key
	AccountHash key.AccountHash `json:"account_hash"`
	// TODO: Is it could be any type of keys or certain types?
	NamedKeys NamedKeys `json:"named_keys"`
	// Purse that can hold Casper tokens
	MainPurse key.URef `json:"main_purse"`
	// Set of public keys allowed to provide signatures on deploys for the account
	AssociatedKeys []AssociatedKey `json:"associated_keys"`
	// Thresholds that have to be met when executing an action of a certain type.
	ActionThresholds ActionThresholds `json:"action_thresholds"`
}

Account representing a user's account, stored in a global state.

type ActionThresholds

type ActionThresholds struct {
	// Threshold that has to be met for a deployment action
	Deployment uint64 `json:"deployment"`
	// Threshold that has to be met for a key management action
	KeyManagement uint64 `json:"key_management"`
}

ActionThresholds have to be met when executing an action of a certain type.

type AddressableEntity

type AddressableEntity struct {
	// The type of Package.
	EntityKind  EntityKind `json:"entity_kind"`
	PackageHash string     `json:"package_hash"`
	// The hash address of the contract wasm
	ByteCodeHash string `json:"byte_code_hash"`
	// A collection of weighted public keys (represented as account hashes) associated with an account.
	AssociatedKeys []AssociatedKey `json:"associated_keys"`
	// Thresholds that have to be met when executing an action of a certain type.
	ActionThresholds EntityActionThresholds `json:"action_thresholds"`
	MainPurse        key.URef               `json:"main_purse"`
	// Casper Platform protocol version
	ProtocolVersion string `json:"protocol_version"`

	MessageTopics []MessageTopic `json:"message_topics"`
}

type Approval

type Approval struct {
	Signature HexBytes          `json:"signature"`
	Signer    keypair.PublicKey `json:"signer"`
}

type Args

type Args []PairArgument

func (*Args) AddArgument

func (args *Args) AddArgument(name string, value clvalue.CLValue) *Args

func (Args) Bytes

func (args Args) Bytes() ([]byte, error)

func (Args) Find

func (args Args) Find(name string) (*Argument, error)

type Argument

type Argument struct {
	// contains filtered or unexported fields
}

func (*Argument) Bytes

func (a *Argument) Bytes() (HexBytes, error)

func (*Argument) MarshalJSON

func (a *Argument) MarshalJSON() ([]byte, error)

func (*Argument) Name

func (a *Argument) Name() (string, error)

func (*Argument) Parsed

func (a *Argument) Parsed() (json.RawMessage, error)

func (*Argument) Raw

func (a *Argument) Raw() (RawArg, error)

func (*Argument) UnmarshalJSON

func (a *Argument) UnmarshalJSON(bytes []byte) error

func (*Argument) Value

func (a *Argument) Value() (clvalue.CLValue, error)

type AssociatedKey

type AssociatedKey struct {
	// AccountHash is an Account's identity key
	AccountHash key.AccountHash `json:"account_hash"`
	// Weight of the associated key
	Weight uint64 `json:"weight"`
}

AssociatedKey is allowed to provide signatures on deploys for the account

type AuctionState

type AuctionState struct {
	// All bids contained within a vector.
	Bids          []PublicKeyAndBid `json:"bids"`
	BlockHeight   uint64            `json:"block_height"`
	EraValidators []EraValidators   `json:"era_validators"`
	StateRootHash string            `json:"state_root_hash"`
}

AuctionState is a data structure summarizing auction contract data.

type Bid

type Bid struct {
	// The purse was used for bonding.
	BondingPurse key.URef `json:"bonding_purse"`
	// The delegation rate.
	DelegationRate uint8 `json:"delegation_rate"`
	// `true` if validator has been "evicted"
	Inactive bool `json:"inactive"`
	// The amount of tokens staked by a validator (not including delegators).
	StakedAmount clvalue.UInt512 `json:"staked_amount"`
	// Validator's public key.
	ValidatorPublicKey keypair.PublicKey `json:"validator_public_key"`
	// The delegators.
	Delegators Delegators `json:"delegators"`
	// Vesting schedule for a genesis validator. `None` if non-genesis validator.
	VestingSchedule *VestingSchedule `json:"vesting_schedule"`
}

Bid An entry in the validator map.

type BidKind

type BidKind struct {
	// A unified record indexed on validator data, with an embedded collection of all delegator bids assigned to that validator.
	Unified *Bid `json:"Unified,omitempty"`
	// A bid record containing only validator data.
	Validator *ValidatorBid `json:"Validator,omitempty"`
	// A bid record containing only delegator data.
	Delegator *Delegator `json:"Delegator,omitempty"`
	// A bridge record pointing to a new `ValidatorBid` after the public key was changed.
	Bridge *Bridge `json:"Bridge,omitempty"`
	// New validator public key associated with the bid.
	Credit *Credit `json:"Credit,omitempty"`
}

BidKind Auction bid variants.

type Block

type Block struct {
	Hash                key.Hash                        `json:"hash"`
	Height              uint64                          `json:"height"`
	StateRootHash       key.Hash                        `json:"state_root_hash"`
	LastSwitchBlockHash key.Hash                        `json:"last_switch_block_hash"`
	ParentHash          key.Hash                        `json:"parent_hash"`
	EraID               uint64                          `json:"era_id"`
	Timestamp           Timestamp                       `json:"timestamp"`
	AccumulatedSeed     *key.Hash                       `json:"accumulated_seed,omitempty"`
	RandomBit           bool                            `json:"random_bit"`
	CurrentGasPrice     uint8                           `json:"current_gas_price"`
	Proposer            Proposer                        `json:"proposer"`
	ProtocolVersion     string                          `json:"protocol_version,omitempty"`
	EraEnd              *EraEnd                         `json:"era_end"`
	Transactions        BlockTransactions               `json:"transactions"`
	RewardedSignatures  []SingleBlockRewardedSignatures `json:"rewarded_signatures"`
	Proofs              []Proof                         `json:"proofs"`
	// contains filtered or unexported fields
}

Block represents a common object returned as result from RPC response unifying BlockV2 and BlockV1

func NewBlockFromBlockV1

func NewBlockFromBlockV1(blockV1 BlockV1) Block

NewBlockFromBlockV1 construct Block from BlockV1

func NewBlockFromBlockWrapper

func NewBlockFromBlockWrapper(blockWrapper BlockWrapper, proofs []Proof) Block

NewBlockFromBlockWrapper construct Block from BlockWithSignatures

func (Block) GetBlockV1

func (b Block) GetBlockV1() *BlockV1

func (Block) GetBlockV2

func (b Block) GetBlockV2() *BlockV2

type BlockBodyV1

type BlockBodyV1 struct {
	// List of `Deploy` hashes included in the block
	DeployHashes []key.Hash `json:"deploy_hashes"`
	// Public key of the validator that proposed the block
	Proposer Proposer `json:"proposer"`
	// List of `TransferHash` hashes included in the block
	TransferHashes []key.Hash `json:"transfer_hashes"`
}

type BlockBodyV2

type BlockBodyV2 struct {
	// Map of transactions mapping categories to a list of transaction hashes.
	Transactions BlockTransactions `json:"transactions"`
	// List of identifiers for finality signatures for a particular past block
	RewardedSignatures []SingleBlockRewardedSignatures `json:"rewarded_signatures"`
}

type BlockHeader

type BlockHeader struct {
	AccumulatedSeed *key.Hash `json:"accumulated_seed,omitempty"`
	BodyHash        key.Hash  `json:"body_hash"`
	EraID           uint64    `json:"era_id"`
	CurrentGasPrice uint8     `json:"current_gas_price"`
	Height          uint64    `json:"height"`
	ParentHash      key.Hash  `json:"parent_hash"`
	Proposer        Proposer  `json:"proposer"`
	ProtocolVersion string    `json:"protocol_version,omitempty"`
	RandomBit       bool      `json:"random_bit"`
	StateRootHash   key.Hash  `json:"state_root_hash"`
	Timestamp       Timestamp `json:"timestamp"`
	EraEnd          *EraEnd   `json:"era_end"`
	// contains filtered or unexported fields
}

func NewBlockHeaderFromV1

func NewBlockHeaderFromV1(header BlockHeaderV1) BlockHeader

func NewBlockHeaderFromV2

func NewBlockHeaderFromV2(header BlockHeaderV2) BlockHeader

func (BlockHeader) GetBlockHeaderV1

func (b BlockHeader) GetBlockHeaderV1() *BlockHeaderV1

func (BlockHeader) GetBlockHeaderV2

func (b BlockHeader) GetBlockHeaderV2() *BlockHeaderV2

type BlockHeaderV1

type BlockHeaderV1 struct {
	AccumulatedSeed *key.Hash `json:"accumulated_seed,omitempty"`
	BodyHash        key.Hash  `json:"body_hash"`
	EraID           uint64    `json:"era_id"`
	Height          uint64    `json:"height"`
	ParentHash      key.Hash  `json:"parent_hash"`
	ProtocolVersion string    `json:"protocol_version,omitempty"`
	RandomBit       bool      `json:"random_bit"`
	StateRootHash   key.Hash  `json:"state_root_hash"`
	Timestamp       Timestamp `json:"timestamp"`
	EraEnd          *EraEndV1 `json:"era_end"`
}

type BlockHeaderV2

type BlockHeaderV2 struct {
	AccumulatedSeed     *key.Hash `json:"accumulated_seed,omitempty"`
	BodyHash            key.Hash  `json:"body_hash"`
	EraID               uint64    `json:"era_id"`
	CurrentGasPrice     uint8     `json:"current_gas_price"`
	Height              uint64    `json:"height"`
	ParentHash          key.Hash  `json:"parent_hash"`
	Proposer            Proposer  `json:"proposer"`
	ProtocolVersion     string    `json:"protocol_version,omitempty"`
	RandomBit           bool      `json:"random_bit"`
	StateRootHash       key.Hash  `json:"state_root_hash"`
	LastSwitchBlockHash key.Hash  `json:"last_switch_block_hash"`
	Timestamp           Timestamp `json:"timestamp"`
	EraEnd              *EraEndV2 `json:"era_end"`
}

type BlockHeaderWrapper

type BlockHeaderWrapper struct {
	BlockHeaderV1 *BlockHeaderV1 `json:"Version1"`
	BlockHeaderV2 *BlockHeaderV2 `json:"Version2"`
}

type BlockTransaction

type BlockTransaction struct {
	Category TransactionCategory
	Version  TransactionVersion
	Hash     key.Hash
}

type BlockTransactions

type BlockTransactions []BlockTransaction

func (*BlockTransactions) UnmarshalJSON

func (t *BlockTransactions) UnmarshalJSON(data []byte) error

type BlockV1

type BlockV1 struct {
	Hash   key.Hash      `json:"hash"`
	Header BlockHeaderV1 `json:"header"`
	Body   BlockBodyV1   `json:"body"`
	Proofs []Proof       `json:"proofs"`
}

type BlockV2

type BlockV2 struct {
	Hash   key.Hash      `json:"hash"`
	Header BlockHeaderV2 `json:"header"`
	Body   BlockBodyV2   `json:"body"`
}

type BlockWithSignatures

type BlockWithSignatures struct {
	Block  BlockWrapper `json:"block"`
	Proofs []Proof      `json:"proofs"`
}

type BlockWrapper

type BlockWrapper struct {
	BlockV1 *BlockV1 `json:"Version1"`
	BlockV2 *BlockV2 `json:"Version2"`
}

type Bridge

type Bridge struct {
	EraID uint64 `json:"era_id"`
	// Previous validator public key associated with the bid."
	OldValidatorPublicKey keypair.PublicKey `json:"old_validator_public_key"`
	// New validator public key associated with the bid.
	NewValidatorPublicKey keypair.PublicKey `json:"new_validator_public_key"`
}

Bridge is a bridge record pointing to a new `ValidatorBid` after the public key was changed.

type ByPackageHashInvocationTarget

type ByPackageHashInvocationTarget struct {
	Addr    key.Hash `json:"addr"`
	Version *uint32  `json:"version"`
}

ByPackageHashInvocationTarget The address and optional version identifying the package.

type ByPackageNameInvocationTarget

type ByPackageNameInvocationTarget struct {
	Name    string  `json:"name"`
	Version *uint32 `json:"version"`
}

ByPackageNameInvocationTarget The alias and optional version identifying the package.

type ByteCode

type ByteCode struct {
	Kind ByteCodeKind `json:"kind"`
	// Bytes array representation of underlying data
	Bytes HexBytes `json:"bytes"`
}

ByteCode A container for contract's Wasm bytes.

type ByteCodeKind

type ByteCodeKind string

ByteCodeKind The type of Byte code.

func (ByteCodeKind) IsEmpty

func (b ByteCodeKind) IsEmpty() bool

func (ByteCodeKind) IsV1CasperWasm

func (b ByteCodeKind) IsV1CasperWasm() bool

type CLTypeRaw

type CLTypeRaw struct {
	json.RawMessage
}

func (CLTypeRaw) ParseCLType

func (t CLTypeRaw) ParseCLType() (cltype.CLType, error)

type ClassicMode

type ClassicMode struct {
	// User-specified gas_price tolerance (minimum 1). This is interpreted to mean "do not include this transaction in a block if the current gas price is greater than this number"
	GasPriceTolerance uint8 `json:"gas_price_tolerance"`
	// User-specified payment amount.
	PaymentAmount uint64 `json:"payment_amount"`
	// Standard payment.
	StandardPayment bool `json:"standard_payment"`
}

type Contract

type Contract struct {
	// Key to the storage of the ContractPackage object
	ContractPackageHash key.ContractPackageHash `json:"contract_package_hash"`
	// Key to the storage of the ContractWasm object
	ContractWasmHash key.ContractHash `json:"contract_wasm_hash"`
	// List of entry points or methods in the contract.
	EntryPoints []EntryPointV1 `json:"entry_points"`
	// NamedKeys are a collection of String-Key pairs used to easily identify some data on the network.
	NamedKeys NamedKeys `json:"named_keys"`
	// The protocol version when the contract was deployed
	ProtocolVersion string `json:"protocol_version"`
}

Contract contains information, entry points and named keys belonging to a Contract

type ContractGroup

type ContractGroup struct {
	// Group label
	Group string `json:"group"`
	// List of URefs associated with the group label.
	Keys []key.URef `json:"keys"`
}

ContractGroup associate a set of URefs with a label.

type ContractPackage

type ContractPackage struct {
	// Access key for this contract.
	AccessKey key.URef `json:"access_key"`
	// List of disabled versions of a contract.
	DisabledVersions []DisabledContractVersion `json:"disabled_versions"`
	// Groups associate a set of URefs with a label. Entry points on a contract can be given
	// a list of labels they accept and the runtime will check that a URef from at least one
	// of the allowed groups is present in the caller’s context before execution.
	Groups []ContractGroup `json:"groups"`
	// List of active versions of a contract.
	Versions   []ContractVersion `json:"versions"`
	LockStatus string            `json:"lock_status"`
}

ContractPackage contains contract definition, metadata, and security container.

type ContractVersion

type ContractVersion struct {
	// Hash for this version of the contract.
	Hash key.ContractHash `json:"contract_hash"`
	// Contract version.
	Version uint16 `json:"contract_version"`
	//  The major element of the protocol version this contract is compatible with.
	ProtocolVersionMajor uint16 `json:"protocol_version_major"`
}

ContractVersion contains information related to an active version of a contract.

type Credit

type Credit struct {
	// The era id the credit was created.
	EraID uint64 `json:"era_id"`
	// Validator's public key.
	ValidatorPublicKey keypair.PublicKey `json:"validator_public_key"`
	// The credit amount.
	Amount clvalue.UInt512 `json:"amount"`
}

Credit is a bridge record pointing to a new `ValidatorBid` after the public key was changed.

type Delegator

type Delegator struct {
	// The purse that was used for delegating.
	BondingPurse key.URef `json:"bonding_purse"`
	// Amount of Casper token (in motes) delegated
	StakedAmount clvalue.UInt512 `json:"staked_amount"`
	// Public Key of the delegator
	DelegatorPublicKey keypair.PublicKey `json:"delegator_public_key"`
	// Public key of the validator
	ValidatorPublicKey keypair.PublicKey `json:"validator_public_key"`
	// Vesting schedule for a genesis validator. `None` if non-genesis validator.
	VestingSchedule *VestingSchedule `json:"vesting_schedule"`
}

Delegator is associated with the given validator.

func NewDelegatorFromDelegatorV1

func NewDelegatorFromDelegatorV1(v1 DelegatorV1) Delegator

type DelegatorAllocation

type DelegatorAllocation struct {
	// Public key of the delegator
	DelegatorPublicKey keypair.PublicKey `json:"delegator_public_key"`
	// Public key of the validator
	ValidatorPublicKey keypair.PublicKey `json:"validator_public_key"`
	// Amount allocated as a reward.
	Amount clvalue.UInt512 `json:"amount"`
}

type DelegatorV1

type DelegatorV1 struct {
	// The purse that was used for delegating.
	BondingPurse key.URef `json:"bonding_purse"`
	// Amount of Casper token (in motes) delegated
	StakedAmount clvalue.UInt512 `json:"staked_amount"`
	// Public Key of the validator
	Delegatee keypair.PublicKey `json:"delegatee"`
	// Public key of the delegator
	PublicKey keypair.PublicKey `json:"public_key"`
	// Vesting schedule for a genesis validator. `None` if non-genesis validator.
	VestingSchedule *VestingSchedule `json:"vesting_schedule"`
}

DelegatorV1 of version 1 which is associated with the given validator.

type Delegators

type Delegators []Delegator

Delegators the delegators type.

func (*Delegators) UnmarshalJSON

func (d *Delegators) UnmarshalJSON(data []byte) error

type Deploy

type Deploy struct {
	// List of signers and signatures for this `deploy`.
	Approvals []Approval `json:"approvals"`
	// A hash over the header of the `deploy`.
	Hash key.Hash `json:"hash"`
	// Contains metadata about the `deploy`.
	Header DeployHeader `json:"header"`
	// Contains the payment amount for the `deploy`.
	Payment ExecutableDeployItem `json:"payment"`
	// Contains the session information for the `deploy`.
	Session ExecutableDeployItem `json:"session"`
}

Deploy is an item containing a smart contract along with the requester's signature(s).

func MakeDeploy

func MakeDeploy(deployHeader DeployHeader, payment ExecutableDeployItem, session ExecutableDeployItem) (*Deploy, error)

func NewDeploy

func NewDeploy(hash key.Hash, header DeployHeader, payment ExecutableDeployItem, sessions ExecutableDeployItem,
	approvals []Approval) *Deploy

func (*Deploy) Sign

func (d *Deploy) Sign(keys keypair.PrivateKey) error

func (*Deploy) Validate

func (d *Deploy) Validate() error

type DeployExecutionInfo

type DeployExecutionInfo struct {
	BlockHash       key.Hash        `json:"block_hash"`
	BlockHeight     uint64          `json:"block_height"`
	ExecutionResult ExecutionResult `json:"execution_result"`
}

DeployExecutionInfo represents the result of executing a single deploy V2

func DeployExecutionInfoFromV1

func DeployExecutionInfoFromV1(results []DeployExecutionResult, height *uint64) DeployExecutionInfo

type DeployExecutionResult

type DeployExecutionResult struct {
	BlockHash key.Hash          `json:"block_hash"`
	Result    ExecutionResultV1 `json:"result"`
}

DeployExecutionResult represents the result of executing a single deploy.

type DeployHeader

type DeployHeader struct {
	// Public Key from the `AccountHash` owning the `Deploy`.
	Account keypair.PublicKey `json:"account"`
	// `Hash` of the body part of this `Deploy`.
	BodyHash  key.Hash `json:"body_hash"`
	ChainName string   `json:"chain_name"`
	// List of `Deploy` hashes.
	Dependencies []key.Hash `json:"dependencies"`
	GasPrice     uint64     `json:"gas_price"`
	// `Timestamp` formatted as per RFC 3339
	Timestamp Timestamp `json:"timestamp"`
	// Duration of the `Deploy` in milliseconds (from timestamp).
	TTL Duration `json:"ttl"`
}

func DefaultDeployHeader

func DefaultDeployHeader() DeployHeader

func (DeployHeader) Bytes

func (d DeployHeader) Bytes() []byte

type DeployInfo

type DeployInfo struct {
	// The `Deploy` hash.
	DeployHash key.Hash `json:"deploy_hash"`
	// `Account` identifier of the creator of the `Deploy`.
	From key.AccountHash `json:"from"`
	// `Gas` cost of executing the `Deploy`.
	Gas uint64 `json:"gas,string"`
	// `Source` purse used for payment of the `Deploy`.
	Source key.URef `json:"source"`
	// `Transfer` addresses performed by the `Deploy`.
	Transfers []key.TransferHash `json:"transfers"`
}

DeployInfo provides information relating to the given Deploy.

type DisabledContractVersion

type DisabledContractVersion struct {
	// Contract version.
	Version uint16 `json:"contract_version"`
	//  The major element of the protocol version this contract is compatible with.
	ProtocolVersionMajor uint16 `json:"protocol_version_major"`
}

DisabledContractVersion is a disabled version of a contract.

type Duration

type Duration time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(data []byte) error

type Effect

type Effect struct {
	Operations []Operation    `json:"operations"`
	Transforms []TransformKey `json:"transforms"`
}

type Effects

type Effects []Transform

Effects A log of all transforms produced during execution, used only in 2.0+ Network

type EntityActionThresholds

type EntityActionThresholds struct {
	// Threshold for deploy execution.
	Deployment uint64 `json:"deployment"`
	// Threshold for upgrading contracts.
	UpgradeManagement uint64 `json:"upgrade_management"`
	// Threshold for managing action threshold.
	KeyManagement uint64 `json:"key_management"`
}

EntityActionThresholds Thresholds that have to be met when executing an action of a certain type.

type EntityKind

type EntityKind struct {
	System        *SystemEntityType   `json:"System,omitempty"`
	Account       *key.AccountHash    `json:"Account,omitempty"`
	SmartContract *TransactionRuntime `json:"SmartContract,omitempty"`
}

type EntityVersionAndHash

type EntityVersionAndHash struct {
	AddressableEntityHash key.AddressableEntityHash `json:"addressable_entity_hash"`
	EntityVersionKey      EntityVersionKey          `json:"entity_version_key"`
}

type EntityVersionKey

type EntityVersionKey struct {
	// Automatically incremented value for a contract version within a major `ProtocolVersion`.
	EntityVersion uint32 `json:"entity_version"`
	// Major element of `ProtocolVersion` a `ContractVersion` is compatible with.
	ProtocolVersionMajor uint32 `json:"protocol_version_major"`
}

EntityVersionKey Major element of `ProtocolVersion` combined with `EntityVersion`.

type EntryPointAccess

type EntryPointAccess struct {
	json.RawMessage
}

EntryPointAccess is access control options for a contract entry point (method). TODO: to implement

type EntryPointArg

type EntryPointArg struct {
	Name   string    `json:"name"`
	CLType CLTypeRaw `json:"cl_type"`
}

type EntryPointPayment

type EntryPointPayment string

EntryPointPayment An enum specifying who pays for the invocation and execution of the entrypoint.

const (
	EntryPointPaymentCaller     EntryPointPayment = "Caller"
	EntryPointPaymentSelfOnly   EntryPointPayment = "SelfOnly"
	EntryPointPaymentSelfOnward EntryPointPayment = "SelfOnward"
)

type EntryPointType

type EntryPointType string

EntryPointType defines whether the code runs in the contract's or the session context.

const (
	EntryPointTypeSession  EntryPointType = "Session"
	EntryPointTypeContract EntryPointType = "Contract"
	EntryPointTypeCaller   EntryPointType = "Caller"
	EntryPointTypeCalled   EntryPointType = "Called"
	EntryPointTypeFactory  EntryPointType = "Factory"
)

type EntryPointV1

type EntryPointV1 struct {
	// Access control options for a contract entry point
	Access EntryPointAccess `json:"access"`
	// List of input parameters to the method.
	// Order of arguments matter since can be referenced by index as well as name.
	Args []EntryPointArg `json:"args"`
	// Context of method execution
	EntryPointType EntryPointType `json:"entry_point_type"`
	// Context of method execution
	EntryPointPayment EntryPointPayment `json:"entry_point_payment"`
	// Name of the entry point
	Name string `json:"name"`
	// Returned type
	Ret CLTypeRaw `json:"ret"`
}

EntryPointV1 is a type signature of a method. Order of arguments matter since can be referenced by index as well as name.

type EntryPointV2

type EntryPointV2 struct {
	// The flags
	Flags uint32 `json:"flags"`
	// The selector.
	FunctionIndex uint32 `json:"functionIndex"`
}

EntryPointV2 Entrypoints to be executed against the V2 Casper VM.

type EntryPointValue

type EntryPointValue struct {
	V1CasperVm *EntryPointV1 `json:"V1CasperVm"`
	V2CasperVm *EntryPointV2 `json:"V2CasperVm"`
}

EntryPointValue The encapsulated representation of entrypoints.

type EraEnd

type EraEnd struct {
	// The set of equivocators
	Equivocators []keypair.PublicKey `json:"equivocators"`
	// Validators that haven't produced any unit during the era
	InactiveValidators []keypair.PublicKey `json:"inactive_validators"`
	// The validators for the upcoming era and their respective weights
	NextEraValidatorWeights []ValidatorWeightEraEnd `json:"next_era_validator_weights"`
	// The rewards distributed to the validators
	Rewards         map[string][]clvalue.UInt512 `json:"rewards"`
	NextEraGasPrice uint8                        `json:"next_era_gas_price"`
}

func NewEraEndFromV1

func NewEraEndFromV1(eraEnd *EraEndV1) *EraEnd

func NewEraEndFromV2

func NewEraEndFromV2(eraEnd *EraEndV2) *EraEnd

type EraEndV1

type EraEndV1 struct {
	EraReport EraReport `json:"era_report"`
	// A list of validator weights for the next era
	NextEraValidatorWeights []ValidatorWeightEraEnd `json:"next_era_validator_weights"`
}

EraEndV1 contains a report and list of validator weights for the next era

type EraEndV2

type EraEndV2 struct {
	// The set of equivocators
	Equivocators []keypair.PublicKey `json:"equivocators"`
	// Validators that haven't produced any unit during the era
	InactiveValidators []keypair.PublicKey `json:"inactive_validators"`
	// The validators for the upcoming era and their respective weights
	NextEraValidatorWeights []ValidatorWeightEraEnd `json:"next_era_validator_weights"`
	// The rewards distributed to the validators
	Rewards         map[string][]clvalue.UInt512 `json:"rewards"`
	NextEraGasPrice uint8                        `json:"next_era_gas_price"`
}

EraEndV2 information related to the end of an era, and validator weights for the following era

type EraInfo

type EraInfo struct {
	// List of rewards allocated to delegators and validators.
	SeigniorageAllocations []SeigniorageAllocation `json:"seigniorage_allocations"`
}

EraInfo stores an auction metadata. Intended to be recorded at each era.

type EraReport

type EraReport struct {
	// List of public keys of the equivocators
	Equivocators []keypair.PublicKey `json:"equivocators"`
	// List of public keys of inactive validators
	InactiveValidators []keypair.PublicKey `json:"inactive_validators"`
	Rewards            []EraReward         `json:"rewards"`
}

EraReport is an equivocation and reward information to be included in the terminal block.

type EraReward

type EraReward struct {
	Validator keypair.PublicKey `json:"validator"`
	Amount    clvalue.UInt512   `json:"amount"`
}

type EraSummary

type EraSummary struct {
	// The block hash
	BlockHash key.Hash `json:"block_hash"`
	// The Era Id
	EraID uint64 `json:"era_id"`
	// The StoredValue containing era information.
	StoredValue StoredValue `json:"stored_value"`
	// Hex-encoded hash of the state root.
	StateRootHash key.Hash `json:"state_root_hash"`
	// The merkle proof.
	MerkleProof string `json:"merkle_proof"`
}

EraSummary is a summary of an era

type EraValidators

type EraValidators struct {
	EraID uint64 `json:"era_id"`
	// List of the validator's weight in the Era
	ValidatorWeights []ValidatorWeightAuction `json:"validator_weights"`
}

EraValidators contains validators and weights for an Era.

type ExecutableDeployItem

type ExecutableDeployItem struct {
	ModuleBytes                   *ModuleBytes                   `json:"ModuleBytes,omitempty"`
	StoredContractByHash          *StoredContractByHash          `json:"StoredContractByHash,omitempty"`
	StoredContractByName          *StoredContractByName          `json:"StoredContractByName,omitempty"`
	StoredVersionedContractByHash *StoredVersionedContractByHash `json:"StoredVersionedContractByHash,omitempty"`
	StoredVersionedContractByName *StoredVersionedContractByName `json:"StoredVersionedContractByName,omitempty"`
	Transfer                      *TransferDeployItem            `json:"Transfer,omitempty"`
}

ExecutableDeployItem is a base structure for the possible variants of an executable deploy. This structure should contain only one object.

func StandardPayment

func StandardPayment(amount *big.Int) ExecutableDeployItem

func (ExecutableDeployItem) Args

func (e ExecutableDeployItem) Args() *Args

func (ExecutableDeployItem) Bytes

func (e ExecutableDeployItem) Bytes() ([]byte, error)

type ExecutableDeployItemType

type ExecutableDeployItemType byte
const (
	ExecutableDeployItemTypeModuleBytes ExecutableDeployItemType = iota
	ExecutableDeployItemTypeStoredContractByHash
	ExecutableDeployItemTypeStoredContractByName
	ExecutableDeployItemTypeStoredVersionedContractByHash
	ExecutableDeployItemTypeStoredVersionedContractByName
	ExecutableDeployItemTypeTransfer
)

type ExecutionInfo

type ExecutionInfo struct {
	BlockHash       key.Hash        `json:"block_hash"`
	BlockHeight     uint64          `json:"block_height"`
	ExecutionResult ExecutionResult `json:"execution_result"`
}

ExecutionInfo represents the result of executing a single deploy V2

func ExecutionInfoFromV1

func ExecutionInfoFromV1(results []DeployExecutionResult, height *uint64) ExecutionInfo

type ExecutionResult

type ExecutionResult struct {
	Initiator    InitiatorAddr   `json:"initiator"`
	ErrorMessage *string         `json:"error_message"`
	Limit        uint64          `json:"limit,string"`
	Consumed     uint64          `json:"consumed,string"`
	Cost         uint64          `json:"cost,string"`
	Payment      json.RawMessage `json:"payment"`
	Transfers    []Transfer      `json:"transfers"`
	SizeEstimate uint64          `json:"size_estimate"`
	Effects      []Transform     `json:"effects"`
	// contains filtered or unexported fields
}

func NewExecutionResultFromV1

func NewExecutionResultFromV1(v1 ExecutionResultV1) ExecutionResult

func (*ExecutionResult) GetExecutionResultV1

func (v *ExecutionResult) GetExecutionResultV1() *ExecutionResultV1

func (*ExecutionResult) GetExecutionResultV2

func (v *ExecutionResult) GetExecutionResultV2() *ExecutionResultV2

func (*ExecutionResult) UnmarshalJSON

func (v *ExecutionResult) UnmarshalJSON(data []byte) error

type ExecutionResultStatusData

type ExecutionResultStatusData struct {
	Effect Effect `json:"effect"`
	// A record of `Transfers` performed while executing the `deploy`.
	Transfers    []key.TransferHash `json:"transfers"`
	Cost         uint64             `json:"cost,string"`
	ErrorMessage string             `json:"error_message"`
}

type ExecutionResultV1

type ExecutionResultV1 struct {
	Success *ExecutionResultStatusData `json:"Success,omitempty"`
	Failure *ExecutionResultStatusData `json:"Failure,omitempty"`
}

type ExecutionResultV2

type ExecutionResultV2 struct {
	Initiator    InitiatorAddr   `json:"initiator"`
	ErrorMessage *string         `json:"error_message"`
	Limit        uint64          `json:"limit,string"`
	Consumed     uint64          `json:"consumed,string"`
	Cost         uint64          `json:"cost,string"`
	Payment      json.RawMessage `json:"payment"`
	Transfers    []Transfer      `json:"transfers"`
	SizeEstimate uint64          `json:"size_estimate"`
	Effects      []Transform     `json:"effects"`
}

ExecutionResultV2 represents the result of executing a single deploy for V2 version

type FixedMode

type FixedMode struct {
	// User-specified gas_price tolerance (minimum 1). This is interpreted to mean "do not include this transaction in a block if the current gas price is greater than this number"
	GasPriceTolerance uint8 `json:"gas_price_tolerance"`
}

type FutureEraScheduling

type FutureEraScheduling struct {
	EraID uint64
}

type FutureTimestampScheduling

type FutureTimestampScheduling struct {
	TimeStamp Timestamp `json:"FutureTimestamp"`
}

type HexBytes

type HexBytes []byte

func (HexBytes) MarshalJSON

func (h HexBytes) MarshalJSON() ([]byte, error)

func (HexBytes) String

func (h HexBytes) String() string

func (*HexBytes) UnmarshalJSON

func (h *HexBytes) UnmarshalJSON(bytes []byte) error

type InitiatorAddr

type InitiatorAddr struct {
	// The public key of the initiator
	PublicKey *keypair.PublicKey `json:"PublicKey,omitempty"`
	// The account hash derived from the public key of the initiator
	AccountHash *key.AccountHash `json:"AccountHash,omitempty"`
}

InitiatorAddr the address of the initiator of a TransactionV1.

func (InitiatorAddr) Bytes

func (d InitiatorAddr) Bytes() []byte

type Message

type Message struct {
	// The payload of the message.
	Message MessagePayload `json:"message"`
	// The name of the topic on which the message was emitted on.
	TopicName string `json:"topic_name"`
	// The hash of the name of the topic.
	TopicNameHash key.Hash `json:"topic_name_hash"`
	// The identity of the entity that produced the message.
	EntityHash key.EntityAddr `json:"entity_hash"`
	// Message index in the block.
	BlockIndex uint64 `json:"block_index"`
	// Message index in the topic.
	TopicIndex uint32 `json:"topic_index"`
}

Message that was emitted by an addressable entity during execution.

type MessageChecksum

type MessageChecksum string

MessageChecksum Variant that stores a message digest.

type MessagePayload

type MessagePayload struct {
	String *string      `json:"String"`
	Bytes  *ModuleBytes `json:"Bytes"`
}

MessagePayload The payload of the message.

type MessageTopic

type MessageTopic struct {
	// The name of the topic on which the message was emitted on.
	TopicName string `json:"topic_name"`
	// The hash of the name of the topic.
	TopicNameHash key.Hash `json:"topic_name_hash"`
}

type MessageTopicSummary

type MessageTopicSummary struct {
	// Number of messages in this topic.
	MessageCount uint32 `json:"message_count"`
	// Block timestamp in which these messages were emitted.
	BlockTime uint64 `json:"blocktime"`
}

MessageTopicSummary Summary of a message topic that will be stored in global state.

type MinimalBlockInfo

type MinimalBlockInfo struct {
	Creator       keypair.PublicKey `json:"creator"`
	EraID         uint64            `json:"era_id"`
	Hash          key.Hash          `json:"hash"`
	Height        uint32            `json:"height"`
	StateRootHash key.Hash          `json:"state_root_hash"`
	Timestamp     time.Time         `json:"timestamp"`
}

type ModuleBytes

type ModuleBytes struct {
	// WASM Bytes
	ModuleBytes string `json:"module_bytes"`
	Args        *Args  `json:"args,omitempty"`
}

ModuleBytes is a `deploy` item with the capacity to contain executable code (e.g. a contract).

func (ModuleBytes) Bytes

func (m ModuleBytes) Bytes() ([]byte, error)

type NamedEntryPoint

type NamedEntryPoint struct {
	EntryPoint EntryPointV1 `json:"entry_point"`
	Name       string       `json:"name"`
}

type NamedKey

type NamedKey struct {
	// The name of the entry.
	Name string `json:"name"`
	// The value of the entry: a casper `key.Key` type.
	Key key.Key `json:"key"`
}

NamedKey is a key in an Account or Contract.

type NamedKeyKind

type NamedKeyKind struct {
	NamedKey Argument `json:"named_key"`
	Name     Argument `json:"name"`
}

type NamedKeyValue

type NamedKeyValue struct {
	// The name of the `Key` encoded as a CLValue.
	Name clvalue.CLValue `json:"name"`
	// The actual `Key` encoded as a CLValue.
	NamedKey clvalue.CLValue `json:"named_key"`
}

NamedKeyValue A NamedKey value.

func (*NamedKeyValue) UnmarshalJSON

func (t *NamedKeyValue) UnmarshalJSON(data []byte) error

type NamedKeys

type NamedKeys []NamedKey

func (NamedKeys) Find

func (k NamedKeys) Find(target string) (key.Key, error)

func (NamedKeys) ToMap

func (k NamedKeys) ToMap() map[string]string

type NamedUserGroup

type NamedUserGroup struct {
	// A (labelled) "user group". Each method of a versioned contract may be associated with one or more user groups which are allowed to call it.
	GroupName  string     `json:"group_name"`
	GroupUsers []key.URef `json:"group_users"`
}

type Operation

type Operation struct {
	Key  key.Key `json:"key"`
	Kind string  `json:"kind"`
}

type Package

type Package struct {
	// All versions (enabled & disabled).
	Versions []EntityVersionAndHash `json:"versions"`
	// Collection of disabled entity versions. The runtime will not permit disabled entity versions to be executed.
	DisabledVersions []EntityVersionAndHash `json:"disabled_versions"`
	// A flag that determines whether a entity is locked
	LockStatus string `json:"lock_status"`
	// Mapping maintaining the set of URefs associated with each "user group"
	Groups []string `json:"groups"`
}

Package Entity definition, metadata, and security container.

type PairArgument

type PairArgument [2]*Argument

func (PairArgument) Argument

func (r PairArgument) Argument() *Argument

func (PairArgument) Name

func (r PairArgument) Name() (string, error)

func (PairArgument) Value

func (r PairArgument) Value() (clvalue.CLValue, error)

type PricingMode

type PricingMode struct {
	// The original payment model, where the creator of the transaction specifies how much they will pay, at what gas price.
	Classic *ClassicMode `json:"Classic,omitempty"`
	// The cost of the transaction is determined by the cost table, per the transaction kind.
	Fixed *FixedMode `json:"Fixed,omitempty"`
	// The payment for this transaction was previously reserved, as proven by the receipt hash.
	Reserved *ReservedMode `json:"reserved,omitempty"`
}

func (PricingMode) Bytes

func (d PricingMode) Bytes() []byte

type Proof

type Proof struct {
	// Validator public key
	PublicKey keypair.PublicKey `json:"public_key"`
	// Validator signature
	Signature HexBytes `json:"signature"`
}

Proof is a `BlockV1`'s finality signature.

type Proposer

type Proposer struct {
	// contains filtered or unexported fields
}

func NewProposer

func NewProposer(src string) (Proposer, error)

func (Proposer) IsSystem

func (p Proposer) IsSystem() bool

func (Proposer) MarshalJSON

func (p Proposer) MarshalJSON() ([]byte, error)

func (Proposer) PublicKey

func (p Proposer) PublicKey() (keypair.PublicKey, error)

func (Proposer) PublicKeyOptional

func (p Proposer) PublicKeyOptional() *keypair.PublicKey

func (*Proposer) Scan

func (p *Proposer) Scan(value any) error

func (*Proposer) UnmarshalJSON

func (p *Proposer) UnmarshalJSON(bytes []byte) error

func (Proposer) Value

func (p Proposer) Value() (driver.Value, error)

type PublicKeyAndBid

type PublicKeyAndBid struct {
	// Validator public key
	PublicKey keypair.PublicKey `json:"public_key"`
	Bid       Bid               `json:"bid"`
}

PublicKeyAndBid is an entry in a founding validator map representing a bid.

type RawArg

type RawArg struct {
	// Type of the value. Can be simple or constructed
	CLType json.RawMessage `json:"cl_type"`
	// Bytes array representation of underlying data
	Bytes HexBytes `json:"bytes"`
	// The optional parsed value of the bytes used when testing
	Parsed json.RawMessage `json:"parsed,omitempty"`
}

RawArg is a type used in deploy input arguments. And it can also be returned as a result of a query to the network or a contract call.

type ReservationKind

type ReservationKind struct {
	Receipt         key.Hash `json:"receipt"`
	ReservationData HexBytes `json:"reservation_data"`
	ReservationKind uint8    `json:"reservation_kind"`
}

ReservationKind Container for bytes recording location, type and data for a gas reservation

type ReservedMode

type ReservedMode struct {
	// Pre-paid receipt
	Receipt key.Hash `json:"receipt"`
}

type SeigniorageAllocation

type SeigniorageAllocation struct {
	Validator *ValidatorAllocation `json:"Validator,omitempty"`
	Delegator *DelegatorAllocation `json:"Delegator,omitempty"`
}

SeigniorageAllocation sores information about a seigniorage allocation

type SessionTarget

type SessionTarget struct {
	ModuleBytes string             `json:"module_bytes"`
	Runtime     TransactionRuntime `json:"runtime"`
}

type SingleBlockRewardedSignatures

type SingleBlockRewardedSignatures []uint8

SingleBlockRewardedSignatures List of identifiers for finality signatures for a particular past block. That past block height is current_height - signature_rewards_max_delay, the latter being defined in the chainspec. We need to wait for a few blocks to pass (`signature_rewards_max_delay`) to store the finality signers because we need a bit of time to get the block finality.

type StoredContractByHash

type StoredContractByHash struct {
	Hash       key.ContractHash `json:"hash"`
	EntryPoint string           `json:"entry_point"`
	Args       *Args            `json:"args"`
}

StoredContractByHash is a `Deploy` item to call an entry point in a contract. The contract is referenced by its hash.

func (StoredContractByHash) Bytes

func (m StoredContractByHash) Bytes() ([]byte, error)

type StoredContractByName

type StoredContractByName struct {
	Name       string `json:"name"`
	EntryPoint string `json:"entry_point"`
	Args       *Args  `json:"args"`
}

StoredContractByName is a `Deploy` item to call an entry point in a contract. The contract is referenced by a named key in the caller account pointing to the contract hash.

func (StoredContractByName) Bytes

func (m StoredContractByName) Bytes() ([]byte, error)

type StoredTarget

type StoredTarget struct {
	// Identifier of a `Stored` transaction target.
	ID      TransactionInvocationTarget `json:"id"`
	Runtime TransactionRuntime          `json:"runtime"`
}

type StoredValue

type StoredValue struct {
	CLValue           *Argument            `json:"CLValue,omitempty"`
	Account           *Account             `json:"Account,omitempty"`
	Contract          *Contract            `json:"Contract,omitempty"`
	ContractWASM      *json.RawMessage     `json:"ContractWASM,omitempty"`
	ContractPackage   *ContractPackage     `json:"ContractPackage,omitempty"`
	LegacyTransfer    *TransferV1          `json:"LegacyTransfer,omitempty"`
	DeployInfo        *DeployInfo          `json:"DeployInfo,omitempty"`
	EraInfo           *EraInfo             `json:"EraInfo,omitempty"`
	Bid               *Bid                 `json:"Bid,omitempty"`
	Withdraw          []UnbondingPurse     `json:"Withdraw,omitempty"`
	Unbonding         *UnbondingPurse      `json:"Unbonding,omitempty"`
	AddressableEntity *AddressableEntity   `json:"AddressableEntity,omitempty"`
	BidKind           *BidKind             `json:"BidKind,omitempty"`
	Package           *Package             `json:"Package,omitempty"`
	ByteCode          *ByteCode            `json:"ByteCode,omitempty"`
	MessageTopic      *MessageTopicSummary `json:"MessageTopic,omitempty"`
	Message           *MessageChecksum     `json:"Message,omitempty"`
	NamedKey          *NamedKeyValue       `json:"NamedKey,omitempty"`
	Reservation       *ReservationKind     `json:"Reservation,omitempty"`
	EntryPoint        *EntryPointValue     `json:"EntryPoint,omitempty"`
}

StoredValue is a wrapper class for different types of values stored in the global state.

type StoredVersionedContractByHash

type StoredVersionedContractByHash struct {
	// Hash of the contract.
	Hash key.ContractHash `json:"hash"`
	// Entry point or method of the contract to call.
	EntryPoint string       `json:"entry_point"`
	Version    *json.Number `json:"version,omitempty"`
	Args       *Args        `json:"args"`
}

StoredVersionedContractByHash is a `Deploy` item to call an entry point in a contract. The contract is referenced by a contract package hash and a version number.

func (StoredVersionedContractByHash) Bytes

func (m StoredVersionedContractByHash) Bytes() ([]byte, error)

type StoredVersionedContractByName

type StoredVersionedContractByName struct {
	// Name of a named key in the caller account that stores the contract package hash.
	Name string `json:"name"`
	// Entry point or method of the contract to call.
	EntryPoint string       `json:"entry_point"`
	Version    *json.Number `json:"version,omitempty"`
	Args       *Args        `json:"args"`
}

StoredVersionedContractByName is a `Deploy` item to call an entry point in a contract. The contract is referenced by a named key in the caller account pointing to the contract package hash and a version number.

func (StoredVersionedContractByName) Bytes

func (m StoredVersionedContractByName) Bytes() ([]byte, error)

type SystemEntityType

type SystemEntityType string

SystemEntityType System contract types.

type Timestamp

type Timestamp time.Time

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) ToTime

func (t *Timestamp) ToTime() time.Time

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

type Transaction

type Transaction struct {
	// Hex-encoded Transaction hash
	Hash key.Hash `json:"hash"`
	// The header portion of a Transaction
	Header TransactionHeader `json:"header"`
	// Body of a `Transaction`
	Body TransactionBody `json:"body"`
	// List of signers and signatures for this Transaction
	Approvals []Approval `json:"approvals"`
	// contains filtered or unexported fields
}

func NewTransactionFromDeploy

func NewTransactionFromDeploy(deploy Deploy) Transaction

func NewTransactionFromTransactionV1

func NewTransactionFromTransactionV1(v1 TransactionV1) Transaction

func (*Transaction) GetDeploy

func (t *Transaction) GetDeploy() *Deploy

func (*Transaction) GetTransactionV1

func (t *Transaction) GetTransactionV1() *TransactionV1

type TransactionBody

type TransactionBody struct {
	Args *Args `json:"args,omitempty"`
	// Execution target of a Transaction.
	Target TransactionTarget `json:"target"`
	// Entry point of a Transaction.
	EntryPoint TransactionEntryPoint `json:"entry_point"`
	// Scheduling mode of a Transaction.
	Scheduling TransactionScheduling `json:"scheduling"`
	// Transaction category
	Category uint8 `json:"transaction_category"`
}

type TransactionCategory

type TransactionCategory uint
const (
	TransactionCategoryMint TransactionCategory = iota
	TransactionCategoryAuction
	TransactionCategoryInstallUpgrade
	TransactionCategoryLarge
	TransactionCategoryMedium
	TransactionCategorySmall
)

type TransactionEntryPoint

type TransactionEntryPoint struct {
	Custom *string
	// The `transfer` native entry point, used to transfer `Motes` from a source purse to a target purse.
	Transfer *struct{}
	// The `add_bid` native entry point, used to create or top off a bid purse.
	AddBid *struct{}
	// The `withdraw_bid` native entry point, used to decrease a stake.
	WithdrawBid *struct{}
	// The `delegate` native entry point, used to add a new delegator or increase an existing delegator's stake.
	Delegate *struct{}
	// The `undelegate` native entry point, used to reduce a delegator's stake or remove the delegator if the remaining stake is 0.
	Undelegate *struct{}
	// The `redelegate` native entry point, used to reduce a delegator's stake or remove the delegator if
	// the remaining stake is 0, and after the unbonding delay, automatically delegate to a new validator.
	Redelegate *struct{}
	// The `activate_bid` native entry point, used to used to reactivate an inactive bid.
	ActivateBid *struct{}
	// The `change_bid_public_key` native entry point, used to change a bid's public key.
	ChangeBidPublicKey *struct{}
	// Used to call entry point call() in session transactions
	Call *struct{}
}

func (*TransactionEntryPoint) Bytes

func (t *TransactionEntryPoint) Bytes() []byte

func (TransactionEntryPoint) MarshalJSON

func (t TransactionEntryPoint) MarshalJSON() ([]byte, error)

func (*TransactionEntryPoint) Tag

func (t *TransactionEntryPoint) Tag() byte

func (*TransactionEntryPoint) UnmarshalJSON

func (t *TransactionEntryPoint) UnmarshalJSON(data []byte) error

type TransactionHash

type TransactionHash struct {
	Deploy        *key.Hash `json:"Deploy,omitempty"`
	TransactionV1 *key.Hash `json:"Version1,omitempty"`
}

TransactionHash A versioned wrapper for a transaction hash or deploy hash

type TransactionHeader

type TransactionHeader struct {
	// Transaction chain name
	ChainName string `json:"chain_name"`
	// `Timestamp` formatted as per RFC 3339
	Timestamp Timestamp `json:"timestamp"`
	// Duration of the `TransactionV1` in milliseconds (from timestamp).
	TTL Duration `json:"ttl"`
	// The address of the initiator of a Transaction.
	InitiatorAddr InitiatorAddr `json:"initiator_addr"`
	// Pricing mode of a Transaction.
	PricingMode PricingMode `json:"pricing_mode"`
}

type TransactionInvocationTarget

type TransactionInvocationTarget struct {
	// Hex-encoded entity address identifying the invocable entity.
	ByHash *key.Hash `json:"ByHash"`
	// The alias identifying the invocable entity.
	ByName *string `json:"ByName"`
	// The address and optional version identifying the package.
	ByPackageHash *ByPackageHashInvocationTarget `json:"ByPackageHash"`
	// The alias and optional version identifying the package.
	ByPackageName *ByPackageNameInvocationTarget `json:"ByPackageName"`
}

type TransactionRuntime

type TransactionRuntime string

TransactionRuntime SmartContract transaction types.

const (
	TransactionRuntimeVmCasperV1 TransactionRuntime = "VmCasperV1"
	TransactionRuntimeVmCasperV2 TransactionRuntime = "VmCasperV2"
)

func (TransactionRuntime) RuntimeTag

func (t TransactionRuntime) RuntimeTag() byte

type TransactionScheduling

type TransactionScheduling struct {
	// No special scheduling applied.
	Standard *struct{} `json:"Standard,omitempty"`
	// Execution should be scheduled for the specified era.
	FutureEra *FutureEraScheduling `json:"FutureTimestamp,omitempty"`
	// Execution should be scheduled for the specified timestamp or later.
	FutureTimestamp *FutureTimestampScheduling `json:"FutureEra,omitempty"`
}

func (*TransactionScheduling) Bytes

func (t *TransactionScheduling) Bytes() []byte

func (TransactionScheduling) MarshalJSON

func (t TransactionScheduling) MarshalJSON() ([]byte, error)

func (*TransactionScheduling) Tag

func (t *TransactionScheduling) Tag() byte

func (*TransactionScheduling) UnmarshalJSON

func (t *TransactionScheduling) UnmarshalJSON(data []byte) error

type TransactionTarget

type TransactionTarget struct {
	// The execution target is a native operation (e.g. a transfer).
	Native *struct{}
	// The execution target is a stored entity or package.
	Stored *StoredTarget `json:"Stored"`
	// The execution target is the included module bytes, i.e. compiled Wasm.
	Session *SessionTarget `json:"Session"`
}

func NewTransactionTargetFromSession

func NewTransactionTargetFromSession(session ExecutableDeployItem) TransactionTarget

NewTransactionTargetFromSession create new TransactionTarget from ExecutableDeployItem

func (*TransactionTarget) Bytes

func (t *TransactionTarget) Bytes() ([]byte, error)

func (TransactionTarget) MarshalJSON

func (t TransactionTarget) MarshalJSON() ([]byte, error)

func (*TransactionTarget) UnmarshalJSON

func (t *TransactionTarget) UnmarshalJSON(data []byte) error

type TransactionV1

type TransactionV1 struct {
	// Hex-encoded TransactionV1 hash
	Hash key.Hash `json:"hash"`
	// The header portion of a TransactionV1
	Header TransactionV1Header `json:"header"`
	// Body of a `TransactionV1`
	Body TransactionV1Body `json:"body"`
	// List of signers and signatures for this `deploy`
	Approvals []Approval `json:"approvals"`
}

func MakeTransactionV1

func MakeTransactionV1(transactionHeader TransactionV1Header, transactionBody TransactionV1Body) (*TransactionV1, error)

func NewTransactionV1

func NewTransactionV1(hash key.Hash, header TransactionV1Header, body TransactionV1Body, approvals []Approval) *TransactionV1

func (*TransactionV1) Sign

func (t *TransactionV1) Sign(keys keypair.PrivateKey) error

func (*TransactionV1) Validate

func (t *TransactionV1) Validate() error

type TransactionV1Body

type TransactionV1Body struct {
	Args *Args `json:"args,omitempty"`
	// Execution target of a Transaction.
	Target TransactionTarget `json:"target"`
	// Entry point of a Transaction.
	TransactionEntryPoint TransactionEntryPoint `json:"entry_point"`
	// Scheduling mode of a Transaction.
	TransactionScheduling TransactionScheduling `json:"scheduling"`
	// Transaction category
	TransactionCategory uint8 `json:"transaction_category"`
}

func (*TransactionV1Body) Bytes

func (t *TransactionV1Body) Bytes() ([]byte, error)

type TransactionV1Header

type TransactionV1Header struct {
	// `Hash` of the body part of this `Deploy`.
	BodyHash  key.Hash `json:"body_hash"`
	ChainName string   `json:"chain_name"`
	// `Timestamp` formatted as per RFC 3339
	Timestamp Timestamp `json:"timestamp"`
	// Duration of the `Deploy` in milliseconds (from timestamp).
	TTL Duration `json:"ttl"`
	// The address of the initiator of a TransactionV1.
	InitiatorAddr InitiatorAddr `json:"initiator_addr"`
	// Pricing mode of a Transaction.
	PricingMode PricingMode `json:"pricing_mode"`
}

func (TransactionV1Header) Bytes

func (d TransactionV1Header) Bytes() []byte

type TransactionVersion

type TransactionVersion uint
const (
	TransactionVersionV1 TransactionVersion = iota
	TransactionDeploy
)

type TransactionWrapper

type TransactionWrapper struct {
	Deploy        *Deploy        `json:"Deploy,omitempty"`
	TransactionV1 *TransactionV1 `json:"Version1,omitempty"`
}

type Transfer

type Transfer struct {
	// Transfer amount
	Amount clvalue.UInt512 `json:"amount"`
	// Deploy that created the transfer
	TransactionHash TransactionHash `json:"transaction_hash"`
	// Account hash from which transfer was executed
	From InitiatorAddr `json:"from"`
	Gas  uint          `json:"gas,string"`
	// User-defined id
	ID uint64 `json:"id,omitempty"`
	// Source purse
	Source key.URef `json:"source"`
	// Target purse
	Target key.URef `json:"target"`
	// Account to which funds are transferred
	To *key.AccountHash `json:"to"`
	// contains filtered or unexported fields
}

Transfer a versioned wrapper for a transfer.

func NewTransferFromV1

func NewTransferFromV1(transfer TransferV1) Transfer

func (*Transfer) GetTransferV1

func (h *Transfer) GetTransferV1() *TransferV1

func (*Transfer) GetTransferV2

func (h *Transfer) GetTransferV2() *TransferV2

func (*Transfer) UnmarshalJSON

func (h *Transfer) UnmarshalJSON(bytes []byte) error

type TransferDeployItem

type TransferDeployItem struct {
	Args Args `json:"args"`
}

TransferDeployItem is a `Deploy` item for transferring funds to a target account.

func (TransferDeployItem) Bytes

func (m TransferDeployItem) Bytes() ([]byte, error)

type TransferV1

type TransferV1 struct {
	// Transfer amount
	Amount clvalue.UInt512 `json:"amount"`
	// Deploy that created the transfer
	DeployHash key.Hash `json:"deploy_hash"`
	// Account hash from which transfer was executed
	From key.AccountHash `json:"from"`
	Gas  uint            `json:"gas,string"`
	// User-defined id
	ID uint64 `json:"id,omitempty"`
	// Source purse
	Source key.URef `json:"source"`
	// Target purse
	Target key.URef `json:"target"`
	// Account to which funds are transferred
	To *key.AccountHash `json:"to"`
}

TransferV1 represents a transfer from one purse to another

type TransferV2

type TransferV2 struct {
	// Transfer amount
	Amount clvalue.UInt512 `json:"amount"`
	// Deploy that created the transfer
	TransactionHash TransactionHash `json:"transaction_hash"`
	// Account hash from which transfer was executed
	From InitiatorAddr `json:"from"`
	Gas  uint          `json:"gas,string"`
	// User-defined id
	ID uint64 `json:"id,omitempty"`
	// Source purse
	Source key.URef `json:"source"`
	// Target purse
	Target key.URef `json:"target"`
	// Account to which funds are transferred
	To *key.AccountHash `json:"to"`
}

TransferV2 represents a version 2 transfer from one purse to another.

type Transform

type Transform struct {
	Key  key.Key       `json:"key"`
	Kind TransformKind `json:"kind"`
}

Transform is an enumeration of transformation types used in the execution of a `transaction` for V2 version.

type TransformKey

type TransformKey struct {
	Key       key.Key       `json:"key"`
	Transform TransformKind `json:"transform"`
}

TransformKey is an enumeration of transformation types used in the execution of a `deploy`.

type TransformKind

type TransformKind json.RawMessage

func (*TransformKind) IsAddUint512

func (t *TransformKind) IsAddUint512() bool

func (*TransformKind) IsWriteAccount

func (t *TransformKind) IsWriteAccount() bool

func (*TransformKind) IsWriteAddressableEntity

func (t *TransformKind) IsWriteAddressableEntity() bool

func (*TransformKind) IsWriteBid

func (t *TransformKind) IsWriteBid() bool

func (*TransformKind) IsWriteBidKind

func (t *TransformKind) IsWriteBidKind() bool

func (*TransformKind) IsWriteCLValue

func (t *TransformKind) IsWriteCLValue() bool

func (*TransformKind) IsWriteContract

func (t *TransformKind) IsWriteContract() bool

func (*TransformKind) IsWriteDeployInfo

func (t *TransformKind) IsWriteDeployInfo() bool

func (*TransformKind) IsWriteMessage

func (t *TransformKind) IsWriteMessage() bool

func (*TransformKind) IsWriteMessageTopic

func (t *TransformKind) IsWriteMessageTopic() bool

func (*TransformKind) IsWriteNamedKey

func (t *TransformKind) IsWriteNamedKey() bool

func (*TransformKind) IsWritePackage

func (t *TransformKind) IsWritePackage() bool

func (*TransformKind) IsWriteTransfer

func (t *TransformKind) IsWriteTransfer() bool

func (*TransformKind) IsWriteUnbonding

func (t *TransformKind) IsWriteUnbonding() bool

func (*TransformKind) IsWriteWithdraw

func (t *TransformKind) IsWriteWithdraw() bool

func (TransformKind) MarshalJSON

func (t TransformKind) MarshalJSON() ([]byte, error)

MarshalJSON returns m as the JSON encoding of m.

func (*TransformKind) ParseAsUInt512

func (t *TransformKind) ParseAsUInt512() (*clvalue.UInt512, error)

func (*TransformKind) ParseAsWriteAccount

func (t *TransformKind) ParseAsWriteAccount() (key.AccountHash, error)

func (*TransformKind) ParseAsWriteAddressableEntity

func (t *TransformKind) ParseAsWriteAddressableEntity() (*AddressableEntity, error)

func (*TransformKind) ParseAsWriteBidKind

func (t *TransformKind) ParseAsWriteBidKind() (*BidKind, error)

func (*TransformKind) ParseAsWriteCLValue

func (t *TransformKind) ParseAsWriteCLValue() (*Argument, error)

func (*TransformKind) ParseAsWriteDeployInfo

func (t *TransformKind) ParseAsWriteDeployInfo() (*DeployInfo, error)

func (*TransformKind) ParseAsWriteMessage

func (t *TransformKind) ParseAsWriteMessage() (*MessageChecksum, error)

func (*TransformKind) ParseAsWriteMessageTopic

func (t *TransformKind) ParseAsWriteMessageTopic() (*MessageTopicSummary, error)

func (*TransformKind) ParseAsWriteNamedKey

func (t *TransformKind) ParseAsWriteNamedKey() (*NamedKeyKind, error)

func (*TransformKind) ParseAsWritePackage

func (t *TransformKind) ParseAsWritePackage() (*Package, error)

func (*TransformKind) ParseAsWriteTransfer

func (t *TransformKind) ParseAsWriteTransfer() (*WriteTransfer, error)

func (*TransformKind) ParseAsWriteUnbondings

func (t *TransformKind) ParseAsWriteUnbondings() ([]UnbondingPurse, error)

func (*TransformKind) ParseAsWriteWithdraws

func (t *TransformKind) ParseAsWriteWithdraws() ([]UnbondingPurse, error)

func (*TransformKind) UnmarshalJSON

func (t *TransformKind) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *m to a copy of data.

type UnbondingPurse

type UnbondingPurse struct {
	// Unbonding Amount
	Amount clvalue.UInt512 `json:"amount"`
	// Bonding purse
	BondingPurse key.URef `json:"bonding_purse"`
	// Era ID in which this unbonding request was created.
	EraOfCreation uint64 `json:"era_of_creation"`
	// Unbonder public key.
	UnbonderPublicKey keypair.PublicKey `json:"unbonder_public_key"`
	// The original validator's public key.
	ValidatorPublicKey keypair.PublicKey `json:"validator_public_key"`
	// The re-delegated validator's public key.
	NewValidator *keypair.PublicKey `json:"new_validator"`
}

UnbondingPurse stores information of an unbonding or delegation withdrawal

type ValidatorAllocation

type ValidatorAllocation struct {
	// Public key of the validator
	ValidatorPublicKey keypair.PublicKey `json:"validator_public_key"`
	// Amount allocated as a reward.
	Amount clvalue.UInt512 `json:"amount"`
}

type ValidatorBid

type ValidatorBid struct {
	// The purse was used for bonding.
	BondingPurse key.URef `json:"bonding_purse"`
	// The delegation rate.
	DelegationRate float32 `json:"delegation_rate"`
	// `true` if validator has been "evicted"
	Inactive bool `json:"inactive"`
	// The amount of tokens staked by a validator (not including delegators).
	StakedAmount clvalue.UInt512 `json:"staked_amount"`
	// Minimum allowed delegation amount in motes
	MinimumDelegationAmount uint64 `json:"minimum_delegation_amount"`
	// Maximum allowed delegation amount in motes
	MaximumDelegationAmount uint64 `json:"maximum_delegation_amount"`
	// Vesting schedule for a genesis validator. `None` if non-genesis validator.
	VestingSchedule *VestingSchedule `json:"vesting_schedule"`
}

ValidatorBid is an entry in the validator map.

type ValidatorWeightAuction

type ValidatorWeightAuction struct {
	Validator keypair.PublicKey `json:"public_key"`
	Weight    clvalue.UInt512   `json:"weight"`
}

type ValidatorWeightEraEnd

type ValidatorWeightEraEnd struct {
	Validator keypair.PublicKey `json:"validator"`
	Weight    clvalue.UInt512   `json:"weight"`
}

type VestingSchedule

type VestingSchedule struct {
	InitialReleaseTimestampMillis uint64            `json:"initial_release_timestamp_millis"`
	LockedAmounts                 []clvalue.UInt512 `json:"locked_amounts"`
}

VestingSchedule for a genesis validator.

type WriteTransfer

type WriteTransfer struct {
	ID         *uint64          `json:"id"`
	To         *key.AccountHash `json:"to"`
	DeployHash key.Hash         `json:"deploy_hash"`
	From       key.AccountHash  `json:"from"`
	Amount     clvalue.UInt512  `json:"amount"`
	Source     key.URef         `json:"source"`
	Target     key.URef         `json:"target"`
	Gas        uint             `json:"gas,string"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL