sia

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: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//币种
	Symbol    = "SC"
	MasterKey = "Siacoin seed"
)

Variables

This section is empty.

Functions

func BackupWallet

func BackupWallet() (string, error)

BackupWallet 备份钱包私钥数据

func CreateAddress

func CreateAddress() (string, error)

CreateAddress 创建钱包地址(慎用)

func CreateBatchAddress

func CreateBatchAddress(count uint64) (string, error)

CreateBatchAddress 批量创建钱包地址 func CreateBatchAddress(alias, accountID string, count uint64) (string, error) {

func CreateNewWallet

func CreateNewWallet(password string, force bool) (string, error)

CreateNewWallet 创建钱包

func CreateReceiverAddress

func CreateReceiverAddress() ([]byte, error)

CreateReceiverAddress 给指定账户创建地址

func GetAddressInfo

func GetAddressInfo() ([]string, error)

GetAddressInfo 获取地址列表

func GetConsensus

func GetConsensus() error

func RestoreWallet

func RestoreWallet(dbFile string) error

RestoreWallet 通过keystore恢复钱包

func SendTransaction

func SendTransaction(amount string, destination string) (string, error)

SendTransaction 发送交易

func SummaryWallets

func SummaryWallets()

SummaryWallets 执行汇总流程

func UnlockWallet

func UnlockWallet(password string) error

UnlockWallet 解锁钱包

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"`
}

type Address

type Address struct {
	//Alias     string
	//AccountId string
	Address string
}

func NewAddress

func NewAddress(json gjson.Result) *Address

type Client

type Client struct {
	BaseURL string
	Auth    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, method string, request interface{}) ([]byte, error)

func (*Client) CallBatchAddress

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

Call calls for batch address

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 Wallet

type Wallet struct {
	WalletID string `json:"rootid"`
	Alias    string `json:"alias"`
	Balance  string `json:"balance"`
	Password string `json:"password"`
	RootPub  string `json:"rootpub"`
	KeyFile  string

	ConfirmBalance string `json:"confirmedsiacoinbalance"`

	OutgoingSC string `json:"unconfirmedoutgoingsiacoins"`
	IncomingSC string `json:"unconfirmedincomingsiacoins"`

	SiaFundBalance      string `json:"siafundbalance"`
	SiaCoinClaimBalance string `json:"siacoinclaimbalance"`

	Rescanning bool `json:"rescanning"`
	Unlocked   bool `json:"unlocked"`
	Encrypted  bool `json:"encrypted"`
}

Wallet 钱包模型

func GetWalletInfo

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

GetWalletInfo 获取钱包信息

func GetWalletKeys

func GetWalletKeys(dir string) ([]*Wallet, error)

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

func NewWallet

func NewWallet(json gjson.Result) *Wallet

NewWallet 创建钱包

func (*Wallet) FileName

func (w *Wallet) FileName() string

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

func (*Wallet) OpenDB

func (w *Wallet) OpenDB() (*storm.DB, error)

openDB 打开钱包数据库

type WalletManager

type WalletManager struct{}

func (*WalletManager) BackupWalletFlow

func (w *WalletManager) BackupWalletFlow() error

备份钱包流程

func (*WalletManager) CreateAddressFlow

func (w *WalletManager) CreateAddressFlow() error

创建地址流程

func (*WalletManager) CreateWalletFlow

func (w *WalletManager) CreateWalletFlow() error

创建钱包流程

func (*WalletManager) GetWalletList

func (w *WalletManager) GetWalletList() error

GetWalletList 获取钱包列表

func (*WalletManager) InitConfigFlow

func (w *WalletManager) InitConfigFlow() error

初始化配置流程

func (*WalletManager) RestoreWalletFlow

func (w *WalletManager) RestoreWalletFlow() error

RestoreWalletFlow 恢复钱包流程

func (*WalletManager) ShowConfig

func (w *WalletManager) ShowConfig() error

查看配置信息

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