Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
crox-safe committed Jan 30, 2025
1 parent efabb38 commit beb5049
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 49 deletions.
48 changes: 18 additions & 30 deletions app/views/cosmos/address/_currencies_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,23 @@
$( document ).ready(function() {

var query = new widgets.query(`
query($network: CosmosNetwork!,
$address: String!,
$from: ISO8601DateTime,
$till: ISO8601DateTime,
$limit: Int!,
$offset: Int!){
cosmos(network: $network) {
transfers(date: {since: $from, till: $till},
any: [{receiver: {is: $address}}, {sender: {is: $address}}]
options: {limit: $limit, offset: $offset, desc: ["count_in","count_out"] asc: "currency.symbol"}){
sum_in: value(calculate: sum,
receiver: {is: $address}
)
sum_out: value(calculate: sum,
sender: {is: $address}
)
count_in: count(
receiver: {is: $address}
)
count_out: count(
sender: {is: $address}
)
currency {
symbol
}
}
}
}`);
query ($network: CosmosNetwork!, $address: String!, $limit: Int!, $offset: Int!) {
cosmos(network: $network) {
transfers(
any: [{receiver: {is: $address}}, {sender: {is: $address}}]
options: {limit: $limit, offset: $offset, desc: ["count_in", "count_out"], asc: "currency.symbol"}
) {
sum_in: value(calculate: sum, receiver: {is: $address})
sum_out: value(calculate: sum, sender: {is: $address})
count_in: count(receiver: {is: $address})
count_out: count(sender: {is: $address})
currency {
symbol
}
}
}
}
`);

new widgets.table('#currencies_table', query, 'cosmos.transfers', {
title: '<%= t('widgets.headers.currencies_sent_received') %>',
Expand Down Expand Up @@ -98,4 +86,4 @@

});

</script>
</script>
31 changes: 12 additions & 19 deletions app/views/cosmos/address/_in_out_transfers_by_time.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,18 @@
$( document ).ready(function() {

var query = new widgets.query(`
query ($network: CosmosNetwork!,
$dateFormat: String!,
$address: String!,
$from: ISO8601DateTime,
$till: ISO8601DateTime){
cosmos(network: $network ){
transfers(date: {
since: $from
till: $till}
options: {asc: "date.date"}
) {
date{
date(format: $dateFormat)
}
in_count: countBigInt(receiver: {is: $address})
out_count: countBigInt(sender: {is: $address})
}
}
}`);
query ($network: CosmosNetwork!, $dateFormat: String!, $address: String!) {
cosmos(network: $network) {
transfers(options: {desc: "date.date", limit: 10}) {
date {
date(format: $dateFormat)
}
in_count: countBigInt(receiver: {is: $address})
out_count: countBigInt(sender: {is: $address})
}
}
}
`);


new widgets.chartByTime('#in_out_transfers_by_time', query, 'cosmos.transfers', {
Expand Down

0 comments on commit beb5049

Please sign in to comment.