client

package
v0.0.0-...-0387dd6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DotFromPlanck

func DotFromPlanck(planck *big.Int) *big.Float

func PlanckFromDot

func PlanckFromDot(dot *big.Float) *big.Int

Types

type Client

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

func NewClient

func NewClient(
	sk string,
	api *dot.API,
	queryDepth types.BlockNumber,
	host string,
	wireAccount wire.Account,
	txTimeout time.Duration,
	app *app.TicTacToeApp,
	io *cli.IO,
) (*Client, error)

func (*Client) AcceptProposal

func (c *Client) AcceptProposal(ctx context.Context, p Proposal) error

func (*Client) Account

func (c *Client) Account() dotwallet.Address

func (*Client) Balance

func (c *Client) Balance() (types.U128, error)

func (*Client) Game

func (c *Client) Game() (*Game, error)

func (*Client) NewTransactionContext

func (c *Client) NewTransactionContext() (context.Context, context.CancelFunc)

func (*Client) Proposals

func (c *Client) Proposals() chan Proposal

func (*Client) ProposeGame

func (c *Client) ProposeGame(ctx context.Context, peer wire.Address, stake channel.Bal, challengeDuration uint64) (*Game, error)

func (*Client) RegisterPeer

func (c *Client) RegisterPeer(addr wire.Address, host string)

func (*Client) RejectProposal

func (c *Client) RejectProposal(ctx context.Context, p Proposal, reason string) error

type Game

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

func (*Game) ForceSet

func (g *Game) ForceSet(ctx context.Context, row, col int) error

ForceSet registers a game move on-chain.

func (*Game) IsFinal

func (g *Game) IsFinal() bool

IsFinal returns whether the game is in a final state.

func (*Game) Set

func (g *Game) Set(ctx context.Context, row, col int) error

Set sends a game move to the channel peer.

func (*Game) Settle

func (g *Game) Settle(ctx context.Context) error

Settle settles the app channel and withdraws the funds.

func (*Game) String

func (g *Game) String() string

type Proposal

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

Jump to

Keyboard shortcuts

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