zcncoremobile

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GetEthClient = func() (*ethclient.Client, error) {
	if len(zcncore.GetConfig().GetChain().EthNode) == 0 {
		return nil, fmt.Errorf("eth node SDK not initialized")
	}

	zcncore.Logger.Info("requesting from ", zcncore.GetConfig().GetChain().EthNode)
	client, err := ethclient.Dial(zcncore.GetConfig().GetChain().EthNode)
	if err != nil {
		return nil, err
	}
	return client, nil
}

Functions

func CheckEthHashStatus

func CheckEthHashStatus(hash string) int

CheckEthHashStatus - checking the status of ETH transaction possible values 0 or 1

func ConvertToToken

func ConvertToToken(value int64) float64

ConvertToToken converts the value to ZCN tokens

func ConvertToValue

func ConvertToValue(token float64) int64

ConvertToValue converts ZCN tokens to value

func ConvertZcnTokenToETH

func ConvertZcnTokenToETH(token float64) (float64, error)

ConvertZcnTokenToETH - converting Zcn tokens to Eth

func CreateWallet

func CreateWallet(statusCb models.WalletCallback) error

CreateWallet creates the wallet for to configure signature scheme. It also registers the wallet again to block chain.

func CreateWalletFromEthMnemonic

func CreateWalletFromEthMnemonic(mnemonic, password string, statusCb models.WalletCallback) error

CreateWalletFromEthMnemonic - creating new wallet from Eth mnemonics

func EthToTokens

func EthToTokens(tokens float64) int64

TokensToEth - converting eth tokens to wei

func GEthToTokens

func GEthToTokens(gwei float64) int64

func GTokensToEth

func GTokensToEth(tokens int64) float64

func GetBalance

func GetBalance(cb models.GetBalanceCallback) error

GetBalance retreives wallet balance from sharders

func GetEthBalance

func GetEthBalance(ethAddr string, cb models.GetBalanceCallback) error

GetEthBalance - getting back balance for ETH wallet

func GetVersion

func GetVersion() string

GetVersion - returns version string

func GetWalletAddrFromEthMnemonic

func GetWalletAddrFromEthMnemonic(mnemonic string) (string, error)

GetWalletAddrFromEthMnemonic - wallet ETH address from mnemoninnc

func Init

func Init(chainConfigJSON string) error

func IsMnemonicValid

func IsMnemonicValid(mnemonic string) bool

IsMnemonicValid is an utility function to check the mnemonic valid

func IsValidEthAddress

func IsValidEthAddress(ethAddr string) (bool, error)

IsValidEthAddress - multiple checks for valid ETH address

func RecoverWallet

func RecoverWallet(mnemonic string, statusCb models.WalletCallback) error

RecoverWallet recovers the previously generated wallet using the mnemonic. It also registers the wallet again to block chain.

func SetLogLevel

func SetLogLevel(lvl int)

SetLogLevel set the log level. lvl - 0 disabled; higher number (upto 4) more verbosity

func SetWalletInfo

func SetWalletInfo(w string, splitKeyWallet bool) error

SetWalletInfo should be set before any transaction or client specific APIs splitKeyWallet parameter is valid only if SignatureScheme is "BLS0Chain"

func SuggestEthGasPrice

func SuggestEthGasPrice() (int64, error)

SuggestEthGasPrice - return back suggested price for gas

func TokensToEth

func TokensToEth(tokens int64) float64

TokensToEth - converting wei to eth tokens

func TransferEthTokens

func TransferEthTokens(fromPrivKey string, amountTokens, gasPrice int64) (string, error)

TransferEthTokens - transfer ETH tokens to multisign wallet

Types

This section is empty.

Jump to

Keyboard shortcuts

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