diff --git a/api/spec/v1.yaml b/api/spec/v1.yaml index d29dceb07..efcb1538e 100644 --- a/api/spec/v1.yaml +++ b/api/spec/v1.yaml @@ -977,6 +977,11 @@ paths: - *limit - *offset - *runtime + - in: query + name: name + schema: + type: string + description: A filter on the name, the name must contain this value as a substring. responses: '200': description: The requested tokens. diff --git a/storage/client/client.go b/storage/client/client.go index 2fa4fe342..c9ad1e609 100644 --- a/storage/client/client.go +++ b/storage/client/client.go @@ -1448,6 +1448,7 @@ func (c *StorageClient) RuntimeTokens(ctx context.Context, p apiTypes.GetRuntime queries.EvmTokens, runtimeFromCtx(ctx), address, + p.Name, p.Limit, p.Offset, ) diff --git a/storage/client/queries/queries.go b/storage/client/queries/queries.go index 49abe9790..c2155c1a9 100644 --- a/storage/client/queries/queries.go +++ b/storage/client/queries/queries.go @@ -466,10 +466,11 @@ const ( WHERE (tokens.runtime = $1) AND ($2::oasis_addr IS NULL OR tokens.token_address = $2::oasis_addr) AND + ($3::text IS NULL OR tokens.token_name ILIKE '%' || $3 || '%' OR tokens.symbol ILIKE '%' || $3 || '%') AND tokens.token_type != 0 -- exclude unknown-type tokens; they're often just contracts that emitted Transfer events but don't expose the token ticker, name, balance etc. ORDER BY num_holders DESC - LIMIT $3::bigint - OFFSET $4::bigint` + LIMIT $4::bigint + OFFSET $5::bigint` //nolint:gosec // Linter suspects a hardcoded credentials token. EvmTokenHolders = `