models

package
v0.0.0-...-1f0f14a Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountData

type AccountData struct {
	Alias    string
	Status   AccountStatus
	Account  blockhandler.Account
	OutputID iotago.OutputID
	Index    uint64
}

type AccountState

type AccountState struct {
	Alias      string             `serix:"0,lengthPrefixType=uint8"`
	AccountID  iotago.AccountID   `serix:"2"`
	PrivateKey ed25519.PrivateKey `serix:"3,lengthPrefixType=uint8"`
	OutputID   iotago.OutputID    `serix:"4"`
	Index      uint64             `serix:"5"`
}

func AccountStateFromAccountData

func AccountStateFromAccountData(acc *AccountData) *AccountState

func (*AccountState) ToAccountData

func (a *AccountState) ToAccountData() *AccountData

type AccountStatus

type AccountStatus uint8
const (
	AccountPending AccountStatus = iota
	AccountReady
)

type AllotmentStrategy

type AllotmentStrategy uint8
const (
	AllotmentStrategyNone AllotmentStrategy = iota
	AllotmentStrategyMinCost
	AllotmentStrategyAll
)

type Client

type Client interface {
	Client() *nodeclient.Client
	Indexer() (nodeclient.IndexerClient, error)
	// URL returns a client API url.
	URL() (cltID string)
	// PostBlock sends a block to the Tangle via a given client.
	PostBlock(block *iotago.ProtocolBlock) (iotago.BlockID, error)
	// PostData sends the given data (payload) by creating a block in the backend.
	PostData(data []byte) (blkID string, err error)
	// GetTransactionConfirmationState returns the AcceptanceState of a given transaction ID.
	GetTransactionConfirmationState(txID iotago.TransactionID) string
	// GetOutput gets the output of a given outputID.
	GetOutput(outputID iotago.OutputID) iotago.Output
	// GetOutputConfirmationState gets the first unspent outputs of a given address.
	GetOutputConfirmationState(outputID iotago.OutputID) string
	// GetTransaction gets the transaction.
	GetTransaction(txID iotago.TransactionID) (resp *iotago.SignedTransaction, err error)
	// GetBlockIssuance returns the latest commitment and data needed to create a new block.
	GetBlockIssuance(...iotago.SlotIndex) (resp *apimodels.IssuanceBlockHeaderResponse, err error)
	// GetCongestion returns congestion data such as rmc or issuing readiness.
	GetCongestion(id iotago.AccountID) (resp *apimodels.CongestionResponse, err error)

	iotago.APIProvider
}

type Connector

type Connector interface {
	// ServersStatuses retrieves the connected server status for each client.
	ServersStatuses() ServerInfos
	// ServerStatus retrieves the connected server status.
	ServerStatus(cltIdx int) (status *ServerInfo, err error)
	// Clients returns list of all clients.
	Clients(...bool) []Client
	// GetClients returns the numOfClt client instances that were used the longest time ago.
	GetClients(numOfClt int) []Client
	// AddClient adds a client to WebClients based on provided GoShimmerAPI url.
	AddClient(url string, setters ...options.Option[WebClient])
	// RemoveClient removes a client with the provided url from the WebClients.
	RemoveClient(url string)
	// GetClient returns the client instance that was used the longest time ago.
	GetClient() Client
}

type Input

type Input struct {
	OutputID iotago.OutputID
	Address  iotago.Address
}

Input contains details of an input.

type IssuancePaymentStrategy

type IssuancePaymentStrategy struct {
	AllotmentStrategy AllotmentStrategy
	IssuerAlias       string
}

type Output

type Output struct {
	OutputID iotago.OutputID
	Address  iotago.Address
	Index    uint64
	Balance  iotago.BaseToken

	OutputStruct iotago.Output
}

Output contains details of an output ID.

type Outputs

type Outputs []*Output

Outputs is a list of Output.

type PayloadIssuanceData

type PayloadIssuanceData struct {
	Payload            iotago.Payload
	CongestionResponse *apimodels.CongestionResponse
}

type ServerInfo

type ServerInfo struct {
	Healthy bool
	Version string
}

type ServerInfos

type ServerInfos []*ServerInfo

type WebClient

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

WebClient contains a GoShimmer web API to interact with a node.

func NewWebClient

func NewWebClient(url string, opts ...options.Option[WebClient]) (*WebClient, error)

NewWebClient creates Connector from provided iota-core API urls.

func (*WebClient) APIForEpoch

func (c *WebClient) APIForEpoch(index iotago.EpochIndex) iotago.API

func (*WebClient) APIForSlot

func (c *WebClient) APIForSlot(index iotago.SlotIndex) iotago.API

func (*WebClient) APIForTime

func (c *WebClient) APIForTime(t time.Time) iotago.API

func (*WebClient) APIForVersion

func (c *WebClient) APIForVersion(version iotago.Version) (iotago.API, error)

func (*WebClient) Client

func (c *WebClient) Client() *nodeclient.Client

func (*WebClient) CommittedAPI

func (c *WebClient) CommittedAPI() iotago.API

func (*WebClient) GetBlockIssuance

func (c *WebClient) GetBlockIssuance(slotIndex ...iotago.SlotIndex) (resp *apimodels.IssuanceBlockHeaderResponse, err error)

func (*WebClient) GetCongestion

func (c *WebClient) GetCongestion(accountID iotago.AccountID) (resp *apimodels.CongestionResponse, err error)

func (*WebClient) GetOutput

func (c *WebClient) GetOutput(outputID iotago.OutputID) iotago.Output

GetOutput gets the output of a given outputID.

func (*WebClient) GetOutputConfirmationState

func (c *WebClient) GetOutputConfirmationState(outputID iotago.OutputID) string

GetOutputConfirmationState gets the first unspent outputs of a given address.

func (*WebClient) GetTransaction

func (c *WebClient) GetTransaction(txID iotago.TransactionID) (tx *iotago.SignedTransaction, err error)

GetTransaction gets the transaction.

func (*WebClient) GetTransactionConfirmationState

func (c *WebClient) GetTransactionConfirmationState(txID iotago.TransactionID) string

GetTransactionConfirmationState returns the AcceptanceState of a given transaction ID.

func (*WebClient) Indexer

func (c *WebClient) Indexer() (nodeclient.IndexerClient, error)

func (*WebClient) LatestAPI

func (c *WebClient) LatestAPI() iotago.API

func (*WebClient) PostBlock

func (c *WebClient) PostBlock(block *iotago.ProtocolBlock) (blockID iotago.BlockID, err error)

func (*WebClient) PostData

func (c *WebClient) PostData(data []byte) (blkID string, err error)

PostData sends the given data (payload) by creating a block in the backend.

func (*WebClient) URL

func (c *WebClient) URL() string

URL returns a client API Url.

type WebClients

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

WebClients is responsible for handling connections via GoShimmerAPI.

func NewWebClients

func NewWebClients(urls []string, setters ...options.Option[WebClient]) *WebClients

NewWebClients creates Connector from provided GoShimmerAPI urls.

func (*WebClients) AddClient

func (c *WebClients) AddClient(url string, setters ...options.Option[WebClient])

AddClient adds client to WebClients based on provided GoShimmerAPI url.

func (*WebClients) Clients

func (c *WebClients) Clients(...bool) []Client

Clients returns list of all clients.

func (*WebClients) GetClient

func (c *WebClients) GetClient() Client

GetClient returns the client instance that was used the longest time ago.

func (*WebClients) GetClients

func (c *WebClients) GetClients(numOfClt int) []Client

GetClients returns the numOfClt client instances that were used the longest time ago.

func (*WebClients) RemoveClient

func (c *WebClients) RemoveClient(url string)

RemoveClient removes client with the provided url from the WebClients.

func (*WebClients) ServerStatus

func (c *WebClients) ServerStatus(cltIdx int) (status *ServerInfo, err error)

ServerStatus retrieves the connected server status.

func (*WebClients) ServersStatuses

func (c *WebClients) ServersStatuses() ServerInfos

ServersStatuses retrieves the connected server status for each client.

Jump to

Keyboard shortcuts

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