eos

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: 31 Imported by: 5

Documentation

Index

Constants

View Source
const ALPHABET = "defghijklmnopqrstuvwxyz12345abcdefghijklmnopqrstuvwxyz12345abc"
View Source
const CREATOR_ACCOUNT = "gzx123454321"
View Source
const CREATOR_PRIVKEY = "5JqBVZS4shWHBhcht6bn3ecWDoZXPk3TRSVpsLriQz5J3BKZtqH"

Variables

View Source
var BALANCE_SERVER string
View Source
var EOSRegExpmap map[string]string = map[string]string{
	"EOSDCRM": "^d[1-5a-z]{32,33}$",

	"EOS":        "^([a-z\\d\\.]+)$",
	"EOS_NORMAL": "^([1-5a-z]{12})$",
}
View Source
var EOS_DEFAULT_FEE *big.Int
View Source
var InitialCPU = int64(1000)
View Source
var InitialRam = uint32(5000)
View Source
var InitialStakeNet = int64(1000)

Functions

func CheckRealEosAccount

func CheckRealEosAccount(accountName, ownerkey, activekey string) (ok bool)

func CreateNewAccount

func CreateNewAccount(creatorName, creatorActivePrivKey, accountName, ownerkey, activekey string, buyram uint32) (bool, error)

创建eos账户 需要一个creator账户, creator要有余额用于购买内存

func CreateRealEosAccount

func CreateRealEosAccount(accountName string, ownerkey string, activekey string) error

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir is the default data directory to use for the databases and other persistence requirements.

func DelegateBW

func DelegateBW(fromAcctName, fromActivePrivKey, receiverName string, stakeCPU, stakeNet int64, transfer bool) (bool, error)

预购cpu和net带宽, 用于帐号执行各种action

func EOSConfigInit

func EOSConfigInit()

func EOSInit

func EOSInit()

func EOS_newUnsignedTransaction

func EOS_newUnsignedTransaction(fromAcctName, toAcctName string, amount *big.Int, memo2 string, memo string) (string, *eos.SignedTransaction, error)

func GenAccountName

func GenAccountName(pubKeyHex string) string

根据公钥生成地址

func GetAccountNameByPubKey

func GetAccountNameByPubKey(pubKey string) ([]string, error)

func GetEosAccount

func GetEosAccount() (acct, owner, active string)

func GetEosDbDir

func GetEosDbDir() string

eos_init---> eos account key: crypto.Keccak256Hash([]byte("eossettings")) value: pubkey+eos account

func GetHeadBlockID

func GetHeadBlockID(nodeos string) (chainID string, err error)

func HexToPubKey

func HexToPubKey(pubKeyHex string) (ecc.PublicKey, error)

func IsCanonical

func IsCanonical(rsv []byte) bool

func IsCanonical(compactSig []byte) bool {

func MakeSignedTransaction

func MakeSignedTransaction(stx *eos.SignedTransaction, signature ecc.Signature) *eos.SignedTransaction

func PubKeyToHex

func PubKeyToHex(pk string) (pubKeyHex string, _ error)

func RSVToSignature

func RSVToSignature(rsvStr string) (ecc.Signature, error)

dcrm签的rsv转换成eos签名

func SignDigestWithPrivKey

func SignDigestWithPrivKey(hash, wif string) (ecc.Signature, error)

func SubmitTransaction

func SubmitTransaction(stx *eos.SignedTransaction) string

Types

type AccountInfo

type AccountInfo struct {
	AccountName string                 `json:"account_name"`
	RamQuato    uint32                 `json:"ram_quato"`
	NetWeight   uint32                 `json:"net_weight"`
	CpuWeight   uint32                 `json:"cpu_weight"`
	NetLimit    Limit                  `json:"net_limit"`
	CpuLimit    Limit                  `json:"cpu_limit"`
	RamUsage    uint32                 `json:"ram_usage"`
	Perms       Permissions            `json:"permissions"`
	Error       map[string]interface{} `json:"error"`
}

type Auth

type Auth struct {
	Threshold int   `json:"threshold"`
	Keys      []Key `json:"keys"`
}

type EOSHandler

type EOSHandler struct {
}

func NewEOSHandler

func NewEOSHandler() *EOSHandler

func (*EOSHandler) BuildUnsignedLockinTransaction

func (h *EOSHandler) BuildUnsignedLockinTransaction(fromAddress, toUserKey, toAcctName string, amount *big.Int, jsonstring string) (transaction interface{}, digests []string, err error)

构造Lockin交易, 开发用

func (*EOSHandler) BuildUnsignedTransaction

func (h *EOSHandler) BuildUnsignedTransaction(fromAddress, fromPublicKey, toAcctName string, amount *big.Int, jsonstring string, memo string) (transaction interface{}, digests []string, err error)

构造交易

func (*EOSHandler) FiltTransaction

func (h *EOSHandler) FiltTransaction(blocknumber uint64, filter types.Filter) (txhashes []string, err error)

func (*EOSHandler) GetAddressBalance

func (h *EOSHandler) GetAddressBalance(address string, jsonstring string) (balance types.Balance, err error)

func (*EOSHandler) GetDefaultFee

func (h *EOSHandler) GetDefaultFee() types.Value

func (*EOSHandler) GetTransactionInfo

func (h *EOSHandler) GetTransactionInfo(txhash string) (*types.TransactionInfo, error)

func (h *EOSHandler) GetTransactionInfo(txhash string) (fromAddress string, txOutputs []types.TxOutput, jsonstring string, confirmed bool, fee types.Value, err error) {

func (*EOSHandler) IsToken

func (h *EOSHandler) IsToken() bool

func (*EOSHandler) MakeSignedTransaction

func (h *EOSHandler) MakeSignedTransaction(rsv []string, transaction interface{}) (signedTransaction interface{}, err error)

func (*EOSHandler) MakeSignedTransactionByJson

func (h *EOSHandler) MakeSignedTransactionByJson(rsv []string, txjson string) (signedTransaction interface{}, err error)

func (*EOSHandler) PublicKeyToAddress

func (h *EOSHandler) PublicKeyToAddress(pubKeyHex string) (acctName string, err error)

用一个大账户存钱,用交易备注区分用户,交易备注是公钥hash+base58

func (*EOSHandler) SignTransaction

func (h *EOSHandler) SignTransaction(hash []string, privateKey interface{}) (rsv []string, err error)

func (*EOSHandler) SubmitTransaction

func (h *EOSHandler) SubmitTransaction(signedTransaction interface{}) (txhash string, err error)

func (*EOSHandler) SubmitTransactionByJson

func (h *EOSHandler) SubmitTransactionByJson(txjson string) (txhash string, err error)

type EOSTx

type EOSTx struct {
	FromAddress string
	TxOutputs   []EOSTxOutput
	Fee         int64
	Confirmed   bool
}

type EOSTxOutput

type EOSTxOutput struct {
	ToAddress string
	Amount    string
}

func (*EOSTxOutput) ToTxOutput

func (e *EOSTxOutput) ToTxOutput() *types.TxOutput

type Key

type Key struct {
	Key    string `json:"key"`
	Weight int    `json:"weight"`
}

type Limit

type Limit struct {
	Used      int64 `used`
	Available int64 `available`
	Max       int64 `max`
}

type Permission

type Permission struct {
	PermName     string `json:"perm_name"`
	Parent       string `json:"parent"`
	RequiredAuth Auth   `json:"required_auth"`
}

type Permissions

type Permissions []Permission

func (Permissions) Len

func (p Permissions) Len() int

func (Permissions) Less

func (p Permissions) Less(i, j int) bool

func (Permissions) Swap

func (p Permissions) Swap(i, j int)

type SubmitTxRes

type SubmitTxRes struct {
	Transaction_id string      `json:"transaction_id"`
	Error          interface{} `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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