types

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2019 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UTXO_DESTS_MAX_NUM = 16
	UTXO_ADDR_STR_LEN  = 94
)

Variables

View Source
var (
	ErrArgsInvalid         = NewWErr(-600001, "args invalid")
	ErrUTXONotSupportToken = NewWErr(-600002, "utxo not support token")
	ErrPasswdEmpty         = NewWErr(-600003, "password empty")
	ErrCueTooLong          = NewWErr(-600004, "cue too long")
	ErrUTXODestsOverLimit  = NewWErr(-600005, fmt.Sprintf("utxo dests over limit, should less than %d", UTXO_DESTS_MAX_NUM))
	ErrAccDestsOverLimit   = NewWErr(-600006, "account output too more")
	ErrTxTypeNotSupport    = NewWErr(-600007, "not support tx type")
	ErrNoNeedToProof       = NewWErr(-600008, "account input utxo trans do not need proof")
	ErrNoTransInTx         = NewWErr(-600009, "no trans in tx")
	ErrWalletNotOpen       = NewWErr(-600010, "wallet not open")
	ErrAccountNeedUnlock   = NewWErr(-600011, "account need unlock")
	ErrNewUTXOAccount      = NewWErr(-600012, "fail new UTXO account")

	ErrAccountNotFound      = NewWErr(-601001, "account not found")
	ErrNewAccount           = NewWErr(-601002, "new account fail")
	ErrStrToAddressInvalid  = NewWErr(-601003, "str to address invalid")
	ErrStrToAddressCheckSum = NewWErr(-601004, "str to address check sum fail")
	ErrAccBalanceUpdate     = NewWErr(-601005, "update balance fail")
	ErrSubaddrIdxOverRange  = NewWErr(-601006, "subaddr index over range")
	ErrSubAccountOverLimit  = NewWErr(-601007, "subaccount over limit")

	ErrTransNeedSplit       = NewWErr(-602001, "Transaction would be too large.  try transfer_split")
	ErrBlockParentHash      = NewWErr(-602002, "err block parent hash")
	ErrOutputQueryNotMatch  = NewWErr(-602003, "output query not match")
	ErrOutputEmpty          = NewWErr(-602004, "output empty")
	ErrOutputMoneyInvalid   = NewWErr(-602005, "output money invalid")
	ErrOutputMoneyOverFlow  = NewWErr(-602006, "sum output money over flow")
	ErrBalanceNotEnough     = NewWErr(-602007, "balance not enough")
	ErrSignTx               = NewWErr(-602008, "sign tx err")
	ErrNewAinTrans          = NewWErr(-602009, "new account input transaction err")
	ErrNoMoreOutput         = NewWErr(-602010, "no more output")
	ErrTxTooBig             = NewWErr(-602011, "tx too big")
	ErrNewUinTrans          = NewWErr(-602012, "new utxo input transaction err")
	ErrUinTransWithSign     = NewWErr(-602013, "utxo transaction with sign err")
	ErrNotSupportContractTx = NewWErr(-602014, "not support contract tx")
	ErrMixInputNotSupport   = NewWErr(-602015, "mix input not support")
	ErrTransInvalid         = NewWErr(-602016, "transaction output amount invalid")
	ErrExactMatchFail       = NewWErr(-602017, "DFS exact mathch fail")
	ErrDestsMergeFail       = NewWErr(-602018, "dests merge fail")
	ErrTokenFeeNotEnough    = NewWErr(-602019, "balance not enough for token fee")
	ErrAddingFeeNotEnough   = NewWErr(-602020, "balance not enough for fee when transfer split")
	ErrUtxoPoolDeplete      = NewWErr(-602021, "utxo pool deplete when transfer split")

	ErrNoConnectionToDaemon   = NewWErr(-603001, "no_connection_to_daemon")
	ErrDaemonResponseBody     = NewWErr(-603002, "dameon response body err")
	ErrDaemonResponseCode     = NewWErr(-603003, "dameon response code err")
	ErrDaemonResponseData     = NewWErr(-603004, "dameon response data err")
	ErrSubmitTrans            = NewWErr(-603005, "submit transaction fail")
	ErrGetTransactionCount    = NewWErr(-603006, "getTransactionCount fail")
	ErrSendRawTransaction     = NewWErr(-603007, "sendRawTransaction fail")
	ErrSendRawUTXOTransaction = NewWErr(-603008, "sendRawUTXOTransaction fail")
	ErrEstimateGas            = NewWErr(-603009, "estimateGas fail")

	ErrSaveAccountSubCnt = NewWErr(-604001, "save AccountSubCnt fail")
	ErrNotFoundTxKey     = NewWErr(-604002, "not found tx key")
	ErrBlockNotFound     = NewWErr(-604003, "block not found")
	ErrOutputNotFound    = NewWErr(-604004, "output not found")
	ErrBatchSave         = NewWErr(-604005, "batch save fail")
	ErrBatchCommit       = NewWErr(-604006, "batch commit fail")
	ErrSaveTxKey         = NewWErr(-604007, "tx key save fail")
	ErrTxNotFound        = NewWErr(-604008, "tx not found")
	ErrUTXOTxCommit      = NewWErr(-604009, "utxo tx commit fail")
	ErrAddInfoNotFound   = NewWErr(-604010, "utxo add info not found")
	ErrTxAddInfoCommit   = NewWErr(-604011, "tx add info commit fail")
	ErrTxAddInfoDel      = NewWErr(-604012, "tx add info del fail")

	ErrInnerServer = NewWErr(-605001, "server inner error")
)

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"`
	ChangeIdx int      `json:"change_idx"`
}

type UTXOBlock added in v0.1.1

type UTXOBlock struct {
	Height     *hexutil.Big      `json:"height"`
	NextHeight *hexutil.Big      `json:"next_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"`
	IsChange    bool           `json:"is_change"`
}

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"`
}

type WErr added in v0.1.2

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

func NewWErr added in v0.1.2

func NewWErr(code int, msg string) *WErr

func (*WErr) Error added in v0.1.2

func (e *WErr) Error() string

func (*WErr) ErrorCode added in v0.1.2

func (e *WErr) ErrorCode() int

Jump to

Keyboard shortcuts

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