Skip to content

Commit

Permalink
feat: add referralId
Browse files Browse the repository at this point in the history
closing issue #70
  • Loading branch information
jackstar12 committed Jan 31, 2024
1 parent 4e304fc commit 562a0e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions boltz/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ type CreateSwapRequest struct {
RefundPublicKey string `json:"refundPublicKey"`
Invoice string `json:"invoice"`
PreimageHash string `json:"preimageHash"`
ReferralId string `json:"referralId"`
}

type CreateSwapResponse struct {
Expand Down Expand Up @@ -174,6 +175,7 @@ type CreateReverseSwapRequest struct {
InvoiceAmount uint64 `json:"invoiceAmount"`
PreimageHash string `json:"preimageHash"`
ClaimPublicKey string `json:"claimPublicKey"`
ReferralId string `json:"referralId"`
}

type CreateReverseSwapResponse struct {
Expand Down
4 changes: 4 additions & 0 deletions rpcserver/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import (
"github.com/lightningnetwork/lnd/zpay32"
)

const referralId = "boltz-client"

type routedBoltzServer struct {
boltzrpc.BoltzServer

Expand Down Expand Up @@ -269,6 +271,7 @@ func (server *routedBoltzServer) createSwap(isAuto bool, request *boltzrpc.Creat
PairId: string(pair),
OrderSide: "sell",
RefundPublicKey: hex.EncodeToString(publicKey.SerializeCompressed()),
ReferralId: referralId,
}

var preimage, preimageHash []byte
Expand Down Expand Up @@ -461,6 +464,7 @@ func (server *routedBoltzServer) createReverseSwap(isAuto bool, request *boltzrp
InvoiceAmount: uint64(request.Amount),
PreimageHash: hex.EncodeToString(preimageHash),
ClaimPublicKey: hex.EncodeToString(publicKey.SerializeCompressed()),
ReferralId: referralId,
})

if err != nil {
Expand Down

0 comments on commit 562a0e0

Please sign in to comment.