Documentation
¶
Index ¶
Constants ¶
View Source
const ( Inactive = iota Initiated Audited AuditFailed Redeemed Refunded )
View Source
const ExpiryUnit = int64(2 * 60 * 60)
Variables ¶
View Source
var ( Bitcoin = "bitcoin" Ethereum = "ethereum" )
Functions ¶
func NewErrUnsupportedToken ¶
Types ¶
type ErrUnsupportedToken ¶
type ErrUnsupportedToken string
func (ErrUnsupportedToken) Error ¶
func (err ErrUnsupportedToken) Error() string
type Swap ¶
type Swap struct {
ID SwapID
Token Token
Value *big.Int
SecretHash [32]byte
TimeLock int64
SpendingAddress string
FundingAddress string
}
A Swap stores all of the information required to execute an atomic swap.
type SwapBlob ¶
type SwapBlob struct {
ID SwapID `json:"id"`
SendToken string `json:"sendToken"`
ReceiveToken string `json:"receiveToken"`
// SendAmount and ReceiveAmount are hex encoded.
SendAmount string `json:"sendAmount"`
ReceiveAmount string `json:"receiveAmount"`
SendTo string `json:"sendTo"`
ReceiveFrom string `json:"receiveFrom"`
TimeLock int64 `json:"timeLock"`
SecretHash string `json:"secretHash"`
ShouldInitiateFirst bool `json:"shouldInitiateFirst"`
}
A SwapBlob is used to encode a Swap for storage and transmission.
type SwapStatus ¶
The SwapStatus indicates which phase of execution a Swap is in.
func NewSwapStatus ¶
func NewSwapStatus(id SwapID, status int) SwapStatus
Click to show internal directories.
Click to hide internal directories.