stellargoclient

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

README

TFT Stellar go client

Configuration

The client can be constructed with the following parameters:

  • secret - The secret of the account that will be used to sign transactions. If empty, a keypair will be generated.
  • network - The network to use, either testnet or public

Transfering TFT

client, err := NewClient("stellarsecret" "testnet")
if err != nil {
    log.fatal(err)
}

// Transfer 100 TFT to someDestinationAddress with someMemo
err = client.Transfer("someDestinationAddres", "someMemo", "100")
if err != nil {
    log.fatal(err)
}

Documentation

Index

Constants

View Source
const (
	TFT            = "TFT"
	TESTNET_ISSUER = "GA47YZA3PKFUZMPLQ3B5F2E3CJIB57TGGU7SPCQT2WAEYKN766PWIMB3"
	MAINNET_ISSUER = "GBOVQKJYHXRR3DX6NOX2RRYFRCUMSADGDESTDNBDS6CDVLGVESRTAC47"
	BaseFee        = 1000000
)

Variables

View Source
var MainnetTft = txnbuild.CreditAsset{Code: TFT, Issuer: MAINNET_ISSUER}
View Source
var MainnetTftAsset = base.Asset{Type: "credit_alphanum4", Code: TFT, Issuer: MAINNET_ISSUER}
View Source
var TestnetTft = txnbuild.CreditAsset{Code: TFT, Issuer: TESTNET_ISSUER}
View Source
var TestnetTftAsset = base.Asset{Type: "credit_alphanum4", Code: TFT, Issuer: TESTNET_ISSUER}

Functions

func GetHorizonClient

func GetHorizonClient(stellarNetwork string) *horizonclient.Client

GetHorizonClient returns the horizon client for the stellar network

func GetKeypairFromSeed

func GetKeypairFromSeed(seed string) (*keypair.Full, error)

Types

type Client

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

func NewClient

func NewClient(stellarNetwork string) *Client

NewClient creates a new client stellarNetwork can be "testnet" or "public" if stellarNetwork is not "testnet" or "public" it will default to "testnet"

func (*Client) AccountData

func (c *Client) AccountData(account string) (horizon.Account, error)

func (*Client) Address

func (c *Client) Address() string

Address of the loaded keypair

func (*Client) AwaitForTransactionWithMemoOnTfchainBridge

func (c *Client) AwaitForTransactionWithMemoOnTfchainBridge(ctx context.Context, memo string, timeout int) error

func (*Client) AwaitTransactionWithMemo

func (c *Client) AwaitTransactionWithMemo(ctx context.Context, account string, memo string, timeout int) error

func (*Client) AwaitTransactionWithMemoOnEthBridge

func (c *Client) AwaitTransactionWithMemoOnEthBridge(ctx context.Context, memo string, timeout int) error

func (*Client) CreateAccount

func (c *Client) CreateAccount() (string, error)

func (*Client) FundTransactionUsingTft

func (c *Client) FundTransactionUsingTft(destination string, amount string) error

Allows you to fund a transaction with tft instead of lumen by using the transaction funding service: https://github.com/threefoldfoundation/tft-stellar/tree/master/ThreeBotPackages/transactionfunding_service

func (*Client) GetActivationServiceUrl

func (c *Client) GetActivationServiceUrl() string

func (*Client) GetAssetFromString

func (c *Client) GetAssetFromString(asset string) (txnbuild.Asset, error)

GetTftAsset returns the tft asset for the stellar network

func (*Client) GetBalance

func (c *Client) GetBalance(account string) (string, error)

func (*Client) GetEthBridgeAddress

func (c *Client) GetEthBridgeAddress() (string, error)

func (*Client) GetStellarNetworkPassphrase

func (c *Client) GetStellarNetworkPassphrase() string

GetStellarNetworkPassphrase returns the passphrase for the stellar network

func (*Client) GetTfchainBridgeAddress

func (c *Client) GetTfchainBridgeAddress() (string, error)

func (*Client) GetTftAsset

func (c *Client) GetTftAsset() txnbuild.CreditAsset

GetTftAsset returns the tft asset for the stellar network

func (*Client) GetTftBaseAsset

func (c *Client) GetTftBaseAsset() base.Asset

GetTftAsset returns the tft asset for the stellar network

func (*Client) GetTransactionFundingUrlFromNetwork

func (c *Client) GetTransactionFundingUrlFromNetwork() string

func (*Client) GetXlmAsset

func (c *Client) GetXlmAsset() txnbuild.CreditAsset

func (*Client) KeyPair

func (c *Client) KeyPair() keypair.Full

KeyPair loaded in the client

func (*Client) Load

func (c *Client) Load(secret string) error

func (*Client) SetAccountOptions

func (c *Client) SetAccountOptions(keypairs []keypair.Full) error

func (*Client) SignAndSubmit

func (c *Client) SignAndSubmit(txn *txnbuild.Transaction) error

func (*Client) SignFundAndSubmitTransaction

func (c *Client) SignFundAndSubmitTransaction(tx *txnbuild.Transaction) error

func (*Client) SignTransactionXdr

func (c *Client) SignTransactionXdr(txXdr string) error

func (*Client) Swap

func (c *Client) Swap(sourceAsset string, destinationAsset string, amount string) error

func (*Client) Transactions

func (c *Client) Transactions(account string, limit uint, includeFailed bool, cursor string, order horizonclient.Order) ([]horizon.Transaction, error)

func (*Client) Transfer

func (c *Client) Transfer(destination, memo string, amount string) (string, error)

func (*Client) TransferToEthBridge

func (c *Client) TransferToEthBridge(destination, amount string) (string, error)

func (*Client) TransferToTfchainBridge

func (c *Client) TransferToTfchainBridge(amount string, twinID uint32) (string, error)

Jump to

Keyboard shortcuts

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