-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add labels package to handle labeling on-chain transactions. * Opening label * claim by CSV label * claim by cooperative close label
- Loading branch information
1 parent
eea02b3
commit 22c7144
Showing
3 changed files
with
66 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package labels | ||
|
||
import "fmt" | ||
|
||
const ( | ||
// peerswapLabelPattern is the pattern that peerswap uses to label on-chain transactions. | ||
peerswapLabelPattern = "peerswap -- %s(swap id=%s)" | ||
// opening is the label used for the opening transaction. | ||
opening = "Opening" | ||
// claimByInvoice is the label used for the claim by invoice transaction. | ||
claimByInvoice = "ClaimByInvoice" | ||
// claimByCoop is the label used for the claim by cooperative close transaction. | ||
claimByCoop = "ClaimByCoop" | ||
// ClaimByCsv is the label used for the claim by CSV transaction. | ||
claimByCsv = "ClaimByCsv" | ||
) | ||
|
||
// Opening returns the label used for the opening transaction. | ||
func Opening(swapID string) string { | ||
return fmt.Sprintf(peerswapLabelPattern, opening, swapID) | ||
} | ||
|
||
// ClaimByInvoice returns the label used for the claim by invoice transaction. | ||
func ClaimByInvoice(swapID string) string { | ||
return fmt.Sprintf(peerswapLabelPattern, claimByInvoice, swapID) | ||
} | ||
|
||
// ClaimByCoop returns the label used for the claim by cooperative close transaction. | ||
func ClaimByCoop(swapID string) string { | ||
return fmt.Sprintf(peerswapLabelPattern, claimByCoop, swapID) | ||
} | ||
|
||
// ClaimByCsv returns the label used for the claim by CSV transaction. | ||
func ClaimByCsv(swapID string) string { | ||
return fmt.Sprintf(peerswapLabelPattern, claimByCsv, swapID) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters