stellar

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// NetworkProduction uses stellar production network
	NetworkProduction = "production"
	// NetworkTest uses stellar test network
	NetworkTest = "testnet"
	// NetworkDebug doesn't do validation, and always address validation is skipped
	// Only supported by the AddressValidator
	NetworkDebug = "debug"
)

Variables

View Source
var (
	// ErrInsufficientBalance is an error that is used when there is insufficient balance
	ErrInsufficientBalance = errors.New("insufficient balance")
	// ErrAssetCodeNotSupported indicated the given asset code is not supported by this wallet
	ErrAssetCodeNotSupported = errors.New("asset code not supported")
)

Functions

This section is empty.

Types

type AddressValidator

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

AddressValidator validates stellar address

func NewAddressValidator

func NewAddressValidator(network, assetCode, horizonURL string) (*AddressValidator, error)

NewAddressValidator creates an address validator instance

func (*AddressValidator) Valid

func (a *AddressValidator) Valid(address string) error

Valid validates a stellar address, and only return nil if address is valid

type Asset

type Asset string

Asset on the stellar network, both code and issuer in the form <CODE>:<ISSUER>

const (
	TFTMainnet Asset = "TFT:GBOVQKJYHXRR3DX6NOX2RRYFRCUMSADGDESTDNBDS6CDVLGVESRTAC47"
)

Supported assets for the wallet. Assets are different based on testnet/mainnet

func (Asset) Code

func (a Asset) Code() string

Code of the asset

func (Asset) Issuer

func (a Asset) Issuer() string

Issuer of the asset

func (Asset) String

func (a Asset) String() string

String implements Stringer interface

type PayoutInfo

type PayoutInfo struct {
	Address string
	Amount  xdr.Int64
}

PayoutInfo holds information about which address needs to receive how many funds for payment commands which take multiple receivers

type Signers

type Signers []string

Signers is a flag type for setting the signers on the escrow accounts

func (*Signers) Set

func (i *Signers) Set(value string) error

Set a value on the signers flag

func (*Signers) String

func (i *Signers) String() string

type Wallet

type Wallet interface {
	AssetFromCode(code string) (Asset, error)
	PrecisionDigits() int
	PublicAddress() string
	CreateAccount() (encSeed string, address string, err error)
	GetBalance(address string, memo string, asset Asset) (xdr.Int64, []string, error)
	Refund(encryptedSeed string, memo string, asset Asset) error
	PayoutFarmers(encryptedSeed string, destinations []PayoutInfo, memo string, asset Asset) error
	GetAccountDetails(address string) (account hProtocol.Account, err error)
	GetHorizonClient() (*horizonclient.Client, error)
	GetNetworkPassPhrase() string
}

Wallet interface

func New

func New(seed, network string, signers []string, horizonURL string) (Wallet, error)

New stellar wallet from an optional seed. If no seed is given (i.e. empty string), the wallet will panic on all actions which need to be signed, or otherwise require a key to be loaded.

Jump to

Keyboard shortcuts

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