command

package
v0.0.0-...-08046e1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CmdNmClose is the command name.
	CmdNmClose cli.CmdName = "close"
)
View Source
const (
	// CmdNmHelp is the command name.
	CmdNmHelp cli.CmdName = "help"
)
View Source
const (
	// CmdNmLogin is the command name.
	CmdNmLogin cli.CmdName = "login"
)
View Source
const (
	// CmdNmLogout is the command name.
	CmdNmLogout cli.CmdName = "logout"
)
View Source
const (
	// CmdNmMint is the command name.
	CmdNmMint cli.CmdName = "mint"
)
View Source
const (
	// CmdNmPay is the command name.
	CmdNmPay cli.CmdName = "pay"
)
View Source
const (
	// CmdNmRegister is the command name.
	CmdNmRegister cli.CmdName = "register"
)
View Source
const (
	// CmdNmTrust is the command name.
	CmdNmTrust cli.CmdName = "trust"
)

Variables

View Source
var PriceRegexp = regexp.MustCompile(
	"^([0-9]+)\\/([0-9]+)$")

PriceRegexp is used to validate and parse a price.

View Source
var PublicMints = []MintRegister{
	MintRegister{
		Name:        "Settle",
		Host:        "settle.network",
		Description: "Mint maintained by the Settle developers.",
		RegisterURL: map[env.Environment]string{
			env.Production: "https://register.settle.network/users",
			env.QA:         "https://qa-register.settle.network/users",
		},
	},
}

PublicMints is a list of proposed public mints that offer registration form the cli.

Functions

func CloseOffer

func CloseOffer(
	ctx context.Context,
	id string,
) (*mint.OfferResource, error)

CloseOffer closes an offer specified by token.

func Confirm

func Confirm(
	ctx context.Context,
	action string,
) error

Confirm asks the user for confirmation.

func CreateAsset

func CreateAsset(
	ctx context.Context,
	name string,
) (*mint.AssetResource, error)

CreateAsset creates an asset for the currently authenticated user.

func CreateOffer

func CreateOffer(
	ctx context.Context,
	pair string,
	amount big.Int,
	price string,
) (*mint.OfferResource, error)

CreateOffer creates an offer for the currently authenticated user.

func CreateTransaction

func CreateTransaction(
	ctx context.Context,
	pair string,
	amount big.Int,
	destination string,
	path []string,
) (*mint.TransactionResource, error)

CreateTransaction creates a transaction for the currently authenticated user.

func ListAssetBalances

func ListAssetBalances(
	ctx context.Context,
	asset string,
) ([]mint.BalanceResource, error)

ListAssetBalances list balances for one of the current user's asset.

func ListAssetOffers

func ListAssetOffers(
	ctx context.Context,
	asset string,
	propagation mint.PgType,
) ([]mint.OfferResource, error)

ListAssetOffers list offers for the specified asset

func ListAssets

func ListAssets(
	ctx context.Context,
) ([]mint.AssetResource, error)

ListAssets list assets for the current user.

func ListBalances

func ListBalances(
	ctx context.Context,
) ([]mint.BalanceResource, error)

ListBalances list balances of the current user.

func NewClose

func NewClose() cli.Command

NewClose constructs and initializes the command.

func NewHelp

func NewHelp() cli.Command

NewHelp constructs and initializes the command.

func NewList

func NewList() cli.Command

NewList constructs and initializes the command.

func NewLogin

func NewLogin() cli.Command

NewLogin constructs and initializes the command.

func NewLogout

func NewLogout() cli.Command

NewLogout constructs and initializes the command.

func NewMint

func NewMint() cli.Command

NewMint constructs and initializes the command.

func NewPay

func NewPay() cli.Command

NewPay constructs and initializes the command.

func NewRegister

func NewRegister() cli.Command

NewRegister constructs and initializes the command.

func NewTrust

func NewTrust() cli.Command

NewTrust constructs and initializes the command.

func RegisterUser

func RegisterUser(
	ctx context.Context,
	reg MintRegister,
	username string,
	email string,
) (*register.UserResource, error)

RegisterUser registers a user on the provded mint register service.

func RetrieveAsset

func RetrieveAsset(
	ctx context.Context,
	name string,
) (*mint.AssetResource, error)

RetrieveAsset retrieves an asset, returning nil if it does not exist.

func RetrieveOffer

func RetrieveOffer(
	ctx context.Context,
	id string,
) (*mint.OfferResource, error)

RetrieveOffer retrieves an offer, returning nil if it does not exist.

func SettleTransaction

func SettleTransaction(
	ctx context.Context,
	id string,
) (*mint.TransactionResource, error)

SettleTransaction settles a transaction for the currently authenticated user.

Types

type Candidate

type Candidate struct {
	Path      []mint.OfferResource
	BaseAsset string
	Amount    big.Int
}

Candidate represents a candidate base asset, offer path and amount to pay the required amount of quote asset.

type Candidates

type Candidates []Candidate

Candidates is a slice of Candidate implementing sort.Interface

func (Candidates) Len

func (s Candidates) Len() int

Len implenents the sort.Interface

func (Candidates) Less

func (s Candidates) Less(i, j int) bool

Less implenents the sort.Interface

func (Candidates) Swap

func (s Candidates) Swap(i, j int)

Swap implenents the sort.Interface

type Close

type Close struct {
	ID string
}

Close close an existing trustline.

func (*Close) Execute

func (c *Close) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*Close) Help

func (c *Close) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*Close) Name

func (c *Close) Name() cli.CmdName

Name returns the command name.

func (*Close) Parse

func (c *Close) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

type Help

type Help struct {
	Command cli.Command
}

Help a user up to a certain amount of a given asset they issued.

func (*Help) Execute

func (c *Help) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*Help) Help

func (c *Help) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*Help) Name

func (c *Help) Name() cli.CmdName

Name returns the command name.

func (*Help) Parse

func (c *Help) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

type List

type List struct {
	Type      ObjType
	AssetName *string
}

List assets, balances, balances for an asset and trustlines.

func (*List) Execute

func (c *List) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*List) ExecuteAssets

func (c *List) ExecuteAssets(
	ctx context.Context,
) error

ExecuteAssets the list command for assets.

func (*List) ExecuteBalances

func (c *List) ExecuteBalances(
	ctx context.Context,
) error

ExecuteBalances the list command for balances.

func (*List) ExecuteTrustlines

func (c *List) ExecuteTrustlines(
	ctx context.Context,
) error

ExecuteTrustlines the list command for balances.

func (*List) Help

func (c *List) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*List) Name

func (c *List) Name() cli.CmdName

Name returns the command name.

func (*List) OutList

func (c *List) OutList(
	ctx context.Context,
	list [][][2]string,
) error

OutList prints out a list of records.

func (*List) Parse

func (c *List) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

type Login

type Login struct {
}

Login a user up to a certain amount of a given asset they issued.

func (*Login) Execute

func (c *Login) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*Login) Help

func (c *Login) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*Login) Name

func (c *Login) Name() cli.CmdName

Name returns the command name.

func (*Login) Parse

func (c *Login) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

type Logout

type Logout struct {
}

Logout a user up to a certain amount of a given asset they issued.

func (*Logout) Execute

func (c *Logout) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*Logout) Help

func (c *Logout) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*Logout) Name

func (c *Logout) Name() cli.CmdName

Name returns the command name.

func (*Logout) Parse

func (c *Logout) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

type Mint

type Mint struct {
	Asset string
}

Mint a user up to a certain amount of a given asset they issued.

func (*Mint) Execute

func (c *Mint) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*Mint) Help

func (c *Mint) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*Mint) Name

func (c *Mint) Name() cli.CmdName

Name returns the command name.

func (*Mint) Parse

func (c *Mint) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

type MintRegister

type MintRegister struct {
	Name        string
	Host        string
	Description string
	RegisterURL map[env.Environment]string
}

MintRegister contains all the required information to register to a mint from the cli.

type ObjType

type ObjType string

ObjType reperesents a list object type.

const (
	// CmdNmList is the command name.
	CmdNmList cli.CmdName = "list"

	// ObjTpAsset asset object type.
	ObjTpAsset ObjType = "asset"
	// ObjTpBalance balance object type.
	ObjTpBalance ObjType = "balance"
	// ObjTpTrustline trustline object type.
	ObjTpTrustline ObjType = "trustline"
)

type Pay

type Pay struct {
	QuoteAsset string
	Amount     big.Int
}

Pay a user up to a certain amount of a given asset they issued.

func (*Pay) ComputeCandidates

func (c *Pay) ComputeCandidates(
	ctx context.Context,
) (Candidates, error)

ComputeCandidates computes candidates to pay the require amount of quote asset.

func (*Pay) Execute

func (c *Pay) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*Pay) Help

func (c *Pay) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*Pay) Name

func (c *Pay) Name() cli.CmdName

Name returns the command name.

func (*Pay) Parse

func (c *Pay) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

type Register

type Register struct {
}

Register a user up to a certain amount of a given asset they issued.

func (*Register) Execute

func (c *Register) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*Register) Help

func (c *Register) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*Register) Name

func (c *Register) Name() cli.CmdName

Name returns the command name.

func (*Register) Parse

func (c *Register) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

type Trust

type Trust struct {
	BaseAsset  string
	QuoteAsset string
	Amount     big.Int
	Price      string
}

Trust a user up to a certain amount of a given asset they issued.

func (*Trust) Execute

func (c *Trust) Execute(
	ctx context.Context,
) error

Execute the command or return a human-friendly error.

func (*Trust) Help

func (c *Trust) Help(
	ctx context.Context,
)

Help prints out the help message for the command.

func (*Trust) Name

func (c *Trust) Name() cli.CmdName

Name returns the command name.

func (*Trust) Parse

func (c *Trust) Parse(
	ctx context.Context,
	args []string,
) error

Parse parses the arguments passed to the command.

Jump to

Keyboard shortcuts

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