client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 29 Imported by: 10

Documentation

Index

Constants

View Source
const (
	KeystoreFilename = "keystore.dat"
)
View Source
const (
	KeystoreVersion = "1.0"
)

Variables

View Source
var CommonFlags = []cli.Flag{
	cli.StringFlag{
		Name:  "password, p",
		Usage: "keystore password",
	},
}

Functions

func Create

func Create(password []byte) error

func GetPassword

func GetPassword(password []byte, confirmed bool) ([]byte, error)

func InputFromUTXO

func InputFromUTXO(utxo *sutil.UTXO) *types.Input

func SelectAccount

func SelectAccount(wallet *Wallet) (string, error)

func Setup

func Setup(dataDir, rpcUrl string, assetId common.Uint256)

func ShowAccountInfo

func ShowAccountInfo(password []byte) error

func ShowAccounts

func ShowAccounts(addrs []*sutil.Addr, newAddr *common.Uint168, wallet *Wallet) error

Types

type Keystore

type Keystore struct {
	sync.Mutex

	*KeystoreFile
	// contains filtered or unexported fields
}

func CreateKeystore

func CreateKeystore(password []byte) (*Keystore, error)

func OpenKeystore

func OpenKeystore(password []byte) (*Keystore, error)

func (*Keystore) ChangePassword

func (store *Keystore) ChangePassword(oldPassword, newPassword []byte) error

func (*Keystore) FromJson

func (store *Keystore) FromJson(str string, password string) error

func (*Keystore) GetAccountByIndex

func (store *Keystore) GetAccountByIndex(index int) *sdk.Account

func (*Keystore) GetAccountByProgramHash

func (store *Keystore) GetAccountByProgramHash(programHash *common.Uint168) *sdk.Account

func (*Keystore) GetAccounts

func (store *Keystore) GetAccounts() []*sdk.Account

func (*Keystore) Json

func (store *Keystore) Json() (string, error)

func (*Keystore) MainAccount

func (store *Keystore) MainAccount() *sdk.Account

func (*Keystore) NewAccount

func (store *Keystore) NewAccount() *sdk.Account

type KeystoreFile

type KeystoreFile struct {
	sync.Mutex

	Version string

	IV                  string
	PasswordHash        string
	MasterKeyEncrypted  string
	PrivateKeyEncrypted string

	SubAccountsCount int
}

func CreateKeystoreFile

func CreateKeystoreFile() (*KeystoreFile, error)

func OpenKeystoreFile

func OpenKeystoreFile() (*KeystoreFile, error)

func (*KeystoreFile) FromJson

func (store *KeystoreFile) FromJson(str string) error

func (*KeystoreFile) GetIV

func (store *KeystoreFile) GetIV() ([]byte, error)

func (*KeystoreFile) GetMasterKeyEncrypted

func (store *KeystoreFile) GetMasterKeyEncrypted() ([]byte, error)

func (*KeystoreFile) GetPasswordHash

func (store *KeystoreFile) GetPasswordHash() ([]byte, error)

func (*KeystoreFile) GetPrivetKeyEncrypted

func (store *KeystoreFile) GetPrivetKeyEncrypted() ([]byte, error)

func (*KeystoreFile) Json

func (store *KeystoreFile) Json() (string, error)

func (*KeystoreFile) LoadFromFile

func (store *KeystoreFile) LoadFromFile() error

func (*KeystoreFile) SaveToFile

func (store *KeystoreFile) SaveToFile() error

func (*KeystoreFile) SetIV

func (store *KeystoreFile) SetIV(iv []byte)

func (*KeystoreFile) SetMasterKeyEncrypted

func (store *KeystoreFile) SetMasterKeyEncrypted(masterKeyEncrypted []byte)

func (*KeystoreFile) SetPasswordHash

func (store *KeystoreFile) SetPasswordHash(passwordHash []byte)

func (*KeystoreFile) SetPrivateKeyEncrypted

func (store *KeystoreFile) SetPrivateKeyEncrypted(privateKeyEncrypted []byte)

type Transfer

type Transfer struct {
	Address string
	Value   *common.Fixed64
}

type Wallet

type Wallet struct {
	database.Database
	*Keystore
}

func Open

func Open() (*Wallet, error)

func (*Wallet) AddMultiSignAccount

func (wallet *Wallet) AddMultiSignAccount(m int, publicKeys ...*crypto.PublicKey) (*common.Uint168, error)

func (*Wallet) CreateLockedMultiOutputTransaction

func (wallet *Wallet) CreateLockedMultiOutputTransaction(fromAddress string, fee *common.Fixed64,
	lockedUntil uint32, outputs ...*Transfer) (it.Transaction, error)

func (*Wallet) CreateLockedTransaction

func (wallet *Wallet) CreateLockedTransaction(fromAddress, toAddress string,
	amount, fee *common.Fixed64, lockedUntil uint32) (it.Transaction, error)

func (*Wallet) CreateMultiOutputTransaction

func (wallet *Wallet) CreateMultiOutputTransaction(fromAddress string, fee *common.Fixed64,
	outputs ...*Transfer) (it.Transaction, error)

func (*Wallet) CreateTransaction

func (wallet *Wallet) CreateTransaction(fromAddress, toAddress string, amount,
	fee *common.Fixed64) (it.Transaction, error)

func (*Wallet) NewSubAccount

func (wallet *Wallet) NewSubAccount(password []byte) (*common.Uint168, error)

func (*Wallet) SendTransaction

func (wallet *Wallet) SendTransaction(tx it.Transaction) error

func (*Wallet) Sign

func (wallet *Wallet) Sign(password []byte, tx it.Transaction) (it.Transaction, error)

func (*Wallet) VerifyPassword

func (wallet *Wallet) VerifyPassword(password []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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