bytom

package
v2.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2022 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//币种
	Symbol = "BTM"
)

Variables

This section is empty.

Functions

func AddWalletInSummary

func AddWalletInSummary(wid string, wallet *AccountBalance)

AddWalletInSummary 添加汇总钱包账户

func BackupWallet

func BackupWallet() (string, error)

BackupWallet 备份钱包私钥数据

func BuildSummaryTransaction

func BuildSummaryTransaction(to, assetsID string, amount uint64, utxo []*Unspent) (string, error)

BuildSummaryTransaction 创建汇总交易单

func BuildTransaction

func BuildTransaction(from, to, assetsID string, amount, fees uint64) (string, error)

CreateReceiverAddress 给指定账户创建地址

func CreateBatchAddress

func CreateBatchAddress(alias, accountID string, count uint64) (string, error)

CreateBatchAddress 批量创建地址

func EstimateTransactionGas

func EstimateTransactionGas(txForm string) (uint64, error)

GetTransactions 获取交易列表

func GetTransactions

func GetTransactions(accountID string) (string, error)

GetTransactions 获取交易列表

func RestoreWallet

func RestoreWallet(keystore []byte) error

RestoreWallet 通过keystore恢复钱包

func SendSummaryTransaction

func SendSummaryTransaction(accountID, to, assetsID string, password string) ([]string, error)

func SendTransaction

func SendTransaction(accountID, to, assetsID string, amount uint64, password string, feesInSender bool) (string, error)

SendTransaction 发送交易

func SignMessage

func SignMessage(address, message, password string) (string, error)

SignMessage 消息签名

func SignTransaction

func SignTransaction(txForm, password string) (string, error)

SignTransaction 签名交易

func SubmitTransaction

func SubmitTransaction(txRaw string) (string, error)

SubmitTransaction 提交新交易单

func SummaryWallets

func SummaryWallets()

SummaryWallets 执行汇总流程

Types

type Account

type Account struct {
	Alias    string   `json:"alias"`
	ID       string   `json:"id"`
	KeyIndex int64    `json:"key_index"`
	Quorum   int64    `json:"theta"`
	XPubs    []string `json:"xpubs"`
}

func CreateNormalAccount

func CreateNormalAccount(xpub, alias string) (*Account, error)

CreateNormalAccount 创建一个单签普通账户

func GetAccountInfo

func GetAccountInfo() ([]*Account, error)

GetAccountInfo 获取账户信息

func NewAccount

func NewAccount(json gjson.Result) *Account

func (*Account) FileName

func (w *Account) FileName() string

FileName 该钱包定义的文件名规则

func (*Account) OpenDB

func (a *Account) OpenDB() (*storm.DB, error)

openDB 打开钱包数据库

type AccountBalance

type AccountBalance struct {
	AccountID  string `json:"account_id"`
	Alias      string `json:"account_alias"`
	AssetAlias string `json:"asset_alias"`
	AssetID    string `json:"asset_id"`
	Amount     uint64 `json:"amount"`
	Password   string
}

AccountBalance account balance

func GetAccountBalance

func GetAccountBalance(accountID string, assetsID string) ([]*AccountBalance, error)

GetAccountBalance 获取账户资产

func GetWalletList

func GetWalletList(assetsID string) ([]*AccountBalance, error)

GetWalletList 获取钱包资产信息列表

func NewAccountBalance

func NewAccountBalance(json gjson.Result) *AccountBalance

type Address

type Address struct {
	Alias     string
	AccountId string
	Address   string
}

func CreateReceiverAddress

func CreateReceiverAddress(alias, accountID string) (*Address, error)

CreateReceiverAddress 给指定账户创建地址

func GetAddressInfo

func GetAddressInfo(alias, accountID string) ([]*Address, error)

GetAddressInfo 获取指定账户的所有地址

func NewAddress

func NewAddress(accountID, alias string, json gjson.Result) *Address

type Client

type Client struct {
	BaseURL     string
	AccessToken string
	Debug       bool
}

A Client is a Bitcoin RPC client. It performs RPCs over HTTP using JSON request and responses. A Client must be configured with a secret token to authenticate with other Cores on the network.

func (*Client) Call

func (c *Client) Call(path string, request interface{}) ([]byte, error)

Call calls a remote procedure on another node, specified by the path.

type Response

type Response struct {
	Code    int         `json:"code,omitempty"`
	Error   interface{} `json:"error,omitempty"`
	Result  interface{} `json:"result,omitempty"`
	Message string      `json:"message,omitempty"`
	Id      string      `json:"id,omitempty"`
}

type Unspent

type Unspent struct {
	AccountId           string
	Address             string
	Amount              uint64
	AssetId             string
	Change              bool
	ControlProgramIndex uint64
	Id                  string
	Program             string
	SourceId            string
	SourcePos           uint64
	ValidHeight         uint64
}

func ListUnspent

func ListUnspent(accountID string, from, count int) ([]*Unspent, error)

ListUnspent 获取指定账户的utxo

func NewUnspent

func NewUnspent(json gjson.Result) *Unspent

type Wallet

type Wallet struct {
	WalletID       string `json:"walletID"`
	Alias          string `json:"alias"`
	Balance        string `json:"balance"`
	AccountsNumber uint64 `json:"accountsNumber"`
	Password       string `json:"password"`
	PublicKey      string `json:"xpub"`
}

Wallet 钱包模型

func CreateNewWallet

func CreateNewWallet(alias, password string) (*Wallet, error)

CreateNewWallet 创建钱包

func GetWalletInfo

func GetWalletInfo() ([]*Wallet, error)

GetWalletInfo 获取钱包信息

func NewWallet

func NewWallet(json gjson.Result) *Wallet

NewWallet 创建钱包

type WalletManager

type WalletManager struct{}

func (*WalletManager) BackupWalletFlow

func (w *WalletManager) BackupWalletFlow() error

备份钱包流程

func (*WalletManager) BuildImage

func (w *WalletManager) BuildImage() error

func (*WalletManager) ConfigMerchantWallet

func (w *WalletManager) ConfigMerchantWallet(wallet *openwallet.Wallet) error

ConfigMerchantWallet 钱包工具配置接口

func (*WalletManager) CreateAddressFlow

func (w *WalletManager) CreateAddressFlow() error

创建地址流程

func (*WalletManager) CreateMerchantAddress

func (w *WalletManager) CreateMerchantAddress(walletID string, count int) ([]*openwallet.Address, error)

CreateMerchantAddress 创建钱包地址

func (*WalletManager) CreateMerchantWallet

func (w *WalletManager) CreateMerchantWallet(alias string, password string) (*openwallet.Wallet, error)

CreateMerchantWallet 创建钱包

func (*WalletManager) CreateWalletFlow

func (w *WalletManager) CreateWalletFlow() error

创建钱包流程

func (*WalletManager) GetMerchantAddressList

func (w *WalletManager) GetMerchantAddressList(walletID string, offset uint64, limit uint64) ([]*openwallet.Address, error)

GetMerchantAddressList 获取钱包地址

func (*WalletManager) GetMerchantWalletList

func (w *WalletManager) GetMerchantWalletList() ([]*openwallet.Wallet, error)

GetMerchantWalletList 获取钱包列表

func (*WalletManager) GetWalletList

func (w *WalletManager) GetWalletList() error

GetWalletList 获取钱包列表

func (*WalletManager) ImportMerchantAddress

func (w *WalletManager) ImportMerchantAddress(addresses []*openwallet.Address) error

ImportMerchantAddress 导入地址

func (*WalletManager) InitConfigFlow

func (w *WalletManager) InitConfigFlow() error

初始化配置流程

func (*WalletManager) InitNodeConfig

func (w *WalletManager) InitNodeConfig() error

func (*WalletManager) LoginContainer

func (w *WalletManager) LoginContainer() error

登录容器

func (*WalletManager) RestoreWalletFlow

func (w *WalletManager) RestoreWalletFlow() error

RestoreWalletFlow 恢复钱包流程

func (*WalletManager) RunContainer

func (w *WalletManager) RunContainer() error

创建容器

func (*WalletManager) RunFullNode

func (w *WalletManager) RunFullNode() error

运行节点

func (*WalletManager) SetConfigFlow

func (w *WalletManager) SetConfigFlow(subCmd string) error

SetConfigFlow 初始化配置流程

func (*WalletManager) ShowConfig

func (w *WalletManager) ShowConfig() error

查看配置信息

func (*WalletManager) ShowConfigInfo

func (w *WalletManager) ShowConfigInfo(subCmd string) error

ShowConfigInfo 查看配置信息

func (*WalletManager) SummaryFollow

func (w *WalletManager) SummaryFollow() error

SummaryFollow 汇总流程

func (*WalletManager) TransferFlow

func (w *WalletManager) TransferFlow() error

SendTXFlow 发送交易

Jump to

Keyboard shortcuts

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