rpc

package
v0.0.0-...-0895702 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: AGPL-3.0 Imports: 32 Imported by: 0

Documentation

Overview

Package rpc is a generated GoMock package.

Package rpc is a generated GoMock package.

Index

Constants

View Source
const (
	SwapService_SwapIn_FullMethodName                   = "/SwapService/SwapIn"
	SwapService_SwapOut_FullMethodName                  = "/SwapService/SwapOut"
	SwapService_GetSwapIn_FullMethodName                = "/SwapService/GetSwapIn"
	SwapService_GetSwapOut_FullMethodName               = "/SwapService/GetSwapOut"
	SwapService_RecoverReusedSwapAddress_FullMethodName = "/SwapService/RecoverReusedSwapAddress"
)

Variables

View Source
var (
	Chain_name = map[int32]string{
		0: "BITCOIN",
		1: "LIQUID",
	}
	Chain_value = map[string]int32{
		"BITCOIN": 0,
		"LIQUID":  1,
	}
)

Enum value maps for Chain.

View Source
var (
	Network_name = map[int32]string{
		0: "MAINNET",
		1: "TESTNET",
		2: "REGTEST",
	}
	Network_value = map[string]int32{
		"MAINNET": 0,
		"TESTNET": 1,
		"REGTEST": 2,
	}
)

Enum value maps for Network.

View Source
var (
	Status_name = map[int32]string{
		0: "CREATED",
		1: "INVOICE_PAYMENT_INTENT_RECEIVED",
		2: "CONTRACT_FUNDED_UNCONFIRMED",
		3: "CONTRACT_FUNDED",
		4: "INVOICE_PAID",
		5: "CONTRACT_CLAIMED_UNCONFIRMED",
		6: "DONE",
		7: "CONTRACT_REFUNDED_UNCONFIRMED",
		8: "CONTRACT_EXPIRED",
	}
	Status_value = map[string]int32{
		"CREATED":                         0,
		"INVOICE_PAYMENT_INTENT_RECEIVED": 1,
		"CONTRACT_FUNDED_UNCONFIRMED":     2,
		"CONTRACT_FUNDED":                 3,
		"INVOICE_PAID":                    4,
		"CONTRACT_CLAIMED_UNCONFIRMED":    5,
		"DONE":                            6,
		"CONTRACT_REFUNDED_UNCONFIRMED":   7,
		"CONTRACT_EXPIRED":                8,
	}
)

Enum value maps for Status.

View Source
var File__40swapd_proto protoreflect.FileDescriptor
View Source
var SwapService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "SwapService",
	HandlerType: (*SwapServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "SwapIn",
			Handler:    _SwapService_SwapIn_Handler,
		},
		{
			MethodName: "SwapOut",
			Handler:    _SwapService_SwapOut_Handler,
		},
		{
			MethodName: "GetSwapIn",
			Handler:    _SwapService_GetSwapIn_Handler,
		},
		{
			MethodName: "GetSwapOut",
			Handler:    _SwapService_GetSwapOut_Handler,
		},
		{
			MethodName: "RecoverReusedSwapAddress",
			Handler:    _SwapService_RecoverReusedSwapAddress_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "40swapd.proto",
}

SwapService_ServiceDesc is the grpc.ServiceDesc for SwapService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func NewConnection

func NewConnection(host string, port uint32) *grpc.ClientConn

func RegisterSwapServiceServer

func RegisterSwapServiceServer(s grpc.ServiceRegistrar, srv SwapServiceServer)

func ToLightningNetworkType

func ToLightningNetworkType(network Network) lightning.Network

func ToModelsChainType

func ToModelsChainType(chain Chain) models.Chain

Types

type Chain

type Chain int32

Enum definition for supported blockchain chains.

const (
	Chain_BITCOIN Chain = 0 // Bitcoin blockchain.
	Chain_LIQUID  Chain = 1 // Liquid sidechain.
)

func (Chain) Descriptor

func (Chain) Descriptor() protoreflect.EnumDescriptor

func (Chain) Enum

func (x Chain) Enum() *Chain

func (Chain) EnumDescriptor deprecated

func (Chain) EnumDescriptor() ([]byte, []int)

Deprecated: Use Chain.Descriptor instead.

func (Chain) Number

func (x Chain) Number() protoreflect.EnumNumber

func (Chain) String

func (x Chain) String() string

func (Chain) Type

func (Chain) Type() protoreflect.EnumType

type GetSwapInRequest

type GetSwapInRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier for the swap.
	// contains filtered or unexported fields
}

Message definitions for querying SwapIn status.

func (*GetSwapInRequest) Descriptor deprecated

func (*GetSwapInRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetSwapInRequest.ProtoReflect.Descriptor instead.

func (*GetSwapInRequest) GetId

func (x *GetSwapInRequest) GetId() string

func (*GetSwapInRequest) ProtoMessage

func (*GetSwapInRequest) ProtoMessage()

func (*GetSwapInRequest) ProtoReflect

func (x *GetSwapInRequest) ProtoReflect() protoreflect.Message

func (*GetSwapInRequest) Reset

func (x *GetSwapInRequest) Reset()

func (*GetSwapInRequest) String

func (x *GetSwapInRequest) String() string

type GetSwapInResponse

type GetSwapInResponse struct {
	Id                 string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`                                                               // Unique identifier for the swap.
	ContractAddress    string                 `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty"`              // Address of the contract.
	CreatedAt          *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`                                // Timestamp when the swap was created.
	InputAmount        float64                `protobuf:"fixed64,4,opt,name=input_amount,json=inputAmount,proto3" json:"input_amount,omitempty"`                        // Input amount in BTC.
	LockTxId           *string                `protobuf:"bytes,5,opt,name=lock_tx_id,json=lockTxId,proto3,oneof" json:"lock_tx_id,omitempty"`                           // Lock transaction txid.
	Outcome            *string                `protobuf:"bytes,6,opt,name=outcome,proto3,oneof" json:"outcome,omitempty"`                                               // Outcome of the swap.
	OutputAmount       float64                `protobuf:"fixed64,7,opt,name=output_amount,json=outputAmount,proto3" json:"output_amount,omitempty"`                     // Output amount in BTC.
	RedeemScript       string                 `protobuf:"bytes,8,opt,name=redeem_script,json=redeemScript,proto3" json:"redeem_script,omitempty"`                       // Redeem script for the contract.
	Status             Status                 `protobuf:"varint,9,opt,name=status,proto3,enum=Status" json:"status,omitempty"`                                          // Current status of the swap.
	TimeoutBlockHeight uint32                 `protobuf:"varint,10,opt,name=timeout_block_height,json=timeoutBlockHeight,proto3" json:"timeout_block_height,omitempty"` // Block height at which the swap times out.
	PreImage           *string                `protobuf:"bytes,11,opt,name=pre_image,json=preImage,proto3,oneof" json:"pre_image,omitempty"`                            // Preimage for the swap.
	RefundTxId         *string                `protobuf:"bytes,12,opt,name=refund_tx_id,json=refundTxId,proto3,oneof" json:"refund_tx_id,omitempty"`                    // Refund transaction ID.
	ServiceFeeSats     uint64                 `protobuf:"varint,13,opt,name=service_fee_sats,json=serviceFeeSats,proto3" json:"service_fee_sats,omitempty"`             // Service fee in satoshis.
	OnchainFeeSats     uint64                 `protobuf:"varint,14,opt,name=onchain_fee_sats,json=onchainFeeSats,proto3" json:"onchain_fee_sats,omitempty"`             // On-chain fee in satoshis.
	// contains filtered or unexported fields
}

func (*GetSwapInResponse) Descriptor deprecated

func (*GetSwapInResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetSwapInResponse.ProtoReflect.Descriptor instead.

func (*GetSwapInResponse) GetContractAddress

func (x *GetSwapInResponse) GetContractAddress() string

func (*GetSwapInResponse) GetCreatedAt

func (x *GetSwapInResponse) GetCreatedAt() *timestamppb.Timestamp

func (*GetSwapInResponse) GetId

func (x *GetSwapInResponse) GetId() string

func (*GetSwapInResponse) GetInputAmount

func (x *GetSwapInResponse) GetInputAmount() float64

func (*GetSwapInResponse) GetLockTxId

func (x *GetSwapInResponse) GetLockTxId() string

func (*GetSwapInResponse) GetOnchainFeeSats

func (x *GetSwapInResponse) GetOnchainFeeSats() uint64

func (*GetSwapInResponse) GetOutcome

func (x *GetSwapInResponse) GetOutcome() string

func (*GetSwapInResponse) GetOutputAmount

func (x *GetSwapInResponse) GetOutputAmount() float64

func (*GetSwapInResponse) GetPreImage

func (x *GetSwapInResponse) GetPreImage() string

func (*GetSwapInResponse) GetRedeemScript

func (x *GetSwapInResponse) GetRedeemScript() string

func (*GetSwapInResponse) GetRefundTxId

func (x *GetSwapInResponse) GetRefundTxId() string

func (*GetSwapInResponse) GetServiceFeeSats

func (x *GetSwapInResponse) GetServiceFeeSats() uint64

func (*GetSwapInResponse) GetStatus

func (x *GetSwapInResponse) GetStatus() Status

func (*GetSwapInResponse) GetTimeoutBlockHeight

func (x *GetSwapInResponse) GetTimeoutBlockHeight() uint32

func (*GetSwapInResponse) ProtoMessage

func (*GetSwapInResponse) ProtoMessage()

func (*GetSwapInResponse) ProtoReflect

func (x *GetSwapInResponse) ProtoReflect() protoreflect.Message

func (*GetSwapInResponse) Reset

func (x *GetSwapInResponse) Reset()

func (*GetSwapInResponse) String

func (x *GetSwapInResponse) String() string

type GetSwapOutRequest

type GetSwapOutRequest struct {
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // Unique identifier for the swap.
	// contains filtered or unexported fields
}

Message definitions for querying SwapOut status.

func (*GetSwapOutRequest) Descriptor deprecated

func (*GetSwapOutRequest) Descriptor() ([]byte, []int)

Deprecated: Use GetSwapOutRequest.ProtoReflect.Descriptor instead.

func (*GetSwapOutRequest) GetId

func (x *GetSwapOutRequest) GetId() string

func (*GetSwapOutRequest) ProtoMessage

func (*GetSwapOutRequest) ProtoMessage()

func (*GetSwapOutRequest) ProtoReflect

func (x *GetSwapOutRequest) ProtoReflect() protoreflect.Message

func (*GetSwapOutRequest) Reset

func (x *GetSwapOutRequest) Reset()

func (*GetSwapOutRequest) String

func (x *GetSwapOutRequest) String() string

type GetSwapOutResponse

type GetSwapOutResponse struct {
	Id                 string                 `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`                                                              // Unique identifier for the swap.
	TimeoutBlockHeight uint32                 `protobuf:"varint,2,opt,name=timeout_block_height,json=timeoutBlockHeight,proto3" json:"timeout_block_height,omitempty"` // Block height at which the swap times out.
	Invoice            string                 `protobuf:"bytes,3,opt,name=invoice,proto3" json:"invoice,omitempty"`                                                    // Invoice associated with the swap.
	InputAmount        float64                `protobuf:"fixed64,4,opt,name=input_amount,json=inputAmount,proto3" json:"input_amount,omitempty"`                       // Input amount in BTC.
	OutputAmount       float64                `protobuf:"fixed64,5,opt,name=output_amount,json=outputAmount,proto3" json:"output_amount,omitempty"`                    // Output amount in BTC.
	Status             Status                 `protobuf:"varint,6,opt,name=status,proto3,enum=Status" json:"status,omitempty"`                                         // Current status of the swap.
	CreatedAt          *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`                               // Timestamp when the swap was created.
	Outcome            *string                `protobuf:"bytes,8,opt,name=outcome,proto3,oneof" json:"outcome,omitempty"`                                              // Outcome of the swap.
	ClaimTxId          *string                `protobuf:"bytes,9,opt,name=claim_tx_id,json=claimTxId,proto3,oneof" json:"claim_tx_id,omitempty"`                       // Claim transaction txid.
	ServiceFeeSats     uint64                 `protobuf:"varint,10,opt,name=service_fee_sats,json=serviceFeeSats,proto3" json:"service_fee_sats,omitempty"`            // Service fee in satoshis.
	OnchainFeeSats     uint64                 `protobuf:"varint,11,opt,name=onchain_fee_sats,json=onchainFeeSats,proto3" json:"onchain_fee_sats,omitempty"`            // On-chain fee in satoshis.
	OffchainFeeSats    uint64                 `protobuf:"varint,12,opt,name=offchain_fee_sats,json=offchainFeeSats,proto3" json:"offchain_fee_sats,omitempty"`         // Off-chain (routing) fee in satoshis.
	// contains filtered or unexported fields
}

func (*GetSwapOutResponse) Descriptor deprecated

func (*GetSwapOutResponse) Descriptor() ([]byte, []int)

Deprecated: Use GetSwapOutResponse.ProtoReflect.Descriptor instead.

func (*GetSwapOutResponse) GetClaimTxId

func (x *GetSwapOutResponse) GetClaimTxId() string

func (*GetSwapOutResponse) GetCreatedAt

func (x *GetSwapOutResponse) GetCreatedAt() *timestamppb.Timestamp

func (*GetSwapOutResponse) GetId

func (x *GetSwapOutResponse) GetId() string

func (*GetSwapOutResponse) GetInputAmount

func (x *GetSwapOutResponse) GetInputAmount() float64

func (*GetSwapOutResponse) GetInvoice

func (x *GetSwapOutResponse) GetInvoice() string

func (*GetSwapOutResponse) GetOffchainFeeSats

func (x *GetSwapOutResponse) GetOffchainFeeSats() uint64

func (*GetSwapOutResponse) GetOnchainFeeSats

func (x *GetSwapOutResponse) GetOnchainFeeSats() uint64

func (*GetSwapOutResponse) GetOutcome

func (x *GetSwapOutResponse) GetOutcome() string

func (*GetSwapOutResponse) GetOutputAmount

func (x *GetSwapOutResponse) GetOutputAmount() float64

func (*GetSwapOutResponse) GetServiceFeeSats

func (x *GetSwapOutResponse) GetServiceFeeSats() uint64

func (*GetSwapOutResponse) GetStatus

func (x *GetSwapOutResponse) GetStatus() Status

func (*GetSwapOutResponse) GetTimeoutBlockHeight

func (x *GetSwapOutResponse) GetTimeoutBlockHeight() uint32

func (*GetSwapOutResponse) ProtoMessage

func (*GetSwapOutResponse) ProtoMessage()

func (*GetSwapOutResponse) ProtoReflect

func (x *GetSwapOutResponse) ProtoReflect() protoreflect.Message

func (*GetSwapOutResponse) Reset

func (x *GetSwapOutResponse) Reset()

func (*GetSwapOutResponse) String

func (x *GetSwapOutResponse) String() string

type MockRepository

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

MockRepository is a mock of Repository interface.

func NewMockRepository

func NewMockRepository(ctrl *gomock.Controller) *MockRepository

NewMockRepository creates a new mock instance.

func (*MockRepository) EXPECT

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

func (*MockRepository) GetPendingAutoSwapOuts

func (m *MockRepository) GetPendingAutoSwapOuts(ctx context.Context) ([]*models.SwapOut, error)

GetPendingAutoSwapOuts mocks base method.

func (*MockRepository) GetPendingSwapIns

func (m *MockRepository) GetPendingSwapIns(ctx context.Context) ([]*models.SwapIn, error)

GetPendingSwapIns mocks base method.

func (*MockRepository) GetPendingSwapOuts

func (m *MockRepository) GetPendingSwapOuts(ctx context.Context) ([]*models.SwapOut, error)

GetPendingSwapOuts mocks base method.

func (*MockRepository) GetSwapIn

func (m *MockRepository) GetSwapIn(ctx context.Context, swapID string) (*models.SwapIn, error)

GetSwapIn mocks base method.

func (*MockRepository) GetSwapInByClaimAddress

func (m *MockRepository) GetSwapInByClaimAddress(ctx context.Context, address string) (*models.SwapIn, error)

GetSwapInByClaimAddress mocks base method.

func (*MockRepository) GetSwapOut

func (m *MockRepository) GetSwapOut(ctx context.Context, swapID string) (*models.SwapOut, error)

GetSwapOut mocks base method.

func (*MockRepository) SaveSwapIn

func (m *MockRepository) SaveSwapIn(ctx context.Context, swapIn *models.SwapIn) error

SaveSwapIn mocks base method.

func (*MockRepository) SaveSwapOut

func (m *MockRepository) SaveSwapOut(ctx context.Context, swapOut *models.SwapOut) error

SaveSwapOut mocks base method.

func (*MockRepository) UpdateAutoSwap

func (m *MockRepository) UpdateAutoSwap(ctx context.Context, swapID string, isAutoSwap bool) error

UpdateAutoSwap mocks base method.

type MockRepositoryMockRecorder

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

MockRepositoryMockRecorder is the mock recorder for MockRepository.

func (*MockRepositoryMockRecorder) GetPendingAutoSwapOuts

func (mr *MockRepositoryMockRecorder) GetPendingAutoSwapOuts(ctx any) *gomock.Call

GetPendingAutoSwapOuts indicates an expected call of GetPendingAutoSwapOuts.

func (*MockRepositoryMockRecorder) GetPendingSwapIns

func (mr *MockRepositoryMockRecorder) GetPendingSwapIns(ctx any) *gomock.Call

GetPendingSwapIns indicates an expected call of GetPendingSwapIns.

func (*MockRepositoryMockRecorder) GetPendingSwapOuts

func (mr *MockRepositoryMockRecorder) GetPendingSwapOuts(ctx any) *gomock.Call

GetPendingSwapOuts indicates an expected call of GetPendingSwapOuts.

func (*MockRepositoryMockRecorder) GetSwapIn

func (mr *MockRepositoryMockRecorder) GetSwapIn(ctx, swapID any) *gomock.Call

GetSwapIn indicates an expected call of GetSwapIn.

func (*MockRepositoryMockRecorder) GetSwapInByClaimAddress

func (mr *MockRepositoryMockRecorder) GetSwapInByClaimAddress(ctx, address any) *gomock.Call

GetSwapInByClaimAddress indicates an expected call of GetSwapInByClaimAddress.

func (*MockRepositoryMockRecorder) GetSwapOut

func (mr *MockRepositoryMockRecorder) GetSwapOut(ctx, swapID any) *gomock.Call

GetSwapOut indicates an expected call of GetSwapOut.

func (*MockRepositoryMockRecorder) SaveSwapIn

func (mr *MockRepositoryMockRecorder) SaveSwapIn(ctx, swapIn any) *gomock.Call

SaveSwapIn indicates an expected call of SaveSwapIn.

func (*MockRepositoryMockRecorder) SaveSwapOut

func (mr *MockRepositoryMockRecorder) SaveSwapOut(ctx, swapOut any) *gomock.Call

SaveSwapOut indicates an expected call of SaveSwapOut.

func (*MockRepositoryMockRecorder) UpdateAutoSwap

func (mr *MockRepositoryMockRecorder) UpdateAutoSwap(ctx, swapID, isAutoSwap any) *gomock.Call

UpdateAutoSwap indicates an expected call of UpdateAutoSwap.

type MockSwapServiceClient

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

MockSwapServiceClient is a mock of SwapServiceClient interface.

func NewMockSwapServiceClient

func NewMockSwapServiceClient(ctrl *gomock.Controller) *MockSwapServiceClient

NewMockSwapServiceClient creates a new mock instance.

func (*MockSwapServiceClient) EXPECT

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

func (*MockSwapServiceClient) GetSwapIn

GetSwapIn mocks base method.

func (*MockSwapServiceClient) GetSwapOut

GetSwapOut mocks base method.

func (*MockSwapServiceClient) RecoverReusedSwapAddress

RecoverReusedSwapAddress mocks base method.

func (*MockSwapServiceClient) SwapIn

SwapIn mocks base method.

func (*MockSwapServiceClient) SwapOut

SwapOut mocks base method.

type MockSwapServiceClientMockRecorder

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

MockSwapServiceClientMockRecorder is the mock recorder for MockSwapServiceClient.

func (*MockSwapServiceClientMockRecorder) GetSwapIn

func (mr *MockSwapServiceClientMockRecorder) GetSwapIn(ctx, in interface{}, opts ...interface{}) *gomock.Call

GetSwapIn indicates an expected call of GetSwapIn.

func (*MockSwapServiceClientMockRecorder) GetSwapOut

func (mr *MockSwapServiceClientMockRecorder) GetSwapOut(ctx, in interface{}, opts ...interface{}) *gomock.Call

GetSwapOut indicates an expected call of GetSwapOut.

func (*MockSwapServiceClientMockRecorder) RecoverReusedSwapAddress

func (mr *MockSwapServiceClientMockRecorder) RecoverReusedSwapAddress(ctx, in interface{}, opts ...interface{}) *gomock.Call

RecoverReusedSwapAddress indicates an expected call of RecoverReusedSwapAddress.

func (*MockSwapServiceClientMockRecorder) SwapIn

func (mr *MockSwapServiceClientMockRecorder) SwapIn(ctx, in interface{}, opts ...interface{}) *gomock.Call

SwapIn indicates an expected call of SwapIn.

func (*MockSwapServiceClientMockRecorder) SwapOut

func (mr *MockSwapServiceClientMockRecorder) SwapOut(ctx, in interface{}, opts ...interface{}) *gomock.Call

SwapOut indicates an expected call of SwapOut.

type MockSwapServiceServer

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

MockSwapServiceServer is a mock of SwapServiceServer interface.

func NewMockSwapServiceServer

func NewMockSwapServiceServer(ctrl *gomock.Controller) *MockSwapServiceServer

NewMockSwapServiceServer creates a new mock instance.

func (*MockSwapServiceServer) EXPECT

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

func (*MockSwapServiceServer) GetSwapIn

GetSwapIn mocks base method.

func (*MockSwapServiceServer) GetSwapOut

GetSwapOut mocks base method.

func (*MockSwapServiceServer) RecoverReusedSwapAddress

RecoverReusedSwapAddress mocks base method.

func (*MockSwapServiceServer) SwapIn

SwapIn mocks base method.

func (*MockSwapServiceServer) SwapOut

SwapOut mocks base method.

type MockSwapServiceServerMockRecorder

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

MockSwapServiceServerMockRecorder is the mock recorder for MockSwapServiceServer.

func (*MockSwapServiceServerMockRecorder) GetSwapIn

func (mr *MockSwapServiceServerMockRecorder) GetSwapIn(arg0, arg1 interface{}) *gomock.Call

GetSwapIn indicates an expected call of GetSwapIn.

func (*MockSwapServiceServerMockRecorder) GetSwapOut

func (mr *MockSwapServiceServerMockRecorder) GetSwapOut(arg0, arg1 interface{}) *gomock.Call

GetSwapOut indicates an expected call of GetSwapOut.

func (*MockSwapServiceServerMockRecorder) RecoverReusedSwapAddress

func (mr *MockSwapServiceServerMockRecorder) RecoverReusedSwapAddress(arg0, arg1 interface{}) *gomock.Call

RecoverReusedSwapAddress indicates an expected call of RecoverReusedSwapAddress.

func (*MockSwapServiceServerMockRecorder) SwapIn

func (mr *MockSwapServiceServerMockRecorder) SwapIn(arg0, arg1 interface{}) *gomock.Call

SwapIn indicates an expected call of SwapIn.

func (*MockSwapServiceServerMockRecorder) SwapOut

func (mr *MockSwapServiceServerMockRecorder) SwapOut(arg0, arg1 interface{}) *gomock.Call

SwapOut indicates an expected call of SwapOut.

type MockUnsafeSwapServiceServer

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

MockUnsafeSwapServiceServer is a mock of UnsafeSwapServiceServer interface.

func NewMockUnsafeSwapServiceServer

func NewMockUnsafeSwapServiceServer(ctrl *gomock.Controller) *MockUnsafeSwapServiceServer

NewMockUnsafeSwapServiceServer creates a new mock instance.

func (*MockUnsafeSwapServiceServer) EXPECT

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

type MockUnsafeSwapServiceServerMockRecorder

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

MockUnsafeSwapServiceServerMockRecorder is the mock recorder for MockUnsafeSwapServiceServer.

type Network

type Network int32

Enum definition for supported network types.

const (
	Network_MAINNET Network = 0 // Main Bitcoin network.
	Network_TESTNET Network = 1 // Bitcoin test network.
	Network_REGTEST Network = 2 // Bitcoin regression test network.
)

func (Network) Descriptor

func (Network) Descriptor() protoreflect.EnumDescriptor

func (Network) Enum

func (x Network) Enum() *Network

func (Network) EnumDescriptor deprecated

func (Network) EnumDescriptor() ([]byte, []int)

Deprecated: Use Network.Descriptor instead.

func (Network) Number

func (x Network) Number() protoreflect.EnumNumber

func (Network) String

func (x Network) String() string

func (Network) Type

func (Network) Type() protoreflect.EnumType

type RecoverReusedSwapAddressRequest

type RecoverReusedSwapAddressRequest struct {
	Outpoint string  `protobuf:"bytes,1,opt,name=outpoint,proto3" json:"outpoint,omitempty"`                       // Outpoint of the transaction to refund
	RefundTo *string `protobuf:"bytes,2,opt,name=refund_to,json=refundTo,proto3,oneof" json:"refund_to,omitempty"` // Address to refund to
	// contains filtered or unexported fields
}

func (*RecoverReusedSwapAddressRequest) Descriptor deprecated

func (*RecoverReusedSwapAddressRequest) Descriptor() ([]byte, []int)

Deprecated: Use RecoverReusedSwapAddressRequest.ProtoReflect.Descriptor instead.

func (*RecoverReusedSwapAddressRequest) GetOutpoint

func (x *RecoverReusedSwapAddressRequest) GetOutpoint() string

func (*RecoverReusedSwapAddressRequest) GetRefundTo

func (x *RecoverReusedSwapAddressRequest) GetRefundTo() string

func (*RecoverReusedSwapAddressRequest) ProtoMessage

func (*RecoverReusedSwapAddressRequest) ProtoMessage()

func (*RecoverReusedSwapAddressRequest) ProtoReflect

func (*RecoverReusedSwapAddressRequest) Reset

func (*RecoverReusedSwapAddressRequest) String

type RecoverReusedSwapAddressResponse

type RecoverReusedSwapAddressResponse struct {
	Txid            string  `protobuf:"bytes,1,opt,name=txid,proto3" json:"txid,omitempty"`                                                // Transaction ID of the refund transaction
	RecoveredAmount float64 `protobuf:"fixed64,2,opt,name=recovered_amount,json=recoveredAmount,proto3" json:"recovered_amount,omitempty"` // Amount recovered in BTC
	// contains filtered or unexported fields
}

func (*RecoverReusedSwapAddressResponse) Descriptor deprecated

func (*RecoverReusedSwapAddressResponse) Descriptor() ([]byte, []int)

Deprecated: Use RecoverReusedSwapAddressResponse.ProtoReflect.Descriptor instead.

func (*RecoverReusedSwapAddressResponse) GetRecoveredAmount

func (x *RecoverReusedSwapAddressResponse) GetRecoveredAmount() float64

func (*RecoverReusedSwapAddressResponse) GetTxid

func (*RecoverReusedSwapAddressResponse) ProtoMessage

func (*RecoverReusedSwapAddressResponse) ProtoMessage()

func (*RecoverReusedSwapAddressResponse) ProtoReflect

func (*RecoverReusedSwapAddressResponse) Reset

func (*RecoverReusedSwapAddressResponse) String

type Repository

type Repository interface {
	database.SwapInRepository
	// Add more repositories here
	database.SwapOutRepository
}

type Server

type Server struct {
	UnimplementedSwapServiceServer
	Port       uint32
	Repository Repository
	// contains filtered or unexported fields
}

func NewRPCServer

func NewRPCServer(port uint32, repository Repository, swapClient swaps.ClientInterface, lightningClient lightning.Client, bitcoin bitcoin.Client, minRelayFee int64, network Network) *Server

func (*Server) CreateSwapOut

func (server *Server) CreateSwapOut(ctx context.Context, claimPubKey string, amountSats money.Money) (*swaps.SwapOutResponse, *lntypes.Preimage, error)

func (*Server) GetSwapIn

func (s *Server) GetSwapIn(ctx context.Context, req *GetSwapInRequest) (*GetSwapInResponse, error)

func (*Server) GetSwapOut

func (s *Server) GetSwapOut(ctx context.Context, req *GetSwapOutRequest) (*GetSwapOutResponse, error)

func (*Server) ListenAndServe

func (server *Server) ListenAndServe() error

func (*Server) Stop

func (server *Server) Stop()

func (*Server) SwapIn

func (server *Server) SwapIn(ctx context.Context, req *SwapInRequest) (*SwapInResponse, error)

func (*Server) SwapOut

func (server *Server) SwapOut(ctx context.Context, req *SwapOutRequest) (*SwapOutResponse, error)

type Status

type Status int32

Enum definition for swap statuses.

const (
	// Happy path statuses.
	Status_CREATED                         Status = 0 // Swap has been created.
	Status_INVOICE_PAYMENT_INTENT_RECEIVED Status = 1 // Payment locked on L2
	Status_CONTRACT_FUNDED_UNCONFIRMED     Status = 2 // Contract funded but unconfirmed (mempool)
	Status_CONTRACT_FUNDED                 Status = 3 // Contract funded and confirmed.
	Status_INVOICE_PAID                    Status = 4 // L2 invoice has been paid.
	Status_CONTRACT_CLAIMED_UNCONFIRMED    Status = 5 // Contract claimed but unconfirmed.
	Status_DONE                            Status = 6 // Swap completed successfully.
	// Expiry-related statuses.
	Status_CONTRACT_REFUNDED_UNCONFIRMED Status = 7 // Contract refunded but unconfirmed.
	Status_CONTRACT_EXPIRED              Status = 8 // Contract expired.
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

func (Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status.Descriptor instead.

func (Status) MarshalIndent

func (s Status) MarshalIndent(prefix, indent string) ([]byte, error)

MarshalIndent is a helper function to marshal Status with indentation.

func (Status) MarshalJSON

func (s Status) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface for Status.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

type SwapInRequest

type SwapInRequest struct {
	Chain      Chain   `protobuf:"varint,1,opt,name=chain,proto3,enum=Chain" json:"chain,omitempty"`                        // Blockchain chain for the swap.
	Invoice    *string `protobuf:"bytes,2,opt,name=invoice,proto3,oneof" json:"invoice,omitempty"`                          // Invoice to be paid.
	AmountSats *uint64 `protobuf:"varint,3,opt,name=amount_sats,json=amountSats,proto3,oneof" json:"amount_sats,omitempty"` // Amount in satoshis.
	Expiry     *uint32 `protobuf:"varint,4,opt,name=expiry,proto3,oneof" json:"expiry,omitempty"`                           // Expiry time for the swap.
	RefundTo   string  `protobuf:"bytes,5,opt,name=refund_to,json=refundTo,proto3" json:"refund_to,omitempty"`              // Address to refund in case of failure.
	// contains filtered or unexported fields
}

Message definitions for SwapIn operation.

func (*SwapInRequest) Descriptor deprecated

func (*SwapInRequest) Descriptor() ([]byte, []int)

Deprecated: Use SwapInRequest.ProtoReflect.Descriptor instead.

func (*SwapInRequest) GetAmountSats

func (x *SwapInRequest) GetAmountSats() uint64

func (*SwapInRequest) GetChain

func (x *SwapInRequest) GetChain() Chain

func (*SwapInRequest) GetExpiry

func (x *SwapInRequest) GetExpiry() uint32

func (*SwapInRequest) GetInvoice

func (x *SwapInRequest) GetInvoice() string

func (*SwapInRequest) GetRefundTo

func (x *SwapInRequest) GetRefundTo() string

func (*SwapInRequest) ProtoMessage

func (*SwapInRequest) ProtoMessage()

func (*SwapInRequest) ProtoReflect

func (x *SwapInRequest) ProtoReflect() protoreflect.Message

func (*SwapInRequest) Reset

func (x *SwapInRequest) Reset()

func (*SwapInRequest) String

func (x *SwapInRequest) String() string

type SwapInResponse

type SwapInResponse struct {
	SwapId        string `protobuf:"bytes,1,opt,name=swap_id,json=swapId,proto3" json:"swap_id,omitempty"`                      // Unique identifier for the swap.
	AmountSats    uint64 `protobuf:"varint,2,opt,name=amount_sats,json=amountSats,proto3" json:"amount_sats,omitempty"`         // Amount in satoshis.
	ClaimAddress  string `protobuf:"bytes,3,opt,name=claim_address,json=claimAddress,proto3" json:"claim_address,omitempty"`    // Address to send the funds to.
	RefundAddress string `protobuf:"bytes,4,opt,name=refund_address,json=refundAddress,proto3" json:"refund_address,omitempty"` // Address where the funds will be refunded.
	// contains filtered or unexported fields
}

func (*SwapInResponse) Descriptor deprecated

func (*SwapInResponse) Descriptor() ([]byte, []int)

Deprecated: Use SwapInResponse.ProtoReflect.Descriptor instead.

func (*SwapInResponse) GetAmountSats

func (x *SwapInResponse) GetAmountSats() uint64

func (*SwapInResponse) GetClaimAddress

func (x *SwapInResponse) GetClaimAddress() string

func (*SwapInResponse) GetRefundAddress

func (x *SwapInResponse) GetRefundAddress() string

func (*SwapInResponse) GetSwapId

func (x *SwapInResponse) GetSwapId() string

func (*SwapInResponse) ProtoMessage

func (*SwapInResponse) ProtoMessage()

func (*SwapInResponse) ProtoReflect

func (x *SwapInResponse) ProtoReflect() protoreflect.Message

func (*SwapInResponse) Reset

func (x *SwapInResponse) Reset()

func (*SwapInResponse) String

func (x *SwapInResponse) String() string

type SwapOutRequest

type SwapOutRequest struct {
	Chain                Chain    `protobuf:"varint,1,opt,name=chain,proto3,enum=Chain" json:"chain,omitempty"`                  // Blockchain chain for the swap.
	AmountSats           uint64   `protobuf:"varint,2,opt,name=amount_sats,json=amountSats,proto3" json:"amount_sats,omitempty"` // Amount in satoshis.
	Address              string   `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`                          // Optional destination address.
	MaxRoutingFeePercent *float32 ``                                                                                             // Maximum routing fee in percentage for the lightning network.
	/* 133-byte string literal not displayed */
	// contains filtered or unexported fields
}

Message definitions for SwapOut operation.

func (*SwapOutRequest) Descriptor deprecated

func (*SwapOutRequest) Descriptor() ([]byte, []int)

Deprecated: Use SwapOutRequest.ProtoReflect.Descriptor instead.

func (*SwapOutRequest) GetAddress

func (x *SwapOutRequest) GetAddress() string

func (*SwapOutRequest) GetAmountSats

func (x *SwapOutRequest) GetAmountSats() uint64

func (*SwapOutRequest) GetChain

func (x *SwapOutRequest) GetChain() Chain

func (*SwapOutRequest) GetMaxRoutingFeePercent

func (x *SwapOutRequest) GetMaxRoutingFeePercent() float32

func (*SwapOutRequest) ProtoMessage

func (*SwapOutRequest) ProtoMessage()

func (*SwapOutRequest) ProtoReflect

func (x *SwapOutRequest) ProtoReflect() protoreflect.Message

func (*SwapOutRequest) Reset

func (x *SwapOutRequest) Reset()

func (*SwapOutRequest) String

func (x *SwapOutRequest) String() string

type SwapOutResponse

type SwapOutResponse struct {
	SwapId     string `protobuf:"bytes,1,opt,name=swap_id,json=swapId,proto3" json:"swap_id,omitempty"`              // Unique identifier for the swap.
	AmountSats uint64 `protobuf:"varint,2,opt,name=amount_sats,json=amountSats,proto3" json:"amount_sats,omitempty"` // Amount in satoshis.
	// contains filtered or unexported fields
}

func (*SwapOutResponse) Descriptor deprecated

func (*SwapOutResponse) Descriptor() ([]byte, []int)

Deprecated: Use SwapOutResponse.ProtoReflect.Descriptor instead.

func (*SwapOutResponse) GetAmountSats

func (x *SwapOutResponse) GetAmountSats() uint64

func (*SwapOutResponse) GetSwapId

func (x *SwapOutResponse) GetSwapId() string

func (*SwapOutResponse) ProtoMessage

func (*SwapOutResponse) ProtoMessage()

func (*SwapOutResponse) ProtoReflect

func (x *SwapOutResponse) ProtoReflect() protoreflect.Message

func (*SwapOutResponse) Reset

func (x *SwapOutResponse) Reset()

func (*SwapOutResponse) String

func (x *SwapOutResponse) String() string

type SwapServiceClient

type SwapServiceClient interface {
	// RPC methods for initiating and querying swaps.
	SwapIn(ctx context.Context, in *SwapInRequest, opts ...grpc.CallOption) (*SwapInResponse, error)
	SwapOut(ctx context.Context, in *SwapOutRequest, opts ...grpc.CallOption) (*SwapOutResponse, error)
	GetSwapIn(ctx context.Context, in *GetSwapInRequest, opts ...grpc.CallOption) (*GetSwapInResponse, error)
	GetSwapOut(ctx context.Context, in *GetSwapOutRequest, opts ...grpc.CallOption) (*GetSwapOutResponse, error)
	RecoverReusedSwapAddress(ctx context.Context, in *RecoverReusedSwapAddressRequest, opts ...grpc.CallOption) (*RecoverReusedSwapAddressResponse, error)
}

SwapServiceClient is the client API for SwapService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewRPCClient

func NewRPCClient(host string, port uint32) SwapServiceClient

type SwapServiceServer

type SwapServiceServer interface {
	// RPC methods for initiating and querying swaps.
	SwapIn(context.Context, *SwapInRequest) (*SwapInResponse, error)
	SwapOut(context.Context, *SwapOutRequest) (*SwapOutResponse, error)
	GetSwapIn(context.Context, *GetSwapInRequest) (*GetSwapInResponse, error)
	GetSwapOut(context.Context, *GetSwapOutRequest) (*GetSwapOutResponse, error)
	RecoverReusedSwapAddress(context.Context, *RecoverReusedSwapAddressRequest) (*RecoverReusedSwapAddressResponse, error)
	// contains filtered or unexported methods
}

SwapServiceServer is the server API for SwapService service. All implementations must embed UnimplementedSwapServiceServer for forward compatibility.

type UnimplementedSwapServiceServer

type UnimplementedSwapServiceServer struct{}

UnimplementedSwapServiceServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedSwapServiceServer) GetSwapIn

func (UnimplementedSwapServiceServer) GetSwapOut

func (UnimplementedSwapServiceServer) SwapIn

func (UnimplementedSwapServiceServer) SwapOut

type UnsafeSwapServiceServer

type UnsafeSwapServiceServer interface {
	// contains filtered or unexported methods
}

UnsafeSwapServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to SwapServiceServer will result in compilation errors.

Jump to

Keyboard shortcuts

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