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 AIOUDevSDK
- func (s *AIOUDevSDK) CloseConn()
- func (s *AIOUDevSDK) Connect() (err error)
- func (s *AIOUDevSDK) Connected() bool
- func (s *AIOUDevSDK) CreateNewAccount(newID string, ownerKey string, activeKey string, initialGasPledge int64, ...) (string, error)
- func (s *AIOUDevSDK) CreateNewAccountActions(newID string, ownerKey string, activeKey string, initialGasPledge int64, ...) ([]*rpcpb.Action, error)
- func (s *AIOUDevSDK) CreateTxFromActions(actions []*rpcpb.Action) (*rpcpb.TransactionRequest, error)
- func (s *AIOUDevSDK) ExecTransaction(signedTx *rpcpb.TransactionRequest) (*rpcpb.TxReceipt, error)
- func (s *AIOUDevSDK) GetAccountInfo(id string) (*rpcpb.Account, error)
- func (s *AIOUDevSDK) GetBatchContractStorage(r *rpcpb.GetBatchContractStorageRequest) (*rpcpb.GetBatchContractStorageResponse, error)
- func (s *AIOUDevSDK) GetBlockByHash(hash string, complete bool) (*rpcpb.BlockResponse, error)
- func (s *AIOUDevSDK) GetBlockByNum(num int64, complete bool) (*rpcpb.BlockResponse, error)
- func (s *AIOUDevSDK) GetChainInfo() (*rpcpb.ChainInfoResponse, error)
- func (s *AIOUDevSDK) GetContractStorage(r *rpcpb.GetContractStorageRequest) (*rpcpb.GetContractStorageResponse, error)
- func (s *AIOUDevSDK) GetNodeInfo() (*rpcpb.NodeInfoResponse, error)
- func (s *AIOUDevSDK) GetProducerVoteInfo(r *rpcpb.GetProducerVoteInfoRequest) (*rpcpb.GetProducerVoteInfoResponse, error)
- func (s *AIOUDevSDK) GetRAMInfo() (*rpcpb.RAMInfoResponse, error)
- func (s *AIOUDevSDK) GetTokenBalance(account string, token string) (*rpcpb.GetTokenBalanceResponse, error)
- func (s *AIOUDevSDK) GetTokenInfo(token string) (*rpcpb.TokenInfo, error)
- func (s *AIOUDevSDK) GetTxByHash(hash string) (*rpcpb.TransactionResponse, error)
- func (s *AIOUDevSDK) GetTxReceiptByTxHash(txHashStr string) (*rpcpb.TxReceipt, error)
- func (s *AIOUDevSDK) PledgeForGasAndRAM(gasPledged int64, ram int64) error
- func (s *AIOUDevSDK) PublishContract(codePath string, abiPath string, conID string, update bool, updateID string) (*rpcpb.TransactionRequest, string, error)
- func (s *AIOUDevSDK) PublishContractActions(codePath string, abiPath string, conID string, update bool, updateID string) ([]*rpcpb.Action, error)
- func (s *AIOUDevSDK) SendTransaction(signedTx *rpcpb.TransactionRequest) (string, error)
- func (s *AIOUDevSDK) SendTx(tx *rpcpb.TransactionRequest) (string, error)
- func (s *AIOUDevSDK) SendTxFromActions(actions []*rpcpb.Action) (txHash string, err error)
- func (s *AIOUDevSDK) SetAccount(name string, kp *account.KeyPair)
- func (s *AIOUDevSDK) SetChainID(chainID uint32)
- func (s *AIOUDevSDK) SetCheckResult(checkResult bool, checkResultDelay float32, checkResultMaxRetry int32)
- func (s *AIOUDevSDK) SetServer(server string)
- func (s *AIOUDevSDK) SetSignAlgo(signAlgo string)
- func (s *AIOUDevSDK) SetTxInfo(gasLimit float64, gasRatio float64, expiration int64, delaySecond int64, ...)
- func (s *AIOUDevSDK) SetUseLongestChain(useLongestChain bool)
- func (s *AIOUDevSDK) SetVerbose(verbose bool)
- func (s *AIOUDevSDK) SignTx(t *rpcpb.TransactionRequest, signAlgo string) (*rpcpb.TransactionRequest, error)
- func (s *AIOUDevSDK) TryTx(tx *rpcpb.TransactionRequest) (*rpcpb.TxReceipt, 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 AIOUDevSDK ¶
type AIOUDevSDK struct {
// contains filtered or unexported fields
}
AIOUDevSDK ...
func NewAIOUDevSDK ¶
func NewAIOUDevSDK() *AIOUDevSDK
NewAIOUDevSDK creatimg an SDK with reasonable params
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 ¶
func (s *AIOUDevSDK) GetBatchContractStorage(r *rpcpb.GetBatchContractStorageRequest) (*rpcpb.GetBatchContractStorageResponse, error)
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 ¶
func (s *AIOUDevSDK) GetContractStorage(r *rpcpb.GetContractStorageRequest) (*rpcpb.GetContractStorageResponse, error)
GetContractStorage ...
func (*AIOUDevSDK) GetNodeInfo ¶
func (s *AIOUDevSDK) GetNodeInfo() (*rpcpb.NodeInfoResponse, error)
GetNodeInfo ...
func (*AIOUDevSDK) GetProducerVoteInfo ¶
func (s *AIOUDevSDK) GetProducerVoteInfo(r *rpcpb.GetProducerVoteInfoRequest) (*rpcpb.GetProducerVoteInfoResponse, error)
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) 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) SignTx ¶
func (s *AIOUDevSDK) SignTx(t *rpcpb.TransactionRequest, signAlgo string) (*rpcpb.TransactionRequest, error)
SignTx ...
func (*AIOUDevSDK) TryTx ¶
func (s *AIOUDevSDK) TryTx(tx *rpcpb.TransactionRequest) (*rpcpb.TxReceipt, error)