test

package
v0.0.0-...-364e73d Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Success = 0 // Success indicates that the function completed its task without errors.
	Fail    = 1 // Fail indicates that the function encountered an error and did not complete successfully.
)

Constants to represent the success or failure of functions.

Variables

View Source
var (
	LocalNetworkInfo = NetworkInfo{
		GrpcEndpoint:      "localhost:9090",
		LcdEndpoint:       "http://localhost:1317",
		TmRpcEndpoint:     "http://localhost:26657",
		WebsocketEndpoint: "ws://localhost:26657/websocket",
		ChainID:           "nibiru-localnet-0",
	}
	DevNetworkInfo = NetworkInfo{
		GrpcEndpoint:      "tcp://grpc.devnet-2.nibiru.fi:443",
		LcdEndpoint:       "http://localhost:1317",
		TmRpcEndpoint:     "https://rpc.devnet-2.nibiru.fi:443",
		WebsocketEndpoint: "wss://rpc.devnet-2.nibiru.fi/websocket",
		ChainID:           "nibiru-devnet-2",
	}
	TestNetworkInfo = NetworkInfo{
		GrpcEndpoint:      "tcp://grpc.testnet-1.nibiru.fi:9090",
		LcdEndpoint:       "https://lcd.testnet-1.nibiru.fi",
		TmRpcEndpoint:     "https://rpc.testnet-1.nibiru.fi::443",
		WebsocketEndpoint: "wss://rpc.testnet-1.nibiru.fi/websocket",
		ChainID:           "nibiru-testnet-1",
	}
	MainNetworkInfo = NetworkInfo{
		GrpcEndpoint:      "localhost:9090",
		LcdEndpoint:       "http://localhost:1317",
		TmRpcEndpoint:     "https://rpc.nibiru.fi:443",
		WebsocketEndpoint: "ws://localhost:26657/websocket",
		ChainID:           "cataclysm-1",
	}
)

Functions

func CreateAccount

func CreateAccount(keyName string, mnemonic string, passphase string) int

func DeleteAccount

func DeleteAccount(keyName string, password string) int

func ExecuteWasmContract

func ExecuteWasmContract(senderAddress, contractAddress, executeMsg, denom string, amount int) string

func GenerateRecoveryPhrase

func GenerateRecoveryPhrase() string

func GetAccountCoins

func GetAccountCoins(
	address string,
) (sdk.Coins, error)

func GetAccountInfo

func GetAccountInfo(
	address string,
) (account authtypes.AccountI, err error)

func GetAddressFromKeyName

func GetAddressFromKeyName(keyName string) string

func GetListAccountInfo

func GetListAccountInfo() (accouns []authtypes.AccountI, err error)

func GetPrivKeyFromMnemonic

func GetPrivKeyFromMnemonic(mnemoic string, keyName string) []byte

func HasKeyByAddress

func HasKeyByAddress(addr string) int

func HasKeyByName

func HasKeyByName(name string) int

func ImportAccountFromMnemoic

func ImportAccountFromMnemoic(mnemonic string, keyName string) int

func ImportAccountFromPrivateKey

func ImportAccountFromPrivateKey(privateKey []byte, keyName string) int

func InitClients

func InitClients() error

func NewNibiruClient

func NewNibiruClient(chainId string, grpcEndpoint string, rpcEndpoint string) int

func NewNibiruClientDefault

func NewNibiruClientDefault() int

func PrintBaseAccountInfo

func PrintBaseAccountInfo(addrs ...string)

func PrintListSigners

func PrintListSigners()

func PrintPayload

func PrintPayload(funcName string, args ...interface{})

func QueryTXHash

func QueryTXHash(txHash string) string

func QueryWasmContract

func QueryWasmContract(contractAddress, queryMsg string) string

func SwitchNetwork

func SwitchNetwork(network string) int

SwitchNetwork changes the network configuration based on the provided network name. It returns Success (0) if the switch is successful, otherwise Fail (1).

func TransferToken

func TransferToken(fromAddress, toAddress, denom string, amount int) string

Types

type BaseAccount

type BaseAccount struct {
	Address       []byte
	Coins         *Coins
	PubKey        []byte
	AccountNumber uint64
	Sequence      uint64
}

Define the BaseAccount struct in Go

func QueryAccount

func QueryAccount(address string) (*BaseAccount, error)

type Coin

type Coin struct {
	Denom  string
	Amount uint64
}

Define the Coin struct in Go

type Coins

type Coins struct {
	Array  []*Coin
	Length uint64
}

Define the Coins struct in Go

type KeyInfo

type KeyInfo struct {
	Type    uint32
	Name    string
	PubKey  []byte
	Address []byte
}

Define the KeyInfo struct in Go

func GetAccountByAddress

func GetAccountByAddress(addr string) *KeyInfo

func GetAccountByKeyName

func GetAccountByKeyName(keyName string) *KeyInfo

type NetworkInfo

type NetworkInfo struct {
	GrpcEndpoint      string
	LcdEndpoint       string
	TmRpcEndpoint     string
	WebsocketEndpoint string
	ChainID           string
}

type UserAccount

type UserAccount struct {
	Info     *KeyInfo
	Password string
}

Define the UserAccount struct in Go

Jump to

Keyboard shortcuts

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