wallet

package module
v0.0.0-...-03246a0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

README

Meson-wallet-demo

A simple wallet that sends transactions through Meson.

Build

cd cmd/wallet
go build .

Usage

Make sure there is an existing katzenmint and Meson mixnet running. You will need to check for the configuration in cmd/wallet/wallet.toml.

Usage of ./wallet:
  -w string
        Path to the wallet config file (default "wallet.toml")
  -l bool
        Listen over tcp and serve transaction requests (default false)

If listen mode is switched off, the wallet sends a single test transaction. The following extra commands can be used.

  -c int
        Chain ID for specific ETH-based chain (default 5)
  -a string
        Address of the receiver (blank means sender itself) (default "")
  -v string
        Value to be transfered (default 10)
  -d string
        Data in hex format to be included (default "")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTransaction

func GenerateTransaction(from common.Address, to common.Address, value *big.Int, data []byte, chainID int64, rpcEndpoint string) (*types.Transaction, error)

GenerateTransaction queries RPC directly to get nonce, gasprice, gaslimit We recommend using (*Wallet).FillTx() instead for more privacy

func ProcessRequest

func ProcessRequest(w *Wallet, request TransactionRequest) (reply string, err error)

func TransactionHandler

func TransactionHandler(w *Wallet, resp http.ResponseWriter, req *http.Request)

Types

type TransactionRequest

type TransactionRequest struct {
	ChainID int64
	To      string
	Value   big.Int
	Data    string
}

type Wallet

type Wallet struct {
	*ks.KeyStore
	// contains filtered or unexported fields
}

func New

func New(CfgFile string) (w *Wallet, err error)

func (*Wallet) Close

func (w *Wallet) Close()

func (*Wallet) Endpoint

func (w *Wallet) Endpoint(chainID int64) string

func (*Wallet) FillTx

func (w *Wallet) FillTx(from ethcommon.Address, to ethcommon.Address, value *big.Int, data string, chainID int64) (*types.Transaction, error)

func (*Wallet) SendTx

func (w *Wallet) SendTx(tx *types.Transaction) (string, error)

func (*Wallet) Ticker

func (w *Wallet) Ticker(chainID int64) string

func (*Wallet) UiSelectAccount

func (w *Wallet) UiSelectAccount() accounts.Account

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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