sdk

package
v3.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: LGPL-3.0 Imports: 16 Imported by: 11

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 IOSTDevSDK

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

IOSTDevSDK ...

func NewIOSTDevSDK

func NewIOSTDevSDK() *IOSTDevSDK

NewIOSTDevSDK creatimg an SDK with reasonable params

func (*IOSTDevSDK) CloseConn

func (s *IOSTDevSDK) CloseConn()

CloseConn ...

func (*IOSTDevSDK) Connect

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

Connect ...

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) GetBatchContractStorage

GetBatchContractStorage ...

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

GetContractStorage ...

func (*IOSTDevSDK) GetNodeInfo

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

GetNodeInfo ...

func (*IOSTDevSDK) GetProducerVoteInfo

GetProducerVoteInfo ...

func (*IOSTDevSDK) GetRAMInfo

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

GetRAMInfo ...

func (*IOSTDevSDK) GetTokenBalance

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

GetTokenBalance return token balance

func (*IOSTDevSDK) GetTokenInfo

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

GetTokenInfo ...

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) SetServer

func (s *IOSTDevSDK) SetServer(server string)

SetServer ...

func (*IOSTDevSDK) SetSignAlgo

func (s *IOSTDevSDK) SetSignAlgo(signAlgo string)

SetSignAlgo ...

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) SetVerbose

func (s *IOSTDevSDK) SetVerbose(verbose bool)

SetVerbose ...

func (*IOSTDevSDK) SignTx

SignTx ...

Jump to

Keyboard shortcuts

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