coins

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: Apache-2.0 Imports: 19 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Coinmap map[string]string = make(map[string]string)
View Source
var Cointypes []string = []string{"ALL", "FSN", "ETH", "BTC", "ATOM", "BCH", "BNB", "ERC20GUSD", "ERC20MKR", "ERC20HT", "ERC20BNB", "ERC20BNT", "ERC20RMBT", "TRX", "XRP", "ERC20USDT"}

only main net coins var Cointypes []string = []string{"ALL","BTC","ETH","XRP","EOS","USDT","ATOM","BCH","TRX","BNB","EVT1","ERC20BNB","ERC20GUSD","ERC20MKR","ERC20HT","ERC20RMBT","EVT1001","BEP2GZX_754"} var Cointypes []string = []string{"ALL","BTC","ETH","ATOM","BCH","TRX","BNB","ERC20BNB","ERC20GUSD","ERC20MKR","ERC20HT","ERC20RMBT","BEP2GZX_754"} //tmp delete EOS XRP EVT1 EVT1001 USDT var Cointypes []string = []string{"ALL", "FSN", "ETH", "BTC", "ATOM", "BCH", "BNB", "EOS", "EVT1", "ERC20GUSD", "ERC20MKR", "ERC20HT", "ERC20BNB", "ERC20BNT", "ERC20RMBT", "TRX", "XRP", "ERC20USDT"}

View Source
var RegExpmap map[string]string = map[string]string{
	"BTC":     "^(1|3|m|n|2)[a-zA-Z\\d]{25,33}$",
	"USDT":    "^(1|3|m|n|2)[a-zA-Z\\d]{25,33}$",
	"BCH":     "^(bchtest:)?(p|q)[0-9a-z]{41}$",
	"TRX":     "",
	"ETH":     "^(0x)?[0-9a-fA-F]{40}$",
	"XRP":     "^r[1-9a-km-zA-HJ-NP-Z]{32,33}$",
	"EOSDCRM": "^d[1-5a-z]{32,33}$",

	"FSN":        "^(0x)?[0-9a-fA-F]{40}$",
	"EOS":        "^([a-z\\d\\.]+)$",
	"EOS_NORMAL": "^([1-5a-z]{12})$",
	"ATOM":       "^cosmos1[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}$",
	"EVT":        "^EVT[a-zA-Z\\d]{50}$",
	"BNB":        "^(t)?(bnb1)[qpzry9x8gf2tvdw0s3jn54khce6mua7l]{38}$",
}

Functions

func GetMainNetCoin

func GetMainNetCoin(cointype string) string

func Init

func Init()

func IsBEP2

func IsBEP2(tokentype string) bool

func IsCoinSupported

func IsCoinSupported(cointype string) bool

func IsEVT

func IsEVT(tokentype string) bool

func IsErc20

func IsErc20(tokentype string) bool

func IsOmni

func IsOmni(propertyname string) bool

Types

type AddressValidator

type AddressValidator struct {
	Exp      string
	Cointype string
}

func NewAddressValidator

func NewAddressValidator(cointype string) *AddressValidator

func NewDcrmAddressValidator

func NewDcrmAddressValidator(cointype string) *AddressValidator

func (*AddressValidator) IsValidAddress

func (v *AddressValidator) IsValidAddress(address string) bool

type CryptocoinHandler

type CryptocoinHandler interface {

	// 公钥to dcrm地址
	PublicKeyToAddress(pubKeyHex string) (address string, err error)

	// 构造未签名交易
	BuildUnsignedTransaction(fromAddress, fromPublicKey, toAddress string, amount *big.Int, jsonstring string, memo string) (transaction interface{}, digests []string, err error)

	// 构造签名交易
	MakeSignedTransaction(rsv []string, transaction interface{}) (signedTransaction interface{}, err error)

	// 根据未签名交易的json数据构造签名交易
	MakeSignedTransactionByJson(rsv []string, txjson string) (signedTransaction interface{}, err error)

	// 提交交易
	SubmitTransaction(signedTransaction interface{}) (txhash string, err error)

	// 根据已签名交易的json数据得到签名交易并提交该交易
	SubmitTransactionByJson(txjson string) (txhash string, err error)

	// 根据交易hash查交易信息
	// fromAddress 交易发起方地址
	// txOutputs 交易输出切片, txOutputs[i].ToAddress 第i条交易接收方地址, txOutputs[i].Amount 第i条交易转账金额
	//GetTransactionInfo(txhash string) (fromAddress string, txOutputs []types.TxOutput, jsonstring string, confirmed bool, fee types.Value, err error)
	GetTransactionInfo(txhash string) (txinfo *types.TransactionInfo, err error)

	// 从区块中过滤特定交易
	FiltTransaction(blocknumber uint64, filter types.Filter) (txhashes []string, err error)

	// 账户查账户余额
	GetAddressBalance(address string, jsonstring string) (balance types.Balance, err error)

	// 默认交易费用
	GetDefaultFee() types.Value

	// 是coin还是token
	IsToken() bool
}

func NewCryptocoinHandler

func NewCryptocoinHandler(coinType string) (txHandler CryptocoinHandler)

Directories

Path Synopsis
Package helpers provides convenience functions to simplify wallet code.
Package helpers provides convenience functions to simplify wallet code.
提供api的节点地址
提供api的节点地址
abi
Package abi implements the Ethereum ABI (Application Binary Interface).
Package abi implements the Ethereum ABI (Application Binary Interface).
eth
sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
trx
Package types contains data types related to Ethereum consensus.
Package types contains data types related to Ethereum consensus.

Jump to

Keyboard shortcuts

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