Documentation ¶
Index ¶
- Variables
- func Generate(ctx context.Context, keysname string, min, max int, mnemonic string) (map[common.Address]string, error)
- type Client
- type DB
- type Endpoint
- type InsertWallet
- type Service
- func (service *Service) Claim(ctx context.Context, satellite string) (_ common.Address, err error)
- func (service *Service) Get(ctx context.Context, satellite string, address common.Address) (*Wallet, error)
- func (service *Service) GetStats(ctx context.Context) (*Stats, error)
- func (service *Service) ListBySatellite(ctx context.Context, satellite string) (map[common.Address]string, error)
- func (service *Service) Register(ctx context.Context, satellite string, inserts []InsertWallet) error
- type Stats
- type Wallet
Constants ¶
This section is empty.
Variables ¶
var ErrEndpoint = errs.Class("Wallets Endpoint")
ErrEndpoint is the wallets endpoint error class.
var ErrNoAvailableWallets = errs.New("no unclaimed wallets found")
ErrNoAvailableWallets represents the error that occurs when there are no deposit addresses that are unclaimed.
var ErrUpdateWallet = errs.New("could not update wallet by address")
ErrUpdateWallet represents the error that occurs when the db cannot update the row that has a certain address.
var ErrWalletsService = errs.Class("Wallets Service")
ErrWalletsService indicates about internal wallets service error.
Functions ¶
Types ¶
type Client ¶
Client is a REST client for wallet endpoints.
func (*Client) AddWallets ¶
func (w *Client) AddWallets(ctx context.Context, inserts []InsertWallet) error
AddWallets sends claimable generated addresses to the backend.
type DB ¶
type DB interface { // Insert adds a new entry in the wallets table. Info can be an empty string. Insert(ctx context.Context, satellite string, address common.Address, info string) (*Wallet, error) // InsertBatch adds a new db entry for each address. Entries is a slice of insert wallet data. InsertBatch(ctx context.Context, satellite string, entries []InsertWallet) error // Claim claims and returns the first unclaimed wallet address. Claim(ctx context.Context, satellite string) (*Wallet, error) // Get returns the information stored for a given address. Get(ctx context.Context, satellite string, address common.Address) (*Wallet, error) // GetStats returns information about the wallets table. GetStats(ctx context.Context) (*Stats, error) // ListBySatellite returns accounts claimed by a certain satellite (address -> info). ListBySatellite(ctx context.Context, satellite string) (map[common.Address]string, error) // ListAll returns all claimed accounts (address -> info). ListAll(ctx context.Context) (map[common.Address]string, error) }
DB is a wallets database that stores deposit address information.
architecture: Database
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint for interacting with the Wallets service.
architecture: Endpoint
func NewEndpoint ¶
NewEndpoint creates new wallets endpoint instance.
func (*Endpoint) AddWallets ¶
func (endpoint *Endpoint) AddWallets(w http.ResponseWriter, r *http.Request)
AddWallets saves newly generated wallets.
type InsertWallet ¶ added in v1.0.2
InsertWallet gathers data needed to insert a wallet.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service for querying and updating wallets information.
architecture: Service
func NewService ¶
NewService initializes a wallets service instance.
func (*Service) Get ¶
func (service *Service) Get(ctx context.Context, satellite string, address common.Address) (*Wallet, error)
Get returns information related to an address.