cardano

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: GPL-3.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	//币种
	Symbol    = "ADA"
	MasterKey = "ada seed"
	CurveType = owcrypt.ECC_CURVE_SECP256K1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Index         int64
	Name          string
	AddressNumber uint64
	Amount        string
	WId           string
	AddressId     string
	Used          bool
	ChangeAddress bool
}

func NewAccountV1

func NewAccountV1(json gjson.Result) *Account

type Address

type Address struct {
	Address       string
	Used          bool
	ChangeAddress bool
}

func NewAddressV1

func NewAddressV1(json gjson.Result) *Address

type Client

type Client struct {
	BaseURL string
	Debug   bool
	Client  *req.Req
	Header  req.Header
}

func NewClient

func NewClient(url string, debug bool) *Client

type Transaction

type Transaction struct {
	TxID          string
	Amount        string
	Confirmations uint64
}

func NewTransactionV1

func NewTransactionV1(json gjson.Result) *Transaction

type Wallet

type Wallet struct {
	WalletID       string `json:"walletID"`
	Name           string `json:"name"`
	Balance        string `json:"balance"`
	AccountsNumber uint64 `json:"accountsNumber"`
	Password       string `json:"password"`
	Mnemonic       string `json:"mnemonic"`
}

Wallet ada的钱包模型

func NewWalletForV1

func NewWalletForV1(json gjson.Result) *Wallet

NewWalletForV1 通过API/V1的结构实例化钱包

type WalletConfig

type WalletConfig struct {
	//币种
	Symbol    string
	MasterKey string

	//证书路径
	CertsDir string

	//是否测试网络
	IsTestNet bool

	//钱包服务API
	ServerAPI string
	//钱包安装的路径
	NodeInstallPath string
	//钱包数据文件目录
	WalletDataPath string
	//汇总阀值
	Threshold decimal.Decimal
	//汇总地址
	SumAddress string
	//汇总执行间隔时间
	CycleSeconds time.Duration
	//默认配置内容
	DefaultConfig string
	//曲线类型
	CurveType uint32
	//转账最小额度
	MinSendAmount decimal.Decimal
	//最小矿工费
	MinFees decimal.Decimal
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(symbol string, masterKey string) *WalletConfig

func (*WalletConfig) InitConfig

func (wc *WalletConfig) InitConfig()

initConfig 初始化配置文件

func (*WalletConfig) PrintConfig

func (wc *WalletConfig) PrintConfig() error

printConfig Print config information

type WalletManager

type WalletManager struct {
	WalletClient *Client            // 节点客户端
	Config       *WalletConfig      //钱包管理配置
	WalletsInSum map[string]*Wallet //参与汇总的钱包
}

func NewWalletManager

func NewWalletManager() *WalletManager

func (*WalletManager) AddWalletInSummary

func (wm *WalletManager) AddWalletInSummary(wid string, wallet *Wallet)

func (*WalletManager) BackupWalletFlow

func (wm *WalletManager) BackupWalletFlow() error

备份钱包流程

func (*WalletManager) CreateAddress

func (wm *WalletManager) CreateAddress(wid string, aid int64, passphrase string) (*Address, error)

CreateAddress 给指定账户创建地址

func (*WalletManager) CreateAddressFlow

func (wm *WalletManager) CreateAddressFlow() error

创建地址流程

func (*WalletManager) CreateBatchAddress

func (wm *WalletManager) CreateBatchAddress(wid string, aid int64, password string, count uint) ([]*Address, string, error)

CreateBatchAddress 批量创建地址

func (*WalletManager) CreateNewAccount

func (wm *WalletManager) CreateNewAccount(name, wid, passphrase string) (*Account, error)

CreateNewAccount 根据钱包wid创建单个账户

func (*WalletManager) CreateNewWallet

func (wm *WalletManager) CreateNewWallet(name, mnemonic, password string) error

CreateNewWallet 创建新钱包

func (*WalletManager) CreateWalletFlow

func (wm *WalletManager) CreateWalletFlow() error

创建钱包流程

func (*WalletManager) EstimateFees

func (wm *WalletManager) EstimateFees(wid string, aid int64, to string, amount uint64, passphrase string) (uint64, error)

EstimateFees 计算预估手续费

func (*WalletManager) GetAccountInfo

func (wm *WalletManager) GetAccountInfo(wid string, aid ...string) ([]*Account, error)

GetAccountInfo 获取用户信息

func (*WalletManager) GetAddressInfo

func (wm *WalletManager) GetAddressInfo(wid, aid string) ([]*Address, error)

GetAddressInfo 获取指定aid用户的地址组

func (*WalletManager) GetWalletInfo

func (wm *WalletManager) GetWalletInfo(wid ...string) ([]*Wallet, error)

GetWalletInfo 获取钱包信息 wid 钱包id,可选

func (*WalletManager) GetWalletList

func (wm *WalletManager) GetWalletList() error

GetWalletList 获取钱包列表

func (*WalletManager) InitConfigFlow

func (wm *WalletManager) InitConfigFlow() error

初始化配置流程

func (*WalletManager) LoadConfig

func (wm *WalletManager) LoadConfig() error

loadConfig 读取配置

func (*WalletManager) RestoreWalletFlow

func (w *WalletManager) RestoreWalletFlow() error

RestoreWalletFlow 恢复钱包

func (*WalletManager) SendTx

func (wm *WalletManager) SendTx(wid string, aid int64, to string, amount uint64, password string) (*Transaction, error)

SendTx 发送交易

func (*WalletManager) ShowConfig

func (wm *WalletManager) ShowConfig() error

查看配置信息

func (*WalletManager) SummaryFollow

func (wm *WalletManager) SummaryFollow() error

SummaryFollow 汇总流程

func (*WalletManager) SummaryWallets

func (wm *WalletManager) SummaryWallets()

SummaryTxFlow 执行汇总流程

func (*WalletManager) TransferFlow

func (wm *WalletManager) TransferFlow() error

SendTXFlow 发送交易

Jump to

Keyboard shortcuts

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