mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-15 03:23:52 +00:00
types: attach explorer url to the deposit attachment
This commit is contained in:
parent
86ac4ee673
commit
20f43e4634
|
@ -139,20 +139,58 @@ func (d *Deposit) SlackAttachment() slack.Attachment {
|
||||||
|
|
||||||
return slack.Attachment{
|
return slack.Attachment{
|
||||||
Color: depositStatusSlackColor(d.Status),
|
Color: depositStatusSlackColor(d.Status),
|
||||||
|
Fallback: "",
|
||||||
|
ID: 0,
|
||||||
Title: fmt.Sprintf("Deposit %s %s To %s (%s)", d.Amount.String(), d.Asset, d.Address, d.Exchange),
|
Title: fmt.Sprintf("Deposit %s %s To %s (%s)", d.Amount.String(), d.Asset, d.Address, d.Exchange),
|
||||||
// TitleLink: "",
|
TitleLink: getExplorerURL(d.Network, d.TransactionID),
|
||||||
Pretext: "",
|
Pretext: "",
|
||||||
Text: "",
|
Text: "",
|
||||||
|
ImageURL: "",
|
||||||
|
ThumbURL: "",
|
||||||
|
ServiceName: "",
|
||||||
|
ServiceIcon: "",
|
||||||
|
FromURL: "",
|
||||||
|
OriginalURL: "",
|
||||||
// ServiceName: "",
|
// ServiceName: "",
|
||||||
// ServiceIcon: "",
|
// ServiceIcon: "",
|
||||||
// FromURL: "",
|
// FromURL: "",
|
||||||
// OriginalURL: "",
|
// OriginalURL: "",
|
||||||
Fields: fields,
|
Fields: fields,
|
||||||
|
Actions: nil,
|
||||||
|
MarkdownIn: nil,
|
||||||
|
Blocks: slack.Blocks{},
|
||||||
Footer: fmt.Sprintf("Apply Time: %s", d.Time.Time().Format(time.RFC3339)),
|
Footer: fmt.Sprintf("Apply Time: %s", d.Time.Time().Format(time.RFC3339)),
|
||||||
FooterIcon: ExchangeFooterIcon(d.Exchange),
|
FooterIcon: ExchangeFooterIcon(d.Exchange),
|
||||||
|
Ts: "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getExplorerURL(network string, txID string) string {
|
||||||
|
switch strings.ToUpper(network) {
|
||||||
|
case "BTC":
|
||||||
|
return getBitcoinNetworkExplorerURL(txID)
|
||||||
|
case "BSC":
|
||||||
|
return getBscNetworkExplorerURL(txID)
|
||||||
|
case "ETH":
|
||||||
|
return getEthNetworkExplorerURL(txID)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func getEthNetworkExplorerURL(txID string) string {
|
||||||
|
return "https://etherscan.io/tx/" + txID
|
||||||
|
}
|
||||||
|
|
||||||
|
func getBitcoinNetworkExplorerURL(txID string) string {
|
||||||
|
return "https://www.blockchain.com/explorer/transactions/btc/" + txID
|
||||||
|
}
|
||||||
|
|
||||||
|
func getBscNetworkExplorerURL(txID string) string {
|
||||||
|
return "https://bscscan.com/tx/" + txID
|
||||||
|
}
|
||||||
|
|
||||||
func depositStatusSlackColor(status DepositStatus) string {
|
func depositStatusSlackColor(status DepositStatus) string {
|
||||||
switch status {
|
switch status {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user