tezos

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: 32 Imported by: 1

Documentation

Index

Constants

View Source
const (
	//币种
	Symbol    = "XTZ"
	MasterKey = "Tezos seed"
	CurveType = owcrypt.ECC_CURVE_ED25519
)

Variables

View Source
var (
	BitcoinAlphabet = NewAlphabet("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
	IPFSAlphabet    = NewAlphabet("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
	FlickrAlphabet  = NewAlphabet("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ")
	RippleAlphabet  = NewAlphabet("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz")
)

Alphabet: copy from https://en.wikipedia.org/wiki/Base58

View Source
var (
	ErrorInvalidBase58String = errors.New("invalid base58 string")
)

Errors

View Source
var (
	SaltLen = 8
)

Functions

func Decode

func Decode(input string, alphabet *Alphabet) ([]byte, error)

Decode docode with custom alphabet

func Decrypt

func Decrypt(password, encryptedKey string) (string, error)

func Encode

func Encode(input []byte, alphabet *Alphabet) string

Encode encode with custom alphabet

func Encrypt

func Encrypt(password, key string) (string, error)

Types

type Alphabet

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

Alphabet The base58 alphabet object.

func NewAlphabet

func NewAlphabet(alphabet string) *Alphabet

NewAlphabet create a custom alphabet from 58-length string. Note: len(rune(alphabet)) must be 58.

func (Alphabet) String

func (alphabet Alphabet) String() string

Alphabet's string representation

type Client

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

func NewClient

func NewClient(url string, debug bool) *Client

func (*Client) CallForgeOps

func (c *Client) CallForgeOps(chain_id string, head_hash string, body interface{}) string

func (*Client) CallGetCounter

func (c *Client) CallGetCounter(pkh string) []byte

func (*Client) CallGetHeader

func (c *Client) CallGetHeader() []byte

func (*Client) CallGetManagerKey

func (c *Client) CallGetManagerKey(pkh string) []byte

func (*Client) CallGetbalance

func (c *Client) CallGetbalance(addr string) []byte

func (*Client) CallInjectOps

func (c *Client) CallInjectOps(body string) []byte

func (*Client) CallPreapplyOps

func (c *Client) CallPreapplyOps(body interface{}) []byte

type Key

type Key struct {
	Address    string `storm:"id"`
	PublicKey  string
	PrivateKey []byte
}

type WalletConfig

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

	//是否测试网络
	IsTestNet bool

	//钱包服务API
	ServerAPI string
	//gas limit & storage limit
	GasLimit     decimal.Decimal
	StorageLimit decimal.Decimal
	//最小矿工费
	MinFee decimal.Decimal
	//钱包安装的路径
	NodeInstallPath string
	//钱包数据文件目录
	WalletDataPath string
	//汇总阀值
	Threshold decimal.Decimal
	//汇总地址
	SumAddress string
	//汇总执行间隔时间
	CycleSeconds time.Duration
	//默认配置内容
	DefaultConfig string
	//曲线类型
	CurveType uint32
	// 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 {
	Storage      *hdkeystore.HDKeystore        //秘钥存取
	WalletClient *Client                       // 节点客户端
	Config       *WalletConfig                 //钱包管理配置
	WalletsInSum map[string]*openwallet.Wallet //参与汇总的钱包

}

func NewWalletManager

func NewWalletManager() *WalletManager

func (*WalletManager) AddWalletInSummary

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

func (*WalletManager) BackupWalletFlow

func (wm *WalletManager) BackupWalletFlow() error

备份钱包流程

func (*WalletManager) CreateAddressFlow

func (wm *WalletManager) CreateAddressFlow() error

创建地址流程

func (*WalletManager) CreateBatchAddress

func (wm *WalletManager) CreateBatchAddress(walletId, password string, count uint64) (string, []*openwallet.Address, error)

func (*WalletManager) CreateNewPrivateKey

func (wm *WalletManager) CreateNewPrivateKey(key *hdkeystore.HDKey, start, index uint64) (*openwallet.Address, error)

CreateNewPrivateKey 创建私钥,返回私钥wif格式字符串

func (*WalletManager) CreateNewWallet

func (wm *WalletManager) CreateNewWallet(name, password string) (*openwallet.Wallet, string, error)

CreateNewWallet 创建钱包

func (*WalletManager) CreateWalletFlow

func (wm *WalletManager) CreateWalletFlow() error

创建钱包流程

func (*WalletManager) GetWalletByID

func (wm *WalletManager) GetWalletByID(walletID string) (*openwallet.Wallet, error)

GetWalletByID 获取钱包

func (*WalletManager) GetWalletList

func (wm *WalletManager) GetWalletList() error

GetWalletList 获取钱包列表

func (*WalletManager) GetWallets

func (wm *WalletManager) GetWallets() ([]*openwallet.Wallet, error)

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

func (*WalletManager) InitConfigFlow

func (wm *WalletManager) InitConfigFlow() error

初始化配置流程

func (*WalletManager) LoadConfig

func (wm *WalletManager) LoadConfig() error

loadConfig 读取配置

func (*WalletManager) RestoreWallet

func (wm *WalletManager) RestoreWallet(keyFile, dbFile, password string) error

RestoreWallet 恢复钱包

func (*WalletManager) RestoreWalletFlow

func (w *WalletManager) RestoreWalletFlow() error

RestoreWalletFlow 恢复钱包

func (*WalletManager) ShowConfig

func (wm *WalletManager) ShowConfig() error

查看配置信息

func (*WalletManager) SummaryFollow

func (wm *WalletManager) SummaryFollow() error

SummaryFollow 汇总流程

func (*WalletManager) SummaryWallets

func (wm *WalletManager) SummaryWallets()

汇总钱包

func (*WalletManager) Transfer

func (wm *WalletManager) Transfer(keys Key, dst string, fee, gas_limit, storage_limit, amount string) (string, string)

转账

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