qlcchain

package module
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 9 Imported by: 8

README

QLC Chain Golang SDK

Build Status codecov GoDoc

QLC Chain Golang API

Example

func main() {
    //client, err := qlcchain.NewQLCClient("http://127.0.0.1:19735")
    client, err := qlcchain.NewQLCClient("ws://127.0.0.1:19736")
    if err != nil || client == nil {
        fmt.Println(err)
        return
    }

    addr, err := client.Ledger.Accounts(20, 0)
    if err != nil {
        fmt.Println(err)
        return
    }

    for idx, val := range addr {
        fmt.Println(idx, "==>", val.String())
    }

    fmt.Println(client.Version())

// Output:
// 0 ==> qlc_13117gep55b5xpa7nbaz71s1ykz36bfqc6bieyzycif3ceykg4dtsmo19867
// 1 ==> qlc_14hshh15cduhhgcus9oqcbptw1qa3iwma4nujow3cuow5ni4df16gtirkb35
// 2 ==> qlc_18mbwzt7kjks1ydzk53hw6xropyz3mb4dgwq75tyzy4pcuc4mso1635mfdfz
// 3 ==> qlc_1b1dm6g17a5xrb8wtkas6pn4xz4m6uiq4nahxckhrob876t4oh8scawbhx8s
// 4 ==> qlc_1dzyqpd7h8ag9mamthxq695s38f71i8icjm6yn7y98rinasukhcb9tkbaqx9
// 5 ==> qlc_1gnggt8b6cwro3b4z9gootipykqd6x5gucfd7exsi4xqkryiijciegfhon4u
// 6 ==> qlc_1kk5xst583y8hpn9c48ruizs5cxprdeptw6s5wm6ezz6i1h5srpz3mnjgxao
// 7 ==> qlc_1mnw9gbzdaxz7sz18pyjcffiqaocxnunfdtu1u3fc4wjkib97rp1wcdw6ato
// 8 ==> qlc_1p11fp649uuan5ib9rpprd1dad3ue9qcqban1y8kwagdu56eea44nhq8do8o
// 9 ==> qlc_1pr8ojutnibmj4ej5aptng546hnqc4webd89tb4b31jz4tyqqots5ne6p553
// 10 ==> qlc_1s6rb1wr74r747b8k6wx6m8swgppef46ccnixy1zgtejhfosxaro15x1s8ab
// 11 ==> qlc_1u1d7mgo8hq5nad8jwesw6azfk53a31ge5minwxdfk8t1fqknypqgk8mi3z7
// 12 ==> qlc_1wyei6waj76k4b38prdubc19sr8dync5pz996cwufiy8ksxz6oshudred7q6
// 13 ==> qlc_1zbo3axuh166w4tno77hqye3n1nx5kehzhn8z71xixig7b5ggfxfyfi7f3er
// 14 ==> qlc_34yujh9i5kewnoqjs1s1fyj67u5tkifew4bc1gec4ftwktwgzbhkpjc7t4ge
// 15 ==> qlc_35ejpaokgu514segi1frsiekhpepbznhybe737qq1peczn4yb9hyic9uipbe
// 16 ==> qlc_361j3uiqdkjrzirttrpu9pn7eeussymty4rz4gifs9ijdx1p46xnpu3je7sy
// 17 ==> qlc_38um9p7z54koeu84cqsgmtjhdnf99jrkyzmh1rnky98wmt46ogboedahnsda
// 18 ==> qlc_3947hepb6ipq1m8b1jdbi6h7te3epqiakeb1j59ppwmi7wnj5optopsdgo5g
// 19 ==> qlc_39grwmri6nwwdfyjqpyumexm4px758ssg7njonfk8qqaxyrhn6kqjocn8scy
}

Build tag

// for testnet
go build -tags testnet -o build/testnet_example example/main.go

// for mainnet
go build -o build/example example/main.go

License

MIT Copyright (c) 2019 QLC Chain

Documentation

Index

Constants

View Source
const BUILDTIME = "2019-06-18_19:44:24"
View Source
const GITREV = "9436e5b"
View Source
const VERSION = "1.0.0"

Variables

This section is empty.

Functions

func SignatureFunc added in v1.2.4

func SignatureFunc(account *types.Account, hash types.Hash) (types.Signature, error)

Types

type APIAccount added in v1.2.4

type APIAccount struct {
	Address        types.Address   `json:"account"`
	CoinBalance    *types.Balance  `json:"coinBalance,omitempty"`
	CoinVote       *types.Balance  `json:"vote,omitempty"`
	CoinNetwork    *types.Balance  `json:"network,omitempty"`
	CoinStorage    *types.Balance  `json:"storage,omitempty"`
	CoinOracle     *types.Balance  `json:"oracle,omitempty"`
	Representative *types.Address  `json:"representative,omitempty"`
	Tokens         []*APITokenMeta `json:"tokens"`
}

type APIAccountBalance added in v1.2.4

type APIAccountBalance struct {
	Address types.Address `json:"address"`
	Balance types.Balance `json:"balance"`
}

type APIAccountsBalance added in v1.2.4

type APIAccountsBalance struct {
	Balance types.Balance  `json:"balance"`
	Vote    *types.Balance `json:"vote,omitempty"`
	Network *types.Balance `json:"network,omitempty"`
	Storage *types.Balance `json:"storage,omitempty"`
	Oracle  *types.Balance `json:"oracle,omitempty"`
	Pending types.Balance  `json:"pending"`
}

type APIBalance added in v1.2.4

type APIBalance struct {
	*big.Float
}

func (*APIBalance) MarshalText added in v1.2.4

func (b *APIBalance) MarshalText() ([]byte, error)

func (*APIBalance) String added in v1.2.4

func (b *APIBalance) String() string

type APIBlock added in v1.2.4

type APIBlock struct {
	*types.StateBlock
	TokenName string        `json:"tokenName"`
	Amount    types.Balance `json:"amount"`
	Hash      types.Hash    `json:"hash"`
}

type APIPending added in v1.2.4

type APIPending struct {
	*types.PendingKey
	*types.PendingInfo
	TokenName string `json:"tokenName"`
	Timestamp int64  `json:"timestamp"`
}

type APIRepresentative added in v1.2.4

type APIRepresentative struct {
	Address types.Address `json:"address"`
	Balance types.Balance `json:"balance"`
	Vote    types.Balance `json:"vote"`
	Network types.Balance `json:"network"`
	Storage types.Balance `json:"storage"`
	Oracle  types.Balance `json:"oracle"`
	Total   types.Balance `json:"total"`
}

type APISendBlockPara added in v1.2.4

type APISendBlockPara struct {
	From      types.Address `json:"from"`
	TokenName string        `json:"tokenName"`
	To        types.Address `json:"to"`
	Amount    types.Balance `json:"amount"`
	Sender    string        `json:"sender"`
	Receiver  string        `json:"receiver"`
	Message   types.Hash    `json:"message"`
}

type APITokenMeta added in v1.2.4

type APITokenMeta struct {
	*types.TokenMeta
	TokenName string        `json:"tokenName"`
	Pending   types.Balance `json:"pending"`
}

type AccountApi added in v1.2.4

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

func NewAccountApi added in v1.2.4

func NewAccountApi(c *rpc.Client) *AccountApi

NewAccountApi creates account module for client

func (*AccountApi) Create added in v1.2.4

func (a *AccountApi) Create(seedStr string, index uint32) (map[string]string, error)

Create gets account by index from seed

func (*AccountApi) ForPublicKey added in v1.2.4

func (a *AccountApi) ForPublicKey(pubStr string) (types.Address, error)

ForPublicKey returns address for public key

func (*AccountApi) NewSeed added in v1.2.4

func (a *AccountApi) NewSeed() (string, error)

NewSeed generates new seed

func (*AccountApi) PublicKey added in v1.2.4

func (a *AccountApi) PublicKey(addr types.Address) string

PublicKey returns public key for address

func (*AccountApi) Validate added in v1.2.4

func (a *AccountApi) Validate(addr string) bool

Validate accepts a address string and checks if it's valid.

type ApiTokenInfo added in v1.2.4

type ApiTokenInfo struct {
	types.TokenInfo
}

type ContractApi added in v1.2.4

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

func NewContractApi added in v1.2.4

func NewContractApi(c *rpc.Client) *ContractApi

NewContractApi creates contract module for client

func (*ContractApi) PackContractData added in v1.2.4

func (c *ContractApi) PackContractData(abiStr string, methodName string, params []string) ([]byte, error)

PackContractData parse a ABI interface and pack the given method name to conform the ABI.

type LedgerApi added in v1.2.4

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

func NewLedgerApi added in v1.2.4

func NewLedgerApi(c *rpc.Client) *LedgerApi

NewLedgerApi creates ledger module for client

func (*LedgerApi) AccountBlocksCount added in v1.2.4

func (l *LedgerApi) AccountBlocksCount(address types.Address) (int64, error)

AccountBlocksCount returns number of blocks for a specific account of chain

func (*LedgerApi) AccountHistoryTopn added in v1.2.4

func (l *LedgerApi) AccountHistoryTopn(address types.Address, count int, offset int) ([]*APIBlock, error)

AccountHistoryTopn returns blocks list for a specific account of chain count is number of blocks to return, and offset is index of block where to start

func (*LedgerApi) AccountInfo added in v1.2.4

func (l *LedgerApi) AccountInfo(address types.Address) (*APIAccount, error)

AccountInfo returns account detail info, include each token meta for the account If account not found, will return error

func (*LedgerApi) AccountRepresentative added in v1.2.4

func (l *LedgerApi) AccountRepresentative(address types.Address) (types.Address, error)

AccountRepresentative returns the representative address for account If account not found, will return error

func (*LedgerApi) AccountVotingWeight added in v1.2.4

func (l *LedgerApi) AccountVotingWeight(address types.Address) (types.Balance, error)

AccountVotingWeight returns the voting weight for account If account not found, will return error

func (*LedgerApi) Accounts added in v1.2.4

func (l *LedgerApi) Accounts(count int, offset int) ([]*types.Address, error)

Accounts returns accounts list of chain count is number of accounts to return, and offset is index of account where to start

func (*LedgerApi) AccountsBalance added in v1.2.4

func (l *LedgerApi) AccountsBalance(addresses []types.Address) (map[types.Address]map[string]*APIAccountsBalance, error)

AccountsBalance returns balance and pending(amount that has not yet been received) for each account

func (*LedgerApi) AccountsCount added in v1.2.4

func (l *LedgerApi) AccountsCount() (uint64, error)

AccountsCount returns total number of accounts of chain

func (*LedgerApi) AccountsFrontiers added in v1.2.4

func (l *LedgerApi) AccountsFrontiers(addresses []types.Address) (map[types.Address]map[string]types.Hash, error)

AccountsFrontiers returns frontier info for each token of account

func (*LedgerApi) AccountsPending added in v1.2.4

func (l *LedgerApi) AccountsPending(addresses []types.Address, n int) (map[types.Address][]*APIPending, error)

AccountsPending returns pending info list for each account maximum number of pending for each account return is n, and if n set to -1, will return all pending for each account

func (*LedgerApi) BlockAccount added in v1.2.4

func (l *LedgerApi) BlockAccount(hash types.Hash) (types.Address, error)

BlockAccount accepts a block hash, and returns account of block owner

func (*LedgerApi) BlockConfirmedStatus added in v1.2.4

func (l *LedgerApi) BlockConfirmedStatus(hash types.Hash) (bool, error)

Return block confirmed status, if block confirmed,return `true`,otherwise return `false`

func (*LedgerApi) BlockHash added in v1.2.4

func (l *LedgerApi) BlockHash(block types.StateBlock) types.Hash

BlockHash return hash of block

func (*LedgerApi) BlockInfo added in v1.2.4

func (l *LedgerApi) BlockInfo(hash types.Hash) (*APIBlock, error)

BlockInfo accepts a block hash, and returns block info for the hash

func (*LedgerApi) Blocks added in v1.2.4

func (l *LedgerApi) Blocks(count int, offset int) ([]*APIBlock, error)

Blocks returns blocks list of chain count is number of blocks to return, and offset is index of block where to start

func (*LedgerApi) BlocksCount added in v1.2.4

func (l *LedgerApi) BlocksCount() (map[string]uint64, error)

BlocksCount returns the number of blocks(include smartcontract block) and unchecked blocks of chain

func (*LedgerApi) BlocksCountByType added in v1.2.4

func (l *LedgerApi) BlocksCountByType() (map[string]uint64, error)

BlocksCountByType returns number of blocks by type of chain

func (*LedgerApi) BlocksInfo added in v1.2.4

func (l *LedgerApi) BlocksInfo(hash []types.Hash) ([]*APIBlock, error)

BlocksInfo accepts blocks hash list, and returns block info for each hash

func (*LedgerApi) Chain added in v1.2.4

func (l *LedgerApi) Chain(hash types.Hash, n int) ([]types.Hash, error)

Chain returns a consecutive block hash list for a specific hash maximum number of blocks hash to return is n, and if n set to -1, will return blocks hash to the open block

func (*LedgerApi) ConfirmedAccountInfo added in v1.2.4

func (l *LedgerApi) ConfirmedAccountInfo(address types.Address) (*APIAccount, error)

Return confirmed account detail info , include each token in the account

func (*LedgerApi) Delegators added in v1.2.4

func (l *LedgerApi) Delegators(hash types.Address) ([]*APIAccountBalance, error)

Delegators accepts a representative account, and returns its delegator and each delegator's balance

func (*LedgerApi) DelegatorsCount added in v1.2.4

func (l *LedgerApi) DelegatorsCount(hash types.Address) (int64, error)

DelegatorsCount gets number of delegators for specific representative account

func (*LedgerApi) GenerateChangeBlock added in v1.2.4

func (l *LedgerApi) GenerateChangeBlock(account types.Address, representative types.Address, sign Signature) (*types.StateBlock, error)

GenerateChangeBlock returns change block by account and new representative address, sign is a function to sign the block

func (*LedgerApi) GenerateReceiveBlock added in v1.2.4

func (l *LedgerApi) GenerateReceiveBlock(txBlock *types.StateBlock, sign Signature) (*types.StateBlock, error)

GenerateReceiveBlock returns receive block by send block, sign is a function to sign the block

func (*LedgerApi) GenerateReceiveBlockByHash added in v1.2.4

func (l *LedgerApi) GenerateReceiveBlockByHash(txHash types.Hash, sign Signature) (*types.StateBlock, error)

GenerateReceiveBlockByHash returns receive block by send block hash, sign is a function to sign the block

func (*LedgerApi) GenerateSendBlock added in v1.2.4

func (l *LedgerApi) GenerateSendBlock(para *APISendBlockPara, sign Signature) (*types.StateBlock, error)

GenerateSendBlock returns send block by transaction parameter, sign is a function to sign the block

func (*LedgerApi) Pending added in v1.2.4

func (l *LedgerApi) Pending(address types.Address, hash types.Hash) (*APIPending, error)

Pending return pending info by account and token hash, if pending not found, return error

func (*LedgerApi) Pendings added in v1.2.4

func (l *LedgerApi) Pendings() ([]*APIPending, error)

Pendings returns pending transaction list on chain

func (*LedgerApi) Performance added in v1.2.4

func (l *LedgerApi) Performance() ([]*types.PerformanceTime, error)

Performance returns performance time

func (*LedgerApi) Process added in v1.2.4

func (l *LedgerApi) Process(block *types.StateBlock) (types.Hash, error)

Process checks block base info , updates info of chain for the block ,and broadcasts block

func (*LedgerApi) Representatives added in v1.2.4

func (l *LedgerApi) Representatives(sorting bool) (*APIRepresentative, error)

Representatives returns pairs of representative and its voting weight of chain if set sorting false , will return representatives randomly, if set true, will sorting representative balance in descending order

func (*LedgerApi) TokenInfoById added in v1.2.4

func (l *LedgerApi) TokenInfoById(tokenId types.Hash) (*ApiTokenInfo, error)

TokenInfoById returns token info by token id

func (*LedgerApi) TokenInfoByName added in v1.2.4

func (l *LedgerApi) TokenInfoByName(tokenName string) (*ApiTokenInfo, error)

TokenInfoById returns token info by token name

func (*LedgerApi) TokenMeta added in v1.2.4

func (l *LedgerApi) TokenMeta(hash types.Hash, address types.Address) (*APITokenMeta, error)

TokenMeta return tokenmeta info by account and token hash

func (*LedgerApi) Tokens added in v1.2.4

func (l *LedgerApi) Tokens() ([]*types.TokenInfo, error)

Tokens return all token info of chain

func (*LedgerApi) TransactionsCount added in v1.2.4

func (l *LedgerApi) TransactionsCount() (map[string]uint64, error)

TransactionsCount returns the number of blocks(not include smartcontract block) and unchecked blocks of chain

type MintageApi added in v1.2.4

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

func NewMintageApi added in v1.2.4

func NewMintageApi(c *rpc.Client) *MintageApi

NewMintageApi creates mintage module for client

func (*MintageApi) GetMintageBlock added in v1.2.4

func (m *MintageApi) GetMintageBlock(param *MintageParams) (*types.StateBlock, error)

GetMintageBlock returns mintage block by mintage parameters

func (*MintageApi) GetMintageData added in v1.2.4

func (m *MintageApi) GetMintageData(param *MintageParams) ([]byte, error)

GetMintageData returns mintage data by mintage parameters

func (*MintageApi) GetRewardBlock added in v1.2.4

func (m *MintageApi) GetRewardBlock(input *types.StateBlock) (*types.StateBlock, error)

GetRewardBlock returns reward block by mintage block

func (*MintageApi) GetWithdrawMintageBlock added in v1.2.4

func (m *MintageApi) GetWithdrawMintageBlock(param *WithdrawParams) (*types.StateBlock, error)

GetWithdrawMintageBlock returns withdraw mintage block by withdraw parameters

func (*MintageApi) GetWithdrawMintageData added in v1.2.4

func (m *MintageApi) GetWithdrawMintageData(tokenId types.Hash) ([]byte, error)

GetWithdrawMintageData returns withdraw mintage data by token id

func (*MintageApi) GetWithdrawRewardBlock added in v1.2.4

func (m *MintageApi) GetWithdrawRewardBlock(input *types.StateBlock) (*types.StateBlock, error)

GetWithdrawRewardBlock returns withdraw mintage block by mintage block

type MintageParams added in v1.2.4

type MintageParams struct {
	SelfAddr    types.Address `json:"selfAddr"`
	PrevHash    types.Hash    `json:"prevHash"`
	TokenName   string        `json:"tokenName"`
	TokenSymbol string        `json:"tokenSymbol"`
	TotalSupply string        `json:"totalSupply"`
	Decimals    uint8         `json:"decimals"`
	Beneficial  types.Address `json:"beneficial"`
	NEP5TxId    string        `json:"nep5TxId"`
}

type NEP5PledgeInfo added in v1.2.4

type NEP5PledgeInfo struct {
	PType         string
	Amount        *big.Int
	WithdrawTime  string
	Beneficial    types.Address
	PledgeAddress types.Address
	NEP5TxId      string
}

type NetApi added in v1.2.4

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

func NewNetApi added in v1.2.4

func NewNetApi(c *rpc.Client) *NetApi

NewNetApi creates net module for client

func (*NetApi) OnlineRepresentatives added in v1.2.4

func (q *NetApi) OnlineRepresentatives() ([]types.Address, error)

OnlineRepresentatives returns representatives that online at this moment

type PledgeApi added in v1.2.4

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

func NewPledgeApi added in v1.2.4

func NewPledgeApi(c *rpc.Client) *PledgeApi

NewPledgeApi creates pledge module for client

func (*PledgeApi) GetPledgeBlock added in v1.2.4

func (p *PledgeApi) GetPledgeBlock(param *PledgeParam) (*types.StateBlock, error)

GetPledgeBlock returns pledge block by pledge parameters

func (*PledgeApi) GetPledgeData added in v1.2.4

func (p *PledgeApi) GetPledgeData(param *PledgeParam) ([]byte, error)

GetMintageData returns pledge data by pledge parameters

func (*PledgeApi) GetPledgeInfoWithNEP5TxId added in v1.2.4

func (p *PledgeApi) GetPledgeInfoWithNEP5TxId(param *WithdrawPledgeParam) (*NEP5PledgeInfo, error)

func (*PledgeApi) GetPledgeRewordBlock added in v1.2.4

func (p *PledgeApi) GetPledgeRewordBlock(input *types.StateBlock) (*types.StateBlock, error)

GetPledgeRewordBlock returns pledge reward block by pledge block

func (*PledgeApi) GetTotalPledgeAmount added in v1.2.4

func (p *PledgeApi) GetTotalPledgeAmount() (*big.Int, error)

func (*PledgeApi) GetWithdrawPledgeBlock added in v1.2.4

func (p *PledgeApi) GetWithdrawPledgeBlock(param *WithdrawPledgeParam) (*types.StateBlock, error)

GetWithdrawPledgeBlock returns withdraw pledge block by withdraw parameters

func (*PledgeApi) GetWithdrawPledgeData added in v1.2.4

func (p *PledgeApi) GetWithdrawPledgeData(param *WithdrawPledgeParam) ([]byte, error)

GetWithdrawPledgeData returns withdraw pledge data by withdraw parameters

func (*PledgeApi) GetWithdrawRewardBlock added in v1.2.4

func (p *PledgeApi) GetWithdrawRewardBlock(input *types.StateBlock) (*types.StateBlock, error)

GetWithdrawRewardBlock returns withdraw reward block by pledge block

func (*PledgeApi) SearchAllPledgeInfo added in v1.2.4

func (p *PledgeApi) SearchAllPledgeInfo() ([]*NEP5PledgeInfo, error)

func (*PledgeApi) SearchPledgeInfo added in v1.2.4

func (p *PledgeApi) SearchPledgeInfo(param *WithdrawPledgeParam) ([]*NEP5PledgeInfo, error)

type PledgeParam added in v1.2.4

type PledgeParam struct {
	Beneficial    types.Address
	PledgeAddress types.Address
	Amount        types.Balance
	PType         string
	NEP5TxId      string
}

type QLCClient

type QLCClient struct {
	Account  *AccountApi
	Contract *ContractApi
	Ledger   *LedgerApi
	Mintage  *MintageApi
	Pledger  *PledgeApi
	Rewards  *RewardsApi
	Network  *NetApi
	SMS      *SMSApi
	Util     *UtilApi
	// contains filtered or unexported fields
}

func NewQLCClient

func NewQLCClient(url string) (*QLCClient, error)

NewQLCClient creates a new client

func (*QLCClient) Close added in v1.1.2

func (c *QLCClient) Close() error

func (*QLCClient) Version

func (c *QLCClient) Version() string

Version returns version for sdk

type RewardsApi added in v1.2.4

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

func NewRewardApi added in v1.2.4

func NewRewardApi(c *rpc.Client) *RewardsApi

NewRewardApi creates reward module for client

func (*RewardsApi) GetConfidantRewords added in v1.2.4

func (r *RewardsApi) GetConfidantRewords(confidant types.Address) (map[string]*big.Int, error)

func (*RewardsApi) GetReceiveRewardBlock added in v1.2.4

func (r *RewardsApi) GetReceiveRewardBlock(send *types.Hash) (*types.StateBlock, error)

func (*RewardsApi) GetSendConfidantBlock added in v1.2.4

func (r *RewardsApi) GetSendConfidantBlock(param *RewardsParam, sign *types.Signature) (*types.StateBlock, error)

func (*RewardsApi) GetSendRewardBlock added in v1.2.4

func (r *RewardsApi) GetSendRewardBlock(param *RewardsParam, sign *types.Signature) (*types.StateBlock, error)

func (*RewardsApi) GetTotalRewards added in v1.2.4

func (r *RewardsApi) GetTotalRewards(txId string) (*big.Int, error)

func (*RewardsApi) GetUnsignedConfidantData added in v1.2.4

func (r *RewardsApi) GetUnsignedConfidantData(param *RewardsParam) (types.Hash, error)

func (*RewardsApi) GetUnsignedRewardData added in v1.2.4

func (r *RewardsApi) GetUnsignedRewardData(param *RewardsParam) (types.Hash, error)

type RewardsParam added in v1.2.4

type RewardsParam struct {
	Id     string        `json:"Id"`
	Amount types.Balance `json:"amount"`
	Self   types.Address `json:"self"`
	To     types.Address `json:"to"`
}

type SMSApi added in v1.2.4

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

func NewSMSApi added in v1.2.4

func NewSMSApi(c *rpc.Client) *SMSApi

NewSMSApi creates sms module for client

func (*SMSApi) MessageBlocks added in v1.2.4

func (s *SMSApi) MessageBlocks(hash types.Hash) ([]*APIBlock, error)

MessageBlock accepts a message hash, and returns blocks that relevant to the hash

func (*SMSApi) MessageHash added in v1.2.4

func (s *SMSApi) MessageHash(message string) (types.Hash, error)

MessageHash returns hash of message

func (*SMSApi) MessageInfo added in v1.2.4

func (s *SMSApi) MessageInfo(mHash types.Hash) (string, error)

MessageInfo returns message for message hash

func (*SMSApi) MessageStore added in v1.2.4

func (s *SMSApi) MessageStore(message string) (types.Hash, error)

MessageStore stores message and returns message hash

func (*SMSApi) PhoneBlocks added in v1.2.4

func (s *SMSApi) PhoneBlocks(phone string) (map[string][]*APIBlock, error)

PhoneBlocks accepts a phone number, and returns send blocks and receiver blocks that relevant to the number

type Signature added in v1.2.4

type Signature func(hash types.Hash) (types.Signature, error)

type UtilApi added in v1.2.4

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

func NewUtilApi added in v1.2.4

func NewUtilApi(c *rpc.Client) *UtilApi

NewUtilApi creates unit module for client

func (*UtilApi) BalanceToRaw added in v1.2.4

func (u *UtilApi) BalanceToRaw(balance types.Balance, unit string) (types.Balance, error)

RawToBalance transforms QLC amount from unit to raw

func (*UtilApi) BalanceToRawForToken added in v1.2.4

func (u *UtilApi) BalanceToRawForToken(balance types.Balance, tokenName string) (types.Balance, error)

RawToBalance transforms token (not QLC) amount to raw

func (*UtilApi) Decrypt added in v1.2.4

func (u *UtilApi) Decrypt(cryptograph string, passphrase string) (string, error)

Decrypt decrypts cryptograph to raw by passphrase

func (*UtilApi) Encrypt added in v1.2.4

func (u *UtilApi) Encrypt(raw string, passphrase string) (string, error)

Encrypt encrypts raw to cryptograph by passphrase

func (*UtilApi) RawToBalance added in v1.2.4

func (u *UtilApi) RawToBalance(balance types.Balance, unit string) (APIBalance, error)

RawToBalance transforms QLC amount from raw to unit

func (*UtilApi) RawToBalanceForToken added in v1.2.4

func (u *UtilApi) RawToBalanceForToken(balance types.Balance, tokenName string) (APIBalance, error)

RawToBalance transforms token (not QLC) amount from raw

type WithdrawParams added in v1.2.4

type WithdrawParams struct {
	SelfAddr types.Address `json:"selfAddr"`
	TokenId  types.Hash    `json:"tokenId"`
}

type WithdrawPledgeParam added in v1.2.4

type WithdrawPledgeParam struct {
	Beneficial types.Address `json:"beneficial"`
	Amount     types.Balance `json:"amount"`
	PType      string        `json:"pType"`
	NEP5TxId   string        `json:"nep5TxId"`
}

Directories

Path Synopsis
robot command
pkg
ed25519
Package ed25519 implements the Ed25519 signature algorithm.
Package ed25519 implements the Ed25519 signature algorithm.
util
Package common contains various helper functions.
Package common contains various helper functions.
util/hexutil
Package hexutil implements hex encoding with 0x prefix.
Package hexutil implements hex encoding with 0x prefix.

Jump to

Keyboard shortcuts

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