Documentation ¶
Overview ¶
* Copyright 2018 The openwallet Authors * This file is part of the openwallet library. * * The openwallet library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The openwallet library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details.
* Copyright 2018 The openwallet Authors * This file is part of the openwallet library. * * The openwallet library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The openwallet library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details.
* Copyright 2018 The openwallet Authors * This file is part of the openwallet library. * * The openwallet library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The openwallet library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details.
* Copyright 2018 The openwallet Authors * This file is part of the openwallet library. * * The openwallet library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The openwallet library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details.
* Copyright 2018 The openwallet Authors * This file is part of the openwallet library. * * The openwallet library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The openwallet library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details.
* Copyright 2018 The openwallet Authors * This file is part of the openwallet library. * * The openwallet library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The openwallet library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details.
* Copyright 2018 The openwallet Authors * This file is part of the openwallet library. * * The openwallet library is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * The openwallet library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details.
Index ¶
- Constants
- func AppendOxToAddress(addr string) string
- 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
- type AddrBalanceInf
- type AddrVec
- type Address
- type AddressDecoder
- 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
- type BlockHeader
- type BlockTransaction
- type Client
- 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) EthGetBlockNumber() (uint64, error)
- func (this *Client) EthGetBlockSpecByBlockNum(blockNum uint64, showTransactionSpec bool) (*EthBlock, error)
- func (this *Client) EthGetTransactionByHash(txid string) (*BlockTransaction, error)
- func (this *Client) EthGetTxPoolContent() (*TxpoolContent, 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
- type ETHBLockScanner
- func (this *ETHBLockScanner) BatchExtractTransaction(txs []BlockTransaction) error
- func (bs *ETHBLockScanner) DeleteUnscanRecord(height uint64) error
- func (bs *ETHBLockScanner) DeleteUnscanRecordByID(id string) 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 (bs *ETHBLockScanner) GetLocalBlock(height uint64) (*EthBlock, error)
- func (bs *ETHBLockScanner) GetLocalBlockHead() (uint64, string, error)
- func (this *ETHBLockScanner) GetLocalNewBlock() (uint64, string, error)
- func (this *ETHBLockScanner) GetScannedBlockHeader() (*openwallet.BlockHeader, error)
- func (this *ETHBLockScanner) GetScannedBlockHeight() uint64
- func (this *ETHBLockScanner) GetTxPoolPendingTxs() ([]BlockTransaction, error)
- func (bs *ETHBLockScanner) GetUnscanRecords() ([]*openwallet.UnscanRecord, 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 (bs *ETHBLockScanner) SaveLocalBlock(blockHeader *EthBlock) error
- func (bs *ETHBLockScanner) SaveLocalBlockHead(blockHeight uint64, blockHash string) error
- func (bs *ETHBLockScanner) SaveUnscanRecord(record *openwallet.UnscanRecord) error
- func (this *ETHBLockScanner) SaveUnscannedTransaction(tx *BlockTransaction, reason string) 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 (bs *ETHBLockScanner) SupportBlockchainDAI() bool
- func (this *ETHBLockScanner) TransactionScanning(tx *BlockTransaction) (*ExtractResult, error)
- func (this *ETHBLockScanner) UpdateTxByReceipt(tx *BlockTransaction) (map[string][]*TransferEvent, error)
- type EthBlock
- type EthContractDecoder
- type EthEvent
- type 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
- type EthTxExtPara
- type ExtractResult
- type Response
- type SaveResult
- type SolidityParam
- type TokenAddrVec
- type TransferEvent
- type TxpoolContent
- type Wallet
- func (this *Wallet) ClearAllTransactions(dbPath string)
- func (w *Wallet) DBFile(dbPath string) string
- func (this *Wallet) DeleteTransactionByHeight(dbPath string, height uint64) error
- func (this *Wallet) DumpWalletDB(dbPath string)
- func (w *Wallet) FileName() string
- func (this *Wallet) HDKey2(password string) (*hdkeystore.HDKey, error)
- func (w *Wallet) OpenDB(dbPath string) (*storm.DB, error)
- func (w *Wallet) OpenDbByPath(path string) (*storm.DB, 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
- type WalletConfig
- type 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) CreateWallet(name string, password string) (*Wallet, string, error)
- func (this *WalletManager) CurveType() uint32
- func (this *WalletManager) Decimal() int32
- 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) 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) (map[string][]*TransferEvent, 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) 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) RecoverUnscannedTransactions(unscannedTxs []*openwallet.UnscanRecord) ([]BlockTransaction, error)
- func (this *WalletManager) SaveERC20TokenConfig(config *ERC20Token) error
- func (this *WalletManager) SendTransactionToAddr(param map[string]interface{}) (string, error)
- func (wm *WalletManager) ShowConfig() error
- func (this *WalletManager) Symbol() string
- func (this *WalletManager) UnlockWallet(wallet *Wallet, password string) error
Constants ¶
const ( // BLOCK_CHAIN_DB = "blockchain.db" BLOCK_CHAIN_BUCKET = "blockchain" ERC20TOKEN_DB = "erc20Token.db" )
const ( Symbol = "VNS" MasterKey = "Ethereum seed" TIME_POSTFIX = "20060102150405" CurveType = owcrypt.ECC_CURVE_SECP256K1 )
const ( ETH_GET_TOKEN_BALANCE_METHOD = "0x70a08231" ETH_TRANSFER_TOKEN_BALANCE_METHOD = "0xa9059cbb" ETH_TRANSFER_EVENT_ID = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef" )
const ( SOLIDITY_TYPE_ADDRESS = "address" SOLIDITY_TYPE_UINT256 = "uint256" SOLIDITY_TYPE_UINT160 = "uint160" )
const ( WALLET_NOT_EXIST_ERR = "The wallet whose name is given not exist!" BACKUP_FILE_TYPE_ADDRESS = 0 BACKUP_FILE_TYPE_WALLET_KEY = 1 BACKUP_FILE_TYPE_WALLET_DB = 2 )
const ( TRANS_AMOUNT_UNIT_LIST = ` 1: wei 2: Kwei 3: Mwei 4: GWei 5: microether 6: milliether 7: ether ` TRANS_AMOUNT_UNIT_WEI = 1 TRANS_AMOUNT_UNIT_K_WEI = 2 TRANS_AMOUNT_UNIT_M_WEI = 3 TRANS_AMOUNT_UNIT_G_WEI = 4 TRANS_AMOUNT_UNIT_MICRO_ETHER = 5 TRANS_AMOUNT_UNIT_MILLIE_ETHER = 6 TRNAS_AMOUNT_UNIT_ETHER = 7 )
const (
ADRESS_STATIS_OVERDATED_TIME = 30
)
const ( //BLOCK_CHAIN_BUCKET = "blockchain" //区块链数据集合 //periodOfTask = 5 * time.Second //定时任务执行隔间 MAX_EXTRACTING_SIZE = 15 //并发的扫描线程数 )
Variables ¶
This section is empty.
Functions ¶
func AppendOxToAddress ¶ added in v1.0.4
func VerifyRawTransaction ¶
func VerifyRawTransaction(rawTx *openwallet.RawTransaction) error
Types ¶
type AddrBalance ¶
func (*AddrBalance) GetAddress ¶
func (this *AddrBalance) GetAddress() string
func (*AddrBalance) SetTokenBalance ¶
func (this *AddrBalance) SetTokenBalance(b *big.Int)
func (*AddrBalance) ValidTokenBalance ¶
func (this *AddrBalance) ValidTokenBalance() bool
type AddrBalanceInf ¶
type Address ¶
type Address struct { Address string `json:"address" storm:"id"` Account string `json:"account" storm:"index"` HDPath string `json:"hdpath"` Index int PublicKey string TxCount uint64 CreatedAt time.Time // contains filtered or unexported fields }
func (*Address) CalcHexPrivKey ¶
func (this *Address) CalcHexPrivKey(masterKey *hdkeystore.HDKey) (string, error)
func (*Address) CalcPrivKey ¶
func (this *Address) CalcPrivKey(masterKey *hdkeystore.HDKey) ([]byte, error)
type AddressDecoder ¶
type AddressDecoder struct{}
AddressDecoder 地址解析器
func (*AddressDecoder) PrivateKeyToWIF ¶
func (decoder *AddressDecoder) PrivateKeyToWIF(priv []byte, isTestnet bool) (string, error)
PrivateKeyToWIF 私钥转WIF
func (*AddressDecoder) PublicKeyToAddress ¶
func (decoder *AddressDecoder) PublicKeyToAddress(pub []byte, isTestnet bool) (string, error)
PublicKeyToAddress 公钥转地址
func (*AddressDecoder) RedeemScriptToAddress ¶
func (decoder *AddressDecoder) RedeemScriptToAddress(pubs [][]byte, required uint64, isTestnet bool) (string, error)
RedeemScriptToAddress 多重签名赎回脚本转地址
func (*AddressDecoder) WIFToPrivateKey ¶
func (decoder *AddressDecoder) WIFToPrivateKey(wif string, isTestnet bool) ([]byte, error)
WIFToPrivateKey WIF转私钥
type AddressTxStatistic ¶
type AddressTxStatistic struct { Address string TransactionCount *uint64 LastModifiedTime *time.Time Valid *int //如果valid指针指向的整形为0, 说明该地址已经被清理线程清理 AddressLocker *sync.Mutex }
func (*AddressTxStatistic) UpdateTime ¶
func (this *AddressTxStatistic) UpdateTime()
type BlockHeader ¶
type BlockHeader struct { BlockNumber string `json:"number" storm:"id"` BlockHash string `json:"hash"` GasLimit string `json:"gasLimit"` GasUsed string `json:"gasUsed"` Miner string `json:"miner"` Difficulty string `json:"difficulty"` TotalDifficulty string `json:"totalDifficulty"` PreviousHash string `json:"parentHash"` BlockHeight uint64 //RecoverBlockHeader的时候进行初始化 }
type BlockTransaction ¶
type BlockTransaction struct { Hash string `json:"hash" storm:"id"` BlockNumber string `json:"blockNumber" storm:"index"` BlockHash string `json:"blockHash" storm:"index"` From string `json:"from"` To string `json:"to"` Gas string `json:"gas"` GasPrice string `json:"gasPrice"` Value string `json:"value"` Data string `json:"input"` TransactionIndex string `json:"transactionIndex"` Timestamp string `json:"timestamp"` BlockHeight uint64 //transaction scanning 的时候对其进行赋值 FilterFunc openwallet.BlockScanAddressFunc Status uint64 }
func (*BlockTransaction) GetAmountEthString ¶
func (this *BlockTransaction) GetAmountEthString() (string, error)
func (*BlockTransaction) GetTxFeeEthString ¶
func (this *BlockTransaction) GetTxFeeEthString() (string, error)
type Client ¶
func (*Client) ERC20GetAddressBalance ¶
func (*Client) ERC20GetAddressBalance2 ¶
func (*Client) EthGetBlockNumber ¶ added in v1.0.6
func (*Client) EthGetBlockSpecByBlockNum ¶ added in v1.0.4
func (*Client) EthGetTransactionByHash ¶
func (this *Client) EthGetTransactionByHash(txid string) (*BlockTransaction, error)
func (*Client) EthGetTxPoolContent ¶ added in v1.0.4
func (this *Client) EthGetTxPoolContent() (*TxpoolContent, error)
func (*Client) GetAddrBalance ¶
func (*Client) GetAddrBalance2 ¶
type ERC20Token ¶
type ETHBLockScanner ¶
type ETHBLockScanner struct { *openwallet.BlockScannerBase CurrentBlockHeight uint64 //当前区块高度 IsScanMemPool bool //是否扫描交易池 RescanLastBlockCount uint64 //重扫上N个区块数量 // contains filtered or unexported fields }
func NewETHBlockScanner ¶
func NewETHBlockScanner(wm *WalletManager) *ETHBLockScanner
NewBTCBlockScanner 创建区块链扫描器
func (*ETHBLockScanner) BatchExtractTransaction ¶
func (this *ETHBLockScanner) BatchExtractTransaction(txs []BlockTransaction) error
BatchExtractTransaction 批量提取交易单 bitcoin 1M的区块链可以容纳3000笔交易,批量多线程处理,速度更快
func (*ETHBLockScanner) DeleteUnscanRecord ¶ added in v1.0.4
func (bs *ETHBLockScanner) DeleteUnscanRecord(height uint64) error
DeleteUnscanRecord 删除指定高度的未扫记录
func (*ETHBLockScanner) DeleteUnscanRecordByID ¶ added in v1.0.4
func (bs *ETHBLockScanner) DeleteUnscanRecordByID(id string) error
DeleteUnscanRecordByID 删除指定的未扫记录
func (*ETHBLockScanner) ExtractTransactionData ¶
func (this *ETHBLockScanner) ExtractTransactionData(txid string, scanTargetFunc openwallet.BlockScanTargetFunc) (map[string][]*openwallet.TxExtractData, error)
ExtractTransactionData 扫描一笔交易
func (*ETHBLockScanner) GetBalanceByAddress ¶
func (this *ETHBLockScanner) GetBalanceByAddress(address ...string) ([]*openwallet.Balance, error)
func (*ETHBLockScanner) GetCurrentBlockHeader ¶
func (this *ETHBLockScanner) GetCurrentBlockHeader() (*openwallet.BlockHeader, error)
GetCurrentBlockHeader 获取当前区块高度
func (*ETHBLockScanner) GetGlobalMaxBlockHeight ¶
func (this *ETHBLockScanner) GetGlobalMaxBlockHeight() uint64
func (*ETHBLockScanner) GetLocalBlock ¶ added in v1.0.4
func (bs *ETHBLockScanner) GetLocalBlock(height uint64) (*EthBlock, error)
GetLocalBlock 获取本地区块数据
func (*ETHBLockScanner) GetLocalBlockHead ¶ added in v1.0.4
func (bs *ETHBLockScanner) GetLocalBlockHead() (uint64, string, error)
GetLocalBlockHead 获取本地记录的区块高度和hash
func (*ETHBLockScanner) GetLocalNewBlock ¶ added in v1.0.4
func (this *ETHBLockScanner) GetLocalNewBlock() (uint64, string, error)
GetLocalNewBlock 获取本地记录的区块高度和hash
func (*ETHBLockScanner) GetScannedBlockHeader ¶
func (this *ETHBLockScanner) GetScannedBlockHeader() (*openwallet.BlockHeader, error)
GetScannedBlockHeader 获取当前已扫区块高度
func (*ETHBLockScanner) GetScannedBlockHeight ¶ added in v1.0.4
func (this *ETHBLockScanner) GetScannedBlockHeight() uint64
GetScannedBlockHeight 获取已扫区块高度
func (*ETHBLockScanner) GetTxPoolPendingTxs ¶
func (this *ETHBLockScanner) GetTxPoolPendingTxs() ([]BlockTransaction, error)
func (*ETHBLockScanner) GetUnscanRecords ¶ added in v1.0.4
func (bs *ETHBLockScanner) GetUnscanRecords() ([]*openwallet.UnscanRecord, error)
func (*ETHBLockScanner) MakeFromExtractData ¶
func (this *ETHBLockScanner) MakeFromExtractData(tx *BlockTransaction, tokenEvent *TransferEvent) (string, []*openwallet.TxExtractData, error)
func (*ETHBLockScanner) MakeSimpleToExtractData ¶
func (this *ETHBLockScanner) MakeSimpleToExtractData(tx *BlockTransaction) (string, []*openwallet.TxExtractData, error)
func (*ETHBLockScanner) MakeSimpleTxFromExtractData ¶
func (this *ETHBLockScanner) MakeSimpleTxFromExtractData(tx *BlockTransaction) (string, []*openwallet.TxExtractData, error)
func (*ETHBLockScanner) MakeToExtractData ¶
func (this *ETHBLockScanner) MakeToExtractData(tx *BlockTransaction, tokenEvent *TransferEvent) (string, []*openwallet.TxExtractData, error)
func (*ETHBLockScanner) MakeTokenToExtractData ¶
func (this *ETHBLockScanner) MakeTokenToExtractData(tx *BlockTransaction, tokenEvent *TransferEvent) (string, []*openwallet.TxExtractData, error)
func (*ETHBLockScanner) MakeTokenTxFromExtractData ¶
func (this *ETHBLockScanner) MakeTokenTxFromExtractData(tx *BlockTransaction, tokenEvent *TransferEvent) (string, []*openwallet.TxExtractData, error)
func (*ETHBLockScanner) RescanFailedTransactions ¶
func (this *ETHBLockScanner) RescanFailedTransactions() error
func (*ETHBLockScanner) SaveLocalBlock ¶ added in v1.0.4
func (bs *ETHBLockScanner) SaveLocalBlock(blockHeader *EthBlock) error
SaveLocalBlock 记录本地新区块
func (*ETHBLockScanner) SaveLocalBlockHead ¶ added in v1.0.4
func (bs *ETHBLockScanner) SaveLocalBlockHead(blockHeight uint64, blockHash string) error
SaveLocalBlockHead 记录区块高度和hash到本地
func (*ETHBLockScanner) SaveUnscanRecord ¶ added in v1.0.4
func (bs *ETHBLockScanner) SaveUnscanRecord(record *openwallet.UnscanRecord) error
SaveUnscanRecord 保存交易记录到钱包数据库
func (*ETHBLockScanner) SaveUnscannedTransaction ¶ added in v1.0.4
func (this *ETHBLockScanner) SaveUnscannedTransaction(tx *BlockTransaction, reason string) error
func (*ETHBLockScanner) ScanBlock ¶
func (this *ETHBLockScanner) ScanBlock(height uint64) error
func (*ETHBLockScanner) ScanBlockTask ¶
func (this *ETHBLockScanner) ScanBlockTask()
func (*ETHBLockScanner) ScanTxMemPool ¶
func (this *ETHBLockScanner) ScanTxMemPool() error
func (*ETHBLockScanner) SetRescanBlockHeight ¶
func (this *ETHBLockScanner) SetRescanBlockHeight(height uint64) error
SetRescanBlockHeight 重置区块链扫描高度
func (*ETHBLockScanner) SupportBlockchainDAI ¶ added in v1.0.4
func (bs *ETHBLockScanner) SupportBlockchainDAI() bool
SupportBlockchainDAI 支持外部设置区块链数据访问接口 @optional
func (*ETHBLockScanner) TransactionScanning ¶
func (this *ETHBLockScanner) TransactionScanning(tx *BlockTransaction) (*ExtractResult, error)
func (*ETHBLockScanner) UpdateTxByReceipt ¶
func (this *ETHBLockScanner) UpdateTxByReceipt(tx *BlockTransaction) (map[string][]*TransferEvent, error)
type EthBlock ¶
type EthBlock struct { BlockHeader Transactions []BlockTransaction `json:"transactions"` }
func (*EthBlock) CreateOpenWalletBlockHeader ¶
func (this *EthBlock) CreateOpenWalletBlockHeader() *openwallet.BlockHeader
type EthContractDecoder ¶
type EthContractDecoder struct { *openwallet.SmartContractDecoderBase // contains filtered or unexported fields }
func (*EthContractDecoder) GetTokenBalanceByAddress ¶
func (this *EthContractDecoder) GetTokenBalanceByAddress(contract openwallet.SmartContract, address ...string) ([]*openwallet.TokenBalance, error)
type EthTransactionDecoder ¶
type EthTransactionDecoder struct { openwallet.TransactionDecoderBase AddrTxStatisMap *sync.Map // contains filtered or unexported fields }
func NewTransactionDecoder ¶
func NewTransactionDecoder(wm *WalletManager) *EthTransactionDecoder
NewTransactionDecoder 交易单解析器
func (*EthTransactionDecoder) CreateErc20TokenRawTransaction ¶
func (this *EthTransactionDecoder) CreateErc20TokenRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
func (*EthTransactionDecoder) CreateErc20TokenSummaryRawTransaction ¶
func (this *EthTransactionDecoder) CreateErc20TokenSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error)
CreateErc20TokenSummaryRawTransaction 创建ERC20Token汇总交易
func (*EthTransactionDecoder) CreateRawTransaction ¶
func (this *EthTransactionDecoder) CreateRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
CreateRawTransaction 创建交易单
func (*EthTransactionDecoder) CreateSimpleRawTransaction ¶
func (this *EthTransactionDecoder) CreateSimpleRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction, tmpNonce *uint64) error
func (*EthTransactionDecoder) CreateSimpleSummaryRawTransaction ¶
func (this *EthTransactionDecoder) CreateSimpleSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error)
CreateSimpleSummaryRawTransaction 创建ETH汇总交易
func (*EthTransactionDecoder) CreateSummaryRawTransaction ¶
func (this *EthTransactionDecoder) CreateSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransaction, error)
CreateSummaryRawTransaction 创建汇总交易,返回原始交易单数组
func (*EthTransactionDecoder) CreateSummaryRawTransactionWithError ¶
func (this *EthTransactionDecoder) CreateSummaryRawTransactionWithError(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error)
CreateSummaryRawTransactionWithError 创建汇总交易,返回能原始交易单数组(包含带错误的原始交易单)
func (*EthTransactionDecoder) GetRawTransactionFeeRate ¶
func (this *EthTransactionDecoder) GetRawTransactionFeeRate() (feeRate string, unit string, err error)
func (*EthTransactionDecoder) GetTransactionCount ¶
func (this *EthTransactionDecoder) GetTransactionCount(address string) (uint64, error)
func (*EthTransactionDecoder) GetTransactionCount2 ¶
func (this *EthTransactionDecoder) GetTransactionCount2(address string) (*AddressTxStatistic, uint64, error)
func (*EthTransactionDecoder) RemoveOutdatedAddrStatic ¶
func (this *EthTransactionDecoder) RemoveOutdatedAddrStatic()
func (*EthTransactionDecoder) RunClearAddrStatic ¶
func (this *EthTransactionDecoder) RunClearAddrStatic()
func (*EthTransactionDecoder) SetTransactionCount ¶
func (this *EthTransactionDecoder) SetTransactionCount(address string, transactionCount uint64) error
func (*EthTransactionDecoder) SignRawTransaction ¶
func (this *EthTransactionDecoder) SignRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
SignRawTransaction 签名交易单
func (*EthTransactionDecoder) SubmitErc20TokenRawTransaction ¶
func (this *EthTransactionDecoder) SubmitErc20TokenRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) (*openwallet.Transaction, error)
func (*EthTransactionDecoder) SubmitRawTransaction ¶
func (this *EthTransactionDecoder) SubmitRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) (*openwallet.Transaction, error)
SendRawTransaction 广播交易单
func (*EthTransactionDecoder) SubmitSimpleRawTransaction ¶
func (this *EthTransactionDecoder) SubmitSimpleRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) (*openwallet.Transaction, error)
func (*EthTransactionDecoder) VerifyRawTransaction ¶
func (this *EthTransactionDecoder) VerifyRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
VerifyRawTransaction 验证交易单,验证交易单并返回加入签名后的交易单
type EthTransactionReceipt ¶
type EthTransactionReceipt struct { Logs []EthEvent `json:"logs"` GasUsed string `json:"gasUsed"` Status string `json:"status"` }
func (*EthTransactionReceipt) ParseTransferEvent ¶
func (this *EthTransactionReceipt) ParseTransferEvent() map[string][]*TransferEvent
type EthTxExtPara ¶
func NewEthTxExtPara ¶
func NewEthTxExtPara(j gjson.Result) *EthTxExtPara
type ExtractResult ¶
type ExtractResult struct { //Recharges []*openwallet.Recharge TxID string BlockHeight uint64 Success bool // contains filtered or unexported fields }
ExtractResult 扫描完成的提取结果
type SaveResult ¶
SaveResult 保存结果
type SolidityParam ¶
type SolidityParam struct { ParamType string ParamValue interface{} }
type TokenAddrVec ¶
type TokenAddrVec struct {
// contains filtered or unexported fields
}
func (*TokenAddrVec) Len ¶
func (this *TokenAddrVec) Len() int
func (*TokenAddrVec) Less ¶
func (this *TokenAddrVec) Less(i, j int) bool
func (*TokenAddrVec) Swap ¶
func (this *TokenAddrVec) Swap(i, j int)
type TransferEvent ¶
type TxpoolContent ¶
type TxpoolContent struct {
Pending map[string]map[string]BlockTransaction `json:"pending"`
}
func (*TxpoolContent) GetPendingTxCountForAddr ¶
func (this *TxpoolContent) GetPendingTxCountForAddr(addr string) int
func (*TxpoolContent) GetSequentTxNonce ¶
type Wallet ¶
type Wallet struct { WalletID string `json:"rootid" storm:"id"` Alias string `json:"alias"` Password string `json:"password"` RootPub string `json:"rootpub"` RootPath string KeyFile string HdPath string PublicKey string AddressCount uint64 // contains filtered or unexported fields }
func GetWalletKey ¶
func GetWalletKeys ¶
func (*Wallet) ClearAllTransactions ¶
func (*Wallet) DeleteTransactionByHeight ¶
func (*Wallet) DumpWalletDB ¶
func (*Wallet) HDKey2 ¶
func (this *Wallet) HDKey2(password string) (*hdkeystore.HDKey, error)
HDKey 获取钱包密钥,需要密码
func (*Wallet) RestoreFromDb ¶
func (*Wallet) SaveTransactions ¶
func (this *Wallet) SaveTransactions(dbPath string, txs []BlockTransaction) error
type WalletConfig ¶
type WalletConfig struct { //币种 Symbol string MasterKey string RootDir string //RPC认证账户名 //RpcUser string //RPC认证账户密码 //RpcPassword string //证书目录 //CertsDir string //钥匙备份路径 KeyDir string //地址导出路径 AddressDir string //配置文件路径 ConfigFilePath string //配置文件名 ConfigFileName string //rpc证书 //CertFileName string //区块链数据文件 //BlockchainFile string //是否测试网络 IsTestNet bool // 核心钱包是否只做监听 //CoreWalletWatchOnly bool //最大的输入数量 //MaxTxInputs int //本地数据库文件路径 DbPath string //备份路径 BackupDir string //钱包服务API ServerAPI string //钱包安装的路径 //NodeInstallPath string //钱包数据文件目录 //WalletDataPath string //汇总阀值 //ThreaholdStr string Threshold *big.Int `json:"-"` //汇总地址 SumAddress string //汇总执行间隔时间 CycleSeconds uint64 //time.Duration //默认配置内容 // DefaultConfig string //曲线类型 CurveType uint32 //小数位长度 // CoinDecimal decimal.Decimal `json:"-"` EthereumKeyPath string //是否完全依靠本地维护nonce LocalNonce bool ChainID uint64 //数据目录 DataDir string //固定gasLimit值 FixGasLimit *big.Int }
func NewConfig ¶
func NewConfig(symbol string) *WalletConfig
func (*WalletConfig) LoadConfig ¶
func (this *WalletConfig) LoadConfig(configFilePath string, configFileName string) (*WalletConfig, error)
type WalletManager ¶
type WalletManager struct { openwallet.AssetsAdapterBase Storage *hdkeystore.HDKeystore //秘钥存取 WalletClient *Client // 节点客户端 Config *WalletConfig //钱包管理配置 WalletsInSum map[string]*openwallet.Wallet //参与汇总的钱包 Blockscanner openwallet.BlockScanner //区块扫描器 Decoder openwallet.AddressDecoder //地址编码器 TxDecoder openwallet.TransactionDecoder //交易单编码器 WalletInSumOld map[string]*Wallet ContractDecoder openwallet.SmartContractDecoder // //StorageOld *keystore.HDKeystore ConfigPath string RootPath string DefaultConfig string Log *log.OWLogger //日志工具 // contains filtered or unexported fields }
func NewWalletManager ¶
func NewWalletManager() *WalletManager
func (*WalletManager) AddWalletInSummary ¶
func (this *WalletManager) AddWalletInSummary(wid string, wallet *Wallet)
AddWalletInSummary 添加汇总钱包账户
func (*WalletManager) BackupWallet2 ¶
func (*WalletManager) BackupWalletToDefaultPath ¶
func (this *WalletManager) BackupWalletToDefaultPath(wallet *Wallet, password string) (string, error)
func (*WalletManager) CreateWallet ¶
func (*WalletManager) EthSendRawTransaction ¶
func (this *WalletManager) EthSendRawTransaction(signedTx string) (string, error)
func (*WalletManager) GetAddressDecode ¶
func (this *WalletManager) GetAddressDecode() openwallet.AddressDecoder
GetAddressDecode 地址解析器
func (*WalletManager) GetAddressWithBalance ¶
func (this *WalletManager) GetAddressWithBalance(addresses ...*openwallet.Address) error
GetAddressWithBalance 获取多个地址余额,使用查账户和单地址
func (*WalletManager) GetAssetsLogger ¶
func (this *WalletManager) GetAssetsLogger() *log.OWLogger
GetAssetsLogger 获取资产账户日志工具
func (*WalletManager) GetBlockScanner ¶
func (this *WalletManager) GetBlockScanner() openwallet.BlockScanner
GetBlockScanner 获取区块链
func (*WalletManager) GetConfig ¶
func (this *WalletManager) GetConfig() WalletConfig
func (*WalletManager) GetERC20TokenList ¶
func (this *WalletManager) GetERC20TokenList() ([]ERC20Token, error)
func (*WalletManager) GetERC20TokenTransactionFeeEstimated ¶
func (this *WalletManager) GetERC20TokenTransactionFeeEstimated(from string, to string, data string) (*txFeeInfo, error)
func (*WalletManager) GetErc20TokenEvent ¶
func (this *WalletManager) GetErc20TokenEvent(transactionID string) (map[string][]*TransferEvent, error)
func (*WalletManager) GetNonceForAddress ¶
func (this *WalletManager) GetNonceForAddress(address string) (uint64, error)
func (*WalletManager) GetNonceForAddress2 ¶
func (this *WalletManager) GetNonceForAddress2(address string) (uint64, error)
func (*WalletManager) GetSimpleTransactionFeeEstimated ¶
func (*WalletManager) GetSmartContractDecoder ¶
func (this *WalletManager) GetSmartContractDecoder() openwallet.SmartContractDecoder
func (*WalletManager) GetTokenBalanceByAddress ¶
func (this *WalletManager) GetTokenBalanceByAddress(contractAddr string, addrs ...AddrBalanceInf) error
func (*WalletManager) GetTransactionDecoder ¶
func (this *WalletManager) GetTransactionDecoder() openwallet.TransactionDecoder
GetTransactionDecoder 交易单解析器
func (*WalletManager) GetTransactionFeeEstimated ¶
func (*WalletManager) ImportWatchOnlyAddress ¶
func (this *WalletManager) ImportWatchOnlyAddress(address ...*openwallet.Address) error
ImportWatchOnlyAddress 导入观测地址
func (*WalletManager) InitAssetsConfig ¶
func (this *WalletManager) InitAssetsConfig() (config.Configer, error)
InitAssetsConfig 初始化默认配置
func (*WalletManager) LoadAssetsConfig ¶
func (this *WalletManager) LoadAssetsConfig(c config.Configer) error
func (*WalletManager) PrintConfig ¶
func (this *WalletManager) PrintConfig() error
func (*WalletManager) RecoverUnscannedTransactions ¶
func (this *WalletManager) RecoverUnscannedTransactions(unscannedTxs []*openwallet.UnscanRecord) ([]BlockTransaction, error)
func (*WalletManager) SaveERC20TokenConfig ¶
func (this *WalletManager) SaveERC20TokenConfig(config *ERC20Token) error
func (*WalletManager) SendTransactionToAddr ¶
func (this *WalletManager) SendTransactionToAddr(param map[string]interface{}) (string, error)
func (*WalletManager) UnlockWallet ¶
func (this *WalletManager) UnlockWallet(wallet *Wallet, password string) error