Versions in this module Expand all Collapse all v1 v1.0.2 Aug 2, 2019 v1.0.1 Jul 22, 2019 Changes in this version + const ADRESS_STATIS_OVERDATED_TIME + const BACKUP_FILE_TYPE_ADDRESS + const BACKUP_FILE_TYPE_WALLET_DB + const BACKUP_FILE_TYPE_WALLET_KEY + const BLOCK_CHAIN_BUCKET + const BLOCK_HASH_KEY + const BLOCK_HEIGHT_KEY + const CurveType + const ERC20TOKEN_DB + const ETH_GET_TOKEN_BALANCE_METHOD + const ETH_TRANSFER_EVENT_ID + const ETH_TRANSFER_TOKEN_BALANCE_METHOD + const MAX_EXTRACTING_SIZE + const MasterKey + const SOLIDITY_TYPE_ADDRESS + const SOLIDITY_TYPE_UINT160 + const SOLIDITY_TYPE_UINT256 + const Symbol + const TIME_POSTFIX + const TRANS_AMOUNT_UNIT_G_WEI + const TRANS_AMOUNT_UNIT_K_WEI + const TRANS_AMOUNT_UNIT_LIST + const TRANS_AMOUNT_UNIT_MICRO_ETHER + const TRANS_AMOUNT_UNIT_MILLIE_ETHER + const TRANS_AMOUNT_UNIT_M_WEI + const TRANS_AMOUNT_UNIT_WEI + const TRNAS_AMOUNT_UNIT_ETHER + const WALLET_NOT_EXIST_ERR + func ConverEthDecimalToWei(amount decimal.Decimal) (*big.Int, error) + func ConverWeiStringToEthDecimal(amount string) (decimal.Decimal, error) + func ConvertAmountToFloatDecimal(amount string, decimals int) (decimal.Decimal, error) + func ConvertEthStringToWei(amount string) (*big.Int, error) + func ConvertFloatStringToBigInt(amount string, decimals int) (*big.Int, error) + func ConvertToBigInt(value string, base int) (*big.Int, error) + func ConvertToUint64(value string, base int) (uint64, error) + func OpenDB(dbPath string, dbName string) (*storm.DB, error) + func VerifyRawTransaction(rawTx *openwallet.RawTransaction) error + type AddrBalance struct + Address string + Balance *big.Int + Index int + TokenBalance *big.Int + func (this *AddrBalance) GetAddress() string + func (this *AddrBalance) SetTokenBalance(b *big.Int) + func (this *AddrBalance) ValidTokenBalance() bool + type AddrBalanceInf interface + GetAddress func() string + SetTokenBalance func(b *big.Int) + ValidTokenBalance func() bool + type AddrVec struct + func (this *AddrVec) Len() int + func (this *AddrVec) Less(i, j int) bool + func (this *AddrVec) Swap(i, j int) + type Address struct + Account string + Address string + CreatedAt time.Time + HDPath string + Index int + PublicKey string + TxCount uint64 + func (this *Address) CalcHexPrivKey(masterKey *hdkeystore.HDKey) (string, error) + func (this *Address) CalcPrivKey(masterKey *hdkeystore.HDKey) ([]byte, error) + type AddressDecoder struct + func (decoder *AddressDecoder) PrivateKeyToWIF(priv []byte, isTestnet bool) (string, error) + func (decoder *AddressDecoder) PublicKeyToAddress(pub []byte, isTestnet bool) (string, error) + func (decoder *AddressDecoder) RedeemScriptToAddress(pubs [][]byte, required uint64, isTestnet bool) (string, error) + func (decoder *AddressDecoder) WIFToPrivateKey(wif string, isTestnet bool) ([]byte, error) + type AddressTxStatistic struct + Address string + AddressLocker *sync.Mutex + LastModifiedTime *time.Time + TransactionCount *uint64 + Valid *int + func (this *AddressTxStatistic) UpdateTime() + type BlockHeader struct + BlockHash string + BlockNumber string + Difficulty string + GasLimit string + GasUsed string + Miner string + PreviousHash string + TotalDifficulty string + type BlockTransaction struct + BlockHash string + BlockHeight uint64 + BlockNumber string + Data string + From string + Gas string + GasPrice string + Hash string + Status uint64 + Timestamp string + To string + TransactionIndex string + Value string + func (this *BlockTransaction) GetAmountEthString() (string, error) + func (this *BlockTransaction) GetTxFeeEthString() (string, error) + type Client struct + BaseURL string + Debug bool + func (c *Client) Call(method string, id int64, params []interface{}) (*gjson.Result, error) + func (this *Client) ERC20GetAddressBalance(address string, contractAddr string) (*big.Int, error) + func (this *Client) ERC20GetAddressBalance2(address string, contractAddr string, sign string) (*big.Int, error) + func (this *Client) EthGetTransactionByHash(txid string) (*BlockTransaction, error) + func (this *Client) GetAddrBalance(address string) (*big.Int, error) + func (this *Client) GetAddrBalance2(address string, sign string) (*big.Int, error) + func (this *Client) LockAddr(address string) error + func (this *Client) UnlockAddr(address string, password string, secs int) error + type ERC20Token struct + Address string + Decimals int + Name string + Symbol string + type ETHBLockScanner struct + CurrentBlockHeight uint64 + IsScanMemPool bool + RescanLastBlockCount uint64 + func NewETHBlockScanner(wm *WalletManager) *ETHBLockScanner + func (this *ETHBLockScanner) BatchExtractTransaction(txs []BlockTransaction) error + func (this *ETHBLockScanner) ExtractTransactionData(txid string, scanTargetFunc openwallet.BlockScanTargetFunc) (map[string][]*openwallet.TxExtractData, error) + func (this *ETHBLockScanner) GetBalanceByAddress(address ...string) ([]*openwallet.Balance, error) + func (this *ETHBLockScanner) GetCurrentBlockHeader() (*openwallet.BlockHeader, error) + func (this *ETHBLockScanner) GetGlobalMaxBlockHeight() uint64 + func (this *ETHBLockScanner) GetScannedBlockHeader() (*openwallet.BlockHeader, error) + func (this *ETHBLockScanner) GetTxPoolPendingTxs() ([]BlockTransaction, error) + func (this *ETHBLockScanner) MakeFromExtractData(tx *BlockTransaction, tokenEvent *TransferEvent) (string, []*openwallet.TxExtractData, error) + func (this *ETHBLockScanner) MakeSimpleToExtractData(tx *BlockTransaction) (string, []*openwallet.TxExtractData, error) + func (this *ETHBLockScanner) MakeSimpleTxFromExtractData(tx *BlockTransaction) (string, []*openwallet.TxExtractData, error) + func (this *ETHBLockScanner) MakeToExtractData(tx *BlockTransaction, tokenEvent *TransferEvent) (string, []*openwallet.TxExtractData, error) + func (this *ETHBLockScanner) MakeTokenToExtractData(tx *BlockTransaction, tokenEvent *TransferEvent) (string, []*openwallet.TxExtractData, error) + func (this *ETHBLockScanner) MakeTokenTxFromExtractData(tx *BlockTransaction, tokenEvent *TransferEvent) (string, []*openwallet.TxExtractData, error) + func (this *ETHBLockScanner) RescanFailedTransactions() error + func (this *ETHBLockScanner) ScanBlock(height uint64) error + func (this *ETHBLockScanner) ScanBlockTask() + func (this *ETHBLockScanner) ScanTxMemPool() error + func (this *ETHBLockScanner) SetRescanBlockHeight(height uint64) error + func (this *ETHBLockScanner) TransactionScanning(tx *BlockTransaction) (*ExtractResult, error) + func (this *ETHBLockScanner) UpdateTxByReceipt(tx *BlockTransaction) (*TransferEvent, error) + type EthBlock struct + Transactions []BlockTransaction + func (this *EthBlock) CreateOpenWalletBlockHeader() *openwallet.BlockHeader + func (this *EthBlock) Init() error + type EthContractDecoder struct + func (this *EthContractDecoder) GetTokenBalanceByAddress(contract openwallet.SmartContract, address ...string) ([]*openwallet.TokenBalance, error) + type EthEvent struct + Address string + Data string + LogIndex string + Removed bool + Topics []string + type EthTransactionDecoder struct + AddrTxStatisMap *sync.Map + func NewTransactionDecoder(wm *WalletManager) *EthTransactionDecoder + func (this *EthTransactionDecoder) CreateErc20TokenRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error + func (this *EthTransactionDecoder) CreateErc20TokenSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error) + func (this *EthTransactionDecoder) CreateRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error + func (this *EthTransactionDecoder) CreateSimpleRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction, ...) error + func (this *EthTransactionDecoder) CreateSimpleSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error) + func (this *EthTransactionDecoder) CreateSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransaction, error) + func (this *EthTransactionDecoder) CreateSummaryRawTransactionWithError(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error) + func (this *EthTransactionDecoder) GetRawTransactionFeeRate() (feeRate string, unit string, err error) + func (this *EthTransactionDecoder) GetTransactionCount(address string) (uint64, error) + func (this *EthTransactionDecoder) GetTransactionCount2(address string) (*AddressTxStatistic, uint64, error) + func (this *EthTransactionDecoder) RemoveOutdatedAddrStatic() + func (this *EthTransactionDecoder) RunClearAddrStatic() + func (this *EthTransactionDecoder) SetTransactionCount(address string, transactionCount uint64) error + func (this *EthTransactionDecoder) SignRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error + func (this *EthTransactionDecoder) SubmitErc20TokenRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) (*openwallet.Transaction, error) + func (this *EthTransactionDecoder) SubmitRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) (*openwallet.Transaction, error) + func (this *EthTransactionDecoder) SubmitSimpleRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) (*openwallet.Transaction, error) + func (this *EthTransactionDecoder) VerifyRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error + type EthTransactionReceipt struct + GasUsed string + Logs []EthEvent + Status string + func (this *EthTransactionReceipt) ParseTransferEvent() *TransferEvent + type EthTxExtPara struct + Data string + GasLimit string + func NewEthTxExtPara(j gjson.Result) *EthTxExtPara + type ExtractResult struct + BlockHeight uint64 + Success bool + TxID string + type Response struct + Id int + Result interface{} + Version string + type SaveResult struct + BlockHeight uint64 + Success bool + TxID string + type SolidityParam struct + ParamType string + ParamValue interface{} + type TokenAddrVec struct + func (this *TokenAddrVec) Len() int + func (this *TokenAddrVec) Less(i, j int) bool + func (this *TokenAddrVec) Swap(i, j int) + type TransferEvent struct + FromSourceKey string + ToSourceKey string + TokenFrom string + TokenTo string + Value string + type TxpoolContent struct + Pending map[string]map[string]BlockTransaction + func (this *TxpoolContent) GetPendingTxCountForAddr(addr string) int + func (this *TxpoolContent) GetSequentTxNonce(addr string) (uint64, uint64, uint64, error) + type UnscanTransaction struct + BlockHash string + BlockNumber string + Reason string + TxID string + TxSpec string + type Wallet struct + AddressCount uint64 + Alias string + HdPath string + KeyFile string + Password string + PublicKey string + RootPath string + RootPub string + WalletID string + func GetWalletKey(fileWitoutProfix string) (*Wallet, error) + func GetWalletKeys(dir string) ([]*Wallet, error) + func (this *Wallet) ClearAllTransactions(dbPath string) + func (this *Wallet) DeleteTransactionByHeight(dbPath string, height uint64) error + func (this *Wallet) DumpWalletDB(dbPath string) + func (this *Wallet) HDKey2(password string) (*hdkeystore.HDKey, error) + func (this *Wallet) RestoreFromDb(dbPath string) error + func (this *Wallet) SaveAddress(dbpath string, addr *Address) error + func (this *Wallet) SaveTransactions(dbPath string, txs []BlockTransaction) error + func (w *Wallet) DBFile(dbPath string) string + func (w *Wallet) FileName() string + func (w *Wallet) OpenDB(dbPath string) (*storm.DB, error) + func (w *Wallet) OpenDbByPath(path string) (*storm.DB, error) + type WalletConfig struct + AddressDir string + BackupDir string + BlockchainFile string + ChainID uint64 + ConfigFileName string + ConfigFilePath string + CurveType uint32 + CycleSeconds uint64 + DataDir string + DbPath string + EthereumKeyPath string + IsTestNet bool + KeyDir string + LocalNonce bool + MasterKey string + RootDir string + ServerAPI string + SumAddress string + Symbol string + Threshold *big.Int + func NewConfig(symbol string) *WalletConfig + func (this *WalletConfig) LoadConfig(configFilePath string, configFileName string) (*WalletConfig, error) + type WalletManager struct + Blockscanner *ETHBLockScanner + Config *WalletConfig + ConfigPath string + ContractDecoder openwallet.SmartContractDecoder + Decoder openwallet.AddressDecoder + DefaultConfig string + Log *log.OWLogger + RootPath string + Storage *hdkeystore.HDKeystore + TxDecoder openwallet.TransactionDecoder + WalletClient *Client + WalletInSumOld map[string]*Wallet + WalletsInSum map[string]*openwallet.Wallet + func NewWalletManager() *WalletManager + func (this *WalletManager) AddWalletInSummary(wid string, wallet *Wallet) + func (this *WalletManager) BackupWallet2(newBackupDir string, wallet *Wallet, password string) (string, error) + func (this *WalletManager) BackupWalletToDefaultPath(wallet *Wallet, password string) (string, error) + func (this *WalletManager) ClearBlockScanDb() + func (this *WalletManager) CreateBatchAddress2(name, password string, count uint64) (string, error) + func (this *WalletManager) CreateWallet(name string, password string) (*Wallet, string, error) + func (this *WalletManager) CurveType() uint32 + func (this *WalletManager) Decimal() int32 + func (this *WalletManager) DeleteUnscannedTransactionByHeight(height uint64) error + func (this *WalletManager) DeleteUnscannedTransactions(list []UnscanTransaction) error + func (this *WalletManager) ERC20GetAddressesByWallet(dbPath string, wallet *Wallet) ([]*Address, error) + func (this *WalletManager) ERC20GetWalletBalance(wallet *Wallet) (*big.Int, error) + func (this *WalletManager) ERC20GetWalletList(erc20Token *ERC20Token) ([]*Wallet, error) + func (this *WalletManager) EthSendRawTransaction(signedTx string) (string, error) + func (this *WalletManager) FullName() string + func (this *WalletManager) GetAddressDecode() openwallet.AddressDecoder + func (this *WalletManager) GetAddressWithBalance(addresses ...*openwallet.Address) error + func (this *WalletManager) GetAddressesByWallet(dbPath string, wallet *Wallet) ([]*Address, error) + func (this *WalletManager) GetAllUnscannedTransactions() ([]UnscanTransaction, error) + func (this *WalletManager) GetAssetsLogger() *log.OWLogger + func (this *WalletManager) GetBlockScanner() openwallet.BlockScanner + func (this *WalletManager) GetConfig() WalletConfig + func (this *WalletManager) GetERC20TokenList() ([]ERC20Token, error) + func (this *WalletManager) GetERC20TokenTransactionFeeEstimated(from string, to string, data string) (*txFeeInfo, error) + func (this *WalletManager) GetErc20TokenEvent(transactionID string) (*TransferEvent, error) + func (this *WalletManager) GetLocalBlockHeight() (uint64, error) + func (this *WalletManager) GetLocalNewBlock() (uint64, string, error) + func (this *WalletManager) GetLocalWalletList(keyDir string, dbPath string, showBalance bool) ([]*Wallet, error) + func (this *WalletManager) GetNonceForAddress(address string) (uint64, error) + func (this *WalletManager) GetNonceForAddress2(address string) (uint64, error) + func (this *WalletManager) GetSimpleTransactionFeeEstimated(from string, to string, amount *big.Int) (*txFeeInfo, error) + func (this *WalletManager) GetSmartContractDecoder() openwallet.SmartContractDecoder + func (this *WalletManager) GetTokenBalanceByAddress(contractAddr string, addrs ...AddrBalanceInf) error + func (this *WalletManager) GetTransactionDecoder() openwallet.TransactionDecoder + func (this *WalletManager) GetTransactionFeeEstimated(from string, to string, value *big.Int, data string) (*txFeeInfo, error) + func (this *WalletManager) GetWalletBalance(dbPath string, wallet *Wallet) (*big.Int, error) + func (this *WalletManager) GetWalletInfo(keyDir string, dbPath string, walletID string) (*Wallet, error) + func (this *WalletManager) ImportWatchOnlyAddress(address ...*openwallet.Address) error + func (this *WalletManager) InitAssetsConfig() (config.Configer, error) + func (this *WalletManager) InitConfig() + func (this *WalletManager) InitConfigFlow() error + func (this *WalletManager) LoadAssetsConfig(c config.Configer) error + func (this *WalletManager) PrintConfig() error + func (this *WalletManager) RecoverBlockHeader(height uint64) (*EthBlock, error) + func (this *WalletManager) RecoverUnscannedTransactions(unscannedTxs []UnscanTransaction) ([]BlockTransaction, error) + func (this *WalletManager) SaveBlockHeader(block *EthBlock) error + func (this *WalletManager) SaveBlockHeader2(block *EthBlock) error + func (this *WalletManager) SaveERC20TokenConfig(config *ERC20Token) error + func (this *WalletManager) SaveLocalBlockScanned(blockHeight uint64, blockHash string) error + func (this *WalletManager) SaveUnscannedTransaction(tx *BlockTransaction, reason string) error + func (this *WalletManager) SendTransactionToAddr(param map[string]interface{}) (string, error) + func (this *WalletManager) Symbol() string + func (this *WalletManager) UnlockWallet(wallet *Wallet, password string) error + func (this *WalletManager) UpdateLocalBlockHeight(blockHeight uint64) error + func (wm *WalletManager) ShowConfig() error