scratch

package module
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: Apache-2.0 Imports: 7 Imported by: 10

README

go-eth2-wallet-store-scratch

Tag License GoDoc Travis CI codecov.io Go Report Card

Ephemeral in-memory store for the Ethereum 2 wallet.

Table of Contents

Install

go-eth2-wallet-store-scratch is a standard Go module which can be installed with:

go get github.com/wealdtech/go-eth2-wallet-store-scratch

Usage

In normal operation this module should not be used directly. Instead, it should be configured to be used as part of go-eth2-wallet.

The scratch store has no options.

Note that because this store is ephemeral there should be no funds left in the wallet at the end of the runtime, or else they will become inaccessible due to the lack of private key

Example
package main

import (
	e2wallet "github.com/wealdtech/go-eth2-wallet"
	scratch "github.com/wealdtech/go-eth2-wallet-store-scratch"
)

func main() {
    // Set up and use an ephemeral store
    store := scratch.New()
    e2wallet.UseStore(store)

    // Use e2wallet operations as normal.
}

Maintainers

Jim McDonald: @mcdee.

Contribute

Contributions welcome. Please check out the issues.

License

Apache-2.0 © 2019 Weald Technology Trading Ltd

Documentation

Overview

Package scratch provides an in-memory store. It is ephemeral, and should not be used where accounts are required to be stored.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() wtypes.Store

New creates a new scratch store.

Types

type Store

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

Store is the store for the wallet.

func (*Store) Name

func (s *Store) Name() string

Name returns the name of this store.

func (*Store) RetrieveAccount

func (s *Store) RetrieveAccount(walletID uuid.UUID, accountID uuid.UUID) ([]byte, error)

RetrieveAccount retrieves account-level data. It will fail if it cannot retrieve the data.

func (*Store) RetrieveAccounts

func (s *Store) RetrieveAccounts(walletID uuid.UUID) <-chan []byte

RetrieveAccounts retrieves all account-level data for a wallet.

func (*Store) RetrieveAccountsIndex added in v1.3.0

func (s *Store) RetrieveAccountsIndex(walletID uuid.UUID) ([]byte, error)

RetrieveAccountsIndex retrieves the account index.

func (*Store) RetrieveBatch added in v1.7.2

func (s *Store) RetrieveBatch(_ context.Context, walletID uuid.UUID) ([]byte, error)

RetrieveBatch retrieves the batch of accounts for a given wallet.

func (*Store) RetrieveWallet

func (s *Store) RetrieveWallet(walletName string) ([]byte, error)

RetrieveWallet retrieves wallet-level data. It will fail if it cannot retrieve the data.

func (*Store) RetrieveWalletByID added in v1.2.0

func (s *Store) RetrieveWalletByID(walletID uuid.UUID) ([]byte, error)

RetrieveWalletByID retrieves wallet-level data. It will fail if it cannot retrieve the data.

func (*Store) RetrieveWallets

func (s *Store) RetrieveWallets() <-chan []byte

RetrieveWallets retrieves wallet-level data for all wallets.

func (*Store) StoreAccount

func (s *Store) StoreAccount(walletID uuid.UUID, accountID uuid.UUID, data []byte) error

StoreAccount stores an account. It will fail if it cannot store the data. Note this will overwrite an existing account with the same ID. It will not, however, allow multiple accounts with the same name to co-exist in the same wallet.

func (*Store) StoreAccountsIndex added in v1.3.0

func (s *Store) StoreAccountsIndex(walletID uuid.UUID, data []byte) error

StoreAccountsIndex stores the account index.

func (*Store) StoreBatch added in v1.7.2

func (s *Store) StoreBatch(_ context.Context, walletID uuid.UUID, _ string, data []byte) error

StoreBatch stores wallet batch data. It will fail if it cannot store the data.

func (*Store) StoreWallet

func (s *Store) StoreWallet(walletID uuid.UUID, _ string, data []byte) error

StoreWallet stores wallet-level data.

Jump to

Keyboard shortcuts

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