swaps

package
v0.0.0-...-6854a2b Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package swaps is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var ErrSwapNotFound = fmt.Errorf("swap not found")

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(endpoint string) (*Client, error)

func (*Client) CreateSwapIn

func (f *Client) CreateSwapIn(ctx context.Context, swapReq *CreateSwapInRequest) (*SwapInResponse, error)

func (*Client) CreateSwapOut

func (f *Client) CreateSwapOut(ctx context.Context, swapReq CreateSwapOutRequest) (*SwapOutResponse, error)

func (*Client) GetClaimPSBT

func (f *Client) GetClaimPSBT(ctx context.Context, swapId, address string) (*GetClaimPSBTResponse, error)

func (*Client) GetConfiguration

func (f *Client) GetConfiguration(ctx context.Context) (*ConfigurationResponse, error)

func (*Client) GetRefundPSBT

func (f *Client) GetRefundPSBT(ctx context.Context, swapId, address string) (*RefundPSBTResponse, error)

func (*Client) GetSwapIn

func (f *Client) GetSwapIn(ctx context.Context, swapId string) (*SwapInResponse, error)

func (*Client) GetSwapOut

func (f *Client) GetSwapOut(ctx context.Context, swapId string) (*SwapOutResponse, error)

func (*Client) PostClaim

func (f *Client) PostClaim(ctx context.Context, swapId, tx string) error

func (*Client) PostRefund

func (f *Client) PostRefund(ctx context.Context, swapId, tx string) error

type ClientInterface

type ClientInterface interface {
	GetConfiguration(ctx context.Context) (*ConfigurationResponse, error)
	CreateSwapOut(ctx context.Context, swapReq CreateSwapOutRequest) (*SwapOutResponse, error)
	GetSwapOut(ctx context.Context, swapId string) (*SwapOutResponse, error)
	GetClaimPSBT(ctx context.Context, swapId, address string) (*GetClaimPSBTResponse, error)
	PostClaim(ctx context.Context, swapId, tx string) error
	CreateSwapIn(ctx context.Context, req *CreateSwapInRequest) (*SwapInResponse, error)
	GetSwapIn(ctx context.Context, swapId string) (*SwapInResponse, error)
	GetRefundPSBT(ctx context.Context, swapId, address string) (*RefundPSBTResponse, error)
	PostRefund(ctx context.Context, swapId, tx string) error
}

type ConfigurationResponse

type ConfigurationResponse struct {
	BitcoinNetwork lightning.Network `json:"bitcoinNetwork"`
	FeePercentage  decimal.Decimal   `json:"feePercentage"`
	MinimumAmount  decimal.Decimal   `json:"minimumAmount"`
	MaximumAmount  decimal.Decimal   `json:"maximumAmount"`
}

type CreateSwapInRequest

type CreateSwapInRequest struct {
	Chain           models.Chain
	Invoice         string
	RefundPublicKey string
}

type CreateSwapOutRequest

type CreateSwapOutRequest struct {
	Chain        models.Chain
	PreImageHash string
	ClaimPubKey  string
	Amount       money.Money
}

type GetClaimPSBTResponse

type GetClaimPSBTResponse struct {
	PSBT string `json:"psbt"`
}

type MockClientInterface

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

MockClientInterface is a mock of ClientInterface interface.

func NewMockClientInterface

func NewMockClientInterface(ctrl *gomock.Controller) *MockClientInterface

NewMockClientInterface creates a new mock instance.

func (*MockClientInterface) CreateSwapIn

CreateSwapIn mocks base method.

func (*MockClientInterface) CreateSwapOut

func (m *MockClientInterface) CreateSwapOut(ctx context.Context, swapReq CreateSwapOutRequest) (*SwapOutResponse, error)

CreateSwapOut mocks base method.

func (*MockClientInterface) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClientInterface) GetClaimPSBT

func (m *MockClientInterface) GetClaimPSBT(ctx context.Context, swapId, address string) (*GetClaimPSBTResponse, error)

GetClaimPSBT mocks base method.

func (*MockClientInterface) GetConfiguration

func (m *MockClientInterface) GetConfiguration(ctx context.Context) (*ConfigurationResponse, error)

GetConfiguration mocks base method.

func (*MockClientInterface) GetRefundPSBT

func (m *MockClientInterface) GetRefundPSBT(ctx context.Context, swapId, address string) (*RefundPSBTResponse, error)

GetRefundPSBT mocks base method.

func (*MockClientInterface) GetSwapIn

func (m *MockClientInterface) GetSwapIn(ctx context.Context, swapId string) (*SwapInResponse, error)

GetSwapIn mocks base method.

func (*MockClientInterface) GetSwapOut

func (m *MockClientInterface) GetSwapOut(ctx context.Context, swapId string) (*SwapOutResponse, error)

GetSwapOut mocks base method.

func (*MockClientInterface) PostClaim

func (m *MockClientInterface) PostClaim(ctx context.Context, swapId, tx string) error

PostClaim mocks base method.

func (*MockClientInterface) PostRefund

func (m *MockClientInterface) PostRefund(ctx context.Context, swapId, tx string) error

PostRefund mocks base method.

type MockClientInterfaceMockRecorder

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

MockClientInterfaceMockRecorder is the mock recorder for MockClientInterface.

func (*MockClientInterfaceMockRecorder) CreateSwapIn

func (mr *MockClientInterfaceMockRecorder) CreateSwapIn(ctx, req any) *gomock.Call

CreateSwapIn indicates an expected call of CreateSwapIn.

func (*MockClientInterfaceMockRecorder) CreateSwapOut

func (mr *MockClientInterfaceMockRecorder) CreateSwapOut(ctx, swapReq any) *gomock.Call

CreateSwapOut indicates an expected call of CreateSwapOut.

func (*MockClientInterfaceMockRecorder) GetClaimPSBT

func (mr *MockClientInterfaceMockRecorder) GetClaimPSBT(ctx, swapId, address any) *gomock.Call

GetClaimPSBT indicates an expected call of GetClaimPSBT.

func (*MockClientInterfaceMockRecorder) GetConfiguration

func (mr *MockClientInterfaceMockRecorder) GetConfiguration(ctx any) *gomock.Call

GetConfiguration indicates an expected call of GetConfiguration.

func (*MockClientInterfaceMockRecorder) GetRefundPSBT

func (mr *MockClientInterfaceMockRecorder) GetRefundPSBT(ctx, swapId, address any) *gomock.Call

GetRefundPSBT indicates an expected call of GetRefundPSBT.

func (*MockClientInterfaceMockRecorder) GetSwapIn

func (mr *MockClientInterfaceMockRecorder) GetSwapIn(ctx, swapId any) *gomock.Call

GetSwapIn indicates an expected call of GetSwapIn.

func (*MockClientInterfaceMockRecorder) GetSwapOut

func (mr *MockClientInterfaceMockRecorder) GetSwapOut(ctx, swapId any) *gomock.Call

GetSwapOut indicates an expected call of GetSwapOut.

func (*MockClientInterfaceMockRecorder) PostClaim

func (mr *MockClientInterfaceMockRecorder) PostClaim(ctx, swapId, tx any) *gomock.Call

PostClaim indicates an expected call of PostClaim.

func (*MockClientInterfaceMockRecorder) PostRefund

func (mr *MockClientInterfaceMockRecorder) PostRefund(ctx, swapId, tx any) *gomock.Call

PostRefund indicates an expected call of PostRefund.

type RefundPSBTResponse

type RefundPSBTResponse struct {
	PSBT string `json:"psbt"`
}

type SwapInResponse

type SwapInResponse struct {
	// ContractAddress is the claim address for the swap
	ContractAddress    string             `json:"contractAddress"`
	Chain              models.Chain       `json:"chain"`
	CreatedAt          time.Time          `json:"createdAt"`
	InputAmount        decimal.Decimal    `json:"inputAmount"`
	LockTx             *string            `json:"lockTx"`
	Outcome            models.SwapOutcome `json:"outcome"`
	OutputAmount       decimal.Decimal    `json:"outputAmount"`
	RedeemScript       string             `json:"redeemScript"`
	Status             models.SwapStatus  `json:"status"`
	SwapId             string             `json:"swapId"`
	TimeoutBlockHeight uint32             `json:"timeoutBlockHeight"`
}

type SwapOutResponse

type SwapOutResponse struct {
	SwapId             string             `json:"swapId"`
	TimeoutBlockHeight uint32             `json:"timeoutBlockHeight"`
	Invoice            string             `json:"invoice"`
	InputAmount        decimal.Decimal    `json:"inputAmount"`
	OutputAmount       decimal.Decimal    `json:"outputAmount"`
	Status             models.SwapStatus  `json:"status"`
	Outcome            models.SwapOutcome `json:"outcome"`
	CreatedAt          time.Time          `json:"createdAt"`
	LockTx             *string            `json:"lockTx"`
	UnlockTx           *string            `json:"unlockTx"`
	ContractAddress    *string            `json:"contractAddress"`
	RedeemScript       *string            `json:"redeemScript"`
	RefundPublicKey    *string            `json:"refundPublicKey"`
}

Jump to

Keyboard shortcuts

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