ethwallet

package
v0.0.0-...-2ed6a8d Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckValueEnough

func CheckValueEnough(value *big.Int, gasPrice *big.Int, gasLimit uint64, ether *big.Int) bool

func GetKey

func GetKey(path, auth string) (*crypto.Key, error)

func NewKey

func NewKey() (key *crypto.Key)

func NewKeyFromECDSA

func NewKeyFromECDSA(privateKeyECDSA *ecdsa.PrivateKey) *crypto.Key

func StoreKey

func StoreKey(keyfilepath string, key *crypto.Key, auth string) (path string, err error)

Types

type Asset

type Asset struct {
	AssetID      string
	Name         string
	Symbol       string
	Denomination uint8
}

type Wallet

type Wallet struct {
	Name      string
	Threshold int
	Me        user.User
	Others    []user.User
	KeyData   []byte
	// Public address computed from the MPC config and stored here so it shows up in the persisted JSON for reference
	Address string
	// Config params for a blockchain
	Config constants.ChainConfig

	CreatedAt time.Time

	Key *ethcrypto.Key
	// contains filtered or unexported fields
}

func NewEmptyWallet

func NewEmptyWallet(network string, name string, threshold int, me user.User, others []user.User) *Wallet

NewWallet returns a new Goerli Wallet

func (*Wallet) AllPartyIDs

func (w *Wallet) AllPartyIDs() party.IDSlice

All signers as partyIDs (required by the MSP library)

func (*Wallet) AllPartyNicks

func (w *Wallet) AllPartyNicks() []string

All signers as an array of string nicknames

func (*Wallet) Balance

func (w *Wallet) Balance() uint64

Balance returns the amount of the assets in this wallet

func (*Wallet) BalanceForDisplay

func (w *Wallet) BalanceForDisplay(assetID string) string

func (*Wallet) ConstructEtherscanUrl

func (ew *Wallet) ConstructEtherscanUrl(networkName, txid string) string

func (*Wallet) CreateNormalTransaction

func (ew *Wallet) CreateNormalTransaction(to *common.Address, value *big.Int, data []byte, gasPrice *big.Int, gasLimit uint64) (*types.Transaction, error)

func (*Wallet) FetchBalance

func (ew *Wallet) FetchBalance() error

Run in a Go routine, as well as called directly

func (*Wallet) FormatAmount

func (w *Wallet) FormatAmount(asset Asset, amt uint64) string

func (*Wallet) FormatTxURL

func (w *Wallet) FormatTxURL(txID string) string

func (*Wallet) GetAsset

func (w *Wallet) GetAsset(assetID string) Asset

func (*Wallet) GetBalance

func (ew *Wallet) GetBalance() (*big.Int, error)

func (*Wallet) GetCommonAddress

func (w *Wallet) GetCommonAddress() common.Address

func (*Wallet) GetFormattedAddress

func (w *Wallet) GetFormattedAddress() string

func (*Wallet) GetGasLimit

func (ew *Wallet) GetGasLimit(tx *types.TransactionRequest) (uint64, error)

func (*Wallet) GetGasPrice

func (ew *Wallet) GetGasPrice() (*big.Int, error)

func (*Wallet) GetName

func (w *Wallet) GetName() string

func (*Wallet) GetNonce

func (ew *Wallet) GetNonce(param types.BlockParam) (uint64, error)

func (*Wallet) GetUnwrappedKeyData

func (w *Wallet) GetUnwrappedKeyData() mpsconfig.Config

Unmarshal the MPC config which contains the key data

func (*Wallet) Initialize

func (w *Wallet) Initialize(keydata []byte)

func (*Wallet) IsFetching

func (w *Wallet) IsFetching() bool

func (*Wallet) MpcSigToEthSig

func (w *Wallet) MpcSigToEthSig(hashedmsg []byte, mpcsig *mpsecdsa.Signature) ([]byte, error)

Convert the signature generated by the MPC protocol into an eth recoverable signature

func (*Wallet) OtherPartyIDs

func (w *Wallet) OtherPartyIDs() party.IDSlice

All signers excluding me

func (*Wallet) PublicKeyEth

func (w *Wallet) PublicKeyEth() stdecdsa.PublicKey

From the MPC key data, convert to an eth public key

func (*Wallet) PublicKeyMpsPoint

func (w *Wallet) PublicKeyMpsPoint() curve.Point

func (*Wallet) PublishTx

func (ew *Wallet) PublishTx(rawTx string) (txid string, err error)

func (*Wallet) SendRawTransaction

func (ew *Wallet) SendRawTransaction(raw string) (string, error)

func (*Wallet) SetName

func (w *Wallet) SetName(name string)

func (*Wallet) ToCommonAddress

func (ew *Wallet) ToCommonAddress(address string) common.Address

func (*Wallet) UnmarshalJSON

func (w *Wallet) UnmarshalJSON(data []byte) error

Do the funky chicken to unmarshal then init the struct TODO is this really best way init an unmarshaled struct?

func (*Wallet) VerifyHash

func (w *Wallet) VerifyHash(hashedmsg []byte, mpssig *mpsecdsa.Signature) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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