tfchain

package
v0.0.0-...-0269a1e Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TfchainID = "tfchain"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AcceptTermsAndConditions

type AcceptTermsAndConditions struct {
	Link string `json:"link"`
	Hash string `json:"hash"`
}

type Client

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

Client exposing stellar methods

func NewClient

func NewClient() *Client

NewClient creates a new Client ready for use

func (*Client) AcceptTermsAndConditions

func (c *Client) AcceptTermsAndConditions(ctx context.Context, conState jsonrpc.State, args AcceptTermsAndConditions) error

func (*Client) Address

func (c *Client) Address(ctx context.Context, conState jsonrpc.State) (string, error)

func (*Client) AwaitTransactionOnTfchainBridge

func (c *Client) AwaitTransactionOnTfchainBridge(ctx context.Context, conState jsonrpc.State, memo string) error

func (*Client) Balance

func (c *Client) Balance(ctx context.Context, conState jsonrpc.State, address string) (string, error)

Balance of an account for TFT on stellar.

func (*Client) BatchCancelContract

func (c *Client) BatchCancelContract(ctx context.Context, conState jsonrpc.State, contract_ids []uint64) error

func (*Client) CancelContract

func (c *Client) CancelContract(ctx context.Context, conState jsonrpc.State, contract_id uint64) error

func (*Client) CreateAccount

func (c *Client) CreateAccount(ctx context.Context, conState jsonrpc.State, network string) (string, error)

func (*Client) CreateFarm

func (c *Client) CreateFarm(ctx context.Context, conState jsonrpc.State, args CreateFarm) error

func (*Client) CreateNameContract

func (c *Client) CreateNameContract(ctx context.Context, conState jsonrpc.State, name string) (uint64, error)

func (*Client) CreateNodeContract

func (c *Client) CreateNodeContract(ctx context.Context, conState jsonrpc.State, args CreateNodeContract) (uint64, error)

func (*Client) CreateRentContract

func (c *Client) CreateRentContract(ctx context.Context, conState jsonrpc.State, args CreateRentContract) (uint64, error)

func (*Client) CreateTwin

func (c *Client) CreateTwin(ctx context.Context, conState jsonrpc.State, args CreateTwin) (uint32, error)

func (*Client) GetContract

func (c *Client) GetContract(ctx context.Context, conState jsonrpc.State, contract_id uint64) (*substrate.Contract, error)

func (*Client) GetContractIDByNameRegistration

func (c *Client) GetContractIDByNameRegistration(ctx context.Context, conState jsonrpc.State, name string) (uint64, error)

func (*Client) GetContractWithHash

func (c *Client) GetContractWithHash(ctx context.Context, conState jsonrpc.State, args GetContractWithHash) (uint64, error)

func (*Client) GetFarm

func (c *Client) GetFarm(ctx context.Context, conState jsonrpc.State, id uint32) (*substrate.Farm, error)

func (*Client) GetFarmByName

func (c *Client) GetFarmByName(ctx context.Context, conState jsonrpc.State, name string) (uint32, error)

func (*Client) GetNode

func (c *Client) GetNode(ctx context.Context, conState jsonrpc.State, id uint32) (*substrate.Node, error)

func (*Client) GetNodeContracts

func (c *Client) GetNodeContracts(ctx context.Context, conState jsonrpc.State, node_id uint32) ([]types.U64, error)

func (*Client) GetNodes

func (c *Client) GetNodes(ctx context.Context, conState jsonrpc.State, farm_id uint32) ([]uint32, error)

func (*Client) GetTwin

func (c *Client) GetTwin(ctx context.Context, conState jsonrpc.State, id uint32) (*substrate.Twin, error)

func (*Client) GetTwinByPubKey

func (c *Client) GetTwinByPubKey(ctx context.Context, conState jsonrpc.State, address string) (uint32, error)

func (*Client) GetZosVersion

func (c *Client) GetZosVersion(ctx context.Context, conState jsonrpc.State) (string, error)

func (*Client) Height

func (c *Client) Height(ctx context.Context, conState jsonrpc.State) (uint32, error)

func (*Client) Load

func (c *Client) Load(ctx context.Context, conState jsonrpc.State, args Load) error

Load a client, connecting to the rpc endpoint at the given URL and loading a keypair from the given mnemonic

func (*Client) ServiceContractApprove

func (c *Client) ServiceContractApprove(ctx context.Context, conState jsonrpc.State, contract_id uint64) error

func (*Client) ServiceContractBill

func (c *Client) ServiceContractBill(ctx context.Context, conState jsonrpc.State, args ServiceContractBill) error

func (*Client) ServiceContractCancel

func (c *Client) ServiceContractCancel(ctx context.Context, conState jsonrpc.State, contract_id uint64) error

func (*Client) ServiceContractCreate

func (c *Client) ServiceContractCreate(ctx context.Context, conState jsonrpc.State, args ServiceContractCreate) (uint64, error)

func (*Client) ServiceContractReject

func (c *Client) ServiceContractReject(ctx context.Context, conState jsonrpc.State, contract_id uint64) error

func (*Client) ServiceContractSetFees

func (c *Client) ServiceContractSetFees(ctx context.Context, conState jsonrpc.State, args SetServiceContractFees) error

func (*Client) ServiceContractSetMetadata

func (c *Client) ServiceContractSetMetadata(ctx context.Context, conState jsonrpc.State, args ServiceContractSetMetadata) error

func (*Client) SwapToStellar

func (c *Client) SwapToStellar(ctx context.Context, conState jsonrpc.State, args SwapToStellar) error

func (*Client) Transfer

func (c *Client) Transfer(ctx context.Context, conState jsonrpc.State, args Transfer) error

Transer an amount of TFT from the loaded account to the destination.

type CreateFarm

type CreateFarm struct {
	Name      string                    `json:"name"`
	PublicIPs []substrate.PublicIPInput `json:"public_ips"`
}

type CreateNodeContract

type CreateNodeContract struct {
	NodeID             uint32  `json:"node_id"`
	Body               string  `json:"body"`
	Hash               string  `json:"hash"`
	PublicIPs          uint32  `json:"public_ips"`
	SolutionProviderID *uint64 `json:"solution_provider_id"`
}

type CreateRentContract

type CreateRentContract struct {
	NodeID             uint32  `json:"node_id"`
	SolutionProviderID *uint64 `json:"solution_provider_id"`
}

type CreateTwin

type CreateTwin struct {
	Relay string `json:"relay"`
	Pk    []byte `json:"pk"`
}

type ErrUnknownNetwork

type ErrUnknownNetwork struct{}

ErrUnknownNetwork indicates a client was requested for an unknown network

func (ErrUnknownNetwork) Error

func (e ErrUnknownNetwork) Error() string

Error implements the error interface

type GetContractWithHash

type GetContractWithHash struct {
	NodeID uint32            `json:"node_id"`
	Hash   substrate.HexHash `json:"hash"`
}

type Load

type Load struct {
	Network  string `json:"network"`
	Mnemonic string `json:"mnemonic"`
}

type ServiceContractBill

type ServiceContractBill struct {
	ContractID     uint64 `json:"contract_id"`
	VariableAmount uint64 `json:"variable_amount"`
	Metadata       string `json:"metadata"`
}

type ServiceContractCreate

type ServiceContractCreate struct {
	Service  string `json:"service"`
	Consumer string `json:"consumer"`
}

type ServiceContractSetMetadata

type ServiceContractSetMetadata struct {
	ContractID uint64 `json:"contract_id"`
	Metadata   string `json:"metadata"`
}

type SetServiceContractFees

type SetServiceContractFees struct {
	ContractID  uint64 `json:"contract_id"`
	BaseFee     uint64 `json:"base_fee"`
	VariableFee uint64 `json:"variable_fee"`
}

type SwapToStellar

type SwapToStellar struct {
	TargetStellarAddress string   `json:"target_stellar_address"`
	Amount               *big.Int `json:"amount"`
}

type TfchainState

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

func State

func State(conState jsonrpc.State) *TfchainState

State from a connection. If no state is present, it is initialized

func (*TfchainState) Close

func (s *TfchainState) Close()

Close implements jsonrpc.Closer

type Transfer

type Transfer struct {
	Amount      uint64 `json:"amount"`
	Destination string `json:"destination"`
}

Jump to

Keyboard shortcuts

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