types

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2019 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UTXO_DESTS_MAX_NUM = 16
	UTXO_ADDR_STR_LEN  = 94
)

Variables

View Source
var (
	ErrNoConnectionToDaemon = errors.New("no_connection_to_daemon")
	// ErrDaemonBusy           = errors.New("daemon_busy")
	// ErrGetHashes            = errors.New("get_hashes_error")
	// ErrGetBlocks            = errors.New("get_blocks_error")
	ErrWalletNotOpen       = errors.New("wallet not open")
	ErrNotFoundTxKey       = errors.New("not found tx key")
	ErrTxNotFound          = errors.New("tx not found")
	ErrNoTransInTx         = errors.New("no trans in tx")
	ErrArgsInvalid         = errors.New("args invalid")
	ErrUTXONotSupportToken = errors.New("utxo not support token")
	ErrUTXODestsOverLimit  = fmt.Errorf("utxo dests over limit, should less than %d", UTXO_DESTS_MAX_NUM)
	ErrNoNeedToProof       = errors.New("account input utxo trans do not need proof")
	ErrBlockNotFound       = errors.New("block not found")
	ErrBlockParentHash     = errors.New("err block parent hash")
	ErrOutputNotFound      = errors.New("output not found")
	ErrSubAccountTooLarge  = errors.New("subaccount is too large")
	ErrSaveAccountSubCnt   = errors.New("save AccountSubCnt fail")
	ErrAddInfoNotFound     = errors.New("utxo add info not found")
)

Functions

This section is empty.

Types

type AccountInput added in v0.1.1

type AccountInput struct {
	From   common.Address `json:"from"`
	Nonce  hexutil.Uint64 `json:"nonce"`
	Amount *hexutil.Big   `json:"amount"` //Amount  =  user set amount + Fee, b in c = aG + bH
}

type AccountOutput added in v0.1.1

type AccountOutput struct {
	To     common.Address `json:"to"`
	Amount *hexutil.Big   `json:"amount"`
	Data   hexutil.Bytes  `json:"data"` //contract data
}

type BalanceArgs

type BalanceArgs struct {
	AccountIndex hexutil.Uint64  `json:"index"`
	TokenID      *common.Address `json:"token"`
	Addr         *common.Address `json:"addr"`
}

type BalanceResult

type BalanceResult struct {
	Balance *hexutil.Big    `json:"balance"`
	Address string          `json:"address"`
	TokenID *common.Address `json:"token"`
}

type BlockHeightResult

type BlockHeightResult struct {
	LocalHeight  *hexutil.Big `json:"local_height"`
	RemoteHeight *hexutil.Big `json:"remote_height"`
}

type CallArgs

type CallArgs struct {
	From         common.Address     `json:"from"`
	TokenAddress common.Address     `json:"tokenAddress"`
	To           *common.Address    `json:"to"`
	Gas          hexutil.Uint64     `json:"gas"`
	GasPrice     hexutil.Big        `json:"gasPrice"`
	Value        hexutil.Big        `json:"value"`
	Data         hexutil.Bytes      `json:"data"`
	Nonce        hexutil.Uint64     `json:"nonce"`
	UTXOKind     types.UTXOKind     `json:"utxokind"`
	Outputs      []types.OutputData `json:"outputs"`
}

CallArgs represents the arguments for a call.

type CheckTxKeyArgs

type CheckTxKeyArgs struct {
	TxHash   common.Hash  `json:"hash"`
	TxKey    lkctypes.Key `json:"key"`
	DestAddr string       `json:"dest"`
}

type CheckTxKeyResult

type CheckTxKeyResult struct {
	BlockID hexutil.Uint64 `json:"height"`
	Amount  *hexutil.Big   `json:"amount"`
}

type EthAccount

type EthAccount struct {
	Address common.Address `json:"address"`
	Balance *hexutil.Big   `json:"balance"`
	Nonce   hexutil.Uint64 `json:"nonce"`
}

func (*EthAccount) Equal added in v0.1.1

func (ea *EthAccount) Equal(t *EthAccount) bool

type GetAccountInfoResult

type GetAccountInfoResult struct {
	EthAccount   EthAccount      `json:"eth_account"`
	UTXOAccounts []UTXOAccount   `json:"utxo_accounts"`
	TotalBalance *hexutil.Big    `json:"total_balance"`
	TokenID      *common.Address `json:"token"`
}

func (*GetAccountInfoResult) Equal added in v0.1.1

type LocalOutputsArgs added in v0.1.1

type LocalOutputsArgs struct {
	IDs  []hexutil.Uint64 `json:"ids"`
	Addr *common.Address  `json:"addr"`
}

type NetConfig

type NetConfig struct {
	CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX    int
	CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX int
	CRYPTONOTE_PREFIX_LENGTH                   int
	CRYPTONOTE_ADDRESS_LENGTH                  int
	CRYPTONOTE_CHECKSUM_LENGTH                 int
}

func GetConfig

func GetConfig() *NetConfig

type ProofKeyArgs

type ProofKeyArgs struct {
	Hash    common.Hash     `json:"hash"`
	Addr    string          `json:"addr"`
	EthAddr *common.Address `json:"eth_addr"`
}

type ProofKeyRet

type ProofKeyRet struct {
	ProofKey string `json:"proof_key"`
}

type RPCErr

type RPCErr struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type RPCInput added in v0.1.1

type RPCInput interface {
}

type RPCOutput added in v0.1.1

type RPCOutput interface {
}

Output represents a utxo or account output

type RPCResponse

type RPCResponse struct {
	ID      uint64          `json:"id"`
	Jsonrpc string          `json:"jsonrpc"`
	Result  json.RawMessage `json:"result"`
	Error   RPCErr          `json:"error"`
}

type SendTxRet

type SendTxRet struct {
	Raw     string         `json:"raw"`
	Hash    common.Hash    `json:"hash"`
	Gas     hexutil.Uint64 `json:"gas"`
	ErrCode int            `json:"err_code"`
	ErrMsg  string         `json:"err_msg"`
}

type SendUTXOTransactionResult

type SendUTXOTransactionResult struct {
	Txs []SendTxRet `json:"tx"`
}

type SendUTXOTxArgs

type SendUTXOTxArgs struct {
	From     common.Address    `json:"from"`
	Nonce    *hexutil.Uint64   `json:"nonce"`
	SubAddrs []uint64          `json:"subaddrs"`
	Dests    []*types.UTXODest `json:"dests"`
	TokenID  *common.Address   `json:"token"`
}

func (*SendUTXOTxArgs) SetDefaults

func (s *SendUTXOTxArgs) SetDefaults()

type SignUTXORet

type SignUTXORet struct {
	Raw       string         `json:"raw"`
	Hash      common.Hash    `json:"hash"`
	Gas       hexutil.Uint64 `json:"gas"`
	Subaddrs  []uint64       `json:"subaddrs"`
	OutAmount *big.Int       `json:"outamount"`
}

type SignUTXOTransactionResult

type SignUTXOTransactionResult struct {
	Txs []SignUTXORet `json:"txs"`
}

type StatusResult

type StatusResult struct {
	RemoteHeight         *hexutil.Big   `json:"remote_height"`
	LocalHeight          *hexutil.Big   `json:"local_height"`
	WalletOpen           bool           `json:"wallet_open"`
	AutoRefresh          bool           `json:"auto_refresh"`
	WalletVersion        string         `json:"wallet_version"`
	ChainVersion         string         `json:"chain_version"`
	EthAddress           common.Address `json:"eth_address"`
	RefreshBlockInterval time.Duration  `json:"refresh_block_interval"`
	InitBlockHeight      hexutil.Uint64 `json:"init_block_height"`
}

type UTXOAccount

type UTXOAccount struct {
	Address string         `json:"address"`
	Index   hexutil.Uint64 `json:"index"`
	Balance *hexutil.Big   `json:"balance"`
}

func (*UTXOAccount) Equal added in v0.1.1

func (ua *UTXOAccount) Equal(t *UTXOAccount) bool

type UTXOAddInfo added in v0.1.1

type UTXOAddInfo struct {
	Subaddrs  []uint64 `json:"subaddrs"`
	OutAmount *big.Int `json:"outamount"`
}

type UTXOBlock added in v0.1.1

type UTXOBlock struct {
	Height *hexutil.Big      `json:"height"`
	Time   *hexutil.Big      `json:"timestamp"`
	Txs    []UTXOTransaction `json:"txs"`
}

type UTXOInput added in v0.1.1

type UTXOInput struct {
	GlobalIndex hexutil.Uint64 `json:"global_index"`
}

type UTXOOutput added in v0.1.1

type UTXOOutput struct {
	OTAddr      common.Hash    `json:"otaddr"`
	GlobalIndex hexutil.Uint64 `json:"global_index"`
}

UTXOOutput represents a utxo output

type UTXOOutputDetail added in v0.1.1

type UTXOOutputDetail struct {
	GlobalIndex  hexutil.Uint64 `json:"global_index"`
	Amount       *hexutil.Big   `json:"amount"`
	SubAddrIndex hexutil.Uint64 `json:"sub_addr_index"`
	TokenID      common.Address `json:"token_id"`
	Remark       hexutil.Bytes  `json:"remark"`
}

type UTXOTransaction added in v0.1.1

type UTXOTransaction struct {
	Inputs  []RPCInput     `json:"inputs"`
	Outputs []RPCOutput    `json:"outputs"`
	TokenID common.Address `json:"token_id"` //current version one Tx support only one token
	Fee     *hexutil.Big   `json:"fee"`      //fee charge only LKC, without unit (different from gas)
	Hash    common.Hash    `json:"hash"`
	TxFlag  uint8          `json:"tx_flag"` // 1 - income,2- output,3-in and out
}

type VerifyProofKey

type VerifyProofKey struct {
	Hash   common.Hash  `json:"hash"`
	Addr   string       `json:"addr"`
	Amount *hexutil.Big `json:"amount"`
}

type VerifyProofKeyArgs

type VerifyProofKeyArgs struct {
	Hash    common.Hash     `json:"hash"`
	Addr    string          `json:"addr"`
	Key     string          `json:"key"`
	EthAddr *common.Address `json:"eth_addr"`
}

type VerifyProofKeyRet

type VerifyProofKeyRet struct {
	Records []*VerifyProofKey `json:"records"`
}

Jump to

Keyboard shortcuts

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