Documentation
¶
Index ¶
- func CheckPubKey(k string) bool
- func GetSignAlgoByEnum(enum rpcpb.Signature_Algorithm) crypto.Algorithm
- func GetSignAlgoByName(name string) crypto.Algorithm
- func GetSignatureOfTx(t *rpcpb.TransactionRequest, kp *account.KeyPair, withSign bool) *rpcpb.Signature
- func LoadKeyPair(privKeyFile string, algo string) (*account.KeyPair, error)
- func LoadProtoStructFromJSONFile(fileName string, pb proto.Message) error
- func MarshalTextString(pb proto.Message) string
- func NewAction(contract string, name string, data string) *rpcpb.Action
- func SaveProtoStructToJSONFile(pb proto.Message, fileName string) error
- func VerifySigForTx(t *rpcpb.TransactionRequest, sig *rpcpb.Signature, withSign bool) bool
- func VerifySignature(tx *rpcpb.TransactionRequest) error
- type EMPOWDevSDK
- func (s *EMPOWDevSDK) CloseConn()
- func (s *EMPOWDevSDK) Connect() (err error)
- func (s *EMPOWDevSDK) Connected() bool
- func (s *EMPOWDevSDK) CreateNewAccount(newID string, ownerKey string, activeKey string, initialGasPledge int64, ...) (string, error)
- func (s *EMPOWDevSDK) CreateNewAccountActions(newID string, ownerKey string, activeKey string, initialGasPledge int64, ...) ([]*rpcpb.Action, error)
- func (s *EMPOWDevSDK) CreateTxFromActions(actions []*rpcpb.Action) (*rpcpb.TransactionRequest, error)
- func (s *EMPOWDevSDK) GetAccountInfo(address string) (*rpcpb.Account, error)
- func (s *EMPOWDevSDK) GetBatchContractStorage(r *rpcpb.GetBatchContractStorageRequest) (*rpcpb.GetBatchContractStorageResponse, error)
- func (s *EMPOWDevSDK) GetBlockByHash(hash string, complete bool) (*rpcpb.BlockResponse, error)
- func (s *EMPOWDevSDK) GetBlockByNum(num int64, complete bool) (*rpcpb.BlockResponse, error)
- func (s *EMPOWDevSDK) GetChainInfo() (*rpcpb.ChainInfoResponse, error)
- func (s *EMPOWDevSDK) GetContractStorage(r *rpcpb.GetContractStorageRequest) (*rpcpb.GetContractStorageResponse, error)
- func (s *EMPOWDevSDK) GetNodeInfo() (*rpcpb.NodeInfoResponse, error)
- func (s *EMPOWDevSDK) GetProducerVoteInfo(r *rpcpb.GetProducerVoteInfoRequest) (*rpcpb.GetProducerVoteInfoResponse, error)
- func (s *EMPOWDevSDK) GetRAMInfo() (*rpcpb.RAMInfoResponse, error)
- func (s *EMPOWDevSDK) GetTokenBalance(account string, token string) (*rpcpb.GetTokenBalanceResponse, error)
- func (s *EMPOWDevSDK) GetTokenInfo(token string) (*rpcpb.TokenInfo, error)
- func (s *EMPOWDevSDK) GetTxByHash(hash string) (*rpcpb.TransactionResponse, error)
- func (s *EMPOWDevSDK) GetTxReceiptByTxHash(txHashStr string) (*rpcpb.TxReceipt, error)
- func (s *EMPOWDevSDK) PledgeForGasAndRAM(gasPledged int64, ram int64) error
- func (s *EMPOWDevSDK) PublishContract(codePath string, abiPath string, conID string, update bool, updateID string) (*rpcpb.TransactionRequest, string, error)
- func (s *EMPOWDevSDK) PublishContractActions(codePath string, abiPath string, conID string, update bool, updateID string) ([]*rpcpb.Action, error)
- func (s *EMPOWDevSDK) SendTransaction(signedTx *rpcpb.TransactionRequest) (string, error)
- func (s *EMPOWDevSDK) SendTx(tx *rpcpb.TransactionRequest) (string, error)
- func (s *EMPOWDevSDK) SendTxFromActions(actions []*rpcpb.Action) (txHash string, err error)
- func (s *EMPOWDevSDK) SetAccount(name string, kp *account.KeyPair)
- func (s *EMPOWDevSDK) SetChainID(chainID uint32)
- func (s *EMPOWDevSDK) SetCheckResult(checkResult bool, checkResultDelay float32, checkResultMaxRetry int32)
- func (s *EMPOWDevSDK) SetServer(server string)
- func (s *EMPOWDevSDK) SetSignAlgo(signAlgo string)
- func (s *EMPOWDevSDK) SetTxInfo(gasLimit float64, gasRatio float64, expiration int64, delaySecond int64, ...)
- func (s *EMPOWDevSDK) SetUseLongestChain(useLongestChain bool)
- func (s *EMPOWDevSDK) SetVerbose(verbose bool)
- func (s *EMPOWDevSDK) SignTx(t *rpcpb.TransactionRequest, signAlgo string) (*rpcpb.TransactionRequest, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPubKey ¶
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 ¶
GetSignAlgoByEnum ...
func GetSignatureOfTx ¶
func GetSignatureOfTx(t *rpcpb.TransactionRequest, kp *account.KeyPair, withSign bool) *rpcpb.Signature
GetSignatureOfTx ...
func LoadKeyPair ¶
LoadKeyPair ...
func LoadProtoStructFromJSONFile ¶
LoadProtoStructFromJSONFile ...
func SaveProtoStructToJSONFile ¶
SaveProtoStructToJSONFile ...
func VerifySigForTx ¶
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) 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 ¶
func (s *EMPOWDevSDK) GetBatchContractStorage(r *rpcpb.GetBatchContractStorageRequest) (*rpcpb.GetBatchContractStorageResponse, error)
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 ¶
func (s *EMPOWDevSDK) GetContractStorage(r *rpcpb.GetContractStorageRequest) (*rpcpb.GetContractStorageResponse, error)
GetContractStorage ...
func (*EMPOWDevSDK) GetNodeInfo ¶
func (s *EMPOWDevSDK) GetNodeInfo() (*rpcpb.NodeInfoResponse, error)
GetNodeInfo ...
func (*EMPOWDevSDK) GetProducerVoteInfo ¶
func (s *EMPOWDevSDK) GetProducerVoteInfo(r *rpcpb.GetProducerVoteInfoRequest) (*rpcpb.GetProducerVoteInfoResponse, error)
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) 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) SignTx ¶
func (s *EMPOWDevSDK) SignTx(t *rpcpb.TransactionRequest, signAlgo string) (*rpcpb.TransactionRequest, error)
SignTx ...