cosmosfaucet

package
v0.14.1-0...-8b31b97 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package cosmosfaucet is a faucet to request tokens for sdk accounts.

Code generated for package cosmosfaucet by go-bindata DO NOT EDIT. (@generated) sources: starport/pkg/cosmosfaucet/openapi/index.html starport/pkg/cosmosfaucet/openapi/openapi.yml.tmpl

Index

Constants

View Source
const (
	// DefaultAccountName is the default account to transfer tokens from.
	DefaultAccountName = "faucet"

	// DefaultDenom is the default denomination to distribute.
	DefaultDenom = "uatom"

	// DefaultAmount specifies the default amount to transfer to an account
	// on each request.
	DefaultAmount = 10000000

	// DefaultMaxAmount specifies the maximum amount that can be tranffered to an
	// account in all times.
	DefaultMaxAmount = 100000000
)

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

Types

type Faucet

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

func New

func New(ctx context.Context, ccr chaincmdrunner.Runner, options ...Option) (Faucet, error)

New creates a new faucet with ccr (to access and use blockchain's CLI) and given options.

func (Faucet) ServeHTTP

func (f Faucet) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler to expose the functionality of Faucet.Transfer() via HTTP. request/response payloads are compatible with the previous implementation at allinbits/cosmos-faucet.

func (Faucet) TotalTransferredAmount

func (f Faucet) TotalTransferredAmount(ctx context.Context, toAccountAddress, denom string) (amount uint64, err error)

TotalTransferredAmount returns the total transferred amount from faucet account to toAccountAddress.

func (Faucet) Transfer

func (f Faucet) Transfer(ctx context.Context, toAccountAddress string, amount uint64, denom string) error

Transfer transfer amount of tokens from the faucet account to toAccountAddress.

type Option

type Option func(*Faucet)

Option configures the faucetOptions.

func Account

func Account(name, mnemonic string) Option

Account provides the account information to transfer tokens from. when mnemonic isn't provided, account assumed to be exists in the keyring.

func Coin

func Coin(amount, maxAmount uint64, denom string) Option

Coin adds a new coin to coins list to distribute by the faucet. the first coin added to the list considered as the default coin during transfer requests.

amount is the amount of the coin can be distributed per request. maxAmount is the maximum amount of the coin that can be sent to a single account. denom is denomination of the coin to be distributed by the faucet.

func OpenAPI

func OpenAPI(chainID, apiAddress string) Option

OpenAPI configures how to serve Open API page and and spec.

Jump to

Keyboard shortcuts

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