stellar

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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StellarID is the ID for state of a stellar client in the connection state.
	StellarID = "stellar"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountData

type AccountData struct {
	Account string `json:"account"`
}

type BridgeTransfer

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

type Client

type Client struct {
}

Client exposing stellar methods

func NewClient

func NewClient() *Client

NewClient creates a new Client ready for use

func (*Client) AccountData

func (c *Client) AccountData(ctx context.Context, conState jsonrpc.State, account string) (horizon.Account, error)

Get data related to a stellar account

func (*Client) Address

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

Get the public address of the loaded stellar secret

func (*Client) AwaitTransactionOnEthBridge

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

Await till a transaction is processed on ethereum bridge that contains a specific memo

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

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

BridgeToEth transfers TFT from the loaded account to eth bridge and deposits into the destination ethereum account.

func (*Client) BridgeToTfchain

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

BridgeToTfchain transfers TFT from the loaded account to tfchain bridge and deposits into a twin account.

func (*Client) CreateAccount

func (c *Client) CreateAccount(ctx context.Context, conState jsonrpc.State, network string) (string, 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 secret

func (*Client) Swap

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

Swap some amount from one asset to the other (for example from tft to xlm)

func (*Client) Transactions

func (c *Client) Transactions(ctx context.Context, conState jsonrpc.State, args Transactions) ([]horizon.Transaction, error)

Get the last transactions of your account

func (*Client) Transfer

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

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

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 Load

type Load struct {
	Network string `json:"network"`
	Secret  string `json:"secret"`
}

type StellarState

type StellarState struct {
	Client *stellargoclient.Client
	// contains filtered or unexported fields
}

func State

func State(conState jsonrpc.State) *StellarState

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

func (*StellarState) Close

func (s *StellarState) Close()

Close implements jsonrpc.Closer

type Swap

type Swap struct {
	Amount           string `json:"amount"`
	SourceAsset      string `json:"source_asset"`
	DestinationAsset string `json:"destination_asset"`
}

type TfchainBridgeTransfer

type TfchainBridgeTransfer struct {
	Amount string `json:"amount"`
	TwinId uint32 `json:"twin_id"`
}

type Transactions

type Transactions struct {
	Account       string `json:"account"`
	Limit         uint   `json:"limit"`
	IncludeFailed bool   `json:"include_failed"`
	Cursor        string `json:"cursor"`
	Ascending     bool   `json:"ascending"`
}

type Transfer

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

Jump to

Keyboard shortcuts

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