env

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package env provides the functionality to connect to the Stellar blockchain and broadcast transactions to the network and decode its response.

Index

Constants

View Source
const HorizonURL = "http://localhost:8000"
View Source
const NETWORK_PASSPHRASE = "Standalone Network ; February 2017"

Variables

This section is empty.

Functions

func BuildContractCallOp

func BuildContractCallOp(caller horizon.Account, fName xdr.ScSymbol, callArgs xdr.ScVec, contractIdAddress xdr.ScAddress) *txnbuild.InvokeHostFunction

func BuildForceCloseTxArgs

func BuildForceCloseTxArgs(chanID pchannel.ID) (xdr.ScVec, error)

func BuildFundTxArgs

func BuildFundTxArgs(chanID pchannel.ID, funderIdx bool) (xdr.ScVec, error)

func BuildGetChannelTxArgs

func BuildGetChannelTxArgs(chanID pchannel.ID) (xdr.ScVec, error)

func BuildGetTokenBalanceArgs

func BuildGetTokenBalanceArgs(balanceOf xdr.ScAddress) (xdr.ScVec, error)

func BuildMintTokenArgs

func BuildMintTokenArgs(mintTo xdr.ScAddress, amount xdr.ScVal) (xdr.ScVec, error)

func BuildOpenTxArgs

func BuildOpenTxArgs(params *pchannel.Params, state *pchannel.State) (xdr.ScVec, error)

func CreateSignedTransactionWithParams

func CreateSignedTransactionWithParams(signers []*keypair.Full, txParams txnbuild.TransactionParams,
) (*txnbuild.Transaction, error)

func DecodeTxMeta

func DecodeTxMeta(tx horizon.Transaction) (xdr.TransactionMeta, error)

func GetBaseTransactionParamsWithFee

func GetBaseTransactionParamsWithFee(source txnbuild.Account, fee int64, ops ...txnbuild.Operation) txnbuild.TransactionParams

func NewHorizonClient

func NewHorizonClient() *horizonclient.Client

func PreflightHostFunctions

func PreflightHostFunctions(hzClient *horizonclient.Client,
	sourceAccount txnbuild.Account, function txnbuild.InvokeHostFunction,
) (txnbuild.InvokeHostFunction, int64)

Types

type RPCSimulateHostFunctionResult

type RPCSimulateHostFunctionResult struct {
	Auth []string `json:"auth"`
	XDR  string   `json:"xdr"`
}

type RPCSimulateTxResponse

type RPCSimulateTxResponse struct {
	Error           string                          `json:"error,omitempty"`
	TransactionData string                          `json:"transactionData"`
	Results         []RPCSimulateHostFunctionResult `json:"results"`
	MinResourceFee  int64                           `json:"minResourceFee,string"`
}

type StellarClient

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

func NewHorizonMasterClient

func NewHorizonMasterClient() *StellarClient

func NewStellarClient

func NewStellarClient(kp *keypair.Full) *StellarClient

func (*StellarClient) CreateSignedTxFromParams

func (s *StellarClient) CreateSignedTxFromParams(txParams txnbuild.TransactionParams) (*txnbuild.Transaction, error)

func (*StellarClient) GetAccount

func (h *StellarClient) GetAccount() (horizon.Account, error)

func (*StellarClient) GetAddress

func (s *StellarClient) GetAddress() string

func (*StellarClient) GetHorizonAccount

func (s *StellarClient) GetHorizonAccount() (horizon.Account, error)

func (*StellarClient) GetHorizonClient

func (c *StellarClient) GetHorizonClient() *horizonclient.Client

func (*StellarClient) InvokeAndProcessHostFunction

func (s *StellarClient) InvokeAndProcessHostFunction(fname string, callTxArgs xdr.ScVec, contractAddr xdr.ScAddress) (xdr.TransactionMeta, error)

Jump to

Keyboard shortcuts

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