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 IOSTDevSDK
- func (s *IOSTDevSDK) CloseConn()
- func (s *IOSTDevSDK) Connect() (err error)
- func (s *IOSTDevSDK) Connected() bool
- func (s *IOSTDevSDK) CreateNewAccount(newID string, ownerKey string, activeKey string, initialGasPledge int64, ...) (string, error)
- func (s *IOSTDevSDK) CreateNewAccountActions(newID string, ownerKey string, activeKey string, initialGasPledge int64, ...) ([]*rpcpb.Action, error)
- func (s *IOSTDevSDK) CreateTxFromActions(actions []*rpcpb.Action) (*rpcpb.TransactionRequest, error)
- func (s *IOSTDevSDK) GetAccountInfo(id string) (*rpcpb.Account, error)
- func (s *IOSTDevSDK) GetBlockByHash(hash string, complete bool) (*rpcpb.BlockResponse, error)
- func (s *IOSTDevSDK) GetBlockByNum(num int64, complete bool) (*rpcpb.BlockResponse, error)
- func (s *IOSTDevSDK) GetChainInfo() (*rpcpb.ChainInfoResponse, error)
- func (s *IOSTDevSDK) GetContractStorage(r *rpcpb.GetContractStorageRequest) (*rpcpb.GetContractStorageResponse, error)
- func (s *IOSTDevSDK) GetNodeInfo() (*rpcpb.NodeInfoResponse, error)
- func (s *IOSTDevSDK) GetProducerVoteInfo(r *rpcpb.GetProducerVoteInfoRequest) (*rpcpb.GetProducerVoteInfoResponse, error)
- func (s *IOSTDevSDK) GetTokenBalance(account string, token string) (*rpcpb.GetTokenBalanceResponse, error)
- func (s *IOSTDevSDK) GetTxByHash(hash string) (*rpcpb.TransactionResponse, error)
- func (s *IOSTDevSDK) GetTxReceiptByTxHash(txHashStr string) (*rpcpb.TxReceipt, error)
- func (s *IOSTDevSDK) PledgeForGasAndRAM(gasPledged int64, ram int64) error
- func (s *IOSTDevSDK) PublishContract(codePath string, abiPath string, conID string, update bool, updateID string) (*rpcpb.TransactionRequest, string, error)
- func (s *IOSTDevSDK) PublishContractActions(codePath string, abiPath string, conID string, update bool, updateID string) ([]*rpcpb.Action, error)
- func (s *IOSTDevSDK) SendTransaction(signedTx *rpcpb.TransactionRequest) (string, error)
- func (s *IOSTDevSDK) SendTx(tx *rpcpb.TransactionRequest) (string, error)
- func (s *IOSTDevSDK) SendTxFromActions(actions []*rpcpb.Action) (txHash string, err error)
- func (s *IOSTDevSDK) SetAccount(name string, kp *account.KeyPair)
- func (s *IOSTDevSDK) SetChainID(chainID uint32)
- func (s *IOSTDevSDK) SetCheckResult(checkResult bool, checkResultDelay float32, checkResultMaxRetry int32)
- func (s *IOSTDevSDK) SetServer(server string)
- func (s *IOSTDevSDK) SetSignAlgo(signAlgo string)
- func (s *IOSTDevSDK) SetTxInfo(gasLimit float64, gasRatio float64, expiration int64, delaySecond int64, ...)
- func (s *IOSTDevSDK) SetUseLongestChain(useLongestChain bool)
- func (s *IOSTDevSDK) SetVerbose(verbose bool)
- func (s *IOSTDevSDK) 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 IOSTDevSDK ¶
type IOSTDevSDK struct {
// contains filtered or unexported fields
}
IOSTDevSDK ...
func NewIOSTDevSDK ¶
func NewIOSTDevSDK() *IOSTDevSDK
NewIOSTDevSDK creatimg an SDK with reasonable params
func (*IOSTDevSDK) Connected ¶
func (s *IOSTDevSDK) Connected() bool
Connected checks if is connected to grpc server.
func (*IOSTDevSDK) CreateNewAccount ¶
func (s *IOSTDevSDK) CreateNewAccount(newID string, ownerKey string, activeKey string, initialGasPledge int64, initialRAM int64, initialCoins int64) (string, error)
CreateNewAccount ... return txHash
func (*IOSTDevSDK) CreateNewAccountActions ¶
func (s *IOSTDevSDK) CreateNewAccountActions(newID string, ownerKey string, activeKey string, initialGasPledge int64, initialRAM int64, initialCoins int64) ([]*rpcpb.Action, error)
CreateNewAccountActions makes actions for creating new account.
func (*IOSTDevSDK) CreateTxFromActions ¶
func (s *IOSTDevSDK) CreateTxFromActions(actions []*rpcpb.Action) (*rpcpb.TransactionRequest, error)
CreateTxFromActions ...
func (*IOSTDevSDK) GetAccountInfo ¶
func (s *IOSTDevSDK) GetAccountInfo(id string) (*rpcpb.Account, error)
GetAccountInfo return account info
func (*IOSTDevSDK) GetBlockByHash ¶
func (s *IOSTDevSDK) GetBlockByHash(hash string, complete bool) (*rpcpb.BlockResponse, error)
GetBlockByHash ...
func (*IOSTDevSDK) GetBlockByNum ¶
func (s *IOSTDevSDK) GetBlockByNum(num int64, complete bool) (*rpcpb.BlockResponse, error)
GetBlockByNum ...
func (*IOSTDevSDK) GetChainInfo ¶
func (s *IOSTDevSDK) GetChainInfo() (*rpcpb.ChainInfoResponse, error)
GetChainInfo ...
func (*IOSTDevSDK) GetContractStorage ¶
func (s *IOSTDevSDK) GetContractStorage(r *rpcpb.GetContractStorageRequest) (*rpcpb.GetContractStorageResponse, error)
GetContractStorage ...
func (*IOSTDevSDK) GetNodeInfo ¶
func (s *IOSTDevSDK) GetNodeInfo() (*rpcpb.NodeInfoResponse, error)
GetNodeInfo ...
func (*IOSTDevSDK) GetProducerVoteInfo ¶
func (s *IOSTDevSDK) GetProducerVoteInfo(r *rpcpb.GetProducerVoteInfoRequest) (*rpcpb.GetProducerVoteInfoResponse, error)
GetProducerVoteInfo ...
func (*IOSTDevSDK) GetTokenBalance ¶
func (s *IOSTDevSDK) GetTokenBalance(account string, token string) (*rpcpb.GetTokenBalanceResponse, error)
GetTokenBalance return token balance
func (*IOSTDevSDK) GetTxByHash ¶
func (s *IOSTDevSDK) GetTxByHash(hash string) (*rpcpb.TransactionResponse, error)
GetTxByHash ...
func (*IOSTDevSDK) GetTxReceiptByTxHash ¶
func (s *IOSTDevSDK) GetTxReceiptByTxHash(txHashStr string) (*rpcpb.TxReceipt, error)
GetTxReceiptByTxHash ...
func (*IOSTDevSDK) PledgeForGasAndRAM ¶
func (s *IOSTDevSDK) PledgeForGasAndRAM(gasPledged int64, ram int64) error
PledgeForGasAndRAM ...
func (*IOSTDevSDK) PublishContract ¶
func (s *IOSTDevSDK) 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 (*IOSTDevSDK) PublishContractActions ¶
func (s *IOSTDevSDK) PublishContractActions(codePath string, abiPath string, conID string, update bool, updateID string) ([]*rpcpb.Action, error)
PublishContractActions makes actions for publishing contract.
func (*IOSTDevSDK) SendTransaction ¶
func (s *IOSTDevSDK) SendTransaction(signedTx *rpcpb.TransactionRequest) (string, error)
SendTransaction send raw transaction to server
func (*IOSTDevSDK) SendTx ¶
func (s *IOSTDevSDK) SendTx(tx *rpcpb.TransactionRequest) (string, error)
SendTx send transaction and check result if sdk.checkResult is set
func (*IOSTDevSDK) SendTxFromActions ¶
func (s *IOSTDevSDK) SendTxFromActions(actions []*rpcpb.Action) (txHash string, err error)
SendTxFromActions send transaction and check result if sdk.checkResult is set
func (*IOSTDevSDK) SetAccount ¶
func (s *IOSTDevSDK) SetAccount(name string, kp *account.KeyPair)
SetAccount ...
func (*IOSTDevSDK) SetChainID ¶
func (s *IOSTDevSDK) SetChainID(chainID uint32)
SetChainID sets chainID.
func (*IOSTDevSDK) SetCheckResult ¶
func (s *IOSTDevSDK) SetCheckResult(checkResult bool, checkResultDelay float32, checkResultMaxRetry int32)
SetCheckResult ...
func (*IOSTDevSDK) SetTxInfo ¶
func (s *IOSTDevSDK) SetTxInfo(gasLimit float64, gasRatio float64, expiration int64, delaySecond int64, amountLimit []*rpcpb.AmountLimit)
SetTxInfo ...
func (*IOSTDevSDK) SetUseLongestChain ¶
func (s *IOSTDevSDK) SetUseLongestChain(useLongestChain bool)
SetUseLongestChain ...
func (*IOSTDevSDK) SignTx ¶
func (s *IOSTDevSDK) SignTx(t *rpcpb.TransactionRequest, signAlgo string) (*rpcpb.TransactionRequest, error)
SignTx ...