wallet

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 30 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	WalletRepo  = "keystore"
	KNamePrefix = "wallet-"
)

Variables

View Source
var (
	ErrKeyInfoNotFound = fmt.Errorf("key info not found")
)

Functions

func Balance

func Balance(ctx context.Context, client *ethclient.Client, addr string) (string, error)

func BalanceNumber added in v0.6.2

func BalanceNumber(client *ethclient.Client, addr string) (float64, error)

func Sign

func Sign(privatekey string, msg []byte) ([]byte, error)

Sign takes in signature type, private key and message. Returns a signature for that message.

func ToPublic

func ToPublic(priv string) (string, *ecdsa.PublicKey, error)

ToPublic converts private key to public key

func Verify

func Verify(addr string, signature, dataHash []byte) (bool, error)

Verify verifies signatures

Types

type DiskKeyStore

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

func OpenOrInitKeystore

func OpenOrInitKeystore(p string) (*DiskKeyStore, error)

func (*DiskKeyStore) Close added in v0.4.7

func (dks *DiskKeyStore) Close() error

func (*DiskKeyStore) Delete

func (dks *DiskKeyStore) Delete(key string) error

func (*DiskKeyStore) Get

func (dks *DiskKeyStore) Get(name string) (KeyInfo, error)

Get gets a key out of keystore and returns KeyInfo coresponding to named key

func (*DiskKeyStore) List

func (dks *DiskKeyStore) List() ([]string, error)

List lists all the keys stored in the KeyStore

func (*DiskKeyStore) Put

func (dks *DiskKeyStore) Put(key string, info KeyInfo) error

Put saves key info under given name

type KeyInfo

type KeyInfo struct {
	PrivateKey string
}

KeyInfo is used for storing keys in KeyStore

type KeyStore

type KeyStore interface {
	// List lists all the keys stored in the KeyStore
	List() ([]string, error)
	// Get gets a key out of keystore and returns KeyInfo corresponding to named key
	Get(string) (KeyInfo, error)
	// Put saves a key info under given name
	Put(string, KeyInfo) error
	// Delete removes a key from keystore
	Delete(string) error
	Close() error
}

KeyStore is used for storing secret keys

type LocalWallet

type LocalWallet struct {
	*DiskKeyStore
}

func NewWallet

func NewWallet(keystore *DiskKeyStore) *LocalWallet

func SetupWallet

func SetupWallet(dir string) (*LocalWallet, error)

func (*LocalWallet) CollateralSend added in v0.5.0

func (w *LocalWallet) CollateralSend(ctx context.Context, from, to string, amount string) (string, error)

func (*LocalWallet) CollateralWithdraw

func (w *LocalWallet) CollateralWithdraw(ctx context.Context, address string, amount string, cpAccountAddress string, collateralType string) (string, error)

func (*LocalWallet) CollateralWithdrawConfirm added in v0.6.2

func (w *LocalWallet) CollateralWithdrawConfirm(ctx context.Context, address string, cpAccountAddress string, withdrawType string) (string, error)

func (*LocalWallet) CollateralWithdrawRequest added in v0.6.2

func (w *LocalWallet) CollateralWithdrawRequest(ctx context.Context, address string, amount string, cpAccountAddress string, withdrawType string) (string, error)

func (*LocalWallet) CollateralWithdrawView added in v0.6.2

func (w *LocalWallet) CollateralWithdrawView(ctx context.Context, cpAccountAddress string, withdrawType string) (models.WithdrawRequest, error)

func (*LocalWallet) CollateralWithdrawWithUbiZero added in v1.0.0

func (w *LocalWallet) CollateralWithdrawWithUbiZero(ctx context.Context, address string, amount string, cpAccountAddress string, collateralType string) (string, error)

func (*LocalWallet) FindKey

func (w *LocalWallet) FindKey(addr string) (*KeyInfo, error)

func (*LocalWallet) SequencerDeposit added in v0.6.2

func (w *LocalWallet) SequencerDeposit(ctx context.Context, from string, amount string, cpAccountAddress string) (string, error)

func (*LocalWallet) SequencerWithdraw added in v0.6.2

func (w *LocalWallet) SequencerWithdraw(ctx context.Context, address string, amount string, cpAccountAddress string) (string, error)

func (*LocalWallet) WalletCollateral

func (w *LocalWallet) WalletCollateral(ctx context.Context, from string, amount string, cpAccountAddress string, collateralType string) (string, error)

func (*LocalWallet) WalletDelete

func (w *LocalWallet) WalletDelete(ctx context.Context, addr string) error

func (*LocalWallet) WalletExport

func (w *LocalWallet) WalletExport(ctx context.Context, addr string) (*KeyInfo, error)

func (*LocalWallet) WalletImport

func (w *LocalWallet) WalletImport(ctx context.Context, ki *KeyInfo) (string, error)

func (*LocalWallet) WalletList

func (w *LocalWallet) WalletList(ctx context.Context, contractFlag bool) error

func (*LocalWallet) WalletNew

func (w *LocalWallet) WalletNew(ctx context.Context) (string, error)

func (*LocalWallet) WalletSend

func (w *LocalWallet) WalletSend(ctx context.Context, from, to string, amount string, nonce uint64) (string, error)

func (*LocalWallet) WalletSign

func (w *LocalWallet) WalletSign(ctx context.Context, addr string, msg []byte) (string, error)

func (*LocalWallet) WalletVerify

func (w *LocalWallet) WalletVerify(ctx context.Context, addr string, sigByte []byte, data string) (bool, error)

type Signature

type Signature struct {
	Data []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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