openwcli

package
v1.2.18 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2019 License: GPL-3.0 Imports: 25 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CLIBucket          = "CLIBucket"
	CurrentKeychainKey = "current_keychain"
)

Variables

View Source
var (
	ErrorAppIDIncorrect             = uint64(20001)
	ErrorSummaryTaskTimerIsRunning  = uint64(20002)
	ErrorSummaryTaskTimerIsNotStart = uint64(20003)
	ErrorNodeAbilityDisabled        = uint64(20004)
)

Functions

func FindExistedSummaryAccountTask

func FindExistedSummaryAccountTask(accountID string, tasks []*openwsdk.SummaryAccountTask) (int, *openwsdk.SummaryAccountTask)

func FindExistedSummaryWalletTask

func FindExistedSummaryWalletTask(walletID string, tasks []*openwsdk.SummaryWalletTask) (int, *openwsdk.SummaryWalletTask)

func GenKeychainFlow

func GenKeychainFlow() error

GenKeychainFlow 生成新的keychain流程

func SetupLog

func SetupLog(logDir, logFile string, debug bool)

SetupLog 配置日志

Types

type CLI

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

func NewCLI

func NewCLI(c *Config) (*CLI, error)

初始化工具

func (*CLI) CreateAccountOnServer

func (cli *CLI) CreateAccountOnServer(name, password, symbol string, wallet *openwsdk.Wallet) (*openwsdk.Account, []*openwsdk.Address, error)

CreateAccountOnServer

func (*CLI) CreateAddressOnServer

func (cli *CLI) CreateAddressOnServer(walletID, accountID string, count uint64) error

CreateAddressOnServer

func (*CLI) CreateWalletOnServer

func (cli *CLI) CreateWalletOnServer(name, password string) (*openwsdk.Wallet, error)

CreateWalletOnServer

func (*CLI) GetAccountByAccountID

func (cli *CLI) GetAccountByAccountID(accountID string) (*openwsdk.Account, error)

GetAccountOnServerByAccountID 从服务器获取账户

func (*CLI) GetAccountsOnServer

func (cli *CLI) GetAccountsOnServer(walletID string) ([]*openwsdk.Account, error)

GetAccountsOnServer 从服务器获取账户列表

func (*CLI) GetAddressesOnServer

func (cli *CLI) GetAddressesOnServer(walletID, accountID string, offset, limit int) ([]*openwsdk.Address, error)

GetAddressesOnServer

func (*CLI) GetAllTokenContractBalance

func (cli *CLI) GetAllTokenContractBalance(accountID string, symbol string) ([]*openwsdk.TokenBalance, error)

GetAllTokenContractBalance 查询账户合约余额

func (*CLI) GetKeychain

func (cli *CLI) GetKeychain() (*Keychain, error)

GetKeychain

func (*CLI) GetNodeInfoFlow

func (cli *CLI) GetNodeInfoFlow() error

GetNodeInfo 获取节点信息

func (*CLI) GetSummaryTaskLog

func (cli *CLI) GetSummaryTaskLog(offset, limit int64) ([]*openwsdk.SummaryTaskLog, error)

func (*CLI) GetSymbolInfo

func (cli *CLI) GetSymbolInfo(symbol string) (*openwsdk.Symbol, error)

GetLocalSymbolInfo 查询本地主链信息

func (*CLI) GetSymbolList

func (cli *CLI) GetSymbolList() ([]*openwsdk.Symbol, error)

GetLocalSymbolList 查询本地保存主链

func (*CLI) GetTokenBalance

func (cli *CLI) GetTokenBalance(account *openwsdk.Account, contractID string) string

GetTokenBalance 获取代币余额

func (*CLI) GetTokenBalanceByContractAddress added in v1.2.10

func (cli *CLI) GetTokenBalanceByContractAddress(account *openwsdk.Account, address string) (*openwsdk.TokenBalance, error)

GetTokenBalanceByContractAddress 通过代币合约的地址获取代币余额

func (*CLI) GetTokenContractInfo

func (cli *CLI) GetTokenContractInfo(contractID string) (*openwsdk.TokenContract, error)

GetTokenContractInfo 查询单个合约信息

func (*CLI) GetTokenContractList

func (cli *CLI) GetTokenContractList(cols ...interface{}) ([]*openwsdk.TokenContract, error)

GetContractList 查询本地保存代币合约信息

func (*CLI) GetWalletByWalletID

func (cli *CLI) GetWalletByWalletID(walletID string) (*openwsdk.Wallet, error)

GetWalletByWalletID 查找本地且线上有的钱包对象

func (*CLI) GetWalletByWalletIDOnLocal

func (cli *CLI) GetWalletByWalletIDOnLocal(walletID string) (*openwsdk.Wallet, error)

GetWalletByWalletIDOnLocal 查找本地种子目录的钱包对象

func (*CLI) GetWalletsOnServer

func (cli *CLI) GetWalletsOnServer() ([]*openwsdk.Wallet, error)

GetWalletsByKeyDir 通过给定的文件路径加载keystore文件得到钱包列表

func (*CLI) ListAccountFlow

func (cli *CLI) ListAccountFlow() error

ListAccountFlow

func (*CLI) ListAddressFlow

func (cli *CLI) ListAddressFlow() error

ListAddressFlow

func (*CLI) ListSumInfoFlow

func (cli *CLI) ListSumInfoFlow() error

ListSumInfoFlow

func (*CLI) ListSymbolFlow

func (cli *CLI) ListSymbolFlow() error

ListSymbolFlow

func (*CLI) ListTokenBalanceFlow

func (cli *CLI) ListTokenBalanceFlow() error

ListTokenBalanceFlow

func (*CLI) ListTokenContractFlow

func (cli *CLI) ListTokenContractFlow() error

ListTokenContractFlow

func (*CLI) ListWalletFlow

func (cli *CLI) ListWalletFlow() error

ListWalletFlow

func (*CLI) NewAccountFlow

func (cli *CLI) NewAccountFlow() error

NewAccountFlow

func (*CLI) NewAddressFlow

func (cli *CLI) NewAddressFlow() error

NewAddressFlow

func (*CLI) NewWalletFlow

func (cli *CLI) NewWalletFlow() error

NewWalletFlow 创建钱包流程

func (*CLI) RegisterFlow

func (cli *CLI) RegisterFlow() error

RegisterFlow 注册节点流程

func (*CLI) RegisterOnServer

func (cli *CLI) RegisterOnServer() error

RegisterOnServer 注册节点到openw-server

func (*CLI) SaveCurrentKeychain

func (cli *CLI) SaveCurrentKeychain(keychain *Keychain) error

SaveCurrentKeychain 保存新密钥对到本地缓存

func (*CLI) SearchAddressFlow

func (cli *CLI) SearchAddressFlow() error

SearchAddressFlow

func (*CLI) SearchAddressOnServer

func (cli *CLI) SearchAddressOnServer(address string) (*openwsdk.Address, error)

SearchAddressOnServer

func (*CLI) ServeTransmitNode

func (cli *CLI) ServeTransmitNode(autoReconnect bool) error

func (*CLI) SetSumFlow

func (cli *CLI) SetSumFlow() error

SetSumFlow

func (*CLI) SetSummaryInfo

func (cli *CLI) SetSummaryInfo(obj *openwsdk.SummarySetting) error

SetSummaryInfo 设置账户的汇总设置

func (*CLI) StartSumFlow

func (cli *CLI) StartSumFlow(file string) error

StartSumFlow

func (*CLI) StartTrustServerFlow

func (cli *CLI) StartTrustServerFlow() error

StartTrustServerFlow

func (*CLI) SummaryAccountMainCoin

func (cli *CLI) SummaryAccountMainCoin(accountTask *openwsdk.SummaryAccountTask, account *openwsdk.Account, key *hdkeystore.HDKey) error

SummaryAccountMainCoin 汇总账户主币

func (*CLI) SummaryAccountTokenContracts

func (cli *CLI) SummaryAccountTokenContracts(accountTask *openwsdk.SummaryAccountTask, account *openwsdk.Account, key *hdkeystore.HDKey) error

SummaryAccountTokenContracts 汇总账户代币合约

func (*CLI) SummaryTask

func (cli *CLI) SummaryTask()

SummaryWallets 执行汇总流程

func (*CLI) Transfer

func (cli *CLI) Transfer(wallet *openwsdk.Wallet, account *openwsdk.Account, contractAddress, to, amount, sid, feeRate, memo, password string) ([]*openwsdk.Transaction, []*openwsdk.FailedRawTransaction, *openwallet.Error)

Transfer 转账交易

func (*CLI) TransferAll added in v1.2.15

func (cli *CLI) TransferAll(wallet *openwsdk.Wallet, account *openwsdk.Account, contractAddress, to, sid, feeRate, memo, password string) error

func (*CLI) TransferAllFlow added in v1.2.15

func (cli *CLI) TransferAllFlow() error

TransferAllFlow

func (*CLI) TransferFlow

func (cli *CLI) TransferFlow() error

TransferFlow

func (*CLI) UpdateInfoFlow

func (cli *CLI) UpdateInfoFlow() error

UpdateInfoFlow

func (*CLI) UpdateSymbols

func (cli *CLI) UpdateSymbols() error

UpdateSymbols 更新主链

func (*CLI) UpdateTokenContracts

func (cli *CLI) UpdateTokenContracts(symbol string) error

UpdateSymbols 更新主链

type Config

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

配置

func LoadConfig

func LoadConfig(path string) (*Config, error)

加载工具配置

func NewConfig

func NewConfig(c config.Configer) *Config

初始化一个配置对象

type Keychain

type Keychain struct {
	NodeID     string `json:"nodeID" storm:"id"`
	PrivateKey string `json:"privateKey"`
	PublicKey  string `json:"publicKey"`
	// contains filtered or unexported fields
}

密钥对

func GenKeychain

func GenKeychain() (*Keychain, error)

GenKeychain 生成新密钥对

func NewKeychain

func NewKeychain(cert owtp.Certificate) *Keychain

初始化密钥对

func (*Keychain) Certificate

func (keychain *Keychain) Certificate() (owtp.Certificate, error)

type StormDB added in v1.2.3

type StormDB struct {
	*storm.DB
	FileName string
	Opened   bool
}

func OpenStormDB added in v1.2.3

func OpenStormDB(filename string, stormOptions ...func(*storm.Options) error) (*StormDB, error)

OpenStormDB

func (*StormDB) Close added in v1.2.3

func (db *StormDB) Close() error

Close closes the database.

Jump to

Keyboard shortcuts

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