wallet

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: 32 Imported by: 0

Documentation

Overview

Package wallet is a generated GoMock package.

Index

Constants

View Source
const (
	DFS_TOTAL_TRIES         = 1000000
	UTXO_TX_LOW_SIZE_LIMIT  = 1024 * 25
	UTXO_TX_HIGH_SIZE_LIMIT = 1024 * 30
)
View Source
const (
	UTXOTRANSACTION_MAX_SIZE     = 1024 * 20
	UTXOTRANSACTION_FEE_MAX_SIZE = 1024 * 28
	UTXOTRANSACTION_FEE          = 1e13
	UTXO_SIMPLE_RING_SIZE        = 1
	UTXO_DEFAULT_RING_SIZE       = 11
	UTXO_OUTPUT_QUERY_PAGESIZE   = 2   //2*UTXO_DEFAULT_RING_SIZE
	ACCOUNT_TRANS_FIXED_FEE_RATE = 200 //0.005
)
View Source
const (
	// WalletVersion define curr wallet version
	WalletVersion = "0.1.3"
)

Variables

View Source
var (
	LinkToken = common.EmptyAddress
)

Functions

func AddressToStr

func AddressToStr(key *lktypes.AccountKey, index uint64) string

AddressToStr return prefix + spend public key + view public key + checksum

func GenerateKeys

func GenerateKeys(key lktypes.SecretKey) (lktypes.SecretKey, lktypes.PublicKey)

GenerateKeys return spend secret key and spend public key

func GetSubaddr

func GetSubaddr(key *lktypes.AccountKey, index uint64) string

GetSubaddr return a subaddr

func IsSubaddress

func IsSubaddress(str string) (bool, error)

func KeyFromAccount

func KeyFromAccount(keyjson []byte, passwd string) (lktypes.SecretKey, error)

KeyFromAccount return secret key from the account keystore file. we use this key as the recovery key of utxo

func KeyToWords

func KeyToWords(key lktypes.SecretKey) (string, error)

KeyToWords Converts bytes (secret key) to seed words

func StrToAddress

func StrToAddress(str string) (*lktypes.AccountAddress, error)

StrToAddress parse address str and return utxo address

func WordsToKey

func WordsToKey(words string) (lktypes.SecretKey, error)

WordsToKey Converts seed words to bytes (secret key)

Types

type AccountBase

type AccountBase struct {
	Keys              []*lkctypes.AccountKey
	KeyIndex          map[lkctypes.PublicKey]uint64
	CreationTimestamp int64
	CurrIdx           uint64
	EthAddress        common.Address
}

AccountBase UTXO account base

func NewAccount

func NewAccount(config *cfg.Config) (*AccountBase, error)

NewAccount return AccountBase ,constructed from config

func NewUTXOAccount

func NewUTXOAccount(keystoreFile string, password string) (*AccountBase, error)

NewUTXOAccount return AccountBase ,constructed from config

func RecoveryKeyToAccount

func RecoveryKeyToAccount(rk lktypes.SecretKey) (*AccountBase, error)

RecoveryKeyToAccount recovery utxo account from the key

func WordsToAccount

func WordsToAccount(words string) (*AccountBase, error)

WordsToAccount recovery utxo account from the words

func (*AccountBase) CreateSubAccount

func (a *AccountBase) CreateSubAccount() (string, uint64, error)

CreateSubAccount create a sub address,return account address and sub index

func (*AccountBase) CreateSubAccountN

func (a *AccountBase) CreateSubAccountN(cnt int) error

CreateSubAccountN create cnt subAddress

func (*AccountBase) GetCreatetime

func (a *AccountBase) GetCreatetime() int64

GetCreatetime return accountBase create time

func (*AccountBase) GetKeys

func (a *AccountBase) GetKeys() *lkctypes.AccountKey

GetKeys return CurrIdx key,default is main key

func (*AccountBase) String

func (a *AccountBase) String() string

func (*AccountBase) ZeroKey

func (a *AccountBase) ZeroKey()

ZeroKey zeroes a private key in memory.

type BackendAPI added in v0.1.3

type BackendAPI interface {
	EthGetTransactionCount(addr common.Address) (*uint64, error)
	RefreshMaxBlock() (*big.Int, error)
	GetOutputsFromNode(indice []uint64, tokenID common.Address) ([]*types.UTXORingEntry, error)
	IsContract(addr common.Address) (bool, error)
	EstimateGas(from common.Address, nonce uint64, dest *types.AccountDestEntry, kind types.UTXOKind, tokenID common.Address) (*big.Int, error)
	GetTokenBalance(addr common.Address, tokenID common.Address) (*big.Int, error)
	Transfer(txs []string) (ret []wtypes.SendTxRet)
	GetChainVersion() (string, error)
	GetBlockUTXOsByNumber(height *big.Int) (*rtypes.RPCBlock, error)
	GetUTXOGas() (uint64, error)
	GetBlockTransactionCountByNumber(blockNr rpc.BlockNumber) (*hexutil.Uint, error)
	GetBlockTransactionCountByHash(blockHash common.Hash) (*hexutil.Uint, error)
	GetTransactionByBlockNumberAndIndex(blockNr rpc.BlockNumber, index hexutil.Uint) (r interface{}, err error)
	GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (r interface{}, err error)
	GetRawTransactionByBlockNumberAndIndex(blockNr rpc.BlockNumber, index hexutil.Uint) (r hexutil.Bytes, err error)
	GetRawTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (r hexutil.Bytes, err error)
	GetTransactionCount(address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)
	GetTransactionByHash(hash common.Hash) (r interface{}, err error)
	GetRawTransactionByHash(hash common.Hash) (r hexutil.Bytes, err error)
	GetTransactionReceipt(hash common.Hash) (r map[string]interface{}, err error)
	EthEstimateGas(args wtypes.CallArgs) (*hexutil.Uint64, error)
	SendRawTransaction(encodedTx hexutil.Bytes) (common.Hash, error)
	SendRawUTXOTransaction(encodedTx hexutil.Bytes) (common.Hash, error)
	GetBlockUTXO(height *big.Int) (*rtypes.QuickRPCBlock, error)
	GenesisBlockNumber() (*hexutil.Uint64, error)
	Call(args wtypes.CallArgs, blockNr string) (*hexutil.Bytes, error)
}

BackendAPI for node

type InputMode

type InputMode uint8
const (
	AccountInputMode InputMode = 0
	UTXOInputMode    InputMode = 1
	MixInputMode     InputMode = 2
)

type LinkAccount

type LinkAccount struct {
	// cmn.BaseService
	Logger log.Logger

	AccBalance map[common.Address]balanceMap //key:tokenid

	Transfers transferContainer
	// contains filtered or unexported fields
}

LinkAccount -

func NewLinkAccount

func NewLinkAccount(walletDB dbm.DB, logger log.Logger, keystoreFile string, password string, api BackendAPI) (*LinkAccount, error)

NewLinkAccount return a LinkAccount

func (*LinkAccount) AutoRefreshBlockchain

func (la *LinkAccount) AutoRefreshBlockchain(autoRefresh bool) error

AutoRefreshBlockchain set autoRefresh

func (*LinkAccount) CreateSubAccount

func (la *LinkAccount) CreateSubAccount(maxSub uint64) error

CreateSubAccount return new sub address and sub index

func (*LinkAccount) DelUTXOAddInfo added in v0.1.1

func (la *LinkAccount) DelUTXOAddInfo(hash common.Hash) error

func (*LinkAccount) GetAccountInfo

func (la *LinkAccount) GetAccountInfo(tokenID *common.Address) (*types.GetAccountInfoResult, error)

GetAccountInfo return eth_account and utxo_accounts

func (*LinkAccount) GetAddress

func (la *LinkAccount) GetAddress(index uint64) (string, error)

GetAddress rpc get address

func (*LinkAccount) GetBalance

func (la *LinkAccount) GetBalance(index uint64, token *common.Address) *big.Int

GetBalance rpc get balance

func (*LinkAccount) GetGOutIndex

func (la *LinkAccount) GetGOutIndex(token common.Address) uint64

GetGOutIndex return curr idx

func (*LinkAccount) GetHeight

func (la *LinkAccount) GetHeight() (localHeight *big.Int, remoteHeight *big.Int)

GetHeight rpc get height

func (*LinkAccount) GetLocalOutputs added in v0.1.1

func (la *LinkAccount) GetLocalOutputs(ids []hexutil.Uint64) ([]types.UTXOOutputDetail, error)

GetLocalOutputs return UTXOTransaction

func (*LinkAccount) GetLocalUTXOTxsByHeight added in v0.1.1

func (la *LinkAccount) GetLocalUTXOTxsByHeight(height *big.Int) (*types.UTXOBlock, error)

GetLocalUTXOTxsByHeight return UTXOTransaction

func (*LinkAccount) GetMaxOutput

func (la *LinkAccount) GetMaxOutput(tokenID common.Address) (*hexutil.Uint64, error)

GetMaxOutput return tokenID max output idx

func (*LinkAccount) GetTxKey

func (la *LinkAccount) GetTxKey(hash *common.Hash) (*lkctypes.Key, error)

GetTxKey return transaction's tx secKey

func (*LinkAccount) GetUTXOAddInfo added in v0.1.1

func (la *LinkAccount) GetUTXOAddInfo(hash common.Hash) (*types.UTXOAddInfo, error)

func (*LinkAccount) GetUTXOTx

func (la *LinkAccount) GetUTXOTx(hash common.Hash) (*tctypes.UTXOTransaction, error)

GetUTXOTx return UTXOTransaction

func (*LinkAccount) OnStart

func (la *LinkAccount) OnStart() error

OnStart starts the Wallet. It implements cmn.Service.

func (*LinkAccount) OnStop

func (la *LinkAccount) OnStop()

OnStop stops the Wallet. It implements cmn.Service.

func (*LinkAccount) Refresh

func (la *LinkAccount) Refresh()

Refresh wallet

func (*LinkAccount) RefreshQuick added in v0.1.1

func (la *LinkAccount) RefreshQuick()

RefreshQuick wallet

func (*LinkAccount) RescanBlockchain

func (la *LinkAccount) RescanBlockchain() error

RescanBlockchain ,reset wallet block and transfer info

func (*LinkAccount) SetRefreshBlockInterval

func (la *LinkAccount) SetRefreshBlockInterval(interval time.Duration)

SetRefreshBlockInterval set refreshBlockInterval

func (*LinkAccount) SetSyncQuick added in v0.1.1

func (la *LinkAccount) SetSyncQuick(quick bool)

SetSyncQuick set la.syncQuick

func (*LinkAccount) Status

func (la *LinkAccount) Status() *types.StatusResult

Status return wallet status

type MockBackendAPI added in v0.1.3

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

MockBackendAPI is a mock of BackendAPI interface

func NewMockBackendAPI added in v0.1.3

func NewMockBackendAPI(ctrl *gomock.Controller) *MockBackendAPI

NewMockBackendAPI creates a new mock instance

func (*MockBackendAPI) Call added in v0.1.3

func (m *MockBackendAPI) Call(arg0 types0.CallArgs, arg1 string) (*hexutil.Bytes, error)

Call mocks base method

func (*MockBackendAPI) EXPECT added in v0.1.3

EXPECT returns an object that allows the caller to indicate expected use

func (*MockBackendAPI) EstimateGas added in v0.1.3

func (m *MockBackendAPI) EstimateGas(arg0 common.Address, arg1 uint64, arg2 *types.AccountDestEntry, arg3 types.UTXOKind, arg4 common.Address) (*big.Int, error)

EstimateGas mocks base method

func (*MockBackendAPI) EthEstimateGas added in v0.1.3

func (m *MockBackendAPI) EthEstimateGas(arg0 types0.CallArgs) (*hexutil.Uint64, error)

EthEstimateGas mocks base method

func (*MockBackendAPI) EthGetTransactionCount added in v0.1.3

func (m *MockBackendAPI) EthGetTransactionCount(arg0 common.Address) (*uint64, error)

EthGetTransactionCount mocks base method

func (*MockBackendAPI) GenesisBlockNumber added in v0.1.3

func (m *MockBackendAPI) GenesisBlockNumber() (*hexutil.Uint64, error)

GenesisBlockNumber mocks base method

func (*MockBackendAPI) GetBlockTransactionCountByHash added in v0.1.3

func (m *MockBackendAPI) GetBlockTransactionCountByHash(arg0 common.Hash) (*hexutil.Uint, error)

GetBlockTransactionCountByHash mocks base method

func (*MockBackendAPI) GetBlockTransactionCountByNumber added in v0.1.3

func (m *MockBackendAPI) GetBlockTransactionCountByNumber(arg0 rpc.BlockNumber) (*hexutil.Uint, error)

GetBlockTransactionCountByNumber mocks base method

func (*MockBackendAPI) GetBlockUTXO added in v0.1.3

func (m *MockBackendAPI) GetBlockUTXO(arg0 *big.Int) (*rtypes.QuickRPCBlock, error)

GetBlockUTXO mocks base method

func (*MockBackendAPI) GetBlockUTXOsByNumber added in v0.1.3

func (m *MockBackendAPI) GetBlockUTXOsByNumber(arg0 *big.Int) (*rtypes.RPCBlock, error)

GetBlockUTXOsByNumber mocks base method

func (*MockBackendAPI) GetChainVersion added in v0.1.3

func (m *MockBackendAPI) GetChainVersion() (string, error)

GetChainVersion mocks base method

func (*MockBackendAPI) GetOutputsFromNode added in v0.1.3

func (m *MockBackendAPI) GetOutputsFromNode(arg0 []uint64, arg1 common.Address) ([]*types.UTXORingEntry, error)

GetOutputsFromNode mocks base method

func (*MockBackendAPI) GetRawTransactionByBlockHashAndIndex added in v0.1.3

func (m *MockBackendAPI) GetRawTransactionByBlockHashAndIndex(arg0 common.Hash, arg1 hexutil.Uint) (hexutil.Bytes, error)

GetRawTransactionByBlockHashAndIndex mocks base method

func (*MockBackendAPI) GetRawTransactionByBlockNumberAndIndex added in v0.1.3

func (m *MockBackendAPI) GetRawTransactionByBlockNumberAndIndex(arg0 rpc.BlockNumber, arg1 hexutil.Uint) (hexutil.Bytes, error)

GetRawTransactionByBlockNumberAndIndex mocks base method

func (*MockBackendAPI) GetRawTransactionByHash added in v0.1.3

func (m *MockBackendAPI) GetRawTransactionByHash(arg0 common.Hash) (hexutil.Bytes, error)

GetRawTransactionByHash mocks base method

func (*MockBackendAPI) GetTokenBalance added in v0.1.3

func (m *MockBackendAPI) GetTokenBalance(arg0, arg1 common.Address) (*big.Int, error)

GetTokenBalance mocks base method

func (*MockBackendAPI) GetTransactionByBlockHashAndIndex added in v0.1.3

func (m *MockBackendAPI) GetTransactionByBlockHashAndIndex(arg0 common.Hash, arg1 hexutil.Uint) (interface{}, error)

GetTransactionByBlockHashAndIndex mocks base method

func (*MockBackendAPI) GetTransactionByBlockNumberAndIndex added in v0.1.3

func (m *MockBackendAPI) GetTransactionByBlockNumberAndIndex(arg0 rpc.BlockNumber, arg1 hexutil.Uint) (interface{}, error)

GetTransactionByBlockNumberAndIndex mocks base method

func (*MockBackendAPI) GetTransactionByHash added in v0.1.3

func (m *MockBackendAPI) GetTransactionByHash(arg0 common.Hash) (interface{}, error)

GetTransactionByHash mocks base method

func (*MockBackendAPI) GetTransactionCount added in v0.1.3

func (m *MockBackendAPI) GetTransactionCount(arg0 common.Address, arg1 rpc.BlockNumber) (*hexutil.Uint64, error)

GetTransactionCount mocks base method

func (*MockBackendAPI) GetTransactionReceipt added in v0.1.3

func (m *MockBackendAPI) GetTransactionReceipt(arg0 common.Hash) (map[string]interface{}, error)

GetTransactionReceipt mocks base method

func (*MockBackendAPI) GetUTXOGas added in v0.1.3

func (m *MockBackendAPI) GetUTXOGas() (uint64, error)

GetUTXOGas mocks base method

func (*MockBackendAPI) IsContract added in v0.1.3

func (m *MockBackendAPI) IsContract(arg0 common.Address) (bool, error)

IsContract mocks base method

func (*MockBackendAPI) RefreshMaxBlock added in v0.1.3

func (m *MockBackendAPI) RefreshMaxBlock() (*big.Int, error)

RefreshMaxBlock mocks base method

func (*MockBackendAPI) SendRawTransaction added in v0.1.3

func (m *MockBackendAPI) SendRawTransaction(arg0 hexutil.Bytes) (common.Hash, error)

SendRawTransaction mocks base method

func (*MockBackendAPI) SendRawUTXOTransaction added in v0.1.3

func (m *MockBackendAPI) SendRawUTXOTransaction(arg0 hexutil.Bytes) (common.Hash, error)

SendRawUTXOTransaction mocks base method

func (*MockBackendAPI) Transfer added in v0.1.3

func (m *MockBackendAPI) Transfer(arg0 []string) []types0.SendTxRet

Transfer mocks base method

type MockBackendAPIMockRecorder added in v0.1.3

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

MockBackendAPIMockRecorder is the mock recorder for MockBackendAPI

func (*MockBackendAPIMockRecorder) Call added in v0.1.3

func (mr *MockBackendAPIMockRecorder) Call(arg0, arg1 interface{}) *gomock.Call

Call indicates an expected call of Call

func (*MockBackendAPIMockRecorder) EstimateGas added in v0.1.3

func (mr *MockBackendAPIMockRecorder) EstimateGas(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call

EstimateGas indicates an expected call of EstimateGas

func (*MockBackendAPIMockRecorder) EthEstimateGas added in v0.1.3

func (mr *MockBackendAPIMockRecorder) EthEstimateGas(arg0 interface{}) *gomock.Call

EthEstimateGas indicates an expected call of EthEstimateGas

func (*MockBackendAPIMockRecorder) EthGetTransactionCount added in v0.1.3

func (mr *MockBackendAPIMockRecorder) EthGetTransactionCount(arg0 interface{}) *gomock.Call

EthGetTransactionCount indicates an expected call of EthGetTransactionCount

func (*MockBackendAPIMockRecorder) GenesisBlockNumber added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GenesisBlockNumber() *gomock.Call

GenesisBlockNumber indicates an expected call of GenesisBlockNumber

func (*MockBackendAPIMockRecorder) GetBlockTransactionCountByHash added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetBlockTransactionCountByHash(arg0 interface{}) *gomock.Call

GetBlockTransactionCountByHash indicates an expected call of GetBlockTransactionCountByHash

func (*MockBackendAPIMockRecorder) GetBlockTransactionCountByNumber added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetBlockTransactionCountByNumber(arg0 interface{}) *gomock.Call

GetBlockTransactionCountByNumber indicates an expected call of GetBlockTransactionCountByNumber

func (*MockBackendAPIMockRecorder) GetBlockUTXO added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetBlockUTXO(arg0 interface{}) *gomock.Call

GetBlockUTXO indicates an expected call of GetBlockUTXO

func (*MockBackendAPIMockRecorder) GetBlockUTXOsByNumber added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetBlockUTXOsByNumber(arg0 interface{}) *gomock.Call

GetBlockUTXOsByNumber indicates an expected call of GetBlockUTXOsByNumber

func (*MockBackendAPIMockRecorder) GetChainVersion added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetChainVersion() *gomock.Call

GetChainVersion indicates an expected call of GetChainVersion

func (*MockBackendAPIMockRecorder) GetOutputsFromNode added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetOutputsFromNode(arg0, arg1 interface{}) *gomock.Call

GetOutputsFromNode indicates an expected call of GetOutputsFromNode

func (*MockBackendAPIMockRecorder) GetRawTransactionByBlockHashAndIndex added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetRawTransactionByBlockHashAndIndex(arg0, arg1 interface{}) *gomock.Call

GetRawTransactionByBlockHashAndIndex indicates an expected call of GetRawTransactionByBlockHashAndIndex

func (*MockBackendAPIMockRecorder) GetRawTransactionByBlockNumberAndIndex added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetRawTransactionByBlockNumberAndIndex(arg0, arg1 interface{}) *gomock.Call

GetRawTransactionByBlockNumberAndIndex indicates an expected call of GetRawTransactionByBlockNumberAndIndex

func (*MockBackendAPIMockRecorder) GetRawTransactionByHash added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetRawTransactionByHash(arg0 interface{}) *gomock.Call

GetRawTransactionByHash indicates an expected call of GetRawTransactionByHash

func (*MockBackendAPIMockRecorder) GetTokenBalance added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetTokenBalance(arg0, arg1 interface{}) *gomock.Call

GetTokenBalance indicates an expected call of GetTokenBalance

func (*MockBackendAPIMockRecorder) GetTransactionByBlockHashAndIndex added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetTransactionByBlockHashAndIndex(arg0, arg1 interface{}) *gomock.Call

GetTransactionByBlockHashAndIndex indicates an expected call of GetTransactionByBlockHashAndIndex

func (*MockBackendAPIMockRecorder) GetTransactionByBlockNumberAndIndex added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetTransactionByBlockNumberAndIndex(arg0, arg1 interface{}) *gomock.Call

GetTransactionByBlockNumberAndIndex indicates an expected call of GetTransactionByBlockNumberAndIndex

func (*MockBackendAPIMockRecorder) GetTransactionByHash added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetTransactionByHash(arg0 interface{}) *gomock.Call

GetTransactionByHash indicates an expected call of GetTransactionByHash

func (*MockBackendAPIMockRecorder) GetTransactionCount added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetTransactionCount(arg0, arg1 interface{}) *gomock.Call

GetTransactionCount indicates an expected call of GetTransactionCount

func (*MockBackendAPIMockRecorder) GetTransactionReceipt added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetTransactionReceipt(arg0 interface{}) *gomock.Call

GetTransactionReceipt indicates an expected call of GetTransactionReceipt

func (*MockBackendAPIMockRecorder) GetUTXOGas added in v0.1.3

func (mr *MockBackendAPIMockRecorder) GetUTXOGas() *gomock.Call

GetUTXOGas indicates an expected call of GetUTXOGas

func (*MockBackendAPIMockRecorder) IsContract added in v0.1.3

func (mr *MockBackendAPIMockRecorder) IsContract(arg0 interface{}) *gomock.Call

IsContract indicates an expected call of IsContract

func (*MockBackendAPIMockRecorder) RefreshMaxBlock added in v0.1.3

func (mr *MockBackendAPIMockRecorder) RefreshMaxBlock() *gomock.Call

RefreshMaxBlock indicates an expected call of RefreshMaxBlock

func (*MockBackendAPIMockRecorder) SendRawTransaction added in v0.1.3

func (mr *MockBackendAPIMockRecorder) SendRawTransaction(arg0 interface{}) *gomock.Call

SendRawTransaction indicates an expected call of SendRawTransaction

func (*MockBackendAPIMockRecorder) SendRawUTXOTransaction added in v0.1.3

func (mr *MockBackendAPIMockRecorder) SendRawUTXOTransaction(arg0 interface{}) *gomock.Call

SendRawUTXOTransaction indicates an expected call of SendRawUTXOTransaction

func (*MockBackendAPIMockRecorder) Transfer added in v0.1.3

func (mr *MockBackendAPIMockRecorder) Transfer(arg0 interface{}) *gomock.Call

Transfer indicates an expected call of Transfer

type NodeAPI added in v0.1.3

type NodeAPI struct{}

NodeAPI implementation for API

func (*NodeAPI) Call added in v0.1.3

func (api *NodeAPI) Call(args wtypes.CallArgs, blockNr string) (*hexutil.Bytes, error)

Call -

func (*NodeAPI) EstimateGas added in v0.1.3

func (api *NodeAPI) EstimateGas(from common.Address, nonce uint64, dest *types.AccountDestEntry, kind types.UTXOKind, tokenID common.Address) (*big.Int, error)

limit contract fee > 1e11 and tx fee mod 1e11 == 0

func (*NodeAPI) EthEstimateGas added in v0.1.3

func (api *NodeAPI) EthEstimateGas(args wtypes.CallArgs) (*hexutil.Uint64, error)

EthEstimateGas limit contract fee > 1e11 and tx fee mod 1e11 == 0

func (*NodeAPI) EthGetTransactionCount added in v0.1.3

func (api *NodeAPI) EthGetTransactionCount(addr common.Address) (*uint64, error)

EthGetTransactionCount return eth account balance

func (*NodeAPI) GenesisBlockNumber added in v0.1.3

func (api *NodeAPI) GenesisBlockNumber() (*hexutil.Uint64, error)

GenesisBlockNumber return genesisBlock init height

func (*NodeAPI) GetBlockTransactionCountByHash added in v0.1.3

func (api *NodeAPI) GetBlockTransactionCountByHash(blockHash common.Hash) (*hexutil.Uint, error)

GetBlockTransactionCountByHash return block transaction count

func (*NodeAPI) GetBlockTransactionCountByNumber added in v0.1.3

func (api *NodeAPI) GetBlockTransactionCountByNumber(blockNr rpc.BlockNumber) (*hexutil.Uint, error)

GetBlockTransactionCountByNumber return block transaction count

func (*NodeAPI) GetBlockUTXO added in v0.1.3

func (api *NodeAPI) GetBlockUTXO(height *big.Int) (*rtypes.QuickRPCBlock, error)

GetBlockUTXO - curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockUTXO","params":["0x1a"],"id":1}' https://pocketapi-lianxiangcloud.com/getBlockUTXO

func (*NodeAPI) GetBlockUTXOsByNumber added in v0.1.3

func (api *NodeAPI) GetBlockUTXOsByNumber(height *big.Int) (*rtypes.RPCBlock, error)

func (*NodeAPI) GetChainVersion added in v0.1.3

func (api *NodeAPI) GetChainVersion() (string, error)

func (*NodeAPI) GetOutputsFromNode added in v0.1.3

func (api *NodeAPI) GetOutputsFromNode(indice []uint64, tokenID common.Address) ([]*types.UTXORingEntry, error)

func (*NodeAPI) GetRawTransactionByBlockHashAndIndex added in v0.1.3

func (api *NodeAPI) GetRawTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (r hexutil.Bytes, err error)

GetRawTransactionByBlockHashAndIndex (ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes

func (*NodeAPI) GetRawTransactionByBlockNumberAndIndex added in v0.1.3

func (api *NodeAPI) GetRawTransactionByBlockNumberAndIndex(blockNr rpc.BlockNumber, index hexutil.Uint) (r hexutil.Bytes, err error)

GetRawTransactionByBlockNumberAndIndex (ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes

func (*NodeAPI) GetRawTransactionByHash added in v0.1.3

func (api *NodeAPI) GetRawTransactionByHash(hash common.Hash) (r hexutil.Bytes, err error)

GetRawTransactionByHash (ctx context.Context, hash common.Hash) (hexutil.Bytes, error)

func (*NodeAPI) GetTokenBalance added in v0.1.3

func (api *NodeAPI) GetTokenBalance(addr common.Address, tokenID common.Address) (*big.Int, error)

func (*NodeAPI) GetTransactionByBlockHashAndIndex added in v0.1.3

func (api *NodeAPI) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (r interface{}, err error)

GetTransactionByBlockHashAndIndex return tx

func (*NodeAPI) GetTransactionByBlockNumberAndIndex added in v0.1.3

func (api *NodeAPI) GetTransactionByBlockNumberAndIndex(blockNr rpc.BlockNumber, index hexutil.Uint) (r interface{}, err error)

GetTransactionByBlockNumberAndIndex return rpc tx

func (*NodeAPI) GetTransactionByHash added in v0.1.3

func (api *NodeAPI) GetTransactionByHash(hash common.Hash) (r interface{}, err error)

GetTransactionByHash (ctx context.Context, hash common.Hash) interface{}

func (*NodeAPI) GetTransactionCount added in v0.1.3

func (api *NodeAPI) GetTransactionCount(address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)

GetTransactionCount (ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)

func (*NodeAPI) GetTransactionReceipt added in v0.1.3

func (api *NodeAPI) GetTransactionReceipt(hash common.Hash) (r map[string]interface{}, err error)

GetTransactionReceipt (ctx context.Context, hash common.Hash) (map[string]interface{}, error)

func (*NodeAPI) GetUTXOChangeRate added in v0.1.3

func (api *NodeAPI) GetUTXOChangeRate(addr common.Address) (int64, error)

func (*NodeAPI) GetUTXOGas added in v0.1.3

func (api *NodeAPI) GetUTXOGas() (uint64, error)

func (*NodeAPI) IsContract added in v0.1.3

func (api *NodeAPI) IsContract(addr common.Address) (bool, error)

func (*NodeAPI) RefreshMaxBlock added in v0.1.3

func (api *NodeAPI) RefreshMaxBlock() (*big.Int, error)

RefreshMaxBlock wallet

func (*NodeAPI) SendRawTransaction added in v0.1.3

func (api *NodeAPI) SendRawTransaction(encodedTx hexutil.Bytes) (common.Hash, error)

SendRawTransaction wallet

func (*NodeAPI) SendRawUTXOTransaction added in v0.1.3

func (api *NodeAPI) SendRawUTXOTransaction(encodedTx hexutil.Bytes) (common.Hash, error)

SendRawUTXOTransaction wallet

func (*NodeAPI) Transfer added in v0.1.3

func (api *NodeAPI) Transfer(txs []string) (ret []wtypes.SendTxRet)

Transfer wallet

type OutKind added in v0.1.3

type OutKind uint8
const (
	NilOut  OutKind = 0
	AccOut  OutKind = 1
	UtxoOut OutKind = 2
)

type OutputArg

type OutputArg struct {
	Token common.Address `json:"token"`
	Index hexutil.Uint64 `json:"index"`
}

OutputArg -

type RPCKey

type RPCKey lktypes.Key

RPCKey -

type RPCOutput

type RPCOutput struct {
	Out    string `json:"out"`
	Commit string `json:"commit"`
}

RPCOutput -

type UTXOItem added in v0.1.3

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

func (*UTXOItem) String added in v0.1.3

func (item *UTXOItem) String() string

type Wallet

type Wallet struct {
	Logger log.Logger
	// contains filtered or unexported fields
}

Wallet user wallet

func NewWallet

func NewWallet(config *cfg.Config,
	logger log.Logger, db dbm.DB, accManager *accounts.Manager) (*Wallet, error)

NewWallet returns a new, ready to go.

func (*Wallet) AutoRefreshBlockchain

func (w *Wallet) AutoRefreshBlockchain(autoRefresh bool, addr *common.Address) error

AutoRefreshBlockchain set autoRefresh

func (*Wallet) Call added in v0.1.3

func (w *Wallet) Call(args wtypes.CallArgs, blockNr string) (*hexutil.Bytes, error)

func (*Wallet) CreateAinTransaction

func (wallet *Wallet) CreateAinTransaction(from common.Address, passwd string, nonce uint64, dests []types.DestEntry,
	tokenID common.Address, extra []byte) (*types.UTXOTransaction, error)

CreateAinTransaction return a UTXOTransaction for account input only

func (*Wallet) CreateSubAccount

func (w *Wallet) CreateSubAccount(maxSub uint64, addr *common.Address) error

CreateSubAccount return new sub address and sub index

func (*Wallet) CreateUTXOTransaction

func (wallet *Wallet) CreateUTXOTransaction(from common.Address, nonce uint64, subaddrs []uint64, dests []types.DestEntry,
	tokenID common.Address, refundAddr common.Address, extra []byte) ([]*types.UTXOTransaction, error)

CreateUTXOTransaction -none

func (*Wallet) CreateUinTransaction

func (wallet *Wallet) CreateUinTransaction(from common.Address, subaddrs []uint64, dests []types.DestEntry,
	tokenID common.Address, extra []byte) ([]*types.UTXOTransaction, error)

CreateUinTransaction return a UTXOTransaction for utxo input only

func (*Wallet) DelUTXOAddInfo added in v0.1.1

func (w *Wallet) DelUTXOAddInfo(hash common.Hash) error

DelUTXOAddInfo del UTXO Additional info

func (*Wallet) EthEstimateGas

func (w *Wallet) EthEstimateGas(args wtypes.CallArgs) (*hexutil.Uint64, error)

func (*Wallet) GetAccountInfo

func (w *Wallet) GetAccountInfo(tokenID *common.Address, addr *common.Address) (*types.GetAccountInfoResult, error)

GetAccountInfo return eth_account and utxo_accounts

func (*Wallet) GetAddress

func (w *Wallet) GetAddress(index uint64, addr *common.Address) (string, error)

GetAddress rpc get address

func (*Wallet) GetBalance

func (w *Wallet) GetBalance(index uint64, token *common.Address, addr *common.Address) (*big.Int, error)

GetBalance rpc get balance

func (*Wallet) GetBlockTransactionCountByHash

func (w *Wallet) GetBlockTransactionCountByHash(blockHash common.Hash) (*hexutil.Uint, error)

func (*Wallet) GetBlockTransactionCountByNumber

func (w *Wallet) GetBlockTransactionCountByNumber(blockNr rpc.BlockNumber) (*hexutil.Uint, error)

func (*Wallet) GetHeight

func (w *Wallet) GetHeight(addr *common.Address) (localHeight *big.Int, remoteHeight *big.Int)

GetHeight rpc get height

func (*Wallet) GetLocalOutputs added in v0.1.1

func (w *Wallet) GetLocalOutputs(ids []hexutil.Uint64, addr *common.Address) ([]types.UTXOOutputDetail, error)

GetLocalOutputs return

func (*Wallet) GetLocalUTXOTxsByHeight added in v0.1.1

func (w *Wallet) GetLocalUTXOTxsByHeight(height *big.Int, addr *common.Address) (*types.UTXOBlock, error)

GetLocalUTXOTxsByHeight return

func (*Wallet) GetMaxOutput

func (w *Wallet) GetMaxOutput(tokenID common.Address, addr *common.Address) (*hexutil.Uint64, error)

GetMaxOutput return tokenID max output idx

func (*Wallet) GetRawTransactionByBlockHashAndIndex

func (w *Wallet) GetRawTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (hexutil.Bytes, error)

func (*Wallet) GetRawTransactionByBlockNumberAndIndex

func (w *Wallet) GetRawTransactionByBlockNumberAndIndex(blockNr rpc.BlockNumber, index hexutil.Uint) (hexutil.Bytes, error)

func (*Wallet) GetRawTransactionByHash

func (w *Wallet) GetRawTransactionByHash(hash common.Hash) (hexutil.Bytes, error)

func (*Wallet) GetTransactionByBlockHashAndIndex

func (w *Wallet) GetTransactionByBlockHashAndIndex(blockHash common.Hash, index hexutil.Uint) (interface{}, error)

func (*Wallet) GetTransactionByBlockNumberAndIndex

func (w *Wallet) GetTransactionByBlockNumberAndIndex(blockNr rpc.BlockNumber, index hexutil.Uint) (interface{}, error)

func (*Wallet) GetTransactionByHash

func (w *Wallet) GetTransactionByHash(hash common.Hash) (interface{}, error)

func (*Wallet) GetTransactionCount

func (w *Wallet) GetTransactionCount(address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error)

func (*Wallet) GetTransactionReceipt

func (w *Wallet) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error)

func (*Wallet) GetTxKey

func (w *Wallet) GetTxKey(hash *common.Hash, addr *common.Address) (*lkctypes.Key, error)

GetTxKey return transaction's tx secKey

func (*Wallet) GetUTXOAddInfo added in v0.1.1

func (w *Wallet) GetUTXOAddInfo(hash common.Hash) (*types.UTXOAddInfo, error)

GetUTXOAddInfo return UTXO Additional info

func (*Wallet) GetUTXOTx

func (w *Wallet) GetUTXOTx(hash common.Hash, addr *common.Address) (*tctypes.UTXOTransaction, error)

GetUTXOTx return UTXOTransaction

func (*Wallet) GetWalletEthAddress

func (w *Wallet) GetWalletEthAddress() (*common.Address, error)

GetWalletEthAddress ,return wallet eth address

func (*Wallet) IsWalletClosed

func (w *Wallet) IsWalletClosed() bool

IsWalletClosed return true if currAccount is nil

func (*Wallet) LockAccount

func (w *Wallet) LockAccount(addr common.Address) error

LockAccount lock account by addr

func (*Wallet) OpenWallet

func (w *Wallet) OpenWallet(keystoreFile string, password string) error

OpenWallet ,open wallet with password

func (*Wallet) RescanBlockchain

func (w *Wallet) RescanBlockchain(addr *common.Address) error

RescanBlockchain ,reset wallet block and transfer info

func (*Wallet) SelectAddress

func (w *Wallet) SelectAddress(addr common.Address) error

SelectAddress return

func (*Wallet) SendRawTransaction

func (w *Wallet) SendRawTransaction(encodedTx hexutil.Bytes) (common.Hash, error)

func (*Wallet) SendRawUTXOTransaction added in v0.1.1

func (w *Wallet) SendRawUTXOTransaction(encodedTx hexutil.Bytes) (common.Hash, error)

func (*Wallet) SetRefreshBlockInterval

func (w *Wallet) SetRefreshBlockInterval(interval time.Duration, addr *common.Address) error

SetRefreshBlockInterval return

func (*Wallet) Start

func (w *Wallet) Start() error

Start starts the Wallet. It implements cmn.Service.

func (*Wallet) Status

func (w *Wallet) Status(addr *common.Address) *types.StatusResult

Status return wallet status

func (*Wallet) Stop

func (w *Wallet) Stop()

Stop stops the Wallet. It implements cmn.Service.

func (*Wallet) SubmitUTXOTransaction

func (wallet *Wallet) SubmitUTXOTransaction(tx *types.UTXOTransaction) (common.Hash, error)

SubmitUTXOTransaction -none

func (*Wallet) SubmitUTXOTransactions

func (wallet *Wallet) SubmitUTXOTransactions(txes []*types.UTXOTransaction) ([]common.Hash, error)

SubmitUTXOTransactions -none

func (*Wallet) Transfer

func (w *Wallet) Transfer(txs []string) []wtypes.SendTxRet

Jump to

Keyboard shortcuts

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