Documentation
¶
Index ¶
Constants ¶
View Source
const ( Inactive = iota Initiated Audited AuditPending AuditFailed Redeemed AuditedSecret Refunded RefundFailed Cancelled Expired )
View Source
const ExpiryUnit = int64(2 * 60 * 60)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReceiptUpdate ¶
type ReceiptUpdate struct {
ID SwapID
Update func(receipt *SwapReceipt)
}
func NewReceiptUpdate ¶
func NewReceiptUpdate(id SwapID, update func(receipt *SwapReceipt)) ReceiptUpdate
type Swap ¶
type Swap struct {
ID SwapID
Token tokens.Token
Value *big.Int
BrokerFee *big.Int
SecretHash [32]byte
TimeLock int64
SpendingAddress string
WithdrawAddress string
FundingAddress string
BrokerAddress string
Speed blockchain.TxExecutionSpeed
}
A Swap stores all of the information required to execute an atomic swap.
type SwapBlob ¶
type SwapBlob struct {
ID SwapID `json:"id,omitempty"`
SendToken tokens.Name `json:"sendToken"`
ReceiveToken tokens.Name `json:"receiveToken"`
// SendAmount and ReceiveAmount are decimal strings.
SendAmount string `json:"sendAmount"`
ReceiveAmount string `json:"receiveAmount"`
Speed blockchain.TxExecutionSpeed `json:"speed"`
MinimumReceiveAmount string `json:"minimumReceiveAmount,omitempty"`
SendTo string `json:"sendTo"`
ReceiveFrom string `json:"receiveFrom"`
TimeLock int64 `json:"timeLock"`
SecretHash string `json:"secretHash"`
ShouldInitiateFirst bool `json:"shouldInitiateFirst"`
Delay bool `json:"delay,omitempty"`
DelayInfo json.RawMessage `json:"delayInfo,omitempty"`
DelayCallbackURL string `json:"delayCallbackUrl,omitempty"`
BrokerFee int64 `json:"brokerFee,omitempty"` // in BIPs or (1/10000)
BrokerSendTokenAddr string `json:"brokerSendTokenAddr,omitempty"`
BrokerReceiveTokenAddr string `json:"brokerReceiveTokenAddr,omitempty"`
WithdrawAddress string `json:"withdrawAddress,omitempty"`
ResponseURL string `json:"responseURL,omitempty"`
Password string `json:"password,omitempty"`
PasswordHash string `json:"passwordHash,omitempty"`
}
A SwapBlob is used to encode a Swap for storage and transmission.
type SwapID ¶
type SwapID string
TODO: Rename to ID A SwapID uniquely identifies a Swap that is being executed.
type SwapReceipt ¶
type SwapReceipt struct {
ID SwapID `json:"id"`
SendToken tokens.Name `json:"sendToken"`
ReceiveToken tokens.Name `json:"receiveToken"`
SendAmount string `json:"sendAmount"`
ReceiveAmount string `json:"receiveAmount"`
SendCost blockchain.CostBlob `json:"sendCost"`
ReceiveCost blockchain.CostBlob `json:"receiveCost"`
Timestamp int64 `json:"timestamp"`
TimeLock int64 `json:"timeLock"`
Status int `json:"status"`
Delay bool `json:"delay"`
DelayInfo json.RawMessage `json:"delayInfo,omitempty"`
Active bool `json:"active"`
PasswordHash string `json:"passwordHash,omitempty"`
}
The SwapReceipt contains the swap details and the status.
func NewSwapReceipt ¶
func NewSwapReceipt(blob SwapBlob) SwapReceipt
NewSwapReceipt returns a SwapReceipt from a swapBlob.
Click to show internal directories.
Click to hide internal directories.