webapi

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCallbackImpl

func NewCallbackImpl() *callbackImpl

func PayStatusName

func PayStatusName(status int) string

Types

type ApiServer

type ApiServer struct {
	rpc.UnimplementedWebApiServer
	// contains filtered or unexported fields
}

func NewApiServer

func NewApiServer(
	webPort int,
	grpcPort int,
	allowedOrigins string,
	keystore string,
	password string,
	dataPath string,
	config string,
	useExtSigner bool) *ApiServer

func (*ApiServer) ConfirmOnChainResolvedPayments

func (s *ApiServer) ConfirmOnChainResolvedPayments(
	context context.Context, request *rpc.TokenInfo) (*empty.Empty, error)

func (*ApiServer) ConfirmOutgoingPayment

func (s *ApiServer) ConfirmOutgoingPayment(
	context context.Context, request *rpc.PaymentID) (*empty.Empty, error)

func (*ApiServer) ConfirmSettlePaymentChannel

func (s *ApiServer) ConfirmSettlePaymentChannel(
	context context.Context, request *rpc.TokenInfo) (*empty.Empty, error)

func (*ApiServer) ConfirmWithdraw

func (s *ApiServer) ConfirmWithdraw(
	context context.Context, in *rpc.TokenInfo) (*empty.Empty, error)

func (*ApiServer) CooperativeWithdraw

func (s *ApiServer) CooperativeWithdraw(
	context context.Context, request *rpc.DepositOrWithdrawRequest) (*rpc.DepositOrWithdrawJob, error)

func (*ApiServer) CooperativeWithdrawNonBlocking added in v1.1.0

func (s *ApiServer) CooperativeWithdrawNonBlocking(
	context context.Context,
	request *rpc.DepositOrWithdrawRequest) (*rpc.DepositOrWithdrawJob, error)

func (*ApiServer) CreateAppSessionOnVirtualContract

func (s *ApiServer) CreateAppSessionOnVirtualContract(
	context context.Context,
	request *rpc.CreateAppSessionOnVirtualContractRequest) (
	*rpc.SessionID, error)

func (*ApiServer) DeleteAppSession

func (s *ApiServer) DeleteAppSession(
	context context.Context, request *rpc.SessionID) (*empty.Empty, error)

func (*ApiServer) Deposit

func (*ApiServer) DepositNonBlocking added in v1.1.0

func (s *ApiServer) DepositNonBlocking(
	context context.Context, request *rpc.DepositOrWithdrawRequest) (*rpc.DepositOrWithdrawJob, error)

func (*ApiServer) GetBalance

func (s *ApiServer) GetBalance(
	context context.Context, request *rpc.TokenInfo) (*rpc.GetBalanceResponse, error)

func (*ApiServer) GetBlockNumber

func (s *ApiServer) GetBlockNumber(
	context context.Context, request *empty.Empty) (*rpc.BlockNumber, error)

func (*ApiServer) GetBooleanOutcomeForAppSession

func (s *ApiServer) GetBooleanOutcomeForAppSession(
	context context.Context,
	request *rpc.GetBooleanOutcomeForAppSessionRequest) (*rpc.BooleanOutcome, error)

func (*ApiServer) GetDeployedAddressForAppSession

func (s *ApiServer) GetDeployedAddressForAppSession(
	context context.Context, request *rpc.SessionID) (*rpc.Address, error)

func (*ApiServer) GetIncomingPaymentInfo added in v1.1.0

func (s *ApiServer) GetIncomingPaymentInfo(
	context context.Context, request *rpc.PaymentID) (*rpc.PaymentInfo, error)

func (*ApiServer) GetIncomingPaymentStatus

func (s *ApiServer) GetIncomingPaymentStatus(
	context context.Context, request *rpc.PaymentID) (*rpc.PaymentStatus, error)

func (*ApiServer) GetOnChainPaymentInfo

func (s *ApiServer) GetOnChainPaymentInfo(
	context context.Context, request *rpc.PaymentID) (*rpc.OnChainPaymentInfo, error)

func (*ApiServer) GetOutgoingPaymentStatus

func (s *ApiServer) GetOutgoingPaymentStatus(
	context context.Context, request *rpc.PaymentID) (*rpc.PaymentStatus, error)

func (*ApiServer) GetPayHistory

func (s *ApiServer) GetPayHistory(
	context context.Context, request *rpc.GetPayHistoryRequest) (*rpc.GetPayHistoryResponse, error)

GetPayHistory returns paginated pay history. This method is **NOT IDEMPOTENT**.

func (*ApiServer) GetPeerFreeBalance

func (s *ApiServer) GetPeerFreeBalance(
	context context.Context, request *rpc.GetPeerFreeBalanceRequest) (*rpc.FreeBalance, error)

func (*ApiServer) GetSettleFinalizedTimeForPaymentChannel

func (s *ApiServer) GetSettleFinalizedTimeForPaymentChannel(
	context context.Context, request *rpc.TokenInfo) (*rpc.Timestamp, error)

func (*ApiServer) IntendSettlePaymentChannel

func (s *ApiServer) IntendSettlePaymentChannel(
	context context.Context, request *rpc.TokenInfo) (*empty.Empty, error)

func (*ApiServer) IntendWithdraw

func (s *ApiServer) IntendWithdraw(
	context context.Context, in *rpc.DepositOrWithdrawRequest) (*empty.Empty, error)

func (*ApiServer) MonitorCooperativeWithdrawJob

func (s *ApiServer) MonitorCooperativeWithdrawJob(
	context context.Context, request *rpc.DepositOrWithdrawJob) (*rpc.DepositOrWithdrawJob, error)

func (*ApiServer) MonitorDepositJob

func (s *ApiServer) MonitorDepositJob(
	context context.Context, request *rpc.DepositOrWithdrawJob) (*rpc.DepositOrWithdrawJob, error)

func (*ApiServer) OpenPaymentChannel

func (s *ApiServer) OpenPaymentChannel(
	context context.Context, request *rpc.OpenPaymentChannelRequest) (*rpc.ChannelID, error)

func (*ApiServer) RejectIncomingPayment

func (s *ApiServer) RejectIncomingPayment(
	context context.Context, request *rpc.PaymentID) (*empty.Empty, error)

func (*ApiServer) ResolveIncomingPaymentOnChain

func (s *ApiServer) ResolveIncomingPaymentOnChain(
	context context.Context, request *rpc.PaymentID) (*empty.Empty, error)

func (*ApiServer) SendConditionalPayment

func (s *ApiServer) SendConditionalPayment(
	context context.Context,
	request *rpc.SendConditionalPaymentRequest) (*rpc.PaymentID, error)

func (*ApiServer) SendToken added in v1.1.0

func (s *ApiServer) SendToken(
	context context.Context,
	request *rpc.SendTokenRequest) (*rpc.PaymentID, error)

func (*ApiServer) SetDelegation

func (s *ApiServer) SetDelegation(context context.Context, request *rpc.SetDelegationRequest) (*empty.Empty, error)

func (*ApiServer) SetMsgDropper

func (s *ApiServer) SetMsgDropper(context context.Context, req *rpc.SetMsgDropReq) (*empty.Empty, error)

func (*ApiServer) SettleExpiredPayments

func (s *ApiServer) SettleExpiredPayments(
	context context.Context, request *rpc.TokenInfo) (*empty.Empty, error)

func (*ApiServer) SettleOnChainResolvedIncomingPayment

func (s *ApiServer) SettleOnChainResolvedIncomingPayment(
	context context.Context, request *rpc.PaymentID) (*empty.Empty, error)

func (*ApiServer) SignData

func (s *ApiServer) SignData(context context.Context, request *rpc.Data) (*rpc.Signature, error)

func (*ApiServer) Start

func (s *ApiServer) Start()

func (*ApiServer) SubscribeIncomingPayments

func (s *ApiServer) SubscribeIncomingPayments(
	empty *empty.Empty, stream rpc.WebApi_SubscribeIncomingPaymentsServer) error

func (*ApiServer) SubscribeOutgoingPayments

func (s *ApiServer) SubscribeOutgoingPayments(
	empty *empty.Empty, stream rpc.WebApi_SubscribeOutgoingPaymentsServer) error

func (*ApiServer) SyncOnChainPaymentChannelStatus

func (s *ApiServer) SyncOnChainPaymentChannelStatus(
	context context.Context, request *rpc.TokenInfo) (*empty.Empty, error)

func (*ApiServer) SyncStateWithPeer

func (s *ApiServer) SyncStateWithPeer(
	context context.Context, request *empty.Empty) (*empty.Empty, error)

type InternalApiServer

type InternalApiServer struct {
	*ApiServer
}

func NewInternalApiServer

func NewInternalApiServer(
	webPort int,
	grpcPort int,
	allowedOrigins string,
	keystore string,
	password string,
	dataPath string,
	config string,
	extSigner bool) *InternalApiServer

func (*InternalApiServer) CooperativeWithdrawNonBlocking

func (s *InternalApiServer) CooperativeWithdrawNonBlocking(
	context context.Context,
	request *rpc.DepositOrWithdrawRequest) (*rpc.DepositOrWithdrawJob, error)

func (*InternalApiServer) DepositNonBlocking

func (s *InternalApiServer) DepositNonBlocking(
	context context.Context, request *rpc.DepositOrWithdrawRequest) (*rpc.DepositOrWithdrawJob, error)

func (*InternalApiServer) InstantiateTrustedPaymentChannel

func (s *InternalApiServer) InstantiateTrustedPaymentChannel(
	context context.Context, request *rpc.TokenInfo) (*rpc.ChannelID, error)

func (*InternalApiServer) OpenTrustedPaymentChannel

func (s *InternalApiServer) OpenTrustedPaymentChannel(
	context context.Context, request *rpc.OpenPaymentChannelRequest) (*rpc.ChannelID, error)

func (*InternalApiServer) Start

func (s *InternalApiServer) Start()

type OspPayApiServer added in v1.1.1

type OspPayApiServer struct {
	rpc.UnimplementedWebApiServer
	// contains filtered or unexported fields
}

func NewOspPayApiServer added in v1.1.1

func NewOspPayApiServer(backend OspPayBackend, eventFeed *PaymentEventFeed) *OspPayApiServer

func (*OspPayApiServer) ConfirmOutgoingPayment added in v1.1.1

func (s *OspPayApiServer) ConfirmOutgoingPayment(
	context context.Context,
	request *rpc.PaymentID) (*emptypb.Empty, error)

func (*OspPayApiServer) CreateAppSessionOnVirtualContract added in v1.1.1

func (s *OspPayApiServer) CreateAppSessionOnVirtualContract(
	context context.Context,
	request *rpc.CreateAppSessionOnVirtualContractRequest) (*rpc.SessionID, error)

func (*OspPayApiServer) DeleteAppSession added in v1.1.1

func (s *OspPayApiServer) DeleteAppSession(
	context context.Context,
	request *rpc.SessionID) (*emptypb.Empty, error)

func (*OspPayApiServer) GetBalance added in v1.1.1

func (*OspPayApiServer) GetIncomingPaymentInfo added in v1.1.1

func (s *OspPayApiServer) GetIncomingPaymentInfo(
	context context.Context,
	request *rpc.PaymentID) (*rpc.PaymentInfo, error)

func (*OspPayApiServer) GetIncomingPaymentStatus added in v1.1.1

func (s *OspPayApiServer) GetIncomingPaymentStatus(
	context context.Context,
	request *rpc.PaymentID) (*rpc.PaymentStatus, error)

func (*OspPayApiServer) GetOutgoingPaymentStatus added in v1.1.1

func (s *OspPayApiServer) GetOutgoingPaymentStatus(
	context context.Context,
	request *rpc.PaymentID) (*rpc.PaymentStatus, error)

func (*OspPayApiServer) GetPeerFreeBalance added in v1.1.1

func (*OspPayApiServer) RejectIncomingPayment added in v1.1.1

func (s *OspPayApiServer) RejectIncomingPayment(
	context context.Context,
	request *rpc.PaymentID) (*emptypb.Empty, error)

func (*OspPayApiServer) SendConditionalPayment added in v1.1.1

func (s *OspPayApiServer) SendConditionalPayment(
	context context.Context,
	request *rpc.SendConditionalPaymentRequest) (*rpc.PaymentID, error)

func (*OspPayApiServer) SendToken added in v1.1.1

func (s *OspPayApiServer) SendToken(
	context context.Context,
	request *rpc.SendTokenRequest) (*rpc.PaymentID, error)

func (*OspPayApiServer) SubscribeIncomingPayments added in v1.1.1

func (s *OspPayApiServer) SubscribeIncomingPayments(
	_ *emptypb.Empty,
	stream rpc.WebApi_SubscribeIncomingPaymentsServer) error

func (*OspPayApiServer) SubscribeOutgoingPayments added in v1.1.1

func (s *OspPayApiServer) SubscribeOutgoingPayments(
	_ *emptypb.Empty,
	stream rpc.WebApi_SubscribeOutgoingPaymentsServer) error

type OspPayBackend added in v1.1.1

type OspPayBackend interface {
	SendToken(*rpc.SendTokenRequest) (ctype.PayIDType, error)
	SendConditionalPayment(*rpc.SendConditionalPaymentRequest) (ctype.PayIDType, error)
	CreateAppSessionOnVirtualContract(*rpc.CreateAppSessionOnVirtualContractRequest) (string, error)
	DeleteAppSession(string) error
	GetIncomingPaymentState(ctype.PayIDType) (int, error)
	GetIncomingPaymentRecord(ctype.PayIDType) (*PaymentRecord, error)
	GetOutgoingPaymentState(ctype.PayIDType) (int, error)
	ConfirmOutgoingPayment(ctype.PayIDType) error
	RejectIncomingPayment(ctype.PayIDType) error
}

type PaymentEventFeed added in v1.1.1

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

PaymentEventFeed keeps at most one active subscriber per direction. Publish is best-effort and non-blocking, so slow subscribers may drop events.

func NewPaymentEventFeed added in v1.1.1

func NewPaymentEventFeed() *PaymentEventFeed

func (*PaymentEventFeed) HandleDestinationUnreachable added in v1.1.1

func (f *PaymentEventFeed) HandleDestinationUnreachable(payID ctype.PayIDType, pay *entity.ConditionalPay, note *anypb.Any)

func (*PaymentEventFeed) HandleReceivingDone added in v1.1.1

func (f *PaymentEventFeed) HandleReceivingDone(
	payID ctype.PayIDType,
	pay *entity.ConditionalPay,
	note *anypb.Any,
	reason rpc.PaymentSettleReason)

func (*PaymentEventFeed) HandleReceivingStart added in v1.1.1

func (f *PaymentEventFeed) HandleReceivingStart(payID ctype.PayIDType, pay *entity.ConditionalPay, note *anypb.Any)

func (*PaymentEventFeed) HandleSendComplete added in v1.1.1

func (f *PaymentEventFeed) HandleSendComplete(
	payID ctype.PayIDType,
	pay *entity.ConditionalPay,
	note *anypb.Any,
	reason rpc.PaymentSettleReason)

func (*PaymentEventFeed) HandleSendFail added in v1.1.1

func (f *PaymentEventFeed) HandleSendFail(payID ctype.PayIDType, pay *entity.ConditionalPay, note *anypb.Any, errMsg string)

func (*PaymentEventFeed) SubscribeIncoming added in v1.1.1

func (f *PaymentEventFeed) SubscribeIncoming() (<-chan *celersdkintf.Payment, func(), error)

func (*PaymentEventFeed) SubscribeOutgoing added in v1.1.1

func (f *PaymentEventFeed) SubscribeOutgoing() (<-chan *outgoingPaymentEvent, func(), error)

type PaymentRecord added in v1.1.1

type PaymentRecord struct {
	PayID    ctype.PayIDType
	Pay      *entity.ConditionalPay
	Note     *anypb.Any
	PayState int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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