wallet

package
v0.0.0-...-31898ba Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2019 License: ISC Imports: 12 Imported by: 0

Documentation

Overview

The wallet package implements interaction with a dcrwallet via gRPC.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Account          uint32
	AccountName      string
	ChainParams      *chaincfg.Params
	WalletConnection *grpc.ClientConn
	WalletPassword   string
}

type Wallet

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

Wallet represents an interface to an established RPC connection with dcrwallet software and supports tumbler with wallet and blockchain services.

func New

func New(ctx context.Context, cfg *Config) (*Wallet, error)

New creates a new wallet object associated with the connection conn under chainParams. It also makes sure wallet is running and configured for the correct network.

func (*Wallet) CreateEscrow

func (w *Wallet) CreateEscrow(ctx context.Context, con *contract.Contract) error

CreateEscrow constructs and signs a pay to script hash transaction that transfers funds from the tumbler to the client locked until the specified locktime. It also creates an associated refund transaction.

func (*Wallet) CreateOffer

func (w *Wallet) CreateOffer(ctx context.Context, con *contract.Contract, hashes [][]byte) error

CreateOffer creates an escrow transaction that releases funds when hash preimages are published.

func (*Wallet) CreateRedeem

func (w *Wallet) CreateRedeem(ctx context.Context, con *contract.Contract) error

CreateRedeem creates a transaction redeeming escrowed funds.

func (*Wallet) CurrentBlockHeight

func (w *Wallet) CurrentBlockHeight(ctx context.Context) (uint32, error)

func (*Wallet) GetExtAddress

func (w *Wallet) GetExtAddress(ctx context.Context) (string, string, error)

func (*Wallet) GetIntAddress

func (w *Wallet) GetIntAddress(ctx context.Context) (string, string, error)

func (*Wallet) ImportEscrowScript

func (w *Wallet) ImportEscrowScript(ctx context.Context, con *contract.Contract) error

func (*Wallet) OfferRedeemer

func (w *Wallet) OfferRedeemer(ctx context.Context, con *contract.Contract) (bool, [][]byte, error)

OfferRedeemer looks up the transaction spending the escrow and obtains hash preimages used to redeem the contract.

func (*Wallet) PublishEscrow

func (w *Wallet) PublishEscrow(ctx context.Context, con *contract.Contract) error

PublishEscrow publishes the escrow transaction.

func (*Wallet) PublishRedeem

func (w *Wallet) PublishRedeem(ctx context.Context, con *contract.Contract, peerSig []byte) error

PublishRedeem publishes the redeeming transaction.

func (*Wallet) PublishRefund

func (w *Wallet) PublishRefund(ctx context.Context, con *contract.Contract) error

PublishRefund publishes the refund transaction.

func (*Wallet) PublishSolution

func (w *Wallet) PublishSolution(ctx context.Context, con *contract.Contract, secrets [][]byte) error

PublishSolution builds a fulfilling transaction that reveals preimages for hashes contained in the offer tx and thus redeems funds escrowed by they payer. It publishes both offer and fulfilling transactions.

func (*Wallet) SelectAccount

func (w *Wallet) SelectAccount(ctx context.Context, name string) error

SelectAccount looks up an account by the provided name and selects it for future wallet operations.

func (*Wallet) SignHashes

func (w *Wallet) SignHashes(ctx context.Context, con *contract.Contract, txHashes [][]byte) ([][]byte, []byte, error)

SignHashes signs a bundle of transaction hashes and returns a bundle of created signatures.

func (*Wallet) ValidateOffer

func (w *Wallet) ValidateOffer(ctx context.Context, con *contract.Contract, escrowHash []byte) (bool, error)

ValidateOffer retrieves the escrow transaction created by the client and makes sure it has been confirmed on the blockchain.

Jump to

Keyboard shortcuts

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