Documentation ¶
Index ¶
- Constants
- Variables
- type AddressValidator
- type Asset
- type PayoutInfo
- type Signers
- type Wallet
- func (w *Wallet) AssetFromCode(code string) (Asset, error)
- func (w *Wallet) CreateAccount() (string, string, error)
- func (w *Wallet) GetAccountDetails(address string) (account hProtocol.Account, err error)
- func (w *Wallet) GetBalance(address string, memo string, asset Asset) (xdr.Int64, []string, error)
- func (w *Wallet) GetHorizonClient() (*horizonclient.Client, error)
- func (w *Wallet) GetNetworkPassPhrase() string
- func (w *Wallet) PayoutFarmers(encryptedSeed string, destinations []PayoutInfo, memo string, asset Asset) error
- func (w *Wallet) PrecisionDigits() int
- func (w *Wallet) PublicAddress() string
- func (w *Wallet) Refund(encryptedSeed string, memo string, asset Asset) error
Constants ¶
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 ¶
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 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" TFTTestnet Asset = "TFT:GA47YZA3PKFUZMPLQ3B5F2E3CJIB57TGGU7SPCQT2WAEYKN766PWIMB3" TFTAMainnet Asset = "TFTA:GBUT4GP5GJ6B3XW5PXENHQA7TXJI5GOPW3NF4W3ZIW6OOO4ISY6WNLN2" TFTATestnet Asset = "TFTA:GB55A4RR4G2MIORJTQA4L6FENZU7K4W7ATGY6YOT2CW47M5SZYGYKSCT" FreeTFTMainnet Asset = "FreeTFT:GCBGS5TFE2BPPUVY55ZPEMWWGR6CLQ7T6P46SOFGHXEBJ34MSP6HVEUT" FreeTFTTestnet Asset = "FreeTFT:GBLDUINEFYTF7XEE7YNWA3JQS4K2VD37YU7I2YAE7R5AHZDKQXSS2J6R" )
Supported assets for the wallet. Assets are different based on testnet/mainnet
type PayoutInfo ¶
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
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
Wallet is the foundation wallet Payments will be funded and fees will be taken with this wallet
func New ¶
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.
func (*Wallet) AssetFromCode ¶
AssetFromCode loads the full asset from a code, provided the wallet supports the asset code
func (*Wallet) CreateAccount ¶
CreateAccount and activate it, so that it is ready to be used The encrypted seed of the wallet is returned, together with the public address
func (*Wallet) GetAccountDetails ¶
GetAccountDetails gets account details based an a Stellar address
func (*Wallet) GetBalance ¶
GetBalance gets balance for an address and a given reservation id. It also returns a list of addresses which funded the given address.
func (*Wallet) GetHorizonClient ¶
func (w *Wallet) GetHorizonClient() (*horizonclient.Client, error)
GetHorizonClient gets the horizon client based on the wallet's network
func (*Wallet) GetNetworkPassPhrase ¶
GetNetworkPassPhrase gets the Stellar network passphrase based on the wallet's network
func (*Wallet) PayoutFarmers ¶
func (w *Wallet) PayoutFarmers(encryptedSeed string, destinations []PayoutInfo, memo string, asset Asset) error
PayoutFarmers pays a group of farmers, from an escrow account. The escrow account must be provided as the encrypted string of the seed.
func (*Wallet) PrecisionDigits ¶
PrecisionDigits of the underlying currencies on chain