diff --git a/bindings/group.go b/bindings/group.go index e0da4aff7b437dac7de98d07957a0da14b6888d9..aee0b0f7cc400bf55ed41673fc7c30773ea791fd 100644 --- a/bindings/group.go +++ b/bindings/group.go @@ -263,6 +263,11 @@ func (gsr *GroupSendReport) GetMessageID() []byte { return gsr.messageID[:] } +// GetRoundURL returns the URL of the round that the send occurred on. +func (gsr *GroupSendReport) GetRoundURL() string { + return getRoundURL(gsr.roundID) +} + //// // Group Structure //// @@ -413,6 +418,11 @@ func (gmr *GroupMessageReceive) GetRoundID() int64 { return int64(gmr.RoundID) } +// GetRoundURL returns the ID of the round the message was sent on. +func (gmr *GroupMessageReceive) GetRoundURL() string { + return getRoundURL(gmr.RoundID) +} + // GetRoundTimestampNano returns the timestamp, in nanoseconds, of the round the // message was sent on. func (gmr *GroupMessageReceive) GetRoundTimestampNano() int64 { diff --git a/bindings/message.go b/bindings/message.go index 680d9caf778d8d8ceb700b0a3d3ad2b8b6b20d4b..3eee3b343627338fb907ba81b93fe2e73f8f4731 100644 --- a/bindings/message.go +++ b/bindings/message.go @@ -65,3 +65,8 @@ func (m *Message) GetRoundTimestampNano() int64 { func (m *Message) GetRoundId() int64 { return int64(m.r.RoundId) } + +// GetRoundURL returns the message's round URL +func (m *Message) GetRoundURL() string { + return getRoundURL(m.r.RoundId) +} diff --git a/bindings/send.go b/bindings/send.go index be9366974b339fdd06539394cda02e34d94b785b..3b85a34b0f05fe6f119a7d45ffe4f195604fb8e3 100644 --- a/bindings/send.go +++ b/bindings/send.go @@ -199,6 +199,13 @@ func (sr *SendReport) GetMessageID() []byte { return sr.mid[:] } +func (sr *SendReport) GetRoundURL() string { + if sr.rl != nil && sr.rl.Len() > 0 { + return getRoundURL(sr.rl.list[0]) + } + return dashboardBaseURL +} + // GetTimestampMS returns the message's timestamp in milliseconds func (sr *SendReport) GetTimestampMS() int64 { ts := sr.ts.UnixNano() diff --git a/bindings/url.go b/bindings/url.go new file mode 100644 index 0000000000000000000000000000000000000000..9c7092cf5de6ea1d1ebd0b2fc896add6b4c921dc --- /dev/null +++ b/bindings/url.go @@ -0,0 +1,20 @@ +/////////////////////////////////////////////////////////////////////////////// +// Copyright © 2020 xx network SEZC // +// // +// Use of this source code is governed by a license that can be found in the // +// LICENSE file // +/////////////////////////////////////////////////////////////////////////////// + +package bindings + + +import ( + "gitlab.com/xx_network/primitives/id" + "fmt" +) + +const dashboardBaseURL = "https://dashboard.xx.network" + +func getRoundURL(round id.Round) string { + return fmt.Sprintf("%s/rounds/%d", dashboardBaseURL, round) +}