substrate

package module
v0.0.0-...-eb36aa9 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 28 Imported by: 21

README

test-substrate-client

TFchain go client

Usage

To make substrate calls:

  • First, start a substrate connection against the desired url for the chain:

    manager := NewManager("wss://tfchain.grid.tf/ws")
    substrateConnection, err := manager.Substrate()
    
  • These are the urls for different chain networks:

    • devnet: wss://tfchain.dev.grid.tf/ws
    • testnet: wss://tfchain.test.grid.tf/ws
    • qanet: wss://tfchain.qa.grid.tf/ws
    • mainnet: wss://tfchain.grid.tf/ws
  • It is the user's responsibility to close the connection.

    defer substrateConnection.Close()
    
  • Then, a user could use the provided api calls to communicate with the chain. like:

    contractID, err := substrateConnection.CreateNodeContract(identity, nodeID, body, hash, publicIPsCount, solutionProviderID)
    
  • Also, if a connection is closed for some reason like timing out, internally, it is reopened if nothing blocks.

  • All provided api calls are found under the Substrate struct.

Run tests

To run the tests, you could either run it against a local docker image of the TFChain, or against devnet

  • Run against local docker image

    To run tests against a local docker image of tfchain, you need to set CI environment variable to anything actually.

    docker run -d -p 9944:9944 threefolddev/tfchain:2.2.0-rc8 --dev --rpc-external
    sleep 3
    export CI="true"
    go test . -v
    
  • Run against devnet
    unset CI
    go test . -v
    
Test Coverage
  • 30.6% of statements

Workflows

  • Test
    • This workflow runs all tests found in the root directory against a local docker image of the TFChain found here.
  • Lint
    • This workflow ensures linting, so make sure to run these commands without any errors before pushing code:

      golangci-lint run
      
      gofmt -d -l .
      

Documentation

Index

Constants

View Source
const (

	// TFT in uTFT
	TFT = 10_000_000 // uTFT
	// ReactivateThreshold is threshold to reactivate the account if funds went below that
	ReactivateThreshold = TFT * 0.001 // uTFT
)

Variables

View Source
var (
	ErrBurnTransactionNotFound   = fmt.Errorf("burn tx not found")
	ErrRefundTransactionNotFound = fmt.Errorf("refund tx not found")
	ErrFailedToDecode            = fmt.Errorf("failed to decode events, skipping")
)
View Source
var (
	//ErrInvalidVersion is returned if version 4bytes is invalid
	ErrInvalidVersion = fmt.Errorf("invalid version")
	//ErrUnknownVersion is returned if version number is not supported
	ErrUnknownVersion = fmt.Errorf("unknown version")
	//ErrNotFound is returned if an object is not found
	ErrNotFound = fmt.Errorf("object not found")
)
View Source
var (
	ErrIsUsurped = fmt.Errorf("is usurped")
	Gigabyte     = 1024 * 1024 * 1024
)
View Source
var (
	ErrAccountNotFound = fmt.Errorf("account not found")
)
View Source
var ErrDepositFeeNotFound = fmt.Errorf("deposit fee not found")
View Source
var (
	ErrMintTransactionNotFound = fmt.Errorf("mint tx not found")
)

Functions

func Decode

func Decode(data []byte, value interface{}) error

func Encode

func Encode(value interface{}) ([]byte, error)

func FromKeyBytes

func FromKeyBytes(address []byte) (string, error)

func HexEncodeToString

func HexEncodeToString(b []byte) string

Types

type AccountID

type AccountID types.AccountID

AccountID type

func FromAddress

func FromAddress(address string) (account AccountID, err error)

FromAddress creates an AccountID from a SS58 address

func (AccountID) MarshalJSON

func (a AccountID) MarshalJSON() ([]byte, error)

MarshalJSON implementation

func (AccountID) PublicKey

func (a AccountID) PublicKey() []byte

PublicKey gets public key from account id

func (AccountID) String

func (a AccountID) String() string

String return string representation of account

type AccountInfo

type AccountInfo struct {
	Nonce       types.U32 `json:"nonce"`
	Consumers   types.U32 `json:"consumers"`
	Providers   types.U32 `json:"providers"`
	Sufficients types.U32 `json:"sufficients"`
	Data        Balance   `json:"data"`
}

type Approved

type Approved struct {
	Phase        types.Phase
	ProposalHash types.Hash `json:"proposal_hash"`
	Topics       []types.Hash
}

type AveragePriceIsAboveMaxPrice

type AveragePriceIsAboveMaxPrice struct {
	Phase   types.Phase
	Average types.U32 `json:"average"`
	Max     types.U32 `json:"max"`
	Topics  []types.Hash
}

type AveragePriceIsAboveMinPrice

type AveragePriceIsAboveMinPrice struct {
	Phase   types.Phase
	Average types.U32 `json:"average"`
	Min     types.U32 `json:"min"`
	Topics  []types.Hash
}

type Balance

type Balance struct {
	Free       types.U128 `json:"free"`
	Reserved   types.U128 `json:"reserverd"`
	MiscFrozen types.U128 `json:"misc_frozen"`
	FreeFrozen types.U128 `json:"free_frozen"`
}

Balance

type BalancesMinted

type BalancesMinted struct {
	Phase  types.Phase
	Who    AccountID  `json:"who"`
	Amount types.U128 `json:"amount"`
	Topics []types.Hash
}

type BatchCreateContractData

type BatchCreateContractData struct {
	Node               uint32  `json:"node"`
	Body               string  `json:"body"`
	Hash               string  `json:"hash"`
	PublicIPs          uint32  `json:"public_ips"`
	SolutionProviderID *uint64 `json:"solution_provider_id"`

	// for name contracts. if set the contract is assumed to be a name contract
	// and other fields are ignored
	Name string `json:"name"`
}

BatchCreateContractData struct for batch create contract

type BillingFrequencyChanged

type BillingFrequencyChanged struct {
	Phase     types.Phase
	Frequency types.U64 `json:"frequency"`
	Topics    []types.Hash
}

type BlockNumber

type BlockNumber types.U32

type Bonded

type Bonded struct {
	Phase   types.Phase
	Account AccountID `json:"account_id"`
	Topics  []types.Hash
}

type BridgeBurnTransactionCreated

type BridgeBurnTransactionCreated struct {
	Phase             types.Phase
	BurnTransactionID types.U64       `json:"burn_transaction_id"`
	Source            types.AccountID `json:"source"`
	Target            []byte          `json:"target"`
	Amount            types.U64       `json:"amount"`
	Topics            []types.Hash
}

BridgeBurnTransactionCreated

type BridgeBurnTransactionExpired

type BridgeBurnTransactionExpired struct {
	Phase             types.Phase
	BurnTransactionID types.U64             `json:"burn_transaction_id"`
	Source            types.OptionAccountID `json:"source"`
	Target            []byte                `json:"target"`
	Amount            types.U64             `json:"amount"`
	Topics            []types.Hash
}

BridgeBurnTransactionExpired

type BurnTransaction

type BurnTransaction struct {
	Block          BlockNumber           `json:"block"`
	Amount         types.U64             `json:"amount"`
	Source         types.OptionAccountID `json:"source"`
	Target         string                `json:"target"`
	Signatures     []StellarSignature    `json:"signatures"`
	SequenceNumber types.U64             `json:"sequence_number"`
}

type BurnTransactionCreated

type BurnTransactionCreated struct {
	Phase  types.Phase `json:"phase"`
	Target AccountID   `json:"target"`
	// TODO check if this works ....
	Balance     types.U128   `json:"balance"`
	BlockNumber BlockNumber  `json:"block_number"`
	Message     string       `json:"message"`
	Topics      []types.Hash `json:"topics"`
}

type BurnTransactionProcessed

type BurnTransactionProcessed struct {
	Phase  types.Phase
	Burn   BurnTransaction `json:"burn"`
	Topics []types.Hash
}

BurnTransactionProcessed

type BurnTransactionProposed

type BurnTransactionProposed struct {
	Phase             types.Phase
	BurnTransactionID types.U64 `json:"burn_transaction_id"`
	Target            []byte    `json:"target"`
	Amount            types.U64 `json:"amount"`
	Topics            []types.Hash
}

BurnTransactionProposed

type BurnTransactionReady

type BurnTransactionReady struct {
	Phase             types.Phase
	BurnTransactionID types.U64 `json:"burn_transaction_id"`
	Topics            []types.Hash
}

BurnTransactionReady

type BurnTransactionSignatureAdded

type BurnTransactionSignatureAdded struct {
	Phase             types.Phase
	BurnTransactionID types.U64        `json:"burn_transaction_id"`
	Signature         StellarSignature `json:"signature"`
	Topics            []types.Hash
}

BurnTransactionSignatureAdded

type CallResponse

type CallResponse struct {
	Hash     types.Hash
	Events   *EventRecords
	Block    *types.SignedBlock
	Identity Identity
}

type CertificationCodeStored

type CertificationCodeStored struct {
	Phase  types.Phase
	Codes  CertificationCodes `json:"contract_id"`
	Topics []types.Hash
}

type CertificationCodes

type CertificationCodes struct {
	Versioned
	ID                    types.U32 `json:"id"`
	Name                  string    `json:"name"`
	Description           string    `json:"description"`
	CertificationCodeType byte      `json:"certification_code_type"`
}

type Closed

type Closed struct {
	Phase        types.Phase
	ProposalHash types.Hash `json:"proposal_hash"`
	Yes          types.U32  `json:"yes"`
	YesWeight    types.U64  `json:"yes_weight"`
	No           types.U32  `json:"no"`
	NoWeight     types.U64  `json:"no_weight"`
	Topics       []types.Hash
}

type ClosedByCouncil

type ClosedByCouncil struct {
	Phase        types.Phase
	ProposalHash types.Hash  `json:"proposal_hash"`
	Vetos        []AccountID `json:"vetos"`
	Topics       []types.Hash
}

type Conn

type Conn = *gsrpc.SubstrateAPI

type ConnectionPriceSet

type ConnectionPriceSet struct {
	Phase  types.Phase
	Price  types.U32 `json:"price"`
	Topics []types.Hash
}

type Consumption

type Consumption struct {
	ContractID types.U64 `json:"contract_id"`
	Timestamp  types.U64 `json:"timestamp"`
	CRU        types.U64 `json:"cru"`
	SRU        types.U64 `json:"sru"`
	HRU        types.U64 `json:"hru"`
	MRU        types.U64 `json:"mru"`
	NRU        types.U64 `json:"nru"`
}

Consumption structure

type ConsumptionReportReceived

type ConsumptionReportReceived struct {
	Phase       types.Phase
	Consumption Consumption `json:"consumption"`
	Topics      []types.Hash
}

DEPRECATED ConsumptionReportReceived

type Contract

type Contract struct {
	Versioned
	State              ContractState   `json:"state"`
	ContractID         types.U64       `json:"contract_id"`
	TwinID             types.U32       `json:"twin_id"`
	ContractType       ContractType    `json:"contract_type"`
	SolutionProviderID types.OptionU64 `json:"solution_provider_id"`
}

Contract structure

type ContractBill

type ContractBill struct {
	ContractID    types.U64     `json:"contract_id"`
	Timestamp     types.U64     `json:"timestamp"`
	DiscountLevel DiscountLevel `json:"discount_level"`
	AmountBilled  types.U128    `json:"amount_billed"`
}

ContractBill structure

type ContractBilled

type ContractBilled struct {
	Phase        types.Phase
	ContractBill ContractBill `json:"contract_bill"`
	Topics       []types.Hash
}

ContractBilled

type ContractCreated

type ContractCreated struct {
	Phase    types.Phase
	Contract Contract `json:"contract"`
	Topics   []types.Hash
}

ContractCreated is the contract created event

type ContractDeployed

type ContractDeployed struct {
	Phase      types.Phase
	ContractID types.U64 `json:"contract_id"`
	AccountID  AccountID `json:"account_id"`
	Topics     []types.Hash
}

ContractDeployed

type ContractGracePeriodEnded

type ContractGracePeriodEnded struct {
	Phase      types.Phase
	ContractID types.U64 `json:"contract_id"`
	NodeID     types.U32 `json:"node_id"`
	TwinID     types.U32 `json:"twin_id"`
	Topics     []types.Hash
}

type ContractGracePeriodStarted

type ContractGracePeriodStarted struct {
	Phase      types.Phase
	ContractID types.U64 `json:"contract_id"`
	NodeID     types.U32 `json:"node_id"`
	TwinID     types.U32 `json:"twin_id"`
	StartBlock types.U64 `json:"start_block"`
	Topics     []types.Hash
}

type ContractResources

type ContractResources struct {
	ContractID types.U64 `json:"contract_id"`
	Used       Resources `json:"resources"`
}

type ContractState

type ContractState struct {
	IsCreated                bool         `json:"is_created"`
	IsDeleted                bool         `json:"is_deleted"`
	AsDeleted                DeletedState `json:"as_deleted"`
	IsGracePeriod            bool         `json:"is_grace_period"`
	AsGracePeriodBlockNumber types.U64    `json:"as_grace_period_block_number"`
}

ContractState enum

func (*ContractState) Decode

func (r *ContractState) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (ContractState) Encode

func (r ContractState) Encode(encoder scale.Encoder) (err error)

Encode implementation

type ContractType

type ContractType struct {
	IsNodeContract bool         `json:"is_node_contract"`
	NodeContract   NodeContract `json:"node_contract"`
	IsNameContract bool         `json:"is_name_contract"`
	NameContract   NameContract `json:"name_contract"`
	IsRentContract bool         `json:"is_rent_contract"`
	RentContract   RentContract `json:"rent_contract"`
}

func (*ContractType) Decode

func (r *ContractType) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (ContractType) Encode

func (r ContractType) Encode(encoder scale.Encoder) (err error)

Encode implementation

type ContractUpdated

type ContractUpdated struct {
	Phase    types.Phase
	Contract Contract `json:"contract"`
	Topics   []types.Hash
}

ContractUpdated is the contract updated event

type CouncilMemberVeto

type CouncilMemberVeto struct {
	Phase        types.Phase
	ProposalHash types.Hash `json:"proposal_hash"`
	Who          AccountID  `json:"who"`
	Topics       []types.Hash
}

type DeletedState

type DeletedState struct {
	IsCanceledByUser       bool `json:"is_canceled_by_user"`
	IsOutOfFunds           bool `json:"is_out_of_funds"`
	IsCanceledByCollective bool `json:"is_canceled_by_collective"`
}

func (*DeletedState) Decode

func (r *DeletedState) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (DeletedState) Encode

func (r DeletedState) Encode(encoder scale.Encoder) (err error)

Encode implementation

type Disapproved

type Disapproved struct {
	Phase        types.Phase
	ProposalHash types.Hash `json:"proposal_hash"`
	Topics       []types.Hash
}

type DiscountLevel

type DiscountLevel struct {
	IsNone    bool `json:"is_none"`
	IsDefault bool `json:"is_default"`
	IsBronze  bool `json:"is_bronze"`
	IsSilver  bool `json:"is_silver"`
	IsGold    bool `json:"is_gold"`
}

DiscountLevel enum

func (*DiscountLevel) Decode

func (r *DiscountLevel) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (DiscountLevel) Encode

func (r DiscountLevel) Encode(encoder scale.Encoder) (err error)

Encode implementation

type Entity

type Entity struct {
	Versioned
	ID      types.U32 `json:"id"`
	Name    string    `json:"name"`
	Account AccountID `json:"account_id"`
	Country string    `json:"country"`
	City    string    `json:"city"`
}

Entity type

type EntityDeleted

type EntityDeleted struct {
	Phase  types.Phase
	Entity types.U32 `json:"entity_id"`
	Topics []types.Hash
}

type EntityProof

type EntityProof struct {
	EntityID  types.U32 `json:"entity_id"`
	Signature string    `json:"signature"`
}

EntityProof struct

type EntityStored

type EntityStored struct {
	Phase  types.Phase
	Entity Entity `json:"entity"`
	Topics []types.Hash
}

type EntryEvent

type EntryEvent struct {
	Phase   types.Phase
	Account AccountID `json:"account_id"`
	Key     []byte    `json:"key"`
	Value   []byte    `json:"value"`
	Topics  []types.Hash
}

type EventBatchCompletedWithErrors

type EventBatchCompletedWithErrors struct {
	Phase  types.Phase
	Topics []types.Hash
}

type EventDispatchedAs

type EventDispatchedAs struct {
	Phase  types.Phase
	Result types.DispatchResult
	Topics []types.Hash
}

type EventItemFailed

type EventItemFailed struct {
	Phase  types.Phase
	Error  types.DispatchError
	Topics []types.Hash
}

type EventRecords

type EventRecords struct {
	types.EventRecords
	SmartContractModule_ContractCreated              []ContractCreated              //nolint:stylecheck,golint
	SmartContractModule_ContractUpdated              []ContractUpdated              //nolint:stylecheck,golint
	SmartContractModule_NodeContractCanceled         []NodeContractCanceled         //nolint:stylecheck,golint
	SmartContractModule_NameContractCanceled         []NameContractCanceled         //nolint:stylecheck,golint
	SmartContractModule_IPsReserved                  []IPsReserved                  //nolint:stylecheck,golint
	SmartContractModule_IPsFreed                     []IPsFreed                     //nolint:stylecheck,golint
	SmartContractModule_ContractDeployed             []ContractDeployed             //nolint:stylecheck,golint
	SmartContractModule_ConsumptionReportReceived    []ConsumptionReportReceived    //nolint:stylecheck,golint
	SmartContractModule_ContractBilled               []ContractBilled               //nolint:stylecheck,golint
	SmartContractModule_TokensBurned                 []TokensBurned                 //nolint:stylecheck,golint
	SmartContractModule_UpdatedUsedResources         []UpdatedUsedResources         //nolint:stylecheck,golint
	SmartContractModule_NruConsumptionReportReceived []NruConsumptionReportReceived //nolint:stylecheck,golint
	SmartContractModule_RentContractCanceled         []RentContractCanceled         //nolint:stylecheck,golint
	SmartContractModule_ContractGracePeriodStarted   []ContractGracePeriodStarted   //nolint:stylecheck,golint
	SmartContractModule_ContractGracePeriodEnded     []ContractGracePeriodEnded     //nolint:stylecheck,golint
	SmartContractModule_NodeMarkedAsDedicated        []NodeMarkAsDedicated          //nolint:stylecheck,golint
	SmartContractModule_SolutionProviderCreated      []SolutionProviderCreated      //nolint:stylecheck,golint
	SmartContractModule_SolutionProviderApproved     []SolutionProviderApproved     //nolint:stylecheck,golint
	SmartContractModule_ServiceContractCreated       []ServiceContractCreated       //nolint:stylecheck,golint
	SmartContractModule_ServiceContractMetadataSet   []ServiceContractCreated       //nolint:stylecheck,golint
	SmartContractModule_ServiceContractFeesSet       []ServiceContractCreated       //nolint:stylecheck,golint
	SmartContractModule_ServiceContractApproved      []ServiceContractCreated       //nolint:stylecheck,golint
	SmartContractModule_ServiceContractCanceled      []ServiceContractCanceled      //nolint:stylecheck,golint
	SmartContractModule_ServiceContractBilled        []ServiceContractBilled        //nolint:stylecheck,golint
	SmartContractModule_BillingFrequencyChanged      []BillingFrequencyChanged      //nolint:stylecheck,golint
	SmartContractModule_NodeExtraFeeSet              []NodeExtraFeeSet              //nolint:stylecheck,golint

	// farm events
	TfgridModule_FarmStored  []FarmStored  //nolint:stylecheck,golint
	TfgridModule_FarmUpdated []FarmStored  //nolint:stylecheck,golint
	TfgridModule_FarmDeleted []FarmDeleted //nolint:stylecheck,golint

	// node events
	TfgridModule_NodeStored             []NodeStored         //nolint:stylecheck,golint
	TfgridModule_NodeUpdated            []NodeStored         //nolint:stylecheck,golint
	TfgridModule_NodeDeleted            []NodeDeleted        //nolint:stylecheck,golint
	TfgridModule_NodeUptimeReported     []NodeUptimeReported //nolint:stylecheck,golint
	TfgridModule_NodePublicConfigStored []NodePublicConfig   //nolint:stylecheck,golint
	TfgridModule_PowerTargetChanged     []PowerTargetChanged //nolint:stylecheck,golint
	TfgridModule_PowerStateChanged      []PowerStateChanged  //nolint:stylecheck,golint

	// entity events
	TfgridModule_EntityStored  []EntityStored  //nolint:stylecheck,golint
	TfgridModule_EntityUpdated []EntityStored  //nolint:stylecheck,golint
	TfgridModule_EntityDeleted []EntityDeleted //nolint:stylecheck,golint

	// twin events
	TfgridModule_TwinStored         []TwinStored         //nolint:stylecheck,golint
	TfgridModule_TwinUpdated        []TwinStored         //nolint:stylecheck,golint
	TfgridModule_TwinDeleted        []TwinDeleted        //nolint:stylecheck,golint
	TfgridModule_TwinEntityStored   []TwinEntityStored   //nolint:stylecheck,golint
	TfgridModule_TwinEntityRemoved  []TwinEntityRemoved  //nolint:stylecheck,golint
	TfgridModule_TwinAccountBounded []TwinAccountBounded //nolint:stylecheck,golint

	// policy events
	TfgridModule_PricingPolicyStored []PricingPolicyStored //nolint:stylecheck,golint
	TfgridModule_FarmingPolicyStored []FarmingPolicyStored //nolint:stylecheck,golint

	// other events
	TfgridModule_FarmPayoutV2AddressRegistered []FarmPayoutV2AddressRegistered //nolint:stylecheck,golint
	TfgridModule_FarmMarkedAsDedicated         []FarmMarkedAsDedicated         //nolint:stylecheck,golint
	TfgridModule_ConnectionPriceSet            []ConnectionPriceSet            //nolint:stylecheck,golint
	TfgridModule_NodeCertificationSet          []NodeCertificationSet          //nolint:stylecheck,golint
	TfgridModule_NodeCertifierAdded            []NodeCertifierAdded            //nolint:stylecheck,golint
	TfgridModule_NodeCertifierRemoved          []NodeCertifierRemoved          //nolint:stylecheck,golint
	TfgridModule_FarmingPolicyUpdated          []FarmingPolicyUpdated          //nolint:stylecheck,golint
	TfgridModule_FarmingPolicySet              []FarmingPolicySet              //nolint:stylecheck,golint
	TfgridModule_FarmCertificationSet          []FarmCertificationSet          //nolint:stylecheck,golint
	TfgridModule_ZosVersionUpdated             []ZosVersionUpdated             //nolint:stylecheck,golint

	// burn module events
	BurningModule_BurnTransactionCreated []BurnTransactionCreated //nolint:stylecheck,golint

	// mints
	TFTBridgeModule_MintTransactionProposed []MintTransactionProposed //nolint:stylecheck,golint
	TFTBridgeModule_MintTransactionVoted    []MintTransactionVoted    //nolint:stylecheck,golint
	TFTBridgeModule_MintCompleted           []MintCompleted           //nolint:stylecheck,golint
	TFTBridgeModule_MintTransactionExpired  []MintTransactionExpired  //nolint:stylecheck,golint

	// burns
	TFTBridgeModule_BurnTransactionCreated        []BridgeBurnTransactionCreated  //nolint:stylecheck,golint
	TFTBridgeModule_BurnTransactionProposed       []BurnTransactionProposed       //nolint:stylecheck,golint
	TFTBridgeModule_BurnTransactionSignatureAdded []BurnTransactionSignatureAdded //nolint:stylecheck,golint
	TFTBridgeModule_BurnTransactionReady          []BurnTransactionReady          //nolint:stylecheck,golint
	TFTBridgeModule_BurnTransactionProcessed      []BurnTransactionProcessed      //nolint:stylecheck,golint
	TFTBridgeModule_BurnTransactionExpired        []BridgeBurnTransactionExpired  //nolint:stylecheck,golint

	// refunds
	TFTBridgeModule_RefundTransactionCreated        []RefundTransactionCreated        //nolint:stylecheck,golint
	TFTBridgeModule_RefundTransactionsignatureAdded []RefundTransactionSignatureAdded //nolint:stylecheck,golint
	TFTBridgeModule_RefundTransactionReady          []RefundTransactionReady          //nolint:stylecheck,golint
	TFTBridgeModule_RefundTransactionProcessed      []RefundTransactionProcessed      //nolint:stylecheck,golint
	TFTBridgeModule_RefundTransactionExpired        []RefundTransactionCreated        //nolint:stylecheck,golint

	// TFTPrice module
	TFTPriceModule_PriceStored                 []PriceStored            //nolint:stylecheck,golint
	TFTPriceModule_AveragePriceStored          []PriceStored            //nolint:stylecheck,golint
	TFTPriceModule_OffchainWorkerExecuted      []OffchainWorkerExecuted //nolint:stylecheck,golint
	TFTPriceModule_AveragePriceIsAboveMaxPrice []AveragePriceIsAboveMaxPrice
	TFTPriceModule_AveragePriceIsBelowMinPrice []AveragePriceIsAboveMinPrice
	// KVStore
	TFKVStore_EntrySet   []EntryEvent //nolint:stylecheck,golint
	TFKVStore_EntryGot   []EntryEvent //nolint:stylecheck,golint
	TFKVStore_EntryTaken []EntryEvent //nolint:stylecheck,golint

	// Validatorset pallet
	ValidatorSet_ValidatorAdditionInitiated []ValidatorAdded   //nolint:stylecheck,golint
	ValidatorSet_ValidatorRemovalInitiated  []ValidatorRemoved //nolint:stylecheck,golint

	Validator_Bonded                   []Bonded            //nolint:stylecheck,golint
	Validator_ValidatorRequestCreated  []ValidatorCreated  //nolint:stylecheck,golint
	Validator_ValidatorRequestApproved []ValidatorApproved //nolint:stylecheck,golint
	Validator_ValidatorActivated       []ValidatorApproved //nolint:stylecheck,golint
	Validator_ValidatorRemoved         []ValidatorApproved //nolint:stylecheck,golint
	Validator_NodeValidatorChanged     []Bonded            //nolint:stylecheck,golint
	Validator_NodeValidatorRemoved     []Bonded            //nolint:stylecheck,golint

	CouncilMembership_MemberAdded    []MemberEvent //nolint:stylecheck,golint
	CouncilMembership_MemberRemoved  []MemberEvent //nolint:stylecheck,golint
	CouncilMembership_MembersSwapped []MemberEvent //nolint:stylecheck,golint
	CouncilMembership_MembersReset   []MemberEvent //nolint:stylecheck,golint
	CouncilMembership_KeyChanged     []MemberEvent //nolint:stylecheck,golint
	CouncilMembership_Dummy          []MemberEvent //nolint:stylecheck,golint

	// Dao Pallet
	Dao_Voted             []Voted             //nolint:stylecheck,golint
	Dao_Proposed          []Proposed          //nolint:stylecheck,golint
	Dao_Approved          []Approved          //nolint:stylecheck,golint
	Dao_Disapproved       []Disapproved       //nolint:stylecheck,golint
	Dao_Executed          []Executed          //nolint:stylecheck,golint
	Dao_Closed            []Closed            //nolint:stylecheck,golint
	Dao_ClosedByCouncil   []ClosedByCouncil   //nolint:stylecheck,golint
	Dao_CouncilMemberVeto []CouncilMemberVeto //nolint:stylecheck,golint

	// Scheduler Pallet (temporary until go-substrate-rpc-client is fixed: https://github.com/centrifuge/go-substrate-rpc-client/issues/344)
	Scheduler_CallUnavailable        []EventSchedulerCallUnavailable       `test-gen-blockchain:"polkadot"`
	Scheduler_PeriodicFailed         []EventSchedulerPeriodicFailed        `test-gen-blockchain:"polkadot"`
	Scheduler_PermanentlyOverweight  []EventSchedulerPermanentlyOverweight `test-gen-blockchain:"polkadot"`
	Utility_BatchCompletedWithErrors []EventBatchCompletedWithErrors       `test-gen-blockchain:"centrifuge-parachain"`
	Utility_ItemFailed               []EventItemFailed                     `test-gen-blockchain:"centrifuge-parachain"`
	Utility_DispatchedAs             []EventDispatchedAs                   `test-gen-blockchain:"centrifuge-parachain"`

	// overrides
	Balances_Minted     []BalancesMinted   //nolint:stylecheck,golint
	Balances_BalanceSet []BalancesMinted   //nolint:stylecheck,golint
	Balances_Burned     []BalancesMinted   //nolint:stylecheck,golint
	Balances_Suspended  []BalancesMinted   //nolint:stylecheck,golint
	Balances_Restored   []BalancesMinted   //nolint:stylecheck,golint
	Balances_Upgraded   []EventWithWho     //nolint:stylecheck,golint
	Balances_Issued     []EventWithBalance //nolint:stylecheck,golint
	Balances_Rescinded  []EventWithBalance //nolint:stylecheck,golint
	Balances_Locked     []BalancesMinted   //nolint:stylecheck,golint
	Balances_Unlocked   []BalancesMinted   //nolint:stylecheck,golint
	Balances_Frozen     []BalancesMinted   //nolint:stylecheck,golint
	Balances_Thawed     []BalancesMinted   //nolint:stylecheck,golint
}

EventRecords is a struct that extends the default events with our events

type EventSchedulerCallUnavailable

type EventSchedulerCallUnavailable struct {
	Phase  types.Phase
	Task   types.TaskAddress
	ID     types.OptionBytes
	Topics []types.Hash
}

type EventSchedulerPeriodicFailed

type EventSchedulerPeriodicFailed struct {
	Phase  types.Phase
	Task   types.TaskAddress
	ID     types.OptionBytes
	Topics []types.Hash
}

type EventSchedulerPermanentlyOverweight

type EventSchedulerPermanentlyOverweight struct {
	Phase  types.Phase
	Task   types.TaskAddress
	ID     types.OptionBytes
	Topics []types.Hash
}

type EventWithBalance

type EventWithBalance struct {
	Phase  types.Phase
	Amount types.U128 `json:"amount"`
	Topics []types.Hash
}

type EventWithWho

type EventWithWho struct {
	Phase  types.Phase
	Who    AccountID `json:"who"`
	Topics []types.Hash
}

type Executed

type Executed struct {
	Phase        types.Phase
	ProposalHash types.Hash           `json:"proposal_hash"`
	Result       types.DispatchResult `json:"result"`
	Topics       []types.Hash
}

type Farm

type Farm struct {
	Versioned
	ID                   types.U32                `json:"id"`
	Name                 string                   `json:"name"`
	TwinID               types.U32                `json:"twin_id"`
	PricingPolicyID      types.U32                `json:"pricing_policy_id"`
	CertificationType    FarmCertification        `json:"certification_type"`
	PublicIPs            []PublicIP               `json:"public_ips"`
	DedicatedFarm        bool                     `json:"dedicated_farm"`
	FarmingPoliciesLimit OptionFarmingPolicyLimit `json:"farming_policies_limit"`
}

Farm type

type FarmCertification

type FarmCertification struct {
	IsNotCertified bool `json:"is_not_certified"`
	IsGold         bool `json:"is_gold"`
}

NodeCertification is a substrate enum

func (*FarmCertification) Decode

func (p *FarmCertification) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (FarmCertification) Encode

func (p FarmCertification) Encode(encoder scale.Encoder) (err error)

Decode implementation for the enum type

type FarmCertificationSet

type FarmCertificationSet struct {
	Phase         types.Phase
	Farm          types.U32         `json:"farm_id"`
	Certification FarmCertification `json:"farm_certification"`
	Topics        []types.Hash
}

type FarmDeleted

type FarmDeleted struct {
	Phase  types.Phase
	Farm   types.U32 `json:"farm_id"`
	Topics []types.Hash
}

type FarmMarkedAsDedicated

type FarmMarkedAsDedicated struct {
	Phase  types.Phase
	Farm   types.U32 `json:"farm_id"`
	Topics []types.Hash
}

type FarmPayoutV2AddressRegistered

type FarmPayoutV2AddressRegistered struct {
	Phase   types.Phase
	Farm    types.U32 `json:"farm_id"`
	Address string    `json:"address"`
	Topics  []types.Hash
}

type FarmStored

type FarmStored struct {
	Phase  types.Phase
	Farm   Farm `json:"farm"`
	Topics []types.Hash
}

type FarmingPolicy

type FarmingPolicy struct {
	Versioned
	ID                types.U32         `json:"id"`
	Name              string            `json:"name"`
	CU                types.U32         `json:"cu"`
	SU                types.U32         `json:"su"`
	NU                types.U32         `json:"nu"`
	IPv4              types.U32         `json:"ipv4"`
	MinimalUptime     types.U16         `json:"minimal_uptime"`
	PolicyCreated     types.U32         `json:"policy_created"`
	PolicyEnd         types.U32         `json:"policy_end"`
	Immutable         bool              `json:"immutable"`
	Default           bool              `json:"default"`
	NodeCertification NodeCertification `json:"node_certification"`
	FarmCertification FarmCertification `json:"farm_certification"`
}

type FarmingPolicyLimit

type FarmingPolicyLimit struct {
	FarmingPolicyID   types.U32       `json:"farming_policy_id"`
	Cu                types.OptionU64 `json:"cu"`
	Su                types.OptionU64 `json:"su"`
	End               types.OptionU64 `json:"end"`
	NodeCount         types.OptionU32 `json:"node_count"`
	NodeCertification bool            `json:"node_certification"`
}

type FarmingPolicySet

type FarmingPolicySet struct {
	Phase         types.Phase
	Farm          types.U32                `json:"farm_id"`
	FarmingPolicy OptionFarmingPolicyLimit `json:"farming_policy"`
	Topics        []types.Hash
}

type FarmingPolicyStored

type FarmingPolicyStored struct {
	Phase  types.Phase
	Policy FarmingPolicy `json:"farming_policy"`
	Topics []types.Hash
}

type FarmingPolicyUpdated

type FarmingPolicyUpdated struct {
	Phase         types.Phase
	FarmingPolicy FarmingPolicy `json:"farming_policy"`
	Topics        []types.Hash
}

type HexHash

type HexHash [32]byte

func NewHexHash

func NewHexHash(hash string) (hexHash HexHash)

NewHexHash will create a new hash from a hex input (32 bytes)

func (HexHash) String

func (h HexHash) String() string

type IP

type IP struct {
	IP string `json:"ip"`
	GW string `json:"gw"`
}

type IPsFreed

type IPsFreed struct {
	Phase      types.Phase
	ContractID types.U64  `json:"contract_id"`
	IPs        []PublicIP `json:"ips"`
	Topics     []types.Hash
}

IPsFreed

type IPsReserved

type IPsReserved struct {
	Phase      types.Phase
	ContractID types.U64  `json:"contract_id"`
	IPs        []PublicIP `json:"ips"`
	Topics     []types.Hash
}

IPsReserved

type Identity

type Identity interface {
	KeyPair() (subkey.KeyPair, error)
	Sign(data []byte) ([]byte, error)
	Type() string
	MultiSignature(sig []byte) types.MultiSignature
	Address() string
	PublicKey() []byte
	URI() string
}

Identity is a user identity

func NewIdentityFromEd25519Key

func NewIdentityFromEd25519Key(sk ed25519.PrivateKey) (Identity, error)

func NewIdentityFromEd25519Phrase

func NewIdentityFromEd25519Phrase(phrase string) (Identity, error)

func NewIdentityFromSr25519Phrase

func NewIdentityFromSr25519Phrase(phrase string) (Identity, error)

type Interface

type Interface struct {
	Name string   `json:"name"`
	Mac  string   `json:"mac"`
	IPs  []string `json:"ips"`
}

type Location

type Location struct {
	City      string `json:"city"`
	Country   string `json:"country"`
	Latitude  string `json:"latitude"`
	Longitude string `json:"longitude"`
}

Location type

type Manager

type Manager interface {
	Raw() (Conn, Meta, error)
	Substrate() (*Substrate, error)
}

func NewManager

func NewManager(url ...string) Manager

type MemberEvent

type MemberEvent struct {
	Phase  types.Phase
	Topics []types.Hash
}

to handle council member events that are not defined in base types

type Meta

type Meta = *types.Metadata

type MintCompleted

type MintCompleted struct {
	Phase           types.Phase
	MintTransaction MintTransaction `json:"mint_transaction"`
	TxHash          string          `json:"tx_hash"`
	Topics          []types.Hash
}

MintCompleted

type MintTransaction

type MintTransaction struct {
	Amount types.U64       `json:"amount"`
	Target types.AccountID `json:"target"`
	Block  types.U32       `json:"block"`
	Votes  types.U32       `json:"votes"`
}

type MintTransactionExpired

type MintTransactionExpired struct {
	Phase  types.Phase
	TxHash string    `json:"tx_hash"`
	Amount types.U64 `json:"amount"`
	Target AccountID `json:"target"`
	Topics []types.Hash
}

MintTransactionExpired

type MintTransactionProposed

type MintTransactionProposed struct {
	Phase  types.Phase
	TxHash string    `json:"tx_hash"`
	Target AccountID `json:"target"`
	Amount types.U64 `json:"amount"`
	Topics []types.Hash
}

MintTransactionProposed

type MintTransactionVoted

type MintTransactionVoted struct {
	Phase  types.Phase
	TxHash string `json:"tx_hash"`
	Topics []types.Hash
}

MintTransactionVoted

type NameContract

type NameContract struct {
	Name string `json:"name"`
}

type NameContractCanceled

type NameContractCanceled struct {
	Phase      types.Phase
	ContractID types.U64 `json:"contract_id"`
	Topics     []types.Hash
}

NameContractCanceled

type Node

type Node struct {
	Versioned
	ID              types.U32          `json:"id"`
	FarmID          types.U32          `json:"farm_id"`
	TwinID          types.U32          `json:"twin_id"`
	Resources       Resources          `json:"resources"`
	Location        Location           `json:"location"`
	PublicConfig    OptionPublicConfig `json:"public_config"`
	Created         types.U64          `json:"created"`
	FarmingPolicy   types.U32          `json:"farming_policy"`
	Interfaces      []Interface        `json:"interfaces"`
	Certification   NodeCertification  `json:"certification"`
	SecureBoot      bool               `json:"secure_boot"`
	Virtualized     bool               `json:"virtualized"`
	BoardSerial     OptionBoardSerial  `json:"board_serial"`
	ConnectionPrice types.U32          `json:"connection_price"`
}

Node type

func (*Node) Eq

func (n *Node) Eq(o *Node) bool

Eq compare changes on node settable fields

type NodeCertification

type NodeCertification struct {
	IsDiy       bool `json:"is_diy"`
	IsCertified bool `json:"is_certified"`
}

NodeCertification is a substrate enum

func (*NodeCertification) Decode

func (p *NodeCertification) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (NodeCertification) Encode

func (p NodeCertification) Encode(encoder scale.Encoder) (err error)

Decode implementation for the enum type

type NodeCertificationSet

type NodeCertificationSet struct {
	Phase         types.Phase
	NodeId        types.U32         `json:"node_id"`
	Certification NodeCertification `json:"certification"`
	Topics        []types.Hash
}

type NodeCertifierAdded

type NodeCertifierAdded struct {
	Phase   types.Phase
	Address AccountID `json:"address"`
	Topics  []types.Hash
}

type NodeCertifierRemoved

type NodeCertifierRemoved struct {
	Phase   types.Phase
	Address AccountID `json:"address"`
	Topics  []types.Hash
}

type NodeContract

type NodeContract struct {
	Node           types.U32  `json:"node_id"`
	DeploymentHash HexHash    `json:"deployment_hash"`
	DeploymentData string     `json:"deployment_data"`
	PublicIPsCount types.U32  `json:"public_ips_count"`
	PublicIPs      []PublicIP `json:"public_ips"`
}

type NodeContractCanceled

type NodeContractCanceled struct {
	Phase      types.Phase
	ContractID types.U64 `json:"contract_id"`
	Node       types.U32 `json:"node_id"`
	Twin       types.U32 `json:"twin_id"`
	Topics     []types.Hash
}

NodeContractCanceled

type NodeDeleted

type NodeDeleted struct {
	Phase  types.Phase
	Node   types.U32 `json:"node_id"`
	Topics []types.Hash
}

type NodeExtra

type NodeExtra struct {
	Secure       bool              `json:"secure"`
	Virtualized  bool              `json:"virtualized"`
	SerialNumber OptionBoardSerial `json:"serial_number"`
}

type NodeExtraFeeSet

type NodeExtraFeeSet struct {
	Phase    types.Phase
	NodeID   types.U32 `json:"node_id"`
	ExtraFee types.U64 `json:"extra_fee"`
	Topics   []types.Hash
}

type NodeMarkAsDedicated

type NodeMarkAsDedicated struct {
	Phase     types.Phase
	NodeID    types.U32 `json:"node_id"`
	Dedicated bool      `json:"dedicated"`
	Topics    []types.Hash
}

type NodePower

type NodePower struct {
	State  PowerState `json:"state"`
	Target Power      `json:"target"`
}

type NodePublicConfig

type NodePublicConfig struct {
	Phase  types.Phase
	Node   types.U32          `json:"node_id"`
	Config OptionPublicConfig `json:"config"`
	Topics []types.Hash
}

type NodeStored

type NodeStored struct {
	Phase  types.Phase
	Node   Node `json:"node"`
	Topics []types.Hash
}

type NodeUptimeReported

type NodeUptimeReported struct {
	Phase     types.Phase
	Node      types.U32 `json:"node_id"`
	Timestamp types.U64 `json:"timestamp"`
	Uptime    types.U64 `json:"uptime"`
	Topics    []types.Hash
}

type NruConsumption

type NruConsumption struct {
	ContractID types.U64 `json:"contract_id"`
	Timestamp  types.U64 `json:"timestamp"`
	Window     types.U64 `json:"window"`
	NRU        types.U64 `json:"nru"`
}

Consumption structure

func (*NruConsumption) IsEmpty

func (s *NruConsumption) IsEmpty() bool

IsEmpty true if consumption is zero

type NruConsumptionReportReceived

type NruConsumptionReportReceived struct {
	Phase       types.Phase
	Consumption NruConsumption `json:"consumption"`
	Topics      []types.Hash
}

ConsumptionReportReceived

type OffchainWorkerExecuted

type OffchainWorkerExecuted struct {
	Phase   types.Phase
	Account AccountID `json:"account_id"`
	Topics  []types.Hash
}

type OptionBoardSerial

type OptionBoardSerial struct {
	HasValue bool   `json:"has_value"`
	AsValue  string `json:"as_value"`
}

OptionBoardSerial type

func (*OptionBoardSerial) Decode

func (m *OptionBoardSerial) Decode(decoder scale.Decoder) (err error)

Decode implementation

func (OptionBoardSerial) Encode

func (m OptionBoardSerial) Encode(encoder scale.Encoder) (err error)

Encode implementation

type OptionDomain

type OptionDomain struct {
	HasValue bool   `json:"has_value"`
	AsValue  string `json:"as_value"`
}

func (*OptionDomain) Decode

func (m *OptionDomain) Decode(decoder scale.Decoder) (err error)

Decode implementation

func (OptionDomain) Encode

func (m OptionDomain) Encode(encoder scale.Encoder) (err error)

Encode implementation

type OptionFarmingPolicyLimit

type OptionFarmingPolicyLimit struct {
	HasValue bool               `json:"has_value"`
	AsValue  FarmingPolicyLimit `json:"as_value"`
}

OptionFarmingPolicyLimit type

func (*OptionFarmingPolicyLimit) Decode

func (m *OptionFarmingPolicyLimit) Decode(decoder scale.Decoder) (err error)

Decode implementation

func (OptionFarmingPolicyLimit) Encode

func (m OptionFarmingPolicyLimit) Encode(encoder scale.Encoder) (err error)

Encode implementation

type OptionIP

type OptionIP struct {
	HasValue bool `json:"has_value"`
	AsValue  IP   `json:"as_value"`
}

func (*OptionIP) Decode

func (m *OptionIP) Decode(decoder scale.Decoder) (err error)

Decode implementation

func (OptionIP) Encode

func (m OptionIP) Encode(encoder scale.Encoder) (err error)

Encode implementation

type OptionPublicConfig

type OptionPublicConfig struct {
	HasValue bool         `json:"has_value"`
	AsValue  PublicConfig `json:"as_value"`
}

OptionPublicConfig type

func (*OptionPublicConfig) Decode

func (m *OptionPublicConfig) Decode(decoder scale.Decoder) (err error)

Decode implementation

func (OptionPublicConfig) Encode

func (m OptionPublicConfig) Encode(encoder scale.Encoder) (err error)

Encode implementation

type OptionRelay

type OptionRelay struct {
	HasValue bool   `json:"has_value"`
	AsValue  string `json:"as_value"`
}

OptionRelay type

func (*OptionRelay) Decode

func (r *OptionRelay) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (OptionRelay) Encode

func (m OptionRelay) Encode(encoder scale.Encoder) (err error)

Encode implementation

type Policy

type Policy struct {
	Value types.U32
	Unit  Unit
}

type Power

type Power struct {
	IsUp   bool `json:"is_up"`
	IsDown bool `json:"is_down"`
}

func (*Power) Decode

func (r *Power) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (Power) Encode

func (r Power) Encode(encoder scale.Encoder) (err error)

Encode implementation

type PowerState

type PowerState struct {
	IsUp              bool        `json:"is_up"`
	IsDown            bool        `json:"is_down"`
	AsDownBlockNumber BlockNumber `json:"as_down_block_number"`
}

func (*PowerState) Decode

func (r *PowerState) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (PowerState) Encode

func (r PowerState) Encode(encoder scale.Encoder) (err error)

Encode implementation

type PowerStateChanged

type PowerStateChanged struct {
	Phase      types.Phase
	Farm       types.U32  `json:"farm_id"`
	Node       types.U32  `json:"node_id"`
	PowerState PowerState `json:"power_state"`
	Topics     []types.Hash
}

type PowerTargetChanged

type PowerTargetChanged struct {
	Phase       types.Phase
	Farm        types.U32 `json:"farm_id"`
	Node        types.U32 `json:"node_id"`
	PowerTarget Power     `json:"power_target"`
	Topics      []types.Hash
}

type PriceStored

type PriceStored struct {
	Phase types.Phase
	// in rust this is a U16F16 which is a custom type of 4 bytes width to
	// represent a float point with a
	Price  types.U32 `json:"price"`
	Topics []types.Hash
}

type PricingPolicy

type PricingPolicy struct {
	Versioned
	ID                     types.U32 `json:"id"`
	Name                   string    `json:"name"`
	SU                     Policy    `json:"su"`
	CU                     Policy    `json:"cu"`
	NU                     Policy    `json:"nu"`
	IPU                    Policy    `json:"ipu"`
	UniqueName             Policy    `json:"unique_name"`
	DomainName             Policy    `json:"domain_name"`
	FoundationAccount      AccountID `json:"foundation_name"`
	CertifiedSalesAccount  AccountID `json:"certified_sales_account"`
	DedicatedNodesDiscount types.U8  `json:"dedication_nodes_discount"`
}

PricingPolicy struct represents a PricingPolicy

type PricingPolicyStored

type PricingPolicyStored struct {
	Phase  types.Phase
	Policy PricingPolicy `json:"pricing_policy"`
	Topics []types.Hash
}

type Proposed

type Proposed struct {
	Phase         types.Phase
	Account       AccountID  `json:"account_id"`
	ProposalIndex types.U32  `json:"proposal_index"`
	ProposalHash  types.Hash `json:"proposal_hash"`
	Threshold     types.U32  `json:"threshold"`
	Topics        []types.Hash
}

type Provider

type Provider struct {
	Who  types.AccountID `json:"who"`
	Take types.U8        `json:"take"`
}

type PublicConfig

type PublicConfig struct {
	IP4    IP           `json:"ip4"`
	IP6    OptionIP     `json:"ip6"`
	Domain OptionDomain `json:"domain"`
}

PublicConfig type

type PublicIP

type PublicIP struct {
	IP         string    `json:"ip"`
	Gateway    string    `json:"gateway"`
	ContractID types.U64 `json:"contract_id"`
}

PublicIP structure

type PublicIPInput

type PublicIPInput struct {
	IP      string `json:"ip"`
	Gateway string `json:"gateway"`
}

PublicIPInput structure

type RefundTransaction

type RefundTransaction struct {
	Block          types.U32          `json:"block"`
	Amount         types.U64          `json:"amount"`
	Target         string             `json:"target"`
	TxHash         string             `json:"tx_hash"`
	Signatures     []StellarSignature `json:"signatures"`
	SequenceNumber types.U64          `json:"sequence_number"`
}

type RefundTransactionCreated

type RefundTransactionCreated struct {
	Phase                 types.Phase
	RefundTransactionHash []byte    `json:"refund_transaction_hash"`
	Target                []byte    `json:"target"`
	Amount                types.U64 `json:"amount"`
	Topics                []types.Hash
}

RefundTransactionCreated

type RefundTransactionProcessed

type RefundTransactionProcessed struct {
	Phase                 types.Phase
	RefundTransactionHash RefundTransaction `json:"refund_transaction_hash"`
	Topics                []types.Hash
}

RefundTransactionProcessed

type RefundTransactionReady

type RefundTransactionReady struct {
	Phase                 types.Phase
	RefundTransactionHash []byte `json:"refund_transaction_hash"`
	Topics                []types.Hash
}

RefundTransactionReady

type RefundTransactionSignatureAdded

type RefundTransactionSignatureAdded struct {
	Phase                 types.Phase
	RefundTransactionHash []byte           `json:"refund_transaction_hash"`
	Signature             StellarSignature `json:"signature"`
	Topics                []types.Hash
}

RefundTransactionSignatureAdded

type RentContract

type RentContract struct {
	Node types.U32 `json:"node_id"`
}

type RentContractCanceled

type RentContractCanceled struct {
	Phase      types.Phase
	ContractID types.U64 `json:"contract_id"`
	Topics     []types.Hash
}

RentContractCanceled

type Resources

type Resources struct {
	HRU types.U64 `json:"hru"`
	SRU types.U64 `json:"sru"`
	CRU types.U64 `json:"cru"`
	MRU types.U64 `json:"mru"`
}

Resources type

type Role

type Role struct {
	IsNode    bool `json:"is_node"`
	IsGateway bool `json:"is_gateway"`
}

Role type

func (*Role) Decode

func (r *Role) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

func (Role) Encode

func (r Role) Encode(encoder scale.Encoder) (err error)

Encode implementation

type ScannedNode

type ScannedNode struct {
	ID   uint32 `json:"id"`
	Node Node   `json:"node"`
	Err  error  `json:"err"`
}

type ServiceContract

type ServiceContract struct {
	ServiceContractID  types.U64            `json:"service_contract_id"`
	ServiceTwinID      types.U32            `json:"service_twin_id"`
	ConsumerTwinID     types.U32            `json:"consumer_twin_id"`
	BaseFee            types.U64            `json:"base_fee"`
	VariableFee        types.U64            `json:"variable_fee"`
	Metadata           string               `json:"metadata"`
	AcceptedByService  bool                 `json:"accepted_by_service"`
	AcceptedByConsumer bool                 `json:"accepted_by_consumer"`
	LastBill           types.U64            `json:"last_bill"`
	State              ServiceContractState `json:"state"`
}

ServiceContract struct

type ServiceContractBill

type ServiceContractBill struct {
	VariableAmount types.U64 `json:"variable_amount"`
	Window         types.U64 `json:"window"`
	Metadata       string    `json:"metadata"`
}

ServiceContractBill struct

type ServiceContractBilled

type ServiceContractBilled struct {
	Phase               types.Phase
	ServiceContract     ServiceContract     `json:"service_contract"`
	ServiceContractBill ServiceContractBill `json:"service_contract_bill"`
	Amount              types.U128          `json:"amount"`
	Topics              []types.Hash
}

ServiceContractBilled

type ServiceContractCanceled

type ServiceContractCanceled struct {
	Phase             types.Phase
	ServiceContractID types.U64    `json:"service_contract_id"`
	Cause             DeletedState `json:"cause"`
	Topics            []types.Hash
}

ServiceContractCanceled

type ServiceContractCreated

type ServiceContractCreated struct {
	Phase           types.Phase
	ServiceContract ServiceContract `json:"service_contract"`
	Topics          []types.Hash
}

ServiceContractCreated

type ServiceContractState

type ServiceContractState struct {
	IsCreated        bool `json:"is_created"`
	IsAgreementReady bool `json:"is_agreement_ready"`
	IsApprovedByBoth bool `json:"is_approved_by_both"`
}

ServiceContractState enum

func (*ServiceContractState) Decode

func (r *ServiceContractState) Decode(decoder scale.Decoder) error

Decode implementation for the ServiceContractState enum type

func (ServiceContractState) Encode

func (r ServiceContractState) Encode(encoder scale.Encoder) (err error)

Encode implementation for the ServiceContractState enum type

type SolutionProvider

type SolutionProvider struct {
	SolutionProviderID types.U64  `json:"solution_provider_id"`
	Providers          []Provider `json:"providers"`
	Description        string     `json:"description"`
	Link               string     `json:"link"`
	Approved           bool       `json:"approved"`
}

type SolutionProviderApproved

type SolutionProviderApproved struct {
	Phase              types.Phase
	SolutionProviderID types.U64 `json:"solution_provider_id"`
	Approved           bool      `json:"approved"`
	Topics             []types.Hash
}

type SolutionProviderCreated

type SolutionProviderCreated struct {
	Phase            types.Phase
	SolutionProvider SolutionProvider `json:"solution_provider"`
	Topics           []types.Hash
}

type StellarSignature

type StellarSignature struct {
	Signature      []byte `json:"signature"`
	StellarAddress []byte `json:"stellar_address"`
}

type Substrate

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

Substrate client

func (*Substrate) AcceptTermsAndConditions

func (s *Substrate) AcceptTermsAndConditions(identity Identity, documentLink string, documentHash string) error

AcceptTermsAndConditions accepts terms and conditions

func (*Substrate) BatchAllCreateContract

func (s *Substrate) BatchAllCreateContract(identity Identity, contractData []BatchCreateContractData) ([]uint64, error)

BatchAllCreateContract creates a batch of contracts for deployments atomically. transaction will rollback on error

func (*Substrate) BatchCancelContract

func (s *Substrate) BatchCancelContract(identity Identity, contracts []uint64) error

BatchCancelContract cancels a batch of contracts

func (*Substrate) BatchCreateContract

func (s *Substrate) BatchCreateContract(identity Identity, contractData []BatchCreateContractData) ([]uint64, *int, error)

BatchCreateContract creates a batch of contracts for deployments non-atomically. on error returns the created contracts, the first failing contract index and the error message.

func (*Substrate) Call

func (s *Substrate) Call(cl Conn, meta Meta, identity Identity, call types.Call) (response *CallResponse, err error)

Call call this extrinsic and retry if Usurped

func (*Substrate) CallOnce

func (s *Substrate) CallOnce(cl Conn, meta Meta, identity Identity, call types.Call) (hash types.Hash, err error)

func (*Substrate) CancelContract

func (s *Substrate) CancelContract(identity Identity, contract uint64) error

CancelContract creates a contract for deployment

func (*Substrate) Close

func (s *Substrate) Close()

func (*Substrate) CreateFarm

func (s *Substrate) CreateFarm(identity Identity, name string, publicIps []PublicIPInput) error

CreateFarm creates a farm takes in a name and public ip list

func (*Substrate) CreateNameContract

func (s *Substrate) CreateNameContract(identity Identity, name string) (uint64, error)

CreateNameContract creates a contract for deployment

func (*Substrate) CreateNode

func (s *Substrate) CreateNode(identity Identity, node Node) (uint32, error)

CreateNode creates a node, this ignores public_config since this is only setable by the farmer

func (*Substrate) CreateNodeContract

func (s *Substrate) CreateNodeContract(identity Identity, node uint32, body string, hash string, publicIPs uint32, solutionProviderID *uint64) (uint64, error)

CreateNodeContract creates a contract for deployment

func (*Substrate) CreateRefundTransactionOrAddSig

func (s *Substrate) CreateRefundTransactionOrAddSig(identity Identity, tx_hash string, target string, amount int64, signature string, stellarAddress string, sequence_number uint64) error

func (*Substrate) CreateRentContract

func (s *Substrate) CreateRentContract(identity Identity, node uint32, solutionProviderID *uint64) (uint64, error)

CreateRentContract creates a rent contract on a node

func (*Substrate) CreateTwin

func (s *Substrate) CreateTwin(identity Identity, relay string, pk []byte) (uint32, error)

CreateTwin creates a twin

func (*Substrate) EnsureAccount

func (s *Substrate) EnsureAccount(identity Identity, activationURL, termsAndConditionsLink, terminsAndConditionsHash string) (info AccountInfo, err error)

EnsureAccount makes sure account is available on blockchain if not, it uses activation service to create one. EnsureAccount is safe to call on already activated accounts and it's mostly a NO-OP operation unless the account funds are very low, it will then make sure to reactivate the account (fund it) if the free tokes are <= ReactivateThreefold uTFT

func (*Substrate) FetchEventsForBlockRange

func (s *Substrate) FetchEventsForBlockRange(start uint32, end uint32) (types.StorageKey, []types.StorageChangeSet, error)

func (*Substrate) GetAccount

func (s *Substrate) GetAccount(identity Identity) (info AccountInfo, err error)

GetAccount gets account info with secure key

func (*Substrate) GetAccountPublicInfo

func (s *Substrate) GetAccountPublicInfo(account AccountID) (info AccountInfo, err error)

GetAccountPublicInfo gets the info for a given account ID

func (*Substrate) GetAverageTFTPrice

func (s *Substrate) GetAverageTFTPrice() (price types.U32, err error)

GetAverageTFTPrice gets the average TFT price

func (*Substrate) GetBalance

func (s *Substrate) GetBalance(account AccountID) (balance Balance, err error)

GetBalance gets the balance for a given account ID

func (*Substrate) GetBlock

func (s *Substrate) GetBlock(block types.Hash) (*types.SignedBlock, error)

func (*Substrate) GetBlockByNumber

func (s *Substrate) GetBlockByNumber(blockNumber types.U32) (*types.SignedBlock, error)

func (*Substrate) GetBurnTransaction

func (s *Substrate) GetBurnTransaction(burnTransactionID types.U64) (*BurnTransaction, error)

func (*Substrate) GetClient

func (s *Substrate) GetClient() (Conn, Meta, error)

func (*Substrate) GetContract

func (s *Substrate) GetContract(id uint64) (*Contract, error)

GetContract we should not have calls to create contract, instead only get

func (*Substrate) GetContractIDByNameRegistration

func (s *Substrate) GetContractIDByNameRegistration(name string) (uint64, error)

GetContractIDByNameRegistration gets a contract given the its name

func (*Substrate) GetContractWithHash

func (s *Substrate) GetContractWithHash(node uint32, hash HexHash) (uint64, error)

GetContractWithHash gets a contract given the node id and hash

func (*Substrate) GetCurrentHeight

func (s *Substrate) GetCurrentHeight() (uint32, error)

func (*Substrate) GetDedicatedNodePrice

func (s *Substrate) GetDedicatedNodePrice(nodeID uint32) (uint64, error)

GetDedicatedeNodePrice returns the price of a dedicated node

func (*Substrate) GetDepositFee

func (s *Substrate) GetDepositFee() (int64, error)

func (*Substrate) GetEntity

func (s *Substrate) GetEntity(id uint32) (*Entity, error)

GetEntity gets a entity with ID

func (*Substrate) GetEventsForBlock

func (s *Substrate) GetEventsForBlock(start uint32) (*EventRecords, error)

func (*Substrate) GetFarm

func (s *Substrate) GetFarm(id uint32) (*Farm, error)

GetFarm gets a farm with ID

func (*Substrate) GetFarmByName

func (s *Substrate) GetFarmByName(name string) (uint32, error)

GetFarm gets a farm with ID

func (*Substrate) GetLastNodeID

func (s *Substrate) GetLastNodeID() (uint32, error)

GetNode with id

func (*Substrate) GetNode

func (s *Substrate) GetNode(id uint32) (*Node, error)

GetNode with id

func (*Substrate) GetNodeByTwinID

func (s *Substrate) GetNodeByTwinID(twin uint32) (uint32, error)

GetNodeByTwinID gets a node by twin id

func (*Substrate) GetNodeContracts

func (s *Substrate) GetNodeContracts(node uint32) ([]types.U64, error)

GetNodeContracts gets all contracts on a node (pk) in given state

func (*Substrate) GetNodeRentContract

func (s *Substrate) GetNodeRentContract(node uint32) (uint64, error)

GetNodeContracts gets all contracts on a node (pk) in given state

func (*Substrate) GetNodes

func (s *Substrate) GetNodes(farmID uint32) ([]uint32, error)

GetNodes gets nodes' IDs using farm id

func (*Substrate) GetPowerTarget

func (s *Substrate) GetPowerTarget(nodeID uint32) (power NodePower, err error)

GetPowerTarget returns the power target for a node

func (*Substrate) GetPricingPolicy

func (s *Substrate) GetPricingPolicy(id uint32) (pricingPolicy PricingPolicy, err error)

GetPricingPolicies gets pricing policy from tfgrid module

func (*Substrate) GetRefundTransaction

func (s *Substrate) GetRefundTransaction(txHash string) (*RefundTransaction, error)

func (*Substrate) GetServiceContract

func (s *Substrate) GetServiceContract(id uint64) (*ServiceContract, error)

GetServiceContract gets a service contract given the service contract id

func (*Substrate) GetServiceContractID

func (s *Substrate) GetServiceContractID() (uint64, error)

GetServiceContractID gets the current value of storage ServiceContractID

func (*Substrate) GetTFTPrice

func (s *Substrate) GetTFTPrice() (price types.U32, err error)

GetTFTPrice gets the TFT price

func (*Substrate) GetTwin

func (s *Substrate) GetTwin(id uint32) (*Twin, error)

GetTwin gets a twin

func (*Substrate) GetTwinByPubKey

func (s *Substrate) GetTwinByPubKey(pk []byte) (uint32, error)

GetTwinByPubKey gets a twin with public key

func (*Substrate) GetUser

func (s *Substrate) GetUser(id uint32) (*User, error)

GetUser with id

func (*Substrate) GetZosVersion

func (s *Substrate) GetZosVersion() (string, error)

GetZosVersion gets the latest version for each network

func (*Substrate) IsBurnedAlready

func (s *Substrate) IsBurnedAlready(burnTransactionID types.U64) (exists bool, err error)

func (*Substrate) IsMintedAlready

func (s *Substrate) IsMintedAlready(mintTxID string) (exists bool, err error)

func (*Substrate) IsRefundedAlready

func (s *Substrate) IsRefundedAlready(txHash string) (exists bool, err error)

func (*Substrate) IsValidator

func (s *Substrate) IsValidator(identity Identity) (exists bool, err error)

func (*Substrate) ProposeBurnTransactionOrAddSig

func (s *Substrate) ProposeBurnTransactionOrAddSig(identity Identity, txID uint64, target string, amount *big.Int, signature string, stellarAddress string, sequence_number uint64) error

func (*Substrate) ProposeOrVoteMintTransaction

func (s *Substrate) ProposeOrVoteMintTransaction(identity Identity, txID string, target AccountID, amount *big.Int) error

func (*Substrate) Report

func (s *Substrate) Report(identity Identity, consumptions []NruConsumption) (types.Hash, error)

Report send a capacity report to substrate

func (*Substrate) ScanNodes

func (s *Substrate) ScanNodes(ctx context.Context, from, to uint32) (<-chan ScannedNode, error)

func (*Substrate) ServiceContractApprove

func (s *Substrate) ServiceContractApprove(identity Identity, contract uint64) error

ServiceContractApprove approves a service contract

func (*Substrate) ServiceContractBill

func (s *Substrate) ServiceContractBill(identity Identity, contract uint64, variable_amount uint64, metadata string) error

ServiceContractBill bills a service contract

func (*Substrate) ServiceContractCancel

func (s *Substrate) ServiceContractCancel(identity Identity, contract uint64) error

ServiceContractCancel cancels a service contract

func (*Substrate) ServiceContractCreate

func (s *Substrate) ServiceContractCreate(identity Identity, service AccountID, consumer AccountID) (uint64, error)

ServiceContractCreate creates a service contract

func (*Substrate) ServiceContractReject

func (s *Substrate) ServiceContractReject(identity Identity, contract uint64) error

ServiceContractReject rejects a service contract

func (*Substrate) ServiceContractSetFees

func (s *Substrate) ServiceContractSetFees(identity Identity, contract uint64, base_fee uint64, variable_fee uint64) error

ServiceContractSetFees sets fees for a service contract

func (*Substrate) ServiceContractSetMetadata

func (s *Substrate) ServiceContractSetMetadata(identity Identity, contract uint64, metadata string) error

ServiceContractSetMetadata sets metadata for a service contract

func (*Substrate) SetBurnTransactionExecuted

func (s *Substrate) SetBurnTransactionExecuted(identity Identity, txID uint64) error

func (*Substrate) SetContractConsumption

func (s *Substrate) SetContractConsumption(identity Identity, resources ...ContractResources) error

SetContractConsumption can only be called by the node that owns the contract to set the used resources associated with the node.

func (*Substrate) SetDedicatedNodePrice

func (s *Substrate) SetDedicatedNodePrice(identity Identity, nodeId uint32, price uint64) (hash types.Hash, err error)

SetDedicatedNodePrice sets an extra price on a node expressed in mUSD This price will be distributed back to the farmer if the node is rented Setting this price also makes the node only available to rent as dedicated

func (*Substrate) SetNodeCertificate

func (s *Substrate) SetNodeCertificate(identity Identity, id uint32, cert NodeCertification) error

SetNodeCertificate sets the node certificate type

func (*Substrate) SetNodePowerState

func (s *Substrate) SetNodePowerState(identity Identity, up bool) (hash types.Hash, err error)

SetNodePowerState updates the node uptime to given value

func (*Substrate) SetNodePowerTarget

func (s *Substrate) SetNodePowerTarget(identity Identity, nodeID uint32, up bool) (hash types.Hash, err error)

SetNodePowerTarget updates the power target of a node

func (*Substrate) SetRefundTransactionExecuted

func (s *Substrate) SetRefundTransactionExecuted(identity Identity, txHash string) error

func (*Substrate) SignedTermsAndConditions

func (s *Substrate) SignedTermsAndConditions(account AccountID) ([]TermsAndConditions, error)

SignedTermsAndConditions return list of signed terms and conditions for this account

func (*Substrate) SwapToStellar

func (s *Substrate) SwapToStellar(identity Identity, targetStellarAddress string, amount big.Int) error

func (*Substrate) Time

func (s *Substrate) Time() (t time.Time, err error)

func (*Substrate) Transfer

func (s *Substrate) Transfer(identity Identity, amount uint64, destination AccountID) error

func (*Substrate) UpdateNode

func (s *Substrate) UpdateNode(identity Identity, node Node) (uint32, error)

UpdateNode updates a node, this ignores public_config and only keep the value set by the farmer

func (*Substrate) UpdateNodeContract

func (s *Substrate) UpdateNodeContract(identity Identity, contract uint64, body string, hash string) (uint64, error)

UpdateNodeContract updates existing contract

func (*Substrate) UpdateNodeUptime

func (s *Substrate) UpdateNodeUptime(identity Identity, uptime uint64) (hash types.Hash, err error)

UpdateNodeUptime updates the node uptime to given value

func (*Substrate) UpdateNodeUptimeV2

func (s *Substrate) UpdateNodeUptimeV2(identity Identity, uptime, timestampHint uint64) (hash types.Hash, err error)

UpdateNodeUptime updates the node uptime to given value

func (*Substrate) UpdateTwin

func (s *Substrate) UpdateTwin(identity Identity, relay string, pk []byte) (uint32, error)

UpdateTwin updates a twin

type TermsAndConditions

type TermsAndConditions struct {
	Account      AccountID `json:"account_id"`
	Timestamp    types.U64 `json:"timestamp"`
	DocumentLink string    `json:"document_link"`
	DocumentHash string    `json:"document_hash"`
}

type TokensBurned

type TokensBurned struct {
	Phase      types.Phase
	ContractID types.U64  `json:"contract_id"`
	Amount     types.U128 `json:"amount"`
	Topics     []types.Hash
}

TokensBurned

type Twin

type Twin struct {
	ID       types.U32         `json:"id"`
	Account  AccountID         `json:"acocunt_id"`
	Relay    OptionRelay       `json:"relay"`
	Entities []EntityProof     `json:"entities"`
	Pk       types.OptionBytes `json:"pk"`
}

Twin struct

type TwinAccountBounded

type TwinAccountBounded struct {
	Phase   types.Phase
	Twin    types.U32 `json:"twin_id"`
	Account AccountID `json:"account_id"`
	Topics  []types.Hash
}

type TwinDeleted

type TwinDeleted struct {
	Phase  types.Phase
	Twin   types.U32 `json:"twin_id"`
	Topics []types.Hash
}

type TwinEntityRemoved

type TwinEntityRemoved struct {
	Phase  types.Phase
	Twin   types.U32 `json:"twin_id"`
	Entity types.U32 `json:"identity_id"`
	Topics []types.Hash
}

type TwinEntityStored

type TwinEntityStored struct {
	Phase     types.Phase
	Twin      types.U32 `json:"twin_id"`
	Entity    types.U32 `json:"entity_id"`
	Signature []byte    `json:"signature"`
	Topics    []types.Hash
}

type TwinStored

type TwinStored struct {
	Phase  types.Phase
	Twin   Twin `json:"twin"`
	Topics []types.Hash
}

type Unit

type Unit byte

numeric enum for unit

type UpdatedUsedResources

type UpdatedUsedResources struct {
	Phase             types.Phase
	ContractResources ContractResources `json:"contract_resources"`
	Topics            []types.Hash
}

type User

type User struct {
	Versioned
	ID        types.U32 `json:"id"`
	Name      string    `json:"name"`
	CountryID types.U32 `json:"country_id"`
	CityID    types.U32 `json:"city_id"`
	Address   AccountID `json:"address"`
}

User from substrate

type Validator

type Validator struct {
	ValidatorNodeAccount AccountID             `json:"validator_node_account"`
	StashAccount         AccountID             `json:"stash_account"`
	Description          string                `json:"description"`
	TfConnectId          string                `json:"tf_connect_id"`
	Info                 string                `json:"info"`
	State                ValidatorRequestState `json:"state"`
}

type ValidatorAdded

type ValidatorAdded struct {
	Phase   types.Phase
	Account AccountID `json:"account_id"`
	Topics  []types.Hash
}

type ValidatorApproved

type ValidatorApproved struct {
	Phase     types.Phase
	Validator Validator `json:"validator"`
	Topics    []types.Hash
}

type ValidatorCreated

type ValidatorCreated struct {
	Phase     types.Phase
	Account   AccountID `json:"account_id"`
	Validator Validator `json:"validator"`
	Topics    []types.Hash
}

type ValidatorRemoved

type ValidatorRemoved struct {
	Phase   types.Phase
	Account AccountID `json:"account_id"`
	Topics  []types.Hash
}

type ValidatorRequestState

type ValidatorRequestState struct {
	IsCreated    bool `json:"is_created"`
	IsApproved   bool `json:"is_approved"`
	IsValidating bool `json:"is_validating"`
}

func (*ValidatorRequestState) Decode

func (r *ValidatorRequestState) Decode(decoder scale.Decoder) error

Decode implementation for the enum type

type Versioned

type Versioned struct {
	Version uint32 `json:"version"`
}

Versioned base for all types

type Voted

type Voted struct {
	Phase        types.Phase
	Account      AccountID  `json:"account_id"`
	ProposalHash types.Hash `json:"proposal_hash"`
	Voted        bool       `json:"voted"`
	Yes          types.U32  `json:"yes"`
	No           types.U32  `json:"no"`
	Topics       []types.Hash
}

type ZosVersionUpdated

type ZosVersionUpdated struct {
	Phase   types.Phase
	Version string `json:"version"`
	Topics  []types.Hash
}

Jump to

Keyboard shortcuts

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