solana

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DevnetRPCEndpoint  = rpc.DevnetRPCEndpoint
	TestnetRPCEndpoint = rpc.TestnetRPCEndpoint
	MainnetRPCEndpoint = rpc.MainnetRPCEndpoint
)

Variables

This section is empty.

Functions

func DecodeAddressToPublicKey

func DecodeAddressToPublicKey(address string) (string, error)

func EncodePublicKeyToAddress

func EncodePublicKeyToAddress(publicKey string) (string, error)

func IsValidAddress

func IsValidAddress(address string) bool

Types

type Account

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

func AccountWithPrivateKey

func AccountWithPrivateKey(prikey string) (*Account, error)

rename for support android. Android cant support both NewAccountWithMnemonic(string) and NewAccountWithPrivateKey(string)

func NewAccountWithMnemonic

func NewAccountWithMnemonic(mnemonic string) (*Account, error)

func (*Account) Address

func (a *Account) Address() string

func (*Account) DecodeAddressToPublicKey

func (a *Account) DecodeAddressToPublicKey(address string) (string, error)

@return publicKey that will start with 0x.

func (*Account) EncodePublicKeyToAddress

func (a *Account) EncodePublicKeyToAddress(publicKey string) (string, error)

@param publicKey can start with 0x or not.

func (*Account) IsValidAddress

func (a *Account) IsValidAddress(address string) bool

func (*Account) PrivateKey

func (a *Account) PrivateKey() ([]byte, error)

@return privateKey data

func (*Account) PrivateKeyHex

func (a *Account) PrivateKeyHex() (string, error)

@return privateKey string that will start with 0x.

func (*Account) PublicKey

func (a *Account) PublicKey() []byte

@return publicKey data

func (*Account) PublicKeyHex

func (a *Account) PublicKeyHex() string

@return publicKey string that will start with 0x.

func (*Account) Sign

func (a *Account) Sign(message []byte, password string) ([]byte, error)

func (*Account) SignHex

func (a *Account) SignHex(messageHex string, password string) (*base.OptionalString, error)

type Chain

type Chain struct {
	*Util
	RpcUrl string
}

func NewChainWithRpc

func NewChainWithRpc(rpcUrl string) *Chain

func (*Chain) BalanceOfAccount

func (c *Chain) BalanceOfAccount(account base.Account) (*base.Balance, error)

func (*Chain) BalanceOfAddress

func (c *Chain) BalanceOfAddress(address string) (*base.Balance, error)

func (*Chain) BalanceOfPublicKey

func (c *Chain) BalanceOfPublicKey(publicKey string) (*base.Balance, error)

func (*Chain) BatchFetchTransactionStatus

func (c *Chain) BatchFetchTransactionStatus(hashListString string) string

func (*Chain) FetchTransactionDetail

func (c *Chain) FetchTransactionDetail(hash string) (*base.TransactionDetail, error)

Fetch transaction details through transaction hash

func (*Chain) FetchTransactionStatus

func (c *Chain) FetchTransactionStatus(hash string) base.TransactionStatus

func (*Chain) MainToken

func (c *Chain) MainToken() base.Token

func (*Chain) SendRawTransaction

func (c *Chain) SendRawTransaction(signedTx string) (string, error)

Send the raw transaction on-chain @return the hex hash string

type Token

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

func NewToken

func NewToken(chain *Chain) *Token

func (*Token) BalanceOfAccount

func (t *Token) BalanceOfAccount(account base.Account) (*base.Balance, error)

func (*Token) BalanceOfAddress

func (t *Token) BalanceOfAddress(address string) (*base.Balance, error)

func (*Token) BalanceOfPublicKey

func (t *Token) BalanceOfPublicKey(publicKey string) (*base.Balance, error)

func (*Token) BuildTransferTx

func (t *Token) BuildTransferTx(privateKey, receiverAddress, amount string) (*base.OptionalString, error)

func (*Token) BuildTransferTxWithAccount

func (t *Token) BuildTransferTxWithAccount(account *Account, receiverAddress, amount string) (*base.OptionalString, error)

func (*Token) Chain

func (t *Token) Chain() base.Chain

func (*Token) EstimateFees

func (t *Token) EstimateFees(receiverAddress, amount string) (*base.OptionalString, error)

func (*Token) TokenInfo

func (t *Token) TokenInfo() (*base.TokenInfo, error)

type Util

type Util struct {
}

func NewUtil

func NewUtil() *Util

func (*Util) DecodeAddressToPublicKey

func (u *Util) DecodeAddressToPublicKey(address string) (string, error)

Warning: eth cannot support decode address to public key

func (*Util) EncodePublicKeyToAddress

func (u *Util) EncodePublicKeyToAddress(publicKey string) (string, error)

func (*Util) IsValidAddress

func (u *Util) IsValidAddress(address string) bool

Check if address is 40 hexadecimal characters

Jump to

Keyboard shortcuts

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