atomicswap

package
v0.0.0-...-0269a1e Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AtomicSwapID is the ID for state of an atomic swap client in the connection state.
	AtomicSwapID = "atomic_swap"
)

Variables

View Source
var (
	ErrAtomicSwapClientNotInitialized = errors.New("Atomic swap client is not initialized")
	ErrNoEthClient                    = errors.New("No ethereum client loaded")
	ErrNoStellarClient                = errors.New("No stellar client loaded")
	ErrNoNostrClient                  = errors.New("No nostr client loaded")
)

Functions

This section is empty.

Types

type AtomicSwapState

type AtomicSwapState struct {
	Client *atomicswap.Client
}

func State

func State(conState jsonrpc.State) *AtomicSwapState

State from a connection. If no state is present, it is initialized

func (*AtomicSwapState) Close

func (s *AtomicSwapState) Close()

Close implements jsonrpc.Closer

type Client

type Client struct {
}

func NewClient

func NewClient() *Client

NewClient creates a new Client ready for use

func (*Client) Buy

func (c *Client) Buy(ctx context.Context, conState jsonrpc.State, si SwapInfo) error

func (*Client) Load

func (c *Client) Load(ctx context.Context, conState jsonrpc.State) error

func (*Client) Sell

func (c *Client) Sell(ctx context.Context, conState jsonrpc.State, si SwapInfo) error

type SwapInfo

type SwapInfo struct {
	// PaymentCurrency string of the currency used to buy TFT
	PaymentCurrency string `json:"paymentCurrency"`
	// Amount of TFT to sell (whole units)
	Amount uint64 `json:"amount"`
	// Price expressed as the smallest unit of payment currency for 1 TFT. As buyer, this is the
	// maximum price you are willing to pay for 1 TFT
	Price uint64 `json:"price"`
}

SwapInfo used to start driving an atomic swap

Jump to

Keyboard shortcuts

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