module

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignatureFunc

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

Types

type AccountApi

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

func NewAccountApi

func NewAccountApi(c *rpc.Client) *AccountApi

NewAccountApi creates account module for client

func (*AccountApi) Create

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

Create gets account by index from seed

func (*AccountApi) ForPublicKey

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

ForPublicKey returns address for public key

func (*AccountApi) NewSeed added in v1.1.0

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

NewSeed generates new seed

func (*AccountApi) PublicKey

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

PublicKey returns public key for address

func (*AccountApi) Validate

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

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

type ContractApi

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

func NewContractApi

func NewContractApi(c *rpc.Client) *ContractApi

NewContractApi creates contract module for client

func (*ContractApi) PackContractData

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

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

func NewLedgerApi

func NewLedgerApi(c *rpc.Client) *LedgerApi

NewLedgerApi creates ledger module for client

func (*LedgerApi) AccountBlocksCount

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

AccountBlocksCount returns number of blocks for a specific account of chain

func (*LedgerApi) AccountHistoryTopn

func (l *LedgerApi) AccountHistoryTopn(address types.Address, count int, offset int) ([]*api.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

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

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

func (*LedgerApi) AccountRepresentative

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

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

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

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

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

func (*LedgerApi) AccountsCount

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

AccountsCount returns total number of accounts of chain

func (*LedgerApi) AccountsFrontiers

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

func (l *LedgerApi) AccountsPending(addresses []types.Address, n int) (map[types.Address][]*api.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

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

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

func (*LedgerApi) BlockHash

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

BlockHash return hash of block

func (*LedgerApi) BlockInfo

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

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

func (*LedgerApi) Blocks

func (l *LedgerApi) Blocks(count int, offset int) ([]*api.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

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

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

BlocksCountByType returns number of blocks by type of chain

func (*LedgerApi) BlocksInfo

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

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

func (*LedgerApi) Chain

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

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

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

func (*LedgerApi) DelegatorsCount

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

DelegatorsCount gets number of delegators for specific representative account

func (*LedgerApi) GenerateChangeBlock

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

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

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

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

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

func (*LedgerApi) Pending

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

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

func (*LedgerApi) Pendings added in v1.1.0

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

Pendings returns pending transaction list on chain

func (*LedgerApi) Performance

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

Performance returns performance time

func (*LedgerApi) Process

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

func (l *LedgerApi) Representatives(sorting bool) (*api.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

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

TokenInfoById returns token info by token id

func (*LedgerApi) TokenInfoByName

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

TokenInfoById returns token info by token name

func (*LedgerApi) TokenMeta

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

TokenMeta return tokenmeta info by account and token hash

func (*LedgerApi) Tokens

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

Tokens return all token info of chain

func (*LedgerApi) TransactionsCount

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

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

func NewMintageApi

func NewMintageApi(c *rpc.Client) *MintageApi

NewMintageApi creates mintage module for client

func (*MintageApi) GetMintageBlock

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

GetMintageBlock returns mintage block by mintage parameters

func (*MintageApi) GetMintageData

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

GetMintageData returns mintage data by mintage parameters

func (*MintageApi) GetRewardBlock

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

GetRewardBlock returns reward block by mintage block

func (*MintageApi) GetWithdrawMintageBlock added in v1.1.0

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

GetWithdrawMintageBlock returns withdraw mintage block by withdraw parameters

func (*MintageApi) GetWithdrawMintageData

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

GetWithdrawMintageData returns withdraw mintage data by token id

func (*MintageApi) GetWithdrawRewardBlock added in v1.1.0

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

GetWithdrawRewardBlock returns withdraw mintage block by mintage block

type NetApi

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

func NewNetApi

func NewNetApi(c *rpc.Client) *NetApi

NewNetApi creates net module for client

func (*NetApi) OnlineRepresentatives

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

OnlineRepresentatives returns representatives that online at this moment

type PledgeApi added in v1.1.0

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

func NewPledgeApi added in v1.1.0

func NewPledgeApi(c *rpc.Client) *PledgeApi

NewPledgeApi creates pledge module for client

func (*PledgeApi) GetPledgeBlock added in v1.1.0

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

GetPledgeBlock returns pledge block by pledge parameters

func (*PledgeApi) GetPledgeData added in v1.1.0

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

GetMintageData returns pledge data by pledge parameters

func (*PledgeApi) GetPledgeInfoWithNEP5TxId added in v1.1.2

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

func (*PledgeApi) GetPledgeRewordBlock added in v1.1.0

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.1

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

func (*PledgeApi) GetWithdrawPledgeBlock added in v1.1.0

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

GetWithdrawPledgeBlock returns withdraw pledge block by withdraw parameters

func (*PledgeApi) GetWithdrawPledgeData added in v1.1.0

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

GetWithdrawPledgeData returns withdraw pledge data by withdraw parameters

func (*PledgeApi) GetWithdrawRewardBlock added in v1.1.0

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

GetWithdrawRewardBlock returns withdraw reward block by pledge block

func (*PledgeApi) SearchAllPledgeInfo added in v1.1.0

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

func (*PledgeApi) SearchPledgeInfo added in v1.1.0

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

type RewardsApi added in v1.2.1

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

func NewRewardApi added in v1.2.1

func NewRewardApi(c *rpc.Client) *RewardsApi

NewRewardApi creates reward module for client

func (*RewardsApi) GetConfidantRewords added in v1.2.1

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

func (*RewardsApi) GetReceiveRewardBlock added in v1.2.1

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

func (*RewardsApi) GetSendConfidantBlock added in v1.2.1

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

func (*RewardsApi) GetSendRewardBlock added in v1.2.1

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

func (*RewardsApi) GetTotalRewards added in v1.2.1

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

func (*RewardsApi) GetUnsignedConfidantData added in v1.2.1

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

func (*RewardsApi) GetUnsignedRewardData added in v1.2.1

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

type SMSApi

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

func NewSMSApi

func NewSMSApi(c *rpc.Client) *SMSApi

NewSMSApi creates sms module for client

func (*SMSApi) MessageBlocks

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

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

func (*SMSApi) MessageHash

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

MessageHash returns hash of message

func (*SMSApi) MessageInfo

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

MessageInfo returns message for message hash

func (*SMSApi) MessageStore

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

MessageStore stores message and returns message hash

func (*SMSApi) PhoneBlocks

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

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

type Signature

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

type UtilApi

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

func NewUtilApi

func NewUtilApi(c *rpc.Client) *UtilApi

NewUtilApi creates unit module for client

func (*UtilApi) BalanceToRaw

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

RawToBalance transforms QLC amount from unit to raw

func (*UtilApi) BalanceToRawForToken

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

RawToBalance transforms token (not QLC) amount to raw

func (*UtilApi) Decrypt

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

Decrypt decrypts cryptograph to raw by passphrase

func (*UtilApi) Encrypt

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

Encrypt encrypts raw to cryptograph by passphrase

func (*UtilApi) RawToBalance

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

RawToBalance transforms QLC amount from raw to unit

func (*UtilApi) RawToBalanceForToken

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

RawToBalance transforms token (not QLC) amount from raw

Jump to

Keyboard shortcuts

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