swap

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Accept

func Accept(opts AcceptOpts) (string, []byte, error)

Accept takes a AcceptOpts and returns the id of the SwapAccept entity and its serialized version

func Complete

func Complete(complete CompleteOpts) (string, []byte, error)

Complete takes a CompleteOpts and returns the id of the SwapComplete entity and its serialized version

func Fail

func Fail(opts FailOpts) (string, []byte, error)

func Request

func Request(opts RequestOpts) ([]byte, error)

Request takes a RequestOpts struct and returns a serialized protobuf message.

func ValidateCompletePset

func ValidateCompletePset(opts ValidateCompletePsetOpts) error

ValidateCompletePset takes a VerifyCompeltePsetOpts and returns whether the final signed pset matches the original SwapRequest message

Types

type AcceptOpts

type AcceptOpts struct {
	Message            []byte
	PsetBase64         string
	InputBlindingKeys  map[string][]byte
	OutputBlindingKeys map[string][]byte
}

AcceptOpts is the struct given to Accept method

type CompleteOpts

type CompleteOpts struct {
	Message     []byte
	Transaction string
}

CompleteOpts is the struct given to the Complete method

type ErrCode

type ErrCode int
const (
	ErrCodeInvalidSwapRequest ErrCode = iota
	ErrCodeRejectedSwapRequest
	ErrCodeFailedToComplete
)

type FailOpts

type FailOpts struct {
	MessageID  string
	ErrCode    ErrCode
	ErrMessage string
}

type RequestOpts

type RequestOpts struct {
	Id                 string
	AssetToSend        string
	AmountToSend       uint64
	AssetToReceive     string
	AmountToReceive    uint64
	PsetBase64         string
	InputBlindingKeys  map[string][]byte
	OutputBlindingKeys map[string][]byte
}

RequestOpts is the struct to be given to the Request method

type ValidateCompletePsetOpts

type ValidateCompletePsetOpts struct {
	PsetBase64         string
	InputBlindingKeys  map[string][]byte
	OutputBlindingKeys map[string][]byte
	SwapRequest        *pb.SwapRequest
}

ValidateCompletePsetOpts is the struct given to the ValidateCompletePset method

Jump to

Keyboard shortcuts

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