types

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

README

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArgumentNotFound = errors.New("argument is not found")
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 Approval

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

type Args

type Args []PairArgument

func (*Args) AddArgument

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

func (Args) Bytes

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

func (Args) Find

func (a 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 added in v0.9.4

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

func (*Argument) Name added in v0.9.4

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

func (*Argument) Parsed

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

func (*Argument) Raw added in v1.1.5

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

func (*Argument) UnmarshalJSON added in v0.9.4

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 AuctionBid

type AuctionBid struct {

	// The delegators.
	Delegators []AuctionDelegators `json:"delegators"`
	// contains filtered or unexported fields
}

AuctionBid is an entry in a founding validator map in the Auction state representing a bid.

type AuctionDelegators

type AuctionDelegators struct {

	// Public Key of the delegator
	Delegatee keypair.PublicKey `json:"delegatee"`
	// Public key of the validator
	PublicKey keypair.PublicKey `json:"public_key"`
	// contains filtered or unexported fields
}

AuctionDelegators is associated with the given validator.

type AuctionState

type AuctionState struct {
	// All bids contained within a vector.
	Bids          []ValidatorBid  `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 {

	// Validator's public key.
	PublicKey keypair.PublicKey `json:"validator_public_key"`
	// The delegators.
	Delegators map[string]Delegator `json:"delegators"`
	// Vesting schedule for a genesis validator. `None` if non-genesis validator.
	VestingSchedule *VestingSchedule `json:"vesting_schedule"`
	// contains filtered or unexported fields
}

Bid is an entry stored in the Global state and representing a bid.

type Block

type Block struct {
	Hash   key.Hash    `json:"hash"`
	Header BlockHeader `json:"header"`
	Body   BlockBody   `json:"body"`
	Proofs []Proof     `json:"proofs"`
}

Block in the network

type BlockBody

type BlockBody 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 BlockHeader

type BlockHeader struct {
	AccumulatedSeed *key.Hash `json:"accumulated_seed,omitempty"`
	BodyHash        key.Hash  `json:"body_hash"`
	EraID           uint32    `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          *EraEnd   `json:"era_end"`
}

type CLTypeRaw

type CLTypeRaw struct {
	json.RawMessage
}

func (CLTypeRaw) ParseCLType

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

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 []EntryPoint `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 Delegator

type Delegator struct {

	// Public Key of the delegator
	Delegatee keypair.PublicKey `json:"delegator_public_key"`
	// Public key of the validator
	PublicKey keypair.PublicKey `json:"validator_public_key"`
	// Vesting schedule for a genesis validator. `None` if non-genesis validator.
	VestingSchedule *VestingSchedule `json:"vesting_schedule"`
	// contains filtered or unexported fields
}

Delegator is associated with the given validator.

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 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) SignDeploy

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

func (*Deploy) ValidateDeploy

func (d *Deploy) ValidateDeploy() (bool, error)

type DeployExecutionResult

type DeployExecutionResult struct {
	BlockHash key.Hash              `json:"block_hash"`
	Result    ExecutionResultStatus `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 DefaultHeader

func DefaultHeader() 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 EntryPoint

type EntryPoint 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"`
	// Name of the entry point
	Name string `json:"name"`
	// Returned type
	Ret CLTypeRaw `json:"ret"`
}

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

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 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"
)

type EraEnd

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

EraEnd contains a report and list of validator weights for the next 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            []Reward            `json:"rewards"`
}

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

type EraSummary

type EraSummary struct {
	// The block hash
	BlockHash key.Hash `json:"block_hash"`
	// The Era Id
	EraID uint32 `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 uint32 `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) Bytes

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

type ExecutableDeployItemType

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

type ExecutionResultStatus

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

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 HexBytes

type HexBytes []byte

func (HexBytes) MarshalJSON

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

func (HexBytes) String added in v0.9.4

func (h HexBytes) String() string

func (*HexBytes) UnmarshalJSON

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

type MinimalBlockInfo

type MinimalBlockInfo struct {
	Creator       keypair.PublicKey `json:"creator"`
	EraID         uint32            `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 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 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 Operation

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

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 Proof

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

Proof is a `Block`'s finality signature.

type Proposer added in v1.2.0

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

func NewProposer added in v1.2.0

func NewProposer(src string) (Proposer, error)

func (Proposer) IsSystem added in v1.2.0

func (p Proposer) IsSystem() bool

func (Proposer) MarshalJSON added in v1.2.0

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

func (Proposer) PublicKey added in v1.2.0

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

func (Proposer) PublicKeyOptional added in v1.2.0

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

func (*Proposer) Scan added in v1.2.0

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

func (*Proposer) UnmarshalJSON added in v1.2.0

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

func (Proposer) Value added in v1.2.0

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

type RawArg added in v1.1.5

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 Reward

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

type SeigniorageAllocation

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

SeigniorageAllocation sores information about a seigniorage allocation

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 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"`
	Transfer        *Transfer        `json:"TransferDeployItem,omitempty"`
	DeployInfo      *DeployInfo      `json:"DeployInfo,omitempty"`
	EraInfo         *EraInfo         `json:"EraInfo,omitempty"`
	Bid             *Bid             `json:"Bid,omitempty"`
	Withdraw        []UnbondingPurse `json:"Withdraw,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 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 Transfer

type Transfer 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"`
}

Transfer represents a transfer from one purse to another

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 Transform

type Transform json.RawMessage

func (*Transform) IsAddUint512 added in v1.4.3

func (t *Transform) IsAddUint512() bool

func (*Transform) IsWriteAccount added in v1.5.0

func (t *Transform) IsWriteAccount() bool

func (*Transform) IsWriteBid

func (t *Transform) IsWriteBid() bool

func (*Transform) IsWriteCLValue

func (t *Transform) IsWriteCLValue() bool

func (*Transform) IsWriteContract

func (t *Transform) IsWriteContract() bool

func (*Transform) IsWriteDeployInfo added in v1.4.3

func (t *Transform) IsWriteDeployInfo() bool

func (*Transform) IsWriteTransfer

func (t *Transform) IsWriteTransfer() bool

func (*Transform) IsWriteUnbonding added in v1.4.3

func (t *Transform) IsWriteUnbonding() bool

func (*Transform) IsWriteWithdraw

func (t *Transform) IsWriteWithdraw() bool

func (Transform) MarshalJSON

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

MarshalJSON returns m as the JSON encoding of m.

func (*Transform) ParseAsUInt512 added in v1.4.3

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

func (*Transform) ParseAsWriteAccount added in v1.5.0

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

func (*Transform) ParseAsWriteCLValue

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

func (*Transform) ParseAsWriteDeployInfo added in v1.4.3

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

func (*Transform) ParseAsWriteTransfer

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

func (*Transform) ParseAsWriteUnbondings added in v1.4.3

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

func (*Transform) ParseAsWriteWithdraws

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

func (*Transform) UnmarshalJSON

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

UnmarshalJSON sets *m to a copy of data.

type TransformKey

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

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

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 uint32 `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 {
	// Validator public key
	PublicKey keypair.PublicKey `json:"public_key"`
	Bid       AuctionBid        `json:"bid"`
}

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

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        string           `json:"gas"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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