Documentation ¶
Index ¶
- Constants
- type AddrBalance
- 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 AlgoBlockScanner
- func (bs *AlgoBlockScanner) BatchExtractTransaction(blockHeight uint64, blockHash string, blockTime int64, txs []string) error
- func (bs *AlgoBlockScanner) ExtractTransaction(blockHeight uint64, blockHash string, transaction *Transaction, ...) ExtractResult
- func (bs *AlgoBlockScanner) ExtractTransactionData(txid string, scanAddressFunc openwallet.BlockScanTargetFunc) (map[string][]*openwallet.TxExtractData, error)
- func (bs *AlgoBlockScanner) GetBalanceByAddress(address ...string) ([]*openwallet.Balance, error)
- func (bs *AlgoBlockScanner) GetBlockByHeight(height uint64) (*Block, error)
- func (bs *AlgoBlockScanner) GetBlockHeight() (uint64, error)
- func (bs *AlgoBlockScanner) GetCurrentBlock() (*Block, error)
- func (bs *AlgoBlockScanner) GetCurrentBlockHeader() (*openwallet.BlockHeader, error)
- func (bs *AlgoBlockScanner) GetGlobalMaxBlockHeight() uint64
- func (bs *AlgoBlockScanner) GetScannedBlockHeader() (*openwallet.BlockHeader, error)
- func (bs *AlgoBlockScanner) GetScannedBlockHeight() uint64
- func (bs *AlgoBlockScanner) GetTransaction(hash string) (*Transaction, error)
- func (bs *AlgoBlockScanner) InitExtractResult(transaction *Transaction, sourceKey string, result *ExtractResult, ...)
- func (bs *AlgoBlockScanner) RescanFailedRecord()
- func (bs *AlgoBlockScanner) SaveUnscanRecord(record *UnscanRecord) error
- func (bs *AlgoBlockScanner) ScanBlock(height uint64) error
- func (bs *AlgoBlockScanner) ScanBlockTask()
- func (bs *AlgoBlockScanner) SetRescanBlockHeight(height uint64) error
- type Block
- type ExtractResult
- type SaveResult
- type Transaction
- type TransactionDecoder
- func (decoder *TransactionDecoder) CreateRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
- func (decoder *TransactionDecoder) CreateSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransaction, error)
- func (decoder *TransactionDecoder) CreateSummaryRawTransactionWithError(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error)
- func (decoder *TransactionDecoder) GetRawTransactionFeeRate() (feeRate string, unit string, err error)
- func (decoder *TransactionDecoder) SignRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
- func (decoder *TransactionDecoder) SubmitRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) (*openwallet.Transaction, error)
- func (decoder *TransactionDecoder) VerifyRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
- type UnscanRecord
- type WalletConfig
- type WalletManager
- func (wm *WalletManager) BalanceModelType() openwallet.BalanceModelType
- func (wm *WalletManager) CurveType() uint32
- func (wm *WalletManager) Decimal() int32
- func (wm *WalletManager) DeleteUnscanRecord(height uint64) error
- func (wm *WalletManager) DeleteUnscanRecordNotFindTX() error
- func (wm *WalletManager) FullName() string
- func (wm *WalletManager) GetAddressDecode() openwallet.AddressDecoder
- func (wm *WalletManager) GetAssetsLogger() *log.OWLogger
- func (wm *WalletManager) GetBlockScanner() openwallet.BlockScanner
- func (wm *WalletManager) GetLocalBlock(height uint64) (*Block, error)
- func (wm *WalletManager) GetLocalNewBlock() (uint64, string)
- func (wm *WalletManager) GetSmartContractDecoder() openwallet.SmartContractDecoder
- func (wm *WalletManager) GetTransactionDecoder() openwallet.TransactionDecoder
- func (wm *WalletManager) GetUnscanRecords() ([]*UnscanRecord, error)
- func (wm *WalletManager) InitAssetsConfig() (config.Configer, error)
- func (wm *WalletManager) LoadAssetsConfig(c config.Configer) error
- func (wm *WalletManager) SaveLocalBlock(block *Block)
- func (wm *WalletManager) SaveLocalNewBlock(blockHeight uint64, blockHash string)
- func (wm *WalletManager) Symbol() string
Constants ¶
const ( //币种 Symbol = "ALGO" CurveType = owcrypt.ECC_CURVE_ED25519 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddrBalance ¶
func NewAddrBalance ¶
func NewAddrBalance(b *openwallet.Balance) *AddrBalance
type AddressDecoder ¶
type AddressDecoder struct {
// contains filtered or unexported fields
}
func NewAddressDecoder ¶
func NewAddressDecoder(wm *WalletManager) *AddressDecoder
NewAddressDecoder 地址解析器
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 AlgoBlockScanner ¶
type AlgoBlockScanner struct { *openwallet.BlockScannerBase CurrentBlockHeight uint64 //当前区块高度 RescanLastBlockCount uint64 //重扫上N个区块数量 // contains filtered or unexported fields }
AlgoBlockScanner Algo block scanner
func NewAlgoBlockScanner ¶
func NewAlgoBlockScanner(wm *WalletManager) *AlgoBlockScanner
NewEOSBlockScanner create a block scanner
func (*AlgoBlockScanner) BatchExtractTransaction ¶
func (bs *AlgoBlockScanner) BatchExtractTransaction(blockHeight uint64, blockHash string, blockTime int64, txs []string) error
BatchExtractTransaction 批量提取交易单
func (*AlgoBlockScanner) ExtractTransaction ¶
func (bs *AlgoBlockScanner) ExtractTransaction(blockHeight uint64, blockHash string, transaction *Transaction, scanTargetFunc openwallet.BlockScanTargetFunc) ExtractResult
提取交易单
func (*AlgoBlockScanner) ExtractTransactionData ¶
func (bs *AlgoBlockScanner) ExtractTransactionData(txid string, scanAddressFunc openwallet.BlockScanTargetFunc) (map[string][]*openwallet.TxExtractData, error)
ExtractTransactionData
func (*AlgoBlockScanner) GetBalanceByAddress ¶
func (bs *AlgoBlockScanner) GetBalanceByAddress(address ...string) ([]*openwallet.Balance, error)
GetBalanceByAddress 查询地址余额
func (*AlgoBlockScanner) GetBlockByHeight ¶
func (bs *AlgoBlockScanner) GetBlockByHeight(height uint64) (*Block, error)
func (*AlgoBlockScanner) GetBlockHeight ¶
func (bs *AlgoBlockScanner) GetBlockHeight() (uint64, error)
GetBlockHeight 获取区块链高度
func (*AlgoBlockScanner) GetCurrentBlock ¶
func (bs *AlgoBlockScanner) GetCurrentBlock() (*Block, error)
GetCurrentBlock 获取当前最新区块
func (*AlgoBlockScanner) GetCurrentBlockHeader ¶
func (bs *AlgoBlockScanner) GetCurrentBlockHeader() (*openwallet.BlockHeader, error)
GetCurrentBlockHeader 获取当前区块高度
func (*AlgoBlockScanner) GetGlobalMaxBlockHeight ¶
func (bs *AlgoBlockScanner) GetGlobalMaxBlockHeight() uint64
GetGlobalMaxBlockHeight 获取区块链全网最大高度
func (*AlgoBlockScanner) GetScannedBlockHeader ¶
func (bs *AlgoBlockScanner) GetScannedBlockHeader() (*openwallet.BlockHeader, error)
GetScannedBlockHeader 获取当前扫描的区块头
func (*AlgoBlockScanner) GetScannedBlockHeight ¶
func (bs *AlgoBlockScanner) GetScannedBlockHeight() uint64
GetScannedBlockHeight 获取已扫区块高度
func (*AlgoBlockScanner) GetTransaction ¶
func (bs *AlgoBlockScanner) GetTransaction(hash string) (*Transaction, error)
GetTransaction
func (*AlgoBlockScanner) InitExtractResult ¶
func (bs *AlgoBlockScanner) InitExtractResult(transaction *Transaction, sourceKey string, result *ExtractResult, operate int64)
InitTronExtractResult operate = 0: 输入输出提取,1: 输入提取,2:输出提取
func (*AlgoBlockScanner) RescanFailedRecord ¶
func (bs *AlgoBlockScanner) RescanFailedRecord()
rescanFailedRecord 重扫失败记录
func (*AlgoBlockScanner) SaveUnscanRecord ¶
func (bs *AlgoBlockScanner) SaveUnscanRecord(record *UnscanRecord) error
SaveTxToWalletDB 保存交易记录到钱包数据库
func (*AlgoBlockScanner) ScanBlock ¶
func (bs *AlgoBlockScanner) ScanBlock(height uint64) error
ScanBlock 扫描指定高度区块
func (*AlgoBlockScanner) ScanBlockTask ¶
func (bs *AlgoBlockScanner) ScanBlockTask()
ScanBlockTask 扫描任务
func (*AlgoBlockScanner) SetRescanBlockHeight ¶
func (bs *AlgoBlockScanner) SetRescanBlockHeight(height uint64) error
SetRescanBlockHeight 重置区块链扫描高度
type Block ¶
type Block struct { Hash string CurrentProtocol string PrevBlockHash string TransactionsRoot string Proposer string Time int64 Height uint64 Transactions []string }
func (*Block) BlockHeader ¶
func (b *Block) BlockHeader(symbol string) *openwallet.BlockHeader
BlockHeader 区块链头
type ExtractResult ¶
type ExtractResult struct { TxID string BlockHeight uint64 Success bool // contains filtered or unexported fields }
ExtractResult 扫描完成的提取结果
type SaveResult ¶
SaveResult result
type Transaction ¶
type Transaction struct { Type string `json:"type"` BlockHash string BlockHeight uint64 BlockTime int64 GenesisID string `json:"genesisID"` Fee uint64 `json:"fee"` TxID string `json:"tx"` From string `json:"from"` Note []byte `json:"note"` Payment *models.PaymentTransactionType `json:"payment,omitempty"` }
func NewTransaction ¶
func NewTransaction(tx models.Transaction) *Transaction
type TransactionDecoder ¶
type TransactionDecoder struct { openwallet.TransactionDecoderBase // contains filtered or unexported fields }
func NewTransactionDecoder ¶
func NewTransactionDecoder(wm *WalletManager) *TransactionDecoder
NewTransactionDecoder 交易单解析器
func (*TransactionDecoder) CreateRawTransaction ¶
func (decoder *TransactionDecoder) CreateRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
CreateRawTransaction 创建交易单
func (*TransactionDecoder) CreateSummaryRawTransaction ¶
func (decoder *TransactionDecoder) CreateSummaryRawTransaction(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransaction, error)
CreateSummaryRawTransaction 创建汇总交易
func (*TransactionDecoder) CreateSummaryRawTransactionWithError ¶
func (decoder *TransactionDecoder) CreateSummaryRawTransactionWithError(wrapper openwallet.WalletDAI, sumRawTx *openwallet.SummaryRawTransaction) ([]*openwallet.RawTransactionWithError, error)
CreateSummaryRawTransactionWithError 创建汇总交易,返回能原始交易单数组(包含带错误的原始交易单)
func (*TransactionDecoder) GetRawTransactionFeeRate ¶
func (decoder *TransactionDecoder) GetRawTransactionFeeRate() (feeRate string, unit string, err error)
GetRawTransactionFeeRate 获取交易单的费率
func (*TransactionDecoder) SignRawTransaction ¶
func (decoder *TransactionDecoder) SignRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
SignRawTransaction 签名交易单
func (*TransactionDecoder) SubmitRawTransaction ¶
func (decoder *TransactionDecoder) SubmitRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) (*openwallet.Transaction, error)
SendRawTransaction 广播交易单
func (*TransactionDecoder) VerifyRawTransaction ¶
func (decoder *TransactionDecoder) VerifyRawTransaction(wrapper openwallet.WalletDAI, rawTx *openwallet.RawTransaction) error
VerifyRawTransaction 验证交易单,验证交易单并返回加入签名后的交易单
type UnscanRecord ¶
type UnscanRecord struct { ID string `storm:"id"` // primary key BlockHeight uint64 TxID string Reason string }
UnscanRecords 扫描失败的区块及交易
func NewUnscanRecord ¶
func NewUnscanRecord(height uint64, txID, reason string) *UnscanRecord
type WalletConfig ¶
type WalletConfig struct { //币种 Symbol string //区块链数据文件 BlockchainFile string //钱包服务API ServerAPI string //algod service token ServerToken string //默认配置内容 DefaultConfig string //曲线类型 CurveType uint32 //链ID NetworkID string //固定手续费 FixFees string // ValidRounds limits valid rounds delay count ValidRounds uint64 // force address to retain the balance AddressRetainAmount string // contains filtered or unexported fields }
func NewConfig ¶
func NewConfig(symbol string) *WalletConfig
type WalletManager ¶
type WalletManager struct { openwallet.AssetsAdapterBase Config *WalletConfig // 节点配置 Decoder openwallet.AddressDecoder //地址编码器 TxDecoder openwallet.TransactionDecoder //交易单编码器 Log *log.OWLogger //日志工具 ContractDecoder openwallet.SmartContractDecoder //智能合约解析器 Blockscanner *AlgoBlockScanner //区块扫描器 // contains filtered or unexported fields }
func NewWalletManager ¶
func NewWalletManager() *WalletManager
func (*WalletManager) BalanceModelType ¶
func (wm *WalletManager) BalanceModelType() openwallet.BalanceModelType
BalanceModelType 余额模型类别
func (*WalletManager) DeleteUnscanRecord ¶
func (wm *WalletManager) DeleteUnscanRecord(height uint64) error
DeleteUnscanRecord 删除指定高度的未扫记录
func (*WalletManager) DeleteUnscanRecordNotFindTX ¶
func (wm *WalletManager) DeleteUnscanRecordNotFindTX() error
DeleteUnscanRecordNotFindTX 删除未没有找到交易记录的重扫记录
func (*WalletManager) GetAddressDecode ¶
func (wm *WalletManager) GetAddressDecode() openwallet.AddressDecoder
GetAddressDecode 地址解析器
func (*WalletManager) GetAssetsLogger ¶
func (wm *WalletManager) GetAssetsLogger() *log.OWLogger
GetAssetsLogger 获取资产账户日志工具
func (*WalletManager) GetBlockScanner ¶
func (wm *WalletManager) GetBlockScanner() openwallet.BlockScanner
GetBlockScanner 获取区块链
func (*WalletManager) GetLocalBlock ¶
func (wm *WalletManager) GetLocalBlock(height uint64) (*Block, error)
GetLocalBlock 获取本地区块数据
func (*WalletManager) GetLocalNewBlock ¶
func (wm *WalletManager) GetLocalNewBlock() (uint64, string)
GetLocalNewBlock 获取本地记录的区块高度和hash
func (*WalletManager) GetSmartContractDecoder ¶
func (wm *WalletManager) GetSmartContractDecoder() openwallet.SmartContractDecoder
GetSmartContractDecoder 获取智能合约解析器
func (*WalletManager) GetTransactionDecoder ¶
func (wm *WalletManager) GetTransactionDecoder() openwallet.TransactionDecoder
GetTransactionDecoder 交易单解析器
func (*WalletManager) GetUnscanRecords ¶
func (wm *WalletManager) GetUnscanRecords() ([]*UnscanRecord, error)
获取未扫记录
func (*WalletManager) InitAssetsConfig ¶
func (wm *WalletManager) InitAssetsConfig() (config.Configer, error)
InitAssetsConfig 初始化默认配置
func (*WalletManager) LoadAssetsConfig ¶
func (wm *WalletManager) LoadAssetsConfig(c config.Configer) error
LoadAssetsConfig 加载外部配置
func (*WalletManager) SaveLocalBlock ¶
func (wm *WalletManager) SaveLocalBlock(block *Block)
SaveLocalBlock 记录本地新区块
func (*WalletManager) SaveLocalNewBlock ¶
func (wm *WalletManager) SaveLocalNewBlock(blockHeight uint64, blockHash string)
SaveLocalNewBlock 记录区块高度和hash到本地