sdk

package
v0.0.0-...-376a440 Latest Latest
Warning

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

Go to latest
Published: May 10, 2020 License: LGPL-3.0 Imports: 17 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 AIOUDevSDK

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

AIOUDevSDK ...

func NewAIOUDevSDK

func NewAIOUDevSDK() *AIOUDevSDK

NewAIOUDevSDK creatimg an SDK with reasonable params

func (*AIOUDevSDK) CloseConn

func (s *AIOUDevSDK) CloseConn()

CloseConn ...

func (*AIOUDevSDK) Connect

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

Connect ...

func (*AIOUDevSDK) Connected

func (s *AIOUDevSDK) Connected() bool

Connected checks if is connected to grpc server.

func (*AIOUDevSDK) CreateNewAccount

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

CreateNewAccount ... return txHash

func (*AIOUDevSDK) CreateNewAccountActions

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

CreateNewAccountActions makes actions for creating new account.

func (*AIOUDevSDK) CreateTxFromActions

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

CreateTxFromActions ...

func (*AIOUDevSDK) ExecTransaction

func (s *AIOUDevSDK) ExecTransaction(signedTx *rpcpb.TransactionRequest) (*rpcpb.TxReceipt, error)

ExecTransaction send raw transaction to server

func (*AIOUDevSDK) GetAccountInfo

func (s *AIOUDevSDK) GetAccountInfo(id string) (*rpcpb.Account, error)

GetAccountInfo return account info

func (*AIOUDevSDK) GetBatchContractStorage

GetBatchContractStorage ...

func (*AIOUDevSDK) GetBlockByHash

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

GetBlockByHash ...

func (*AIOUDevSDK) GetBlockByNum

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

GetBlockByNum ...

func (*AIOUDevSDK) GetChainInfo

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

GetChainInfo ...

func (*AIOUDevSDK) GetContractStorage

GetContractStorage ...

func (*AIOUDevSDK) GetNodeInfo

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

GetNodeInfo ...

func (*AIOUDevSDK) GetProducerVoteInfo

GetProducerVoteInfo ...

func (*AIOUDevSDK) GetRAMInfo

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

GetRAMInfo ...

func (*AIOUDevSDK) GetTokenBalance

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

GetTokenBalance return token balance

func (*AIOUDevSDK) GetTokenInfo

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

GetTokenInfo ...

func (*AIOUDevSDK) GetTxByHash

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

GetTxByHash ...

func (*AIOUDevSDK) GetTxReceiptByTxHash

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

GetTxReceiptByTxHash ...

func (*AIOUDevSDK) PledgeForGasAndRAM

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

PledgeForGasAndRAM ...

func (*AIOUDevSDK) PublishContract

func (s *AIOUDevSDK) 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 (*AIOUDevSDK) PublishContractActions

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

PublishContractActions makes actions for publishing contract.

func (*AIOUDevSDK) SendTransaction

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

SendTransaction send raw transaction to server

func (*AIOUDevSDK) SendTx

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

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

func (*AIOUDevSDK) SendTxFromActions

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

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

func (*AIOUDevSDK) SetAccount

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

SetAccount ...

func (*AIOUDevSDK) SetChainID

func (s *AIOUDevSDK) SetChainID(chainID uint32)

SetChainID sets chainID.

func (*AIOUDevSDK) SetCheckResult

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

SetCheckResult ...

func (*AIOUDevSDK) SetServer

func (s *AIOUDevSDK) SetServer(server string)

SetServer ...

func (*AIOUDevSDK) SetSignAlgo

func (s *AIOUDevSDK) SetSignAlgo(signAlgo string)

SetSignAlgo ...

func (*AIOUDevSDK) SetTxInfo

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

SetTxInfo ...

func (*AIOUDevSDK) SetUseLongestChain

func (s *AIOUDevSDK) SetUseLongestChain(useLongestChain bool)

SetUseLongestChain ...

func (*AIOUDevSDK) SetVerbose

func (s *AIOUDevSDK) SetVerbose(verbose bool)

SetVerbose ...

func (*AIOUDevSDK) SignTx

SignTx ...

func (*AIOUDevSDK) TryTx

Jump to

Keyboard shortcuts

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