Skip to content

Commit

Permalink
add func to utils to generate OS collection links
Browse files Browse the repository at this point in the history
  • Loading branch information
benleb committed Jul 28, 2023
1 parent 48dbbec commit b3a5e25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/ticker/manifold.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (s *ManifoldStats) ManifoldTicker(manifoldTicker *time.Ticker, queueOutput

manifoldLine.WriteString(" " + tokenInfo)

openseaURL := utils.GetOpenseaLink(collection.ContractAddress.String(), event.Transfers[0].Token.ID.Int64())
openseaURL := utils.GetOpenseaItemLink(collection.ContractAddress.String(), event.Transfers[0].Token.ID.Int64())

telegramMessage.WriteString(" · [" + collection.Name + "](" + openseaURL + ")")

Expand Down Expand Up @@ -238,7 +238,7 @@ func (s *ManifoldStats) OneMinuteTicker(manifoldTicker *time.Ticker) {
telegramMessage.WriteString(fmt.Sprintf("%6.3f", priceEtherPerItem))
telegramMessage.WriteString("Ξ")

openseaURL := utils.GetOpenseaLink(collection.ContractAddress.String(), event.Transfers[0].Token.ID.Int64())
openseaURL := utils.GetOpenseaItemLink(collection.ContractAddress.String(), event.Transfers[0].Token.ID.Int64())

telegramMessage.WriteString(" · [" + collection.Name + "](" + openseaURL + ")")
// telegramMessage.WriteString(" " + collection.Name)
Expand Down
8 changes: 6 additions & 2 deletions internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
// GetLinks returns the links to etherscan, opensea and blur.
func GetLinks(txHash common.Hash, contractAddress common.Address, tokenID int64) (string, string, string) {
etherscanURL := GetEtherscanTxURL(txHash.String())
openseaURL := GetOpenseaLink(contractAddress.String(), tokenID)
openseaURL := GetOpenseaItemLink(contractAddress.String(), tokenID)
blurURL := getBlurLink(contractAddress.String(), tokenID)

return etherscanURL, openseaURL, blurURL
Expand All @@ -39,10 +39,14 @@ func getBlurLink(contractAddress string, tokenID int64) string {
}

// opensea.io.
func GetOpenseaLink(contractAddress string, tokenID int64) string {
func GetOpenseaItemLink(contractAddress string, tokenID int64) string {
return fmt.Sprintf("https://opensea.io/assets/ethereum/%s/%d", contractAddress, tokenID)
}

func GetOpenseaCollectionLink(slug string) string {
return fmt.Sprintf("https://opensea.io/collection/%s", slug)
}

func WalletShortAddress(address common.Address) string {
addressBytes := address.Bytes()

Expand Down

0 comments on commit b3a5e25

Please sign in to comment.