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 LoadProtoStructFromJSONFile(fileName string, pb proto.Message) error
- func MarshalTextString(pb proto.Message) string
- func NewAction(contract string, name string, data string) *rpcpb.Action
- func ParsePrivKey(rawKey string) []byte
- 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 AccountInfo
- type FileAccountStore
- type IOSTDevSDK
- func (s *IOSTDevSDK) AddAccountWithPerm(name string, kp *account.KeyPair, perm string)
- 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) CurrentAccount() string
- func (s *IOSTDevSDK) ExecTransaction(signedTx *rpcpb.TransactionRequest) (*rpcpb.TxReceipt, error)
- func (s *IOSTDevSDK) GetAccountInfo(id string) (*rpcpb.Account, error)
- func (s *IOSTDevSDK) GetBatchContractStorage(r *rpcpb.GetBatchContractStorageRequest) (*rpcpb.GetBatchContractStorageResponse, 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) GetRAMInfo() (*rpcpb.RAMInfoResponse, error)
- func (s *IOSTDevSDK) GetTokenBalance(account string, token string) (*rpcpb.GetTokenBalanceResponse, error)
- func (s *IOSTDevSDK) GetTokenInfo(token string) (*rpcpb.TokenInfo, 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) 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) (*rpcpb.TransactionRequest, error)
- func (s *IOSTDevSDK) TryTx(tx *rpcpb.TransactionRequest) (*rpcpb.TxReceipt, error)
- func (s *IOSTDevSDK) UpdateAccountKeysActions(account string, ownerKey string, activeKey string) ([]*rpcpb.Action, error)
- func (s *IOSTDevSDK) UseAccount(name string)
- func (s *IOSTDevSDK) UseAccountAndPerm(name string, perm string)
- type KeyPairInfo
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 ¶
func GetSignAlgoByEnum(enum rpcpb.Signature_Algorithm) crypto.Algorithm
GetSignAlgoByEnum ...
func GetSignatureOfTx ¶
func GetSignatureOfTx(t *rpcpb.TransactionRequest, kp *account.KeyPair, withSign bool) *rpcpb.Signature
GetSignatureOfTx ...
func LoadProtoStructFromJSONFile ¶
LoadProtoStructFromJSONFile ...
func ParsePrivKey ¶ added in v3.8.1
func SaveProtoStructToJSONFile ¶
SaveProtoStructToJSONFile ...
func VerifySigForTx ¶
VerifySigForTx ...
func VerifySignature ¶
func VerifySignature(tx *rpcpb.TransactionRequest) error
VerifySignature verify signature of a signed tx
Types ¶
type AccountInfo ¶ added in v3.7.0
type AccountInfo struct { Name string `json:"name"` Keypairs map[string]*KeyPairInfo `json:"keypairs"` }
AccountInfo ...
func LoadAccountFrom ¶ added in v3.7.0
func LoadAccountFrom(fileName string) (*AccountInfo, error)
func (*AccountInfo) Decrypt ¶ added in v3.7.0
func (a *AccountInfo) Decrypt(password []byte) error
func (*AccountInfo) Encrypt ¶ added in v3.7.0
func (a *AccountInfo) Encrypt(password []byte) error
func (*AccountInfo) GetKeyPair ¶ added in v3.7.0
func (a *AccountInfo) GetKeyPair(perm string) (*account.KeyPair, error)
func (*AccountInfo) IsEncrypted ¶ added in v3.7.0
func (a *AccountInfo) IsEncrypted() bool
func (*AccountInfo) SaveTo ¶ added in v3.7.0
func (a *AccountInfo) SaveTo(fileName string) error
type FileAccountStore ¶ added in v3.7.0
type FileAccountStore struct {
AccountDir string
}
func NewFileAccountStore ¶ added in v3.7.0
func NewFileAccountStore(accountDir string) *FileAccountStore
func (*FileAccountStore) DeleteAccount ¶ added in v3.7.0
func (s *FileAccountStore) DeleteAccount(name string) error
func (*FileAccountStore) ListAccounts ¶ added in v3.7.0
func (s *FileAccountStore) ListAccounts() ([]*AccountInfo, error)
func (*FileAccountStore) LoadAccount ¶ added in v3.7.0
func (s *FileAccountStore) LoadAccount(name string) (*AccountInfo, error)
func (*FileAccountStore) SaveAccount ¶ added in v3.7.0
func (s *FileAccountStore) SaveAccount(a *AccountInfo) error
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) AddAccountWithPerm ¶ added in v3.7.0
func (s *IOSTDevSDK) AddAccountWithPerm(name string, kp *account.KeyPair, perm string)
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) CurrentAccount ¶ added in v3.7.0
func (s *IOSTDevSDK) CurrentAccount() string
func (*IOSTDevSDK) ExecTransaction ¶
func (s *IOSTDevSDK) ExecTransaction(signedTx *rpcpb.TransactionRequest) (*rpcpb.TxReceipt, error)
ExecTransaction send raw transaction to server
func (*IOSTDevSDK) GetAccountInfo ¶
func (s *IOSTDevSDK) GetAccountInfo(id string) (*rpcpb.Account, error)
GetAccountInfo return account info
func (*IOSTDevSDK) GetBatchContractStorage ¶
func (s *IOSTDevSDK) GetBatchContractStorage(r *rpcpb.GetBatchContractStorageRequest) (*rpcpb.GetBatchContractStorageResponse, error)
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 ¶
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) 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)
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) (*rpcpb.TransactionRequest, error)
SignTx ...
func (*IOSTDevSDK) TryTx ¶
func (s *IOSTDevSDK) TryTx(tx *rpcpb.TransactionRequest) (*rpcpb.TxReceipt, error)
func (*IOSTDevSDK) UpdateAccountKeysActions ¶ added in v3.7.0
func (*IOSTDevSDK) UseAccount ¶ added in v3.7.0
func (s *IOSTDevSDK) UseAccount(name string)
func (*IOSTDevSDK) UseAccountAndPerm ¶ added in v3.7.0
func (s *IOSTDevSDK) UseAccountAndPerm(name string, perm string)
type KeyPairInfo ¶ added in v3.7.0
type KeyPairInfo struct { RawKey string `json:"raw_key,omitempty"` KeyType string `json:"key_type"` PubKey string `json:"public_key"` EncryptMethod string `json:"encrypt_method,omitempty"` Salt string `json:"salt,omitempty"` EncryptedKey string `json:"encrypted_key,omitempty"` Mac string `json:"mac,omitempty"` }
KeyPairInfo ...
func NewKeyPairInfo ¶ added in v3.7.0
func NewKeyPairInfo(rawKey string, keyType string) (*KeyPairInfo, error)
NewKeyPairInfo ...
func (*KeyPairInfo) Decrypt ¶ added in v3.7.0
func (k *KeyPairInfo) Decrypt(password []byte) error
func (*KeyPairInfo) Encrypt ¶ added in v3.7.0
func (k *KeyPairInfo) Encrypt(password []byte) error
func (*KeyPairInfo) IsEncrypted ¶ added in v3.7.0
func (k *KeyPairInfo) IsEncrypted() bool