sdk

package
v0.0.0-...-5fdeb2f Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2020 License: LGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPubKey

func CheckPubKey(k string) bool

CheckPubKey check whether a string is a valid public key. Since it is not easy to check it fully, only check length here

func GetSignAlgoByEnum

func GetSignAlgoByEnum(enum rpcpb.Signature_Algorithm) crypto.Algorithm

GetSignAlgoByEnum ...

func GetSignAlgoByName

func GetSignAlgoByName(name string) crypto.Algorithm

GetSignAlgoByName ...

func GetSignatureOfTx

func GetSignatureOfTx(t *rpcpb.TransactionRequest, kp *account.KeyPair, withSign bool) *rpcpb.Signature

GetSignatureOfTx ...

func LoadKeyPair

func LoadKeyPair(privKeyFile string, algo string) (*account.KeyPair, error)

LoadKeyPair ...

func LoadProtoStructFromJSONFile

func LoadProtoStructFromJSONFile(fileName string, pb proto.Message) error

LoadProtoStructFromJSONFile ...

func MarshalTextString

func MarshalTextString(pb proto.Message) string

MarshalTextString ...

func NewAction

func NewAction(contract string, name string, data string) *rpcpb.Action

NewAction ...

func SaveProtoStructToJSONFile

func SaveProtoStructToJSONFile(pb proto.Message, fileName string) error

SaveProtoStructToJSONFile ...

func VerifySigForTx

func VerifySigForTx(t *rpcpb.TransactionRequest, sig *rpcpb.Signature, withSign bool) bool

VerifySigForTx ...

func VerifySignature

func VerifySignature(tx *rpcpb.TransactionRequest) error

VerifySignature verify signature of a signed tx

Types

type EMPOWDevSDK

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

EMPOWDevSDK ...

func NewEMPOWDevSDK

func NewEMPOWDevSDK() *EMPOWDevSDK

NewEMPOWDevSDK creatimg an SDK with reasonable params

func (*EMPOWDevSDK) CloseConn

func (s *EMPOWDevSDK) CloseConn()

CloseConn ...

func (*EMPOWDevSDK) Connect

func (s *EMPOWDevSDK) Connect() (err error)

Connect ...

func (*EMPOWDevSDK) Connected

func (s *EMPOWDevSDK) Connected() bool

Connected checks if is connected to grpc server.

func (*EMPOWDevSDK) CreateNewAccount

func (s *EMPOWDevSDK) CreateNewAccount(newID string, ownerKey string, activeKey string, initialGasPledge int64, initialRAM int64, initialCoins int64) (string, error)

CreateNewAccount ... return txHash

func (*EMPOWDevSDK) CreateNewAccountActions

func (s *EMPOWDevSDK) CreateNewAccountActions(newID string, ownerKey string, activeKey string, initialGasPledge int64, initialRAM int64, initialCoins int64) ([]*rpcpb.Action, error)

CreateNewAccountActions makes actions for creating new account.

func (*EMPOWDevSDK) CreateTxFromActions

func (s *EMPOWDevSDK) CreateTxFromActions(actions []*rpcpb.Action) (*rpcpb.TransactionRequest, error)

CreateTxFromActions ...

func (*EMPOWDevSDK) GetAccountInfo

func (s *EMPOWDevSDK) GetAccountInfo(address string) (*rpcpb.Account, error)

GetAccountInfo return account info

func (*EMPOWDevSDK) GetBatchContractStorage

GetBatchContractStorage ...

func (*EMPOWDevSDK) GetBlockByHash

func (s *EMPOWDevSDK) GetBlockByHash(hash string, complete bool) (*rpcpb.BlockResponse, error)

GetBlockByHash ...

func (*EMPOWDevSDK) GetBlockByNum

func (s *EMPOWDevSDK) GetBlockByNum(num int64, complete bool) (*rpcpb.BlockResponse, error)

GetBlockByNum ...

func (*EMPOWDevSDK) GetChainInfo

func (s *EMPOWDevSDK) GetChainInfo() (*rpcpb.ChainInfoResponse, error)

GetChainInfo ...

func (*EMPOWDevSDK) GetContractStorage

GetContractStorage ...

func (*EMPOWDevSDK) GetNodeInfo

func (s *EMPOWDevSDK) GetNodeInfo() (*rpcpb.NodeInfoResponse, error)

GetNodeInfo ...

func (*EMPOWDevSDK) GetProducerVoteInfo

GetProducerVoteInfo ...

func (*EMPOWDevSDK) GetRAMInfo

func (s *EMPOWDevSDK) GetRAMInfo() (*rpcpb.RAMInfoResponse, error)

GetRAMInfo ...

func (*EMPOWDevSDK) GetTokenBalance

func (s *EMPOWDevSDK) GetTokenBalance(account string, token string) (*rpcpb.GetTokenBalanceResponse, error)

GetTokenBalance return token balance

func (*EMPOWDevSDK) GetTokenInfo

func (s *EMPOWDevSDK) GetTokenInfo(token string) (*rpcpb.TokenInfo, error)

GetTokenInfo ...

func (*EMPOWDevSDK) GetTxByHash

func (s *EMPOWDevSDK) GetTxByHash(hash string) (*rpcpb.TransactionResponse, error)

GetTxByHash ...

func (*EMPOWDevSDK) GetTxReceiptByTxHash

func (s *EMPOWDevSDK) GetTxReceiptByTxHash(txHashStr string) (*rpcpb.TxReceipt, error)

GetTxReceiptByTxHash ...

func (*EMPOWDevSDK) PledgeForGasAndRAM

func (s *EMPOWDevSDK) PledgeForGasAndRAM(gasPledged int64, ram int64) error

PledgeForGasAndRAM ...

func (*EMPOWDevSDK) PublishContract

func (s *EMPOWDevSDK) PublishContract(codePath string, abiPath string, conID string, update bool, updateID string) (*rpcpb.TransactionRequest, string, error)

PublishContract converts contract js code to transaction. If 'send', also send it to chain.

func (*EMPOWDevSDK) PublishContractActions

func (s *EMPOWDevSDK) PublishContractActions(codePath string, abiPath string, conID string, update bool, updateID string) ([]*rpcpb.Action, error)

PublishContractActions makes actions for publishing contract.

func (*EMPOWDevSDK) SendTransaction

func (s *EMPOWDevSDK) SendTransaction(signedTx *rpcpb.TransactionRequest) (string, error)

SendTransaction send raw transaction to server

func (*EMPOWDevSDK) SendTx

func (s *EMPOWDevSDK) SendTx(tx *rpcpb.TransactionRequest) (string, error)

SendTx send transaction and check result if sdk.checkResult is set

func (*EMPOWDevSDK) SendTxFromActions

func (s *EMPOWDevSDK) SendTxFromActions(actions []*rpcpb.Action) (txHash string, err error)

SendTxFromActions send transaction and check result if sdk.checkResult is set

func (*EMPOWDevSDK) SetAccount

func (s *EMPOWDevSDK) SetAccount(name string, kp *account.KeyPair)

SetAccount ...

func (*EMPOWDevSDK) SetChainID

func (s *EMPOWDevSDK) SetChainID(chainID uint32)

SetChainID sets chainID.

func (*EMPOWDevSDK) SetCheckResult

func (s *EMPOWDevSDK) SetCheckResult(checkResult bool, checkResultDelay float32, checkResultMaxRetry int32)

SetCheckResult ...

func (*EMPOWDevSDK) SetServer

func (s *EMPOWDevSDK) SetServer(server string)

SetServer ...

func (*EMPOWDevSDK) SetSignAlgo

func (s *EMPOWDevSDK) SetSignAlgo(signAlgo string)

SetSignAlgo ...

func (*EMPOWDevSDK) SetTxInfo

func (s *EMPOWDevSDK) SetTxInfo(gasLimit float64, gasRatio float64, expiration int64, delaySecond int64, amountLimit []*rpcpb.AmountLimit)

SetTxInfo ...

func (*EMPOWDevSDK) SetUseLongestChain

func (s *EMPOWDevSDK) SetUseLongestChain(useLongestChain bool)

SetUseLongestChain ...

func (*EMPOWDevSDK) SetVerbose

func (s *EMPOWDevSDK) SetVerbose(verbose bool)

SetVerbose ...

func (*EMPOWDevSDK) SignTx

SignTx ...

Jump to

Keyboard shortcuts

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