Compare commits

...

6 Commits

Author SHA1 Message Date
Mariano 7c85ebf016 readapt to multiple sourceChains and targetChains 2024-04-26 17:13:38 -03:00
Mariano 4051ad491f adjust x-chain-activity/tops to also support multiple sourceChains and targetChains 2024-04-26 16:43:20 -03:00
Mariano 92b432a906 support multiple appIds 2024-04-26 15:19:37 -03:00
Mariano b4d7e3284e refactor to accept multiple sourceChains,targetChains and appIds 2024-04-26 15:19:34 -03:00
Mariano ce1b7707fb
[WORMSCAN-API-1225] Add new endpoint for fetching x-chain-activity tops data (#1342)
* add 2 new tasks for collecting chain activity every day and hour

* making progress

* change query 2

* add query by month and year

* changes on task

* more changes

* change to 1d

* add 1d

* fix query

* adjust queryies

* change the way the query is executed

* changes on query

* making more progress

* fix per year query

* add a second group of tasks for downsampling

* add app_id

* update swagger docs

* optimize new tasks

* fix W

* fix W

* start using the new measurement

* change endpoint signature

* update endpoint name

* fix indents

* code review changes

* remove unnecessary break
2024-04-26 15:03:02 -03:00
ftocal 9d280f7d5f
Add W token for ethereum, arbitrum, optimism and base (#1358)
Co-authored-by: walker-16 <agpazos85@gmail.com>
2024-04-25 17:06:14 -03:00
21 changed files with 1102 additions and 110 deletions

View File

@ -17,7 +17,7 @@ require (
github.com/shopspring/decimal v1.3.1
github.com/spf13/cobra v1.7.0
github.com/wormhole-foundation/wormhole-explorer/common v0.0.0-00010101000000-000000000000
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240416174455-25e60611a867
go.mongodb.org/mongo-driver v1.11.2
go.uber.org/zap v1.26.0
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22

View File

@ -370,8 +370,8 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240416174455-25e60611a867 h1:GXUBP09C/bnEukdU6H2AY81d0m8UWrWEejDp6CgiFQA=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240416174455-25e60611a867/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1 h1:VOMT+81stJgXW3CpHyqHN3AXDYIMsx56mEFrB37Mb/E=

View File

@ -0,0 +1,40 @@
import "date"
runTask = (start,stop,srcBucket,destBucket,destMeasurement) => {
data = from(bucket: srcBucket)
|> range(start: start,stop: stop)
|> filter(fn: (r) => r._measurement == "vaa_volume_v2" and r.version == "v2")
|> filter(fn: (r) => r._field == "volume" and r._value > 0)
|> drop(columns:["destination_chain","app_id","token_chain","token_address","version","_measurement","_time"])
|> rename(columns: {_start: "_time"})
|> group(columns: ["emitter_chain","_time"])
vols = data
|> sum(column: "_value")
|> set(key: "_field", value: "volume")
|> set(key: "to", value: string(v:stop))
|> set(key: "_measurement", value: destMeasurement)
|> to(bucket: destBucket)
return data
|> count(column: "_value")
|> set(key: "_field", value: "count")
|> set(key: "to", value: string(v:stop))
|> set(key: "_measurement", value: destMeasurement)
|> to(bucket: destBucket)
}
bucketInfinite = "wormscan"
destMeasurement = "emitter_chain_activity_1d"
stop = date.truncate(t: now(),unit: 1d)
start = date.sub(d: 1d, from: stop)
option task = {
name: "calculate chain activity per emitter every day",
every: 1d,
}
runTask(start:start, stop: stop, srcBucket: bucketInfinite, destBucket: bucketInfinite, destMeasurement: destMeasurement)

View File

@ -0,0 +1,40 @@
import "date"
runTask = (start,stop,srcBucket,destBucket,destMeasurement) => {
data = from(bucket: srcBucket)
|> range(start: start,stop: stop)
|> filter(fn: (r) => r._measurement == "vaa_volume_v2" and r.version == "v2")
|> filter(fn: (r) => r._field == "volume" and r._value > 0)
|> drop(columns:["destination_chain","app_id","token_chain","token_address","version","_measurement","_time"])
|> rename(columns: {_start: "_time"})
|> group(columns: ["emitter_chain","_time"])
vols = data
|> sum(column: "_value")
|> set(key: "_field", value: "volume")
|> set(key: "to", value: string(v:stop))
|> set(key: "_measurement", value: destMeasurement)
|> to(bucket: destBucket)
return data
|> count(column: "_value")
|> set(key: "_field", value: "count")
|> set(key: "to", value: string(v:stop))
|> set(key: "_measurement", value: destMeasurement)
|> to(bucket: destBucket)
}
bucketInfinite = "wormscan"
destMeasurement = "emitter_chain_activity_1h"
stop = date.truncate(t: now(),unit: 1h)
start = date.sub(d: 1h, from: stop)
option task = {
name: "calculate chain activity per emitter every hour",
every: 1h,
}
runTask(start:start, stop: stop, srcBucket: bucketInfinite, destBucket: bucketInfinite, destMeasurement: destMeasurement)

View File

@ -0,0 +1,37 @@
import "date"
runTask = (start,stop,srcBucket,destBucket,destMeasurement) => {
data = from(bucket: srcBucket)
|> range(start: start,stop: stop)
|> filter(fn: (r) => r._measurement == "vaa_volume_v2" and r._field == "volume")
|> group(columns: ["emitter_chain", "destination_chain", "app_id"])
data
|> sum(column: "_value")
|> set(key: "_field", value: "volume")
|> map(fn: (r) => ({ r with _time: start }))
|> set(key: "to", value: string(v:date.add(d: 1d, to: start)))
|> set(key: "_measurement", value: destMeasurement)
|> to(bucket: destBucket)
return data
|> count(column: "_value")
|> set(key: "_field", value: "count")
|> map(fn: (r) => ({ r with _time: start }))
|> set(key: "to", value: string(v:date.add(d: 1d, to: start)))
|> set(key: "_measurement", value: destMeasurement)
|> to(bucket: destBucket)
}
bucketInfinite = "wormscan"
destMeasurement = "chain_activity_1d"
stop = date.truncate(t: now(),unit: 24h)
start = date.sub(d: 1d, from: stop)
option task = {
name: "calculate chain activity every day",
every: 1d,
}
runTask(start:start, stop: stop, srcBucket: bucketInfinite, destBucket: bucketInfinite, destMeasurement: destMeasurement)

View File

@ -0,0 +1,40 @@
import "date"
runTask = (start,stop,srcBucket,destBucket,destMeasurement) => {
data = from(bucket: srcBucket)
|> range(start: start,stop: stop)
|> filter(fn: (r) => r._measurement == "vaa_volume_v2" and r._field == "volume")
|> group(columns: ["emitter_chain", "destination_chain", "app_id"])
data
|> sum(column: "_value")
|> set(key: "_field", value: "volume")
|> map(fn: (r) => ({ r with _time: start }))
|> set(key: "to", value: string(v:date.add(d: 1h, to: start)))
|> set(key: "_measurement", value: destMeasurement)
|> to(bucket: destBucket)
return data
|> count(column: "_value")
|> set(key: "_field", value: "count")
|> map(fn: (r) => ({ r with _time: start }))
|> set(key: "to", value: string(v:date.add(d: 1h, to: start)))
|> set(key: "_measurement", value: destMeasurement)
|> to(bucket: destBucket)
}
bucketInfinite = "wormscan"
destMeasurement = "chain_activity_1h"
stop = date.truncate(t: now(),unit: 1h)
start = date.sub(d: 1h, from: stop)
option task = {
name: "calculate chain activity every hour",
every: 1h,
}
runTask(start:start, stop: stop, srcBucket: bucketInfinite, destBucket: bucketInfinite, destMeasurement: destMeasurement)

View File

@ -1760,6 +1760,73 @@ const docTemplate = `{
}
}
},
"/api/v1/x-chain-activity/tops": {
"get": {
"description": "Search, for a specific period of time, the number of transactions and the volume.",
"tags": [
"wormholescan"
],
"operationId": "x-chain-activity-tops",
"parameters": [
{
"type": "string",
"description": "Time span, supported values: 1d, 1mo and 1y",
"name": "timespan",
"in": "query",
"required": true
},
{
"type": "string",
"description": "From date, supported format 2006-01-02T15:04:05Z07:00",
"name": "from",
"in": "query",
"required": true
},
{
"type": "string",
"description": "To date, supported format 2006-01-02T15:04:05Z07:00",
"name": "to",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Search by appId",
"name": "appId",
"in": "query"
},
{
"type": "string",
"description": "Search by sourceChain",
"name": "sourceChain",
"in": "query"
},
{
"type": "string",
"description": "Search by targetChain",
"name": "targetChain",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/transactions.ChainActivityTopResult"
}
}
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/swagger.json": {
"get": {
"description": "Returns the swagger specification for this API.",
@ -2674,17 +2741,17 @@ const docTemplate = `{
"type": "string"
},
"sourceChain": {
"$ref": "#/definitions/operations.SourceChain"
"$ref": "#/definitions/operations.SourceChains"
},
"targetChain": {
"$ref": "#/definitions/operations.TargetChain"
"$ref": "#/definitions/operations.TargetChains"
},
"vaa": {
"$ref": "#/definitions/operations.Vaa"
}
}
},
"operations.SourceChain": {
"operations.SourceChains": {
"type": "object",
"properties": {
"attribute": {
@ -2748,7 +2815,7 @@ const docTemplate = `{
}
}
},
"operations.TargetChain": {
"operations.TargetChains": {
"type": "object",
"properties": {
"chainId": {
@ -3325,6 +3392,29 @@ const docTemplate = `{
}
}
},
"transactions.ChainActivityTopResult": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"destination_chain": {
"type": "string"
},
"emitter_chain": {
"type": "string"
},
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"volume": {
"type": "integer"
}
}
},
"transactions.ChainPair": {
"type": "object",
"properties": {
@ -3591,7 +3681,6 @@ const docTemplate = `{
14,
15,
16,
17,
18,
19,
20,
@ -3599,24 +3688,35 @@ const docTemplate = `{
22,
23,
24,
25,
26,
28,
29,
30,
32,
33,
34,
35,
36,
37,
38,
39,
3104,
4000,
4001,
4002,
4003,
4004,
4005,
4006,
4007,
4008,
10002,
10003,
10004,
10005,
10006
10006,
10007
],
"x-enum-varnames": [
"ChainIDUnset",
@ -3636,7 +3736,6 @@ const docTemplate = `{
"ChainIDCelo",
"ChainIDNear",
"ChainIDMoonbeam",
"ChainIDNeon",
"ChainIDTerra2",
"ChainIDInjective",
"ChainIDOsmosis",
@ -3644,24 +3743,35 @@ const docTemplate = `{
"ChainIDAptos",
"ChainIDArbitrum",
"ChainIDOptimism",
"ChainIDGnosis",
"ChainIDPythNet",
"ChainIDXpla",
"ChainIDBtc",
"ChainIDBase",
"ChainIDSei",
"ChainIDRootstock",
"ChainIDScroll",
"ChainIDMantle",
"ChainIDBlast",
"ChainIDXLayer",
"ChainIDLinea",
"ChainIDBerachain",
"ChainIDWormchain",
"ChainIDCosmoshub",
"ChainIDEvmos",
"ChainIDKujira",
"ChainIDNeutron",
"ChainIDCelestia",
"ChainIDStargaze",
"ChainIDSeda",
"ChainIDDymension",
"ChainIDProvenance",
"ChainIDSepolia",
"ChainIDArbitrumSepolia",
"ChainIDBaseSepolia",
"ChainIDOptimismSepolia",
"ChainIDHolesky"
"ChainIDHolesky",
"ChainIDPolygonSepolia"
]
},
"vaa.VaaDoc": {

View File

@ -1753,6 +1753,73 @@
}
}
},
"/api/v1/x-chain-activity/tops": {
"get": {
"description": "Search, for a specific period of time, the number of transactions and the volume.",
"tags": [
"wormholescan"
],
"operationId": "x-chain-activity-tops",
"parameters": [
{
"type": "string",
"description": "Time span, supported values: 1d, 1mo and 1y",
"name": "timespan",
"in": "query",
"required": true
},
{
"type": "string",
"description": "From date, supported format 2006-01-02T15:04:05Z07:00",
"name": "from",
"in": "query",
"required": true
},
{
"type": "string",
"description": "To date, supported format 2006-01-02T15:04:05Z07:00",
"name": "to",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Search by appId",
"name": "appId",
"in": "query"
},
{
"type": "string",
"description": "Search by sourceChain",
"name": "sourceChain",
"in": "query"
},
{
"type": "string",
"description": "Search by targetChain",
"name": "targetChain",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/transactions.ChainActivityTopResult"
}
}
},
"400": {
"description": "Bad Request"
},
"500": {
"description": "Internal Server Error"
}
}
}
},
"/swagger.json": {
"get": {
"description": "Returns the swagger specification for this API.",
@ -3318,6 +3385,29 @@
}
}
},
"transactions.ChainActivityTopResult": {
"type": "object",
"properties": {
"count": {
"type": "integer"
},
"destination_chain": {
"type": "string"
},
"emitter_chain": {
"type": "string"
},
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"volume": {
"type": "integer"
}
}
},
"transactions.ChainPair": {
"type": "object",
"properties": {
@ -3584,7 +3674,6 @@
14,
15,
16,
17,
18,
19,
20,
@ -3592,24 +3681,35 @@
22,
23,
24,
25,
26,
28,
29,
30,
32,
33,
34,
35,
36,
37,
38,
39,
3104,
4000,
4001,
4002,
4003,
4004,
4005,
4006,
4007,
4008,
10002,
10003,
10004,
10005,
10006
10006,
10007
],
"x-enum-varnames": [
"ChainIDUnset",
@ -3629,7 +3729,6 @@
"ChainIDCelo",
"ChainIDNear",
"ChainIDMoonbeam",
"ChainIDNeon",
"ChainIDTerra2",
"ChainIDInjective",
"ChainIDOsmosis",
@ -3637,24 +3736,35 @@
"ChainIDAptos",
"ChainIDArbitrum",
"ChainIDOptimism",
"ChainIDGnosis",
"ChainIDPythNet",
"ChainIDXpla",
"ChainIDBtc",
"ChainIDBase",
"ChainIDSei",
"ChainIDRootstock",
"ChainIDScroll",
"ChainIDMantle",
"ChainIDBlast",
"ChainIDXLayer",
"ChainIDLinea",
"ChainIDBerachain",
"ChainIDWormchain",
"ChainIDCosmoshub",
"ChainIDEvmos",
"ChainIDKujira",
"ChainIDNeutron",
"ChainIDCelestia",
"ChainIDStargaze",
"ChainIDSeda",
"ChainIDDymension",
"ChainIDProvenance",
"ChainIDSepolia",
"ChainIDArbitrumSepolia",
"ChainIDBaseSepolia",
"ChainIDOptimismSepolia",
"ChainIDHolesky"
"ChainIDHolesky",
"ChainIDPolygonSepolia"
]
},
"vaa.VaaDoc": {

View File

@ -824,6 +824,21 @@ definitions:
$ref: '#/definitions/transactions.Tx'
type: array
type: object
transactions.ChainActivityTopResult:
properties:
count:
type: integer
destination_chain:
type: string
emitter_chain:
type: string
from:
type: string
to:
type: string
volume:
type: integer
type: object
transactions.ChainPair:
properties:
destinationChain:
@ -1012,7 +1027,6 @@ definitions:
- 14
- 15
- 16
- 17
- 18
- 19
- 20
@ -1020,24 +1034,35 @@ definitions:
- 22
- 23
- 24
- 25
- 26
- 28
- 29
- 30
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 3104
- 4000
- 4001
- 4002
- 4003
- 4004
- 4005
- 4006
- 4007
- 4008
- 10002
- 10003
- 10004
- 10005
- 10006
- 10007
type: integer
x-enum-varnames:
- ChainIDUnset
@ -1057,7 +1082,6 @@ definitions:
- ChainIDCelo
- ChainIDNear
- ChainIDMoonbeam
- ChainIDNeon
- ChainIDTerra2
- ChainIDInjective
- ChainIDOsmosis
@ -1065,24 +1089,35 @@ definitions:
- ChainIDAptos
- ChainIDArbitrum
- ChainIDOptimism
- ChainIDGnosis
- ChainIDPythNet
- ChainIDXpla
- ChainIDBtc
- ChainIDBase
- ChainIDSei
- ChainIDRootstock
- ChainIDScroll
- ChainIDMantle
- ChainIDBlast
- ChainIDXLayer
- ChainIDLinea
- ChainIDBerachain
- ChainIDWormchain
- ChainIDCosmoshub
- ChainIDEvmos
- ChainIDKujira
- ChainIDNeutron
- ChainIDCelestia
- ChainIDStargaze
- ChainIDSeda
- ChainIDDymension
- ChainIDProvenance
- ChainIDSepolia
- ChainIDArbitrumSepolia
- ChainIDBaseSepolia
- ChainIDOptimismSepolia
- ChainIDHolesky
- ChainIDPolygonSepolia
vaa.VaaDoc:
properties:
appId:
@ -2326,6 +2361,52 @@ paths:
description: Internal Server Error
tags:
- wormholescan
/api/v1/x-chain-activity/tops:
get:
description: Search, for a specific period of time, the number of transactions
and the volume.
operationId: x-chain-activity-tops
parameters:
- description: 'Time span, supported values: 1d, 1mo and 1y'
in: query
name: timespan
required: true
type: string
- description: From date, supported format 2006-01-02T15:04:05Z07:00
in: query
name: from
required: true
type: string
- description: To date, supported format 2006-01-02T15:04:05Z07:00
in: query
name: to
required: true
type: string
- description: Search by appId
in: query
name: appId
type: string
- description: Search by sourceChain
in: query
name: sourceChain
type: string
- description: Search by targetChain
in: query
name: targetChain
type: string
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/transactions.ChainActivityTopResult'
type: array
"400":
description: Bad Request
"500":
description: Internal Server Error
tags:
- wormholescan
/swagger.json:
get:
description: Returns the swagger specification for this API.

View File

@ -111,53 +111,46 @@ type OperationQuery struct {
Pagination pagination.Pagination
TxHash string
Address string
SourceChainID *vaa.ChainID
TargetChainID *vaa.ChainID
AppID string
SourceChainIDs []vaa.ChainID
TargetChainIDs []vaa.ChainID
AppIDs []string
ExclusiveAppId bool
}
func buildQueryOperationsByChain(sourceChainID, targetChainID *vaa.ChainID) bson.D {
func buildQueryOperationsByChain(sourceChainIDs, targetChainIDs []vaa.ChainID) bson.D {
var allMatch bson.A
if sourceChainID != nil {
matchSourceChain := bson.M{"rawStandardizedProperties.fromChain": *sourceChainID}
if len(sourceChainIDs) > 0 {
matchSourceChain := bson.M{"rawStandardizedProperties.fromChain": bson.M{"$in": sourceChainIDs}}
allMatch = append(allMatch, matchSourceChain)
}
if targetChainID != nil {
matchTargetChain := bson.M{"rawStandardizedProperties.toChain": *targetChainID}
if len(targetChainIDs) > 0 {
matchTargetChain := bson.M{"rawStandardizedProperties.toChain": bson.M{"$in": targetChainIDs}}
allMatch = append(allMatch, matchTargetChain)
}
if (sourceChainID != nil && targetChainID != nil) && (*sourceChainID == *targetChainID) {
if (len(sourceChainIDs) == 1 && len(targetChainIDs) == 1) && (sourceChainIDs[0] == targetChainIDs[0]) {
return bson.D{{Key: "$match", Value: bson.M{"$or": allMatch}}}
}
return bson.D{{Key: "$match", Value: bson.M{"$and": allMatch}}}
}
func buildQueryOperationsByAppID(appID string, exclusive bool) []bson.D {
var result []bson.D
if appID == "" {
result = append(result, bson.D{{Key: "$match", Value: bson.M{}}})
return result
func buildQueryOperationsByAppID(appIDs []string, exclusive bool) bson.D {
if !exclusive {
return bson.D{{Key: "$match", Value: bson.M{"rawStandardizedProperties.appIds": bson.M{"$in": appIDs}}}}
}
if exclusive {
result = append(result, bson.D{{Key: "$match", Value: bson.M{
"$and": bson.A{
bson.M{"rawStandardizedProperties.appIds": bson.M{"$eq": []string{appID}}},
bson.M{"rawStandardizedProperties.appIds": bson.M{"$size": 1}},
}}}})
return result
} else {
result = append(result, bson.D{{Key: "$match", Value: bson.M{"rawStandardizedProperties.appIds": bson.M{"$in": []string{appID}}}}})
matchAppID := bson.A{}
for _, appID := range appIDs {
cond := bson.M{"$and": bson.A{
bson.M{"rawStandardizedProperties.appIds": bson.M{"$eq": appID}},
bson.M{"rawStandardizedProperties.appIds": bson.M{"$size": 1}},
}}
matchAppID = append(matchAppID, cond)
}
return result
return bson.D{{Key: "$match", Value: bson.M{"$or": matchAppID}}}
}
// findOperationsIdByAddress returns all operations filtered by address.
@ -238,14 +231,14 @@ func (r *Repository) FindByChainAndAppId(ctx context.Context, query OperationQue
var pipeline mongo.Pipeline
if query.SourceChainID != nil || query.TargetChainID != nil {
matchBySourceTargetChain := buildQueryOperationsByChain(query.SourceChainID, query.TargetChainID)
if len(query.SourceChainIDs) > 0 || len(query.TargetChainIDs) > 0 {
matchBySourceTargetChain := buildQueryOperationsByChain(query.SourceChainIDs, query.TargetChainIDs)
pipeline = append(pipeline, matchBySourceTargetChain)
}
if len(query.AppID) > 0 {
matchByAppId := buildQueryOperationsByAppID(query.AppID, query.ExclusiveAppId)
pipeline = append(pipeline, matchByAppId...)
if len(query.AppIDs) > 0 {
matchByAppId := buildQueryOperationsByAppID(query.AppIDs, query.ExclusiveAppId)
pipeline = append(pipeline, matchByAppId)
}
pipeline = append(pipeline, bson.D{{Key: "$sort", Value: bson.D{

View File

@ -34,9 +34,9 @@ func (s *Service) FindById(ctx context.Context, chainID vaa.ChainID,
type OperationFilter struct {
TxHash *types.TxHash
Address string
SourceChainID *vaa.ChainID
TargetChainID *vaa.ChainID
AppID string
SourceChainIDs []vaa.ChainID
TargetChainIDs []vaa.ChainID
AppIDs []string
ExclusiveAppId bool
Pagination pagination.Pagination
}
@ -52,13 +52,13 @@ func (s *Service) FindAll(ctx context.Context, filter OperationFilter) ([]*Opera
TxHash: txHash,
Address: filter.Address,
Pagination: filter.Pagination,
SourceChainID: filter.SourceChainID,
TargetChainID: filter.TargetChainID,
AppID: filter.AppID,
SourceChainIDs: filter.SourceChainIDs,
TargetChainIDs: filter.TargetChainIDs,
AppIDs: filter.AppIDs,
ExclusiveAppId: filter.ExclusiveAppId,
}
if operationQuery.AppID != "" || operationQuery.SourceChainID != nil || operationQuery.TargetChainID != nil {
if len(operationQuery.AppIDs) != 0 || len(operationQuery.SourceChainIDs) > 0 || len(operationQuery.TargetChainIDs) > 0 {
return s.repo.FindByChainAndAppId(ctx, operationQuery)
}

View File

@ -143,6 +143,17 @@ type ChainActivityResult struct {
Volume uint64 `mapstructure:"_value" json:"volume"`
}
type ChainActivityTopResult struct {
Time time.Time `json:"from" mapstructure:"_time"`
To string `json:"to" mapstructure:"to"`
ChainSourceID string `mapstructure:"emitter_chain" json:"emitter_chain"`
ChainDestinationID string `mapstructure:"destination_chain" json:"destination_chain,omitempty"`
Volume uint64 `mapstructure:"volume" json:"volume"`
Txs uint64 `mapstructure:"count" json:"count"`
}
type ChainActivityTopResults []ChainActivityTopResult
type ChainActivityTimeSpan string
const (
@ -202,3 +213,25 @@ type TransactionDto struct {
Payload map[string]interface{} `bson:"payload"`
StandardizedProperties map[string]interface{} `bson:"standardizedProperties"`
}
type ChainActivityTopsQuery struct {
SourceChains []sdk.ChainID `json:"source_chain"`
TargetChains []sdk.ChainID `json:"target_chain"`
AppId string `json:"app_id"`
From time.Time `json:"from"`
To time.Time `json:"to"`
Timespan Timespan `json:"timespan"`
}
type Timespan string
const (
Hour Timespan = "1h"
Day Timespan = "1d"
Month Timespan = "1mo"
Year Timespan = "1y"
)
func (t Timespan) IsValid() bool {
return t == Hour || t == Day || t == Month || t == Year
}

View File

@ -3,6 +3,7 @@ package transactions
import (
"context"
"fmt"
"github.com/valyala/fasthttp"
"strconv"
"strings"
"sync"
@ -1048,3 +1049,348 @@ func (r *Repository) ListTransactionsByAddress(
return documents, nil
}
func (r *Repository) FindChainActivityTops(ctx *fasthttp.RequestCtx, q ChainActivityTopsQuery) ([]ChainActivityTopResult, error) {
query := r.buildChainActivityQueryTops(q)
result, err := r.queryAPI.Query(ctx, query)
if err != nil {
return nil, err
}
if result.Err() != nil {
return nil, result.Err()
}
var response []ChainActivityTopResult
for result.Next() {
var row ChainActivityTopResult
if err = mapstructure.Decode(result.Record().Values(), &row); err != nil {
return nil, err
}
parsedTime, errTime := time.Parse(time.RFC3339Nano, row.To)
if errTime == nil {
row.To = parsedTime.Format(time.RFC3339)
}
response = append(response, row)
}
return response, nil
}
func (r *Repository) buildChainActivityQueryTops(q ChainActivityTopsQuery) string {
var start, stop string
switch q.Timespan {
case Hour:
start = q.From.Truncate(1 * time.Hour).UTC().Format(time.RFC3339)
stop = q.To.Truncate(1 * time.Hour).UTC().Format(time.RFC3339)
case Day:
start = q.From.Truncate(24 * time.Hour).UTC().Format(time.RFC3339)
stop = q.To.Truncate(24 * time.Hour).UTC().Format(time.RFC3339)
case Month:
start = time.Date(q.From.Year(), q.From.Month(), 1, 0, 0, 0, 0, q.From.Location()).UTC().Format(time.RFC3339)
stop = time.Date(q.To.Year(), q.To.Month(), 1, 0, 0, 0, 0, q.To.Location()).UTC().Format(time.RFC3339)
default:
start = time.Date(q.From.Year(), 1, 1, 0, 0, 0, 0, q.From.Location()).UTC().Format(time.RFC3339)
stop = time.Date(q.To.Year(), 1, 1, 0, 0, 0, 0, q.To.Location()).UTC().Format(time.RFC3339)
}
filterTargetChain := ""
if len(q.TargetChains) > 0 {
val := fmt.Sprintf("r.destination_chain == \"%d\"", q.TargetChains[0])
buff := ""
for _, tc := range q.TargetChains[1:] {
buff += fmt.Sprintf("or r.destination_chain == \"%d\" ", tc)
}
filterTargetChain = fmt.Sprintf("|> filter(fn: (r) => %s %s)", val, buff)
}
filterSourceChain := ""
if len(q.SourceChains) > 0 {
val := fmt.Sprintf("r.emitter_chain == \"%d\"", q.SourceChains[0])
buff := ""
for _, tc := range q.SourceChains[1:] {
buff += fmt.Sprintf("or r.emitter_chain == \"%d\" ", tc)
}
filterSourceChain = fmt.Sprintf("|> filter(fn: (r) => %s %s)", val, buff)
}
filterAppId := ""
if q.AppId != "" {
filterAppId = "|> filter(fn: (r) => r.app_id == \"" + q.AppId + "\")"
}
if len(q.TargetChains) == 0 && q.AppId == "" {
return r.buildQueryChainActivityTopsByEmitter(q, start, stop, filterSourceChain)
}
var query string
switch q.Timespan {
case Hour:
query = r.buildQueryChainActivityHourly(start, stop, filterSourceChain, filterTargetChain, filterAppId)
case Day:
query = r.buildQueryChainActivityDaily(start, stop, filterSourceChain, filterTargetChain, filterAppId)
case Month:
query = r.buildQueryChainActivityMonthly(start, stop, filterSourceChain, filterTargetChain, filterAppId)
default:
query = r.buildQueryChainActivityYearly(start, stop, filterSourceChain, filterTargetChain, filterAppId)
}
return query
}
func (r *Repository) buildQueryChainActivityTopsByEmitter(q ChainActivityTopsQuery, start, stop, filterSourceChain string) string {
measurement := ""
switch q.Timespan {
case Hour:
measurement = "emitter_chain_activity_1h"
default:
measurement = "emitter_chain_activity_1d"
}
if q.Timespan == Hour || q.Timespan == Day {
query := `
import "date"
from(bucket: "%s")
|> range(start: %s,stop: %s)
|> filter(fn: (r) => r._measurement == "%s")
%s
|> pivot(rowKey:["_time","emitter_chain"], columnKey: ["_field"], valueColumn: "_value")
|> sort(columns:["emitter_chain","_time"],desc:false)
`
return fmt.Sprintf(query, r.bucketInfiniteRetention, start, stop, measurement, filterSourceChain)
}
if q.Timespan == Month {
query := `
import "date"
import "join"
data = from(bucket: "%s")
|> range(start: %s,stop: %s)
|> filter(fn: (r) => r._measurement == "%s")
%s
|> drop(columns:["to"])
|> window(every: 1mo, period:1mo)
|> drop(columns:["_time"])
|> rename(columns: {_start: "_time"})
|> map(fn: (r) => ({r with to: string(v: r._stop)}))
vols = data
|> filter(fn: (r) => (r._field == "volume" and r._value > 0))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "volume"})
counts = data
|> filter(fn: (r) => (r._field == "count"))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "count"})
join.inner(
left: vols,
right: counts,
on: (l, r) => l._time == r._time and l.emitter_chain == r.emitter_chain,
as: (l, r) => ({l with count: r.count}),
)
|> group()
|> sort(columns:["emitter_chain","_time"],desc:false)
`
return fmt.Sprintf(query, r.bucketInfiniteRetention, start, stop, measurement, filterSourceChain)
}
query := `
import "date"
import "join"
data = from(bucket: "%s")
|> range(start: %s,stop: %s)
|> filter(fn: (r) => r._measurement == "%s")
%s
|> drop(columns:["to"])
|> window(every: 1y, period:1y)
|> drop(columns:["_time"])
|> rename(columns: {_start: "_time"})
|> map(fn: (r) => ({r with to: string(v: r._stop)}))
vols = data
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "volume"})
counts = data
|> filter(fn: (r) => (r._field == "count"))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "count"})
join.inner(
left: vols,
right: counts,
on: (l, r) => l._time == r._time and l.emitter_chain == r.emitter_chain,
as: (l, r) => ({l with count: r.count}),
)
|> group()
|> sort(columns:["emitter_chain","_time"],desc:false)
`
return fmt.Sprintf(query, r.bucketInfiniteRetention, start, stop, measurement, filterSourceChain)
}
func (r *Repository) buildQueryChainActivityHourly(start, stop, filterSourceChain, filterTargetChain, filterAppId string) string {
query := `
import "date"
import "join"
data = from(bucket: "%s")
|> range(start: %s,stop: %s)
|> filter(fn: (r) => r._measurement == "chain_activity_1h")
%s
%s
%s
|> drop(columns:["destination_chain"])
vols = data
|> filter(fn: (r) => (r._field == "volume" and r._value > 0))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "volume"})
counts = data
|> filter(fn: (r) => (r._field == "count"))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "count"})
join.inner(
left: vols,
right: counts,
on: (l, r) => l._time == r._time and l.to == r.to and l.emitter_chain == r.emitter_chain,
as: (l, r) => ({l with count: r.count}),
)
|> group()
|> sort(columns:["emitter_chain","_time"],desc:false)
`
return fmt.Sprintf(query, r.bucketInfiniteRetention, start, stop, filterSourceChain, filterTargetChain, filterAppId)
}
func (r *Repository) buildQueryChainActivityDaily(start, stop, filterSourceChain, filterTargetChain, filterAppId string) string {
query := `
import "date"
import "join"
data = from(bucket: "%s")
|> range(start: %s,stop: %s)
|> filter(fn: (r) => r._measurement == "chain_activity_1d")
%s
%s
%s
|> drop(columns:["destination_chain"])
vols = data
|> filter(fn: (r) => (r._field == "volume" and r._value > 0))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "volume"})
counts = data
|> filter(fn: (r) => (r._field == "count"))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "count"})
join.inner(
left: vols,
right: counts,
on: (l, r) => l._time == r._time and l.to == r.to and l.emitter_chain == r.emitter_chain,
as: (l, r) => ({l with count: r.count}),
)
|> group()
|> sort(columns:["emitter_chain","_time"],desc:false)
`
return fmt.Sprintf(query, r.bucketInfiniteRetention, start, stop, filterSourceChain, filterTargetChain, filterAppId)
}
func (r *Repository) buildQueryChainActivityMonthly(start, stop, filterSourceChain, filterTargetChain, filterAppId string) string {
query := `
import "date"
import "join"
data = from(bucket: "%s")
|> range(start: %s,stop: %s)
|> filter(fn: (r) => r._measurement == "chain_activity_1d")
%s
%s
%s
|> drop(columns:["destination_chain","to","app_id"])
|> window(every: 1mo, period:1mo)
|> drop(columns:["_time"])
|> rename(columns: {_start: "_time"})
|> map(fn: (r) => ({r with to: string(v: r._stop)}))
vols = data
|> filter(fn: (r) => (r._field == "volume" and r._value > 0))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "volume"})
counts = data
|> filter(fn: (r) => (r._field == "count"))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "count"})
join.inner(
left: vols,
right: counts,
on: (l, r) => l._time == r._time and l.emitter_chain == r.emitter_chain,
as: (l, r) => ({l with count: r.count}),
)
|> group()
|> sort(columns:["emitter_chain","_time"],desc:false)
`
return fmt.Sprintf(query, r.bucketInfiniteRetention, start, stop, filterSourceChain, filterTargetChain, filterAppId)
}
func (r *Repository) buildQueryChainActivityYearly(start, stop, filterSourceChain, filterTargetChain, filterAppId string) string {
query := `
import "date"
import "join"
data = from(bucket: "%s")
|> range(start: %s,stop: %s)
|> filter(fn: (r) => r._measurement == "chain_activity_1d")
%s
%s
%s
|> drop(columns:["destination_chain","to","app_id"])
|> window(every: 1y, period:1y)
|> drop(columns:["_time"])
|> rename(columns: {_start: "_time"})
|> map(fn: (r) => ({r with to: string(v: r._stop)}))
vols = data
|> filter(fn: (r) => (r._field == "volume" and r._value > 0))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "volume"})
counts = data
|> filter(fn: (r) => (r._field == "count"))
|> group(columns:["_time","to","emitter_chain"])
|> sum()
|> rename(columns: {_value: "count"})
join.inner(
left: vols,
right: counts,
on: (l, r) => l._time == r._time and l.emitter_chain == r.emitter_chain,
as: (l, r) => ({l with count: r.count}),
)
|> group()
|> sort(columns:["emitter_chain","_time"],desc:false)
`
return fmt.Sprintf(query, r.bucketInfiniteRetention, start, stop, filterSourceChain, filterTargetChain, filterAppId)
}

View File

@ -2,12 +2,13 @@ package transactions
import (
"context"
errors "errors"
"fmt"
"github.com/valyala/fasthttp"
"strings"
"time"
"github.com/wormhole-foundation/wormhole-explorer/api/cacheable"
"github.com/wormhole-foundation/wormhole-explorer/api/internal/errors"
errs "github.com/wormhole-foundation/wormhole-explorer/api/internal/errors"
"github.com/wormhole-foundation/wormhole-explorer/api/internal/metrics"
"github.com/wormhole-foundation/wormhole-explorer/api/internal/pagination"
@ -34,6 +35,7 @@ const (
topAssetsByVolumeKey = "wormscan:top-assets-by-volume"
topChainPairsByNumTransfersKey = "wormscan:top-chain-pairs-by-num-transfers"
chainActivityKey = "wormscan:chain-activity"
chainActivityTopsKey = "wormscan:chain-activity-tops"
)
// NewService create a new Service.
@ -157,7 +159,7 @@ func (s *Service) GetTransactionByID(
return nil, err
}
if len(output) == 0 {
return nil, errors.ErrNotFound
return nil, errs.ErrNotFound
}
// Return matching document
@ -167,3 +169,44 @@ func (s *Service) GetTransactionByID(
func (s *Service) GetTokenProvider() *domain.TokenProvider {
return s.tokenProvider
}
func (s *Service) GetChainActivityTops(ctx *fasthttp.RequestCtx, q ChainActivityTopsQuery) (ChainActivityTopResults, error) {
timeDuration := q.To.Sub(q.From)
if q.Timespan == Hour && timeDuration > 15*24*time.Hour {
return nil, errors.New("time range is too large for hourly data. Max time range allowed: 15 days")
}
if q.Timespan == Day {
if timeDuration < 24*time.Hour {
return nil, errors.New("time range is too small for daily data. Min time range allowed: 2 day")
}
if timeDuration > 365*24*time.Hour {
return nil, errors.New("time range is too large for daily data. Max time range allowed: 1 year")
}
}
if q.Timespan == Month {
if timeDuration < 30*24*time.Hour {
return nil, errors.New("time range is too small for monthly data. Min time range allowed: 60 days")
}
if timeDuration > 10*365*24*time.Hour {
return nil, errors.New("time range is too large for monthly data. Max time range allowed: 1 year")
}
}
if q.Timespan == Year {
if timeDuration < 365*24*time.Hour {
return nil, errors.New("time range is too small for yearly data. Min time range allowed: 1 year")
}
if timeDuration > 10*365*24*time.Hour {
return nil, errors.New("time range is too large for yearly data. Max time range allowed: 10 year")
}
}
return s.repo.FindChainActivityTops(ctx, q)
}

View File

@ -61,25 +61,61 @@ func ExtractToChain(c *fiber.Ctx, l *zap.Logger) (*sdk.ChainID, error) {
return &result, nil
}
func ExtractChain(c *fiber.Ctx, l *zap.Logger) (*sdk.ChainID, error) {
return extractChainQueryParam(c, l, "chain")
func ExtractSourceChain(c *fiber.Ctx, l *zap.Logger) ([]sdk.ChainID, error) {
param := c.Query("sourceChain")
if param == "" {
return nil, nil
}
result := make([]sdk.ChainID, 0, len(param))
for _, val := range strings.Split(param, ",") {
chain, err := parseChainIDParam(val)
if err != nil {
requestID := fmt.Sprintf("%v", c.Locals("requestid"))
l.Error("failed to parse sourceChain parameter",
zap.Error(err),
zap.String("requestID", requestID),
)
return nil, response.NewInvalidParamError(c, "INVALID SOURCE_CHAIN VALUE", errors.WithStack(err))
}
result = append(result, chain)
}
return result, nil
}
func ExtractSourceChain(c *fiber.Ctx, l *zap.Logger) (*sdk.ChainID, error) {
return extractChainQueryParam(c, l, "sourceChain")
func ExtractTargetChain(c *fiber.Ctx, l *zap.Logger) ([]sdk.ChainID, error) {
param := c.Query("targetChain")
if param == "" {
return nil, nil
}
result := make([]sdk.ChainID, 0, len(param))
for _, val := range strings.Split(param, ",") {
chain, err := parseChainIDParam(val)
if err != nil {
requestID := fmt.Sprintf("%v", c.Locals("requestid"))
l.Error("failed to parse targetChain parameter",
zap.Error(err),
zap.String("requestID", requestID),
)
return nil, response.NewInvalidParamError(c, "INVALID TARGET_CHAIN VALUE", errors.WithStack(err))
}
result = append(result, chain)
}
return result, nil
}
func ExtractTargetChain(c *fiber.Ctx, l *zap.Logger) (*sdk.ChainID, error) {
return extractChainQueryParam(c, l, "targetChain")
func parseChainIDParam(param string) (sdk.ChainID, error) {
chain, err := strconv.ParseInt(param, 10, 16)
if err != nil {
return sdk.ChainIDUnset, err
}
return sdk.ChainID(chain), nil
}
func extractChainQueryParam(c *fiber.Ctx, l *zap.Logger, queryParam string) (*sdk.ChainID, error) {
param := c.Query(queryParam)
if param == "" {
return nil, nil
}
chain, err := strconv.ParseInt(param, 10, 16)
if err != nil {
requestID := fmt.Sprintf("%v", c.Locals("requestid"))
@ -90,7 +126,6 @@ func extractChainQueryParam(c *fiber.Ctx, l *zap.Logger, queryParam string) (*sd
return nil, response.NewInvalidParamError(c, "INVALID CHAIN VALUE", errors.WithStack(err))
}
result := sdk.ChainID(chain)
return &result, nil
}
@ -358,14 +393,13 @@ func ExtractTimeSpanAndSampleRate(c *fiber.Ctx, l *zap.Logger) (string, string,
return timeSpan, sampleRate, nil
}
func ExtractTime(c *fiber.Ctx, queryParam string) (*time.Time, error) {
func ExtractTime(c *fiber.Ctx, timeLayout, queryParam string) (*time.Time, error) {
// get the start_time from query params
date := c.Query(queryParam, "")
if date == "" {
return nil, nil
}
t, err := time.Parse("20060102T150405Z", date)
t, err := time.Parse(timeLayout, date)
if err != nil {
return nil, response.NewInvalidQueryParamError(c, fmt.Sprintf("INVALID <%s> QUERY PARAMETER", queryParam), nil)
}

View File

@ -1,13 +1,13 @@
package operations
import (
"strconv"
"github.com/gofiber/fiber/v2"
"github.com/wormhole-foundation/wormhole-explorer/api/handlers/operations"
"github.com/wormhole-foundation/wormhole-explorer/api/middleware"
"github.com/wormhole-foundation/wormhole-explorer/api/response"
"go.uber.org/zap"
"strconv"
"strings"
)
// Controller is the controller for the operation resource.
@ -75,14 +75,19 @@ func (c *Controller) FindAll(ctx *fiber.Ctx) error {
return err
}
appID := middleware.ExtractAppId(ctx, c.logger)
var appIDs []string
appIDQueryParam := ctx.Query("appId")
if appIDQueryParam != "" {
appIDs = strings.Split(appIDQueryParam, ",")
}
exclusiveAppId, err := middleware.ExtractExclusiveAppId(ctx)
if err != nil {
return err
}
searchBySourceTargetChain := sourceChain != nil || targetChain != nil
searchByAppId := appID != ""
searchBySourceTargetChain := len(sourceChain) != 0 || targetChain != nil
searchByAppId := len(appIDs) != 0
if (searchByAddress || searchByTxHash) && (searchBySourceTargetChain || searchByAppId) {
return response.NewInvalidParamError(ctx, "address/txHash cannot be combined with sourceChain/targetChain/appId query filter", nil)
@ -91,9 +96,9 @@ func (c *Controller) FindAll(ctx *fiber.Ctx) error {
filter := operations.OperationFilter{
TxHash: txHash,
Address: address,
SourceChainID: sourceChain,
TargetChainID: targetChain,
AppID: appID,
SourceChainIDs: sourceChain,
TargetChainIDs: targetChain,
AppIDs: appIDs,
ExclusiveAppId: exclusiveAppId,
Pagination: *pagination,
}

View File

@ -85,6 +85,7 @@ func RegisterRoutes(
api.Get("/last-txs", transactionCtrl.GetLastTransactions)
api.Get("/scorecards", transactionCtrl.GetScorecards)
api.Get("/x-chain-activity", transactionCtrl.GetChainActivity)
api.Get("/x-chain-activity/tops", transactionCtrl.GetChainActivityTops)
api.Get("/top-assets-by-volume", transactionCtrl.GetTopAssets)
api.Get("/top-chain-pairs-by-num-transfers", transactionCtrl.GetTopChainPairs)
api.Get("token/:chain/:token_address", transactionCtrl.GetTokenByChainAndAddress)

View File

@ -2,6 +2,7 @@ package transactions
import (
"strconv"
"time"
"github.com/gofiber/fiber/v2"
"github.com/shopspring/decimal"
@ -182,6 +183,75 @@ func (c *Controller) GetTopAssets(ctx *fiber.Ctx) error {
return ctx.JSON(response)
}
// GetChainActivityTops godoc
// @Description Search for a specific period of time the number of transactions and the volume.
// @Tags wormholescan
// @ID x-chain-activity-tops
// @Method Get
// @Param timespan query string true "Time span, supported values: 1d, 1mo and 1y"
// @Param from query string true "From date, supported format 2006-01-02T15:04:05Z07:00"
// @Param to query string true "To date, supported format 2006-01-02T15:04:05Z07:00"
// @Param appId query string false "Search by appId"
// @Param sourceChain query string false "Search by sourceChain"
// @Param targetChain query string false "Search by targetChain"
// @Success 200 {object} transactions.ChainActivityTopResults
// @Failure 400
// @Failure 500
// @Router /api/v1/x-chain-activity/tops [get]
func (c *Controller) GetChainActivityTops(ctx *fiber.Ctx) error {
sourceChains, err := middleware.ExtractSourceChain(ctx, c.logger)
if err != nil {
return err
}
targetChains, err := middleware.ExtractTargetChain(ctx, c.logger)
if err != nil {
return err
}
from, err := middleware.ExtractTime(ctx, time.RFC3339, "from")
if err != nil {
return err
}
to, err := middleware.ExtractTime(ctx, time.RFC3339, "to")
if err != nil {
return err
}
if from == nil || to == nil {
return response.NewInvalidParamError(ctx, "missing from/to query params ", nil)
}
payload := transactions.ChainActivityTopsQuery{
SourceChains: sourceChains,
TargetChains: targetChains,
From: *from,
To: *to,
AppId: middleware.ExtractAppId(ctx, c.logger),
Timespan: transactions.Timespan(ctx.Query("timespan")),
}
if !payload.Timespan.IsValid() {
return response.NewInvalidParamError(ctx, "invalid timespan", nil)
}
nowUTC := time.Now().UTC()
if nowUTC.Before(payload.To.UTC()) {
payload.To = nowUTC
}
if payload.To.Sub(payload.From) <= 0 {
return response.NewInvalidParamError(ctx, "invalid time range", nil)
}
// Get the chain activity.
activity, err := c.srv.GetChainActivityTops(ctx.Context(), payload)
if err != nil {
c.logger.Error("Error getting chain activity", zap.Error(err))
return err
}
return ctx.JSON(activity)
}
// GetChainActivity godoc
// @Description Returns a list of chain pairs by origin chain and destination chain.
// @Description The list could be rendered by notional or transaction count.

View File

@ -3,7 +3,12 @@ package domain
// manualMainnetTokenList returns a list of tokens that are not generated automatically.
func manualMainnetTokenList() []TokenMetadata {
return []TokenMetadata{
{TokenChain: 1, TokenAddress: "6927fdc01ea906f96d7137874cdd7adad00ca35764619310e54196c781d84d5b", Symbol: "W", CoingeckoID: "wormhole", Decimals: 6}, // Addr: 85VBFQZC9TZkfaptBWjvUw7YbZjy52A6mjtPGjstQAmQ
{TokenChain: 1, TokenAddress: "6927fdc01ea906f96d7137874cdd7adad00ca35764619310e54196c781d84d5b", Symbol: "W", CoingeckoID: "wormhole", Decimals: 6}, // Addr: 85VBFQZC9TZkfaptBWjvUw7YbZjy52A6mjtPGjstQAmQ
{TokenChain: 2, TokenAddress: "000000000000000000000000b0ffa8000886e57f86dd5264b9582b2ad87b2b91", Symbol: "W", CoingeckoID: "wormhole", Decimals: 18}, // Addr: 0xB0fFa8000886e57F86dd5264b9582b2Ad87b2b91
{TokenChain: 23, TokenAddress: "000000000000000000000000b0ffa8000886e57f86dd5264b9582b2ad87b2b91", Symbol: "W", CoingeckoID: "wormhole", Decimals: 18}, // Addr: 0xB0fFa8000886e57F86dd5264b9582b2Ad87b2b91
{TokenChain: 24, TokenAddress: "000000000000000000000000b0ffa8000886e57f86dd5264b9582b2ad87b2b91", Symbol: "W", CoingeckoID: "wormhole", Decimals: 18}, // Addr: 0xB0fFa8000886e57F86dd5264b9582b2Ad87b2b91
{TokenChain: 30, TokenAddress: "000000000000000000000000b0ffa8000886e57f86dd5264b9582b2ad87b2b91", Symbol: "W", CoingeckoID: "wormhole", Decimals: 18}, // Addr: 0xB0fFa8000886e57F86dd5264b9582b2Ad87b2b91
}
}

View File

@ -12,17 +12,17 @@ require (
github.com/stretchr/testify v1.8.4
github.com/test-go/testify v1.1.4
github.com/wormhole-foundation/wormhole-explorer/common v0.0.0-20230713181709-0425a89e7533
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240416174455-25e60611a867
go.mongodb.org/mongo-driver v1.11.2
go.uber.org/zap v1.25.0
go.uber.org/zap v1.26.0
)
require (
github.com/algorand/go-algorand-sdk v1.23.0 // indirect
github.com/algorand/go-codec/codec v1.1.8 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/certusone/wormhole/node v0.0.0-20240416174455-25e60611a867 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
@ -36,13 +36,12 @@ require (
github.com/holiman/uint256 v1.2.1 // indirect
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
github.com/joho/godotenv v1.5.1 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/compress v1.17.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/montanaflynn/stats v0.7.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/onsi/gomega v1.27.8 // indirect
github.com/philhofer/fwd v1.1.2 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
@ -51,7 +50,6 @@ require (
github.com/savsgio/gotils v0.0.0-20230208104028-c358bd845dee // indirect
github.com/sethvargo/go-envconfig v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tinylib/msgp v1.1.8 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.47.0 // indirect
@ -61,11 +59,12 @@ require (
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

View File

@ -5,11 +5,12 @@ github.com/algorand/go-codec/codec v1.1.8 h1:lsFuhcOH2LiEhpBH3BVUUkdevVmwCRyvb7F
github.com/algorand/go-codec/codec v1.1.8/go.mod h1:tQ3zAJ6ijTps6V+wp8KsGDnPC2uhHVC7ANyrtkIY0bA=
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
github.com/benbjohnson/clock v1.3.5/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c=
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U=
github.com/certusone/wormhole/node v0.0.0-20240416174455-25e60611a867 h1:Wdd/ZJuGD3logxkNuT3hA2aq0Uk5uDGMGhca+S1CDnM=
github.com/certusone/wormhole/node v0.0.0-20240416174455-25e60611a867/go.mod h1:vJHIhQ0MeHZfQ4OpGiUCm3LD3nrdfT1CEIh2JaPCCso=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
@ -61,8 +62,8 @@ github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.16.7 h1:2mk3MPGNzKyxErAw8YaohYh69+pa4sIQSC0fPGCFR9I=
github.com/klauspost/compress v1.16.7/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@ -82,8 +83,8 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
@ -93,8 +94,7 @@ github.com/mr-tron/base58 v1.2.0 h1:T/HDJBh4ZCPbU39/+c3rRvE0uKBQlU27+QI8LJ4t64o=
github.com/mr-tron/base58 v1.2.0/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc=
github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ=
github.com/onsi/gomega v1.30.0 h1:hvMK7xYz4D3HapigLTeGdId/NcfQx1VHMJc60ew99+8=
github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw=
github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0=
@ -133,7 +133,6 @@ github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE
github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU=
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tinylib/msgp v1.1.6/go.mod h1:75BAfg2hauQhs3qedfdDZmWAPcFMAvJE5b9rGOMufyw=
github.com/tinylib/msgp v1.1.8 h1:FCXC1xanKO4I8plpHGH2P7koL/RzZs12l/+r7vakfm0=
github.com/tinylib/msgp v1.1.8/go.mod h1:qkpG+2ldGg4xRFmx+jfTvZPxfGFhi64BcnL9vkCm/Tw=
@ -145,8 +144,8 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229 h1:fqcC4qwEVaJfcpqUVKi5+imz+JpxviQYPW4qu3zILz4=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240109172745-cc0cd9fc5229/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240416174455-25e60611a867 h1:GXUBP09C/bnEukdU6H2AY81d0m8UWrWEejDp6CgiFQA=
github.com/wormhole-foundation/wormhole/sdk v0.0.0-20240416174455-25e60611a867/go.mod h1:pE/jYet19kY4P3V6mE2+01zvEfxdyBqv6L6HsnSa5uc=
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g=
@ -166,8 +165,8 @@ go.mongodb.org/mongo-driver v1.11.2/go.mod h1:s7p5vEtfbeR1gYi6pnj3c3/urpbLv2T5Sf
go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk=
go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0=
go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.25.0 h1:4Hvk6GtkucQ790dqmj7l1eEnRdKm3k3ZUrUMS2d5+5c=
go.uber.org/zap v1.25.0/go.mod h1:JIAUzQIH94IC4fOJQm7gMmBJP5k7wQfdcnYdPoEXJYk=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@ -176,8 +175,9 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@ -195,15 +195,16 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.3.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@ -226,8 +227,9 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@ -244,8 +246,9 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
@ -262,6 +265,8 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I=
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=