Documentation
¶
Index ¶
- func Retry(ctx context.Context, interval time.Duration, ...) error
- type Api
- func (boltz *Api) AcceptChainSwapQuote(swapId string, quote QuoteResponse) error
- func (boltz *Api) CreateChainSwap(request CreateChainSwapRequest) (*CreateChainSwapResponse, error)
- func (boltz *Api) CreateReverseSwap(request CreateReverseSwapRequest) (*CreateReverseSwapResponse, error)
- func (boltz *Api) CreateSwap(request CreateSwapRequest) (*CreateSwapResponse, error)
- func (boltz *Api) FetchBolt12Invoice(request FetchBolt12InvoiceRequest) (*FetchBolt12InvoiceResponse, error)
- func (boltz *Api) GetChainSwapClaimDetails(swapId string) (*ChainSwapClaimDetailsResponse, error)
- func (boltz *Api) GetChainSwapQuote(swapId string) (*QuoteResponse, error)
- func (boltz *Api) GetChainSwapTransactions(swapId string) (*ChainSwapTransactionsResponse, error)
- func (boltz *Api) GetSwapHistory(pubkey string) ([]Swap, error)
- func (boltz *Api) NewWebsocket() *Websocket
- func (boltz *Api) RefundChainSwap(swapId string, request RefundSwapRequest) (*RefundSwapResponse, error)
- func (boltz *Api) RefundSubmarine(swapId string, request RefundSwapRequest) (*RefundSwapResponse, error)
- func (boltz *Api) RevealPreimage(swapId string, preimage string) (*RevealPreimageResponse, error)
- func (boltz *Api) SubmitChainSwapClaim(swapId string, request ChainSwapClaimRequest) (*PartialSignatureResponse, error)
- type ArkTimeouts
- type ChainSwapClaimDetailsResponse
- type ChainSwapClaimRequest
- type ChainSwapLockupDetails
- type ChainSwapTimeouts
- type ChainSwapTransaction
- type ChainSwapTransactionsResponse
- type CreateChainSwapRequest
- type CreateChainSwapResponse
- type CreateReverseSwapRequest
- type CreateReverseSwapResponse
- type CreateSwapRequest
- type CreateSwapResponse
- type CrossSignSignature
- type Currency
- type FetchBolt12InvoiceRequest
- type FetchBolt12InvoiceResponse
- type GetSwapLimitsResponse
- type HTTPError
- type Leaf
- type PartialSignatureResponse
- type QuoteResponse
- type RefundSwapRequest
- type RefundSwapResponse
- type RevealPreimageRequest
- type RevealPreimageResponse
- type Swap
- type SwapDetails
- type SwapLeg
- type SwapStatusResponse
- type SwapTree
- type SwapTreeLeaf
- type SwapUpdate
- type SwapUpdateEvent
- type TapLeaf
- type TimeoutBlockHeights
- type ToSign
- type TransactionRef
- type Tree
- type Websocket
- func (boltz *Websocket) Close() error
- func (boltz *Websocket) Connect() error
- func (boltz *Websocket) ConnectAndSubscribe(ctx context.Context, swapIds []string, retryInterval time.Duration) error
- func (boltz *Websocket) Reconnect() error
- func (boltz *Websocket) Subscribe(swapIds []string) error
- func (boltz *Websocket) Unsubscribe(swapId string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Api ¶
func (*Api) AcceptChainSwapQuote ¶
func (boltz *Api) AcceptChainSwapQuote(swapId string, quote QuoteResponse) error
func (*Api) CreateChainSwap ¶
func (boltz *Api) CreateChainSwap( request CreateChainSwapRequest, ) (*CreateChainSwapResponse, error)
func (*Api) CreateReverseSwap ¶
func (boltz *Api) CreateReverseSwap( request CreateReverseSwapRequest, ) (*CreateReverseSwapResponse, error)
func (*Api) CreateSwap ¶
func (boltz *Api) CreateSwap(request CreateSwapRequest) (*CreateSwapResponse, error)
func (*Api) FetchBolt12Invoice ¶
func (boltz *Api) FetchBolt12Invoice( request FetchBolt12InvoiceRequest, ) (*FetchBolt12InvoiceResponse, error)
func (*Api) GetChainSwapClaimDetails ¶
func (boltz *Api) GetChainSwapClaimDetails(swapId string) (*ChainSwapClaimDetailsResponse, error)
func (*Api) GetChainSwapQuote ¶
func (boltz *Api) GetChainSwapQuote(swapId string) (*QuoteResponse, error)
func (*Api) GetChainSwapTransactions ¶
func (boltz *Api) GetChainSwapTransactions(swapId string) (*ChainSwapTransactionsResponse, error)
func (*Api) NewWebsocket ¶
func (*Api) RefundChainSwap ¶
func (boltz *Api) RefundChainSwap( swapId string, request RefundSwapRequest, ) (*RefundSwapResponse, error)
func (*Api) RefundSubmarine ¶
func (boltz *Api) RefundSubmarine( swapId string, request RefundSwapRequest, ) (*RefundSwapResponse, error)
func (*Api) RevealPreimage ¶
func (boltz *Api) RevealPreimage(swapId string, preimage string) (*RevealPreimageResponse, error)
func (*Api) SubmitChainSwapClaim ¶
func (boltz *Api) SubmitChainSwapClaim( swapId string, request ChainSwapClaimRequest, ) (*PartialSignatureResponse, error)
type ArkTimeouts ¶
type ChainSwapClaimDetailsResponse ¶
type ChainSwapClaimDetailsResponse struct {
PubNonce string `json:"pubNonce"`
PublicKey string `json:"publicKey"`
TheirPublicKey string `json:"theirPublicKey"`
TransactionHash string `json:"transactionHash"`
SwapTree string `json:"swapTree"` // base64 serialized
Transaction TransactionRef `json:"transaction"`
}
type ChainSwapClaimRequest ¶
type ChainSwapClaimRequest struct {
Preimage string `json:"preimage"`
ToSign ToSign `json:"toSign"`
PubNonce string `json:"pubNonce"`
PartialSignature string `json:"partialSignature"`
Transaction string `json:"transaction"`
Index int `json:"index"`
Signature CrossSignSignature `json:"signature,omitempty"`
}
type ChainSwapLockupDetails ¶
type ChainSwapLockupDetails struct {
LockupAddress string `json:"lockupAddress"`
Amount uint64 `json:"amount"`
ClaimPublicKey string `json:"claimPublicKey,omitempty"`
RefundPublicKey string `json:"refundPublicKey,omitempty"`
TimeoutBlockHeight uint32 `json:"timeoutBlockHeight"`
SwapTree SwapTree `json:"swapTree"`
}
type ChainSwapTimeouts ¶
type ChainSwapTransaction ¶
type ChainSwapTransactionsResponse ¶
type ChainSwapTransactionsResponse struct {
UserLock *ChainSwapTransaction `json:"userLock,omitempty"`
ServerLock *ChainSwapTransaction `json:"serverLock,omitempty"`
}
type CreateChainSwapRequest ¶
type CreateChainSwapRequest struct {
From Currency `json:"from"`
To Currency `json:"to"`
PreimageHash string `json:"preimageHash"`
ClaimPublicKey string `json:"claimPublicKey"`
RefundPublicKey string `json:"refundPublicKey"`
UserLockAmount uint64 `json:"userLockAmount,omitempty"`
ServerLockAmount uint64 `json:"serverLockAmount,omitempty"`
PairHash string `json:"pairHash,omitempty"`
ReferralId string `json:"referralId,omitempty"`
}
type CreateChainSwapResponse ¶
type CreateChainSwapResponse struct {
Id string `json:"id"`
ClaimDetails SwapLeg `json:"claimDetails"`
LockupDetails SwapLeg `json:"lockupDetails"`
Error string `json:"error,omitempty"`
}
func (CreateChainSwapResponse) GetSwapTree ¶
func (c CreateChainSwapResponse) GetSwapTree(isArkToBtc bool) SwapTree
type CreateReverseSwapResponse ¶
type CreateReverseSwapResponse struct {
Id string `json:"id"`
LockupAddress string `json:"lockupAddress"`
RefundPublicKey string `json:"refundPublicKey"`
TimeoutBlockHeights TimeoutBlockHeights `json:"timeoutBlockHeights"`
Invoice string `json:"invoice"`
InvoiceAmount uint64 `json:"invoiceAmount,omitempty"`
OnchainAmount uint64 `json:"onchainAmount"`
Error string `json:"error"`
}
type CreateSwapRequest ¶
type CreateSwapResponse ¶
type CreateSwapResponse struct {
Id string `json:"id"`
Address string `json:"address"`
AcceptZeroConf bool `json:"acceptZeroConf"`
ExpectedAmount uint64 `json:"expectedAmount"`
ClaimPublicKey string `json:"claimPublicKey"`
TimeoutBlockHeights TimeoutBlockHeights `json:"timeoutBlockHeights"`
Error string `json:"error"`
}
type CrossSignSignature ¶
type GetSwapLimitsResponse ¶
type QuoteResponse ¶
type RefundSwapRequest ¶
type RefundSwapResponse ¶
type RevealPreimageRequest ¶
type RevealPreimageResponse ¶
type Swap ¶
type Swap struct {
Id string `json:"id"`
Type string `json:"type"`
Status string `json:"status"`
From Currency `json:"from"`
To Currency `json:"to"`
CreatedAt uint32 `json:"createdAt"`
PreimageHash string `json:"preimageHash"`
ClaimDetails *SwapDetails `json:"claimDetails,omitempty"`
RefundDetails *SwapDetails `json:"refundDetails,omitempty"`
}
type SwapDetails ¶
type SwapDetails struct {
Tree Tree `json:"tree"`
Amount uint64 `json:"amount"`
Transaction TransactionRef `json:"transaction,omitempty"`
LockupAddress string `json:"lockupAddress"`
TimeoutBlockHeight uint32 `json:"timeoutBlockHeight"`
}
type SwapLeg ¶
type SwapLeg struct {
ServerPublicKey string `json:"serverPublicKey"`
Amount int `json:"amount"`
LockupAddress string `json:"lockupAddress"`
TimeoutBlockHeight int `json:"timeoutBlockHeight"`
// BTC-specific (present on the BTC leg; may appear on either claimDetails or lockupDetails)
SwapTree *SwapTree `json:"swapTree,omitempty"`
// ARK-specific (present on the ARK leg; may appear on either claimDetails or lockupDetails)
Timeouts *ArkTimeouts `json:"timeouts,omitempty"`
}
SwapLeg describes ONE side (one chain) of the swap. Some fields exist only for BTC (swapTree, bip21) or only for ARK (timeouts).
type SwapStatusResponse ¶
type SwapTree ¶
type SwapTree struct {
ClaimLeaf SwapTreeLeaf `json:"claimLeaf"`
RefundLeaf SwapTreeLeaf `json:"refundLeaf"`
}
type SwapTreeLeaf ¶
type SwapUpdate ¶
type SwapUpdate struct {
SwapStatusResponse ` mapstructure:",squash"`
Id string ` json:"id"`
}
type SwapUpdateEvent ¶
type SwapUpdateEvent int
const ( SwapCreated SwapUpdateEvent = iota SwapExpired InvoiceSet InvoicePaid InvoicePending InvoiceSettled InvoiceFailedToPay ChannelCreated TransactionFailed TransactionMempool TransactionClaimed TransactionRefunded TransactionConfirmed TransactionLockupFailed TransactionClaimPending TransactionServerMempoool TransactionServerConfirmed TransactionDirect TransactionDirectMempool )
func ParseEvent ¶
func ParseEvent(event string) SwapUpdateEvent
type TimeoutBlockHeights ¶
type TransactionRef ¶
type Tree ¶
type Tree struct {
ClaimLeaf Leaf `json:"claimLeaf"`
RefundLeaf Leaf `json:"refundLeaf"`
RefundLeafWithoutReceiver Leaf `json:"refundWithoutBoltzLeaf"`
UnilateralClaimLeaf Leaf `json:"unilateralClaimLeaf"`
UnilateralRefundLeaf Leaf `json:"unilateralRefundLeaf"`
UnilateralRefundWithoutReceiver Leaf `json:"unilateralRefundWithoutBoltzLeaf"`
}
type Websocket ¶
type Websocket struct {
Updates chan SwapUpdate
// contains filtered or unexported fields
}
func (*Websocket) ConnectAndSubscribe ¶
func (*Websocket) Unsubscribe ¶
Click to show internal directories.
Click to hide internal directories.