Skip to content

Commit

Permalink
chore: add anonymous role
Browse files Browse the repository at this point in the history
  • Loading branch information
albttx committed Sep 11, 2024
1 parent cbd583d commit 3d26b7b
Show file tree
Hide file tree
Showing 26 changed files with 273 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ services:
networks:
- eclesia-indexer_default
environment:
# whitelist of gql queries for security purpose
HASURA_GRAPHQL_ENABLE_ALLOWLIST: "true"
# queries are send with x-hasura-role: anonymous
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: "anonymous"
## postgres database to store Hasura metadata
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/metadata-govgen-dapp
## this env var can be used to add the above postgres database to Hasura as a data source. this can be removed/updated based on your needs
Expand Down
8 changes: 8 additions & 0 deletions hasura/metadata/databases/default/tables/public_accounts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,11 @@ array_relationships:
table:
name: validator_infos
schema: public
select_permissions:
- comment: ""
permission:
allow_aggregations: true
columns:
- address
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ configuration:
insert_one: insert_average_block_time_per_day
select_by_pk: average_block_time_per_day
update_by_pk: update_average_block_time_per_day
select_permissions:
- comment: ""
permission:
columns:
- height
- one_row_id
- average_time
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ configuration:
insert_one: insert_average_block_time_per_hour
select_by_pk: average_block_time_per_hour
update_by_pk: update_average_block_time_per_hour
select_permissions:
- comment: ""
permission:
columns:
- height
- one_row_id
- average_time
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ configuration:
insert_one: insert_average_block_time_per_minute
select_by_pk: average_block_time_per_minute
update_by_pk: update_average_block_time_per_minute
select_permissions:
- comment: ""
permission:
columns:
- height
- one_row_id
- average_time
filter: {}
role: anonymous
9 changes: 9 additions & 0 deletions hasura/metadata/databases/default/tables/public_balances.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ object_relationships:
- name: block
using:
foreign_key_constraint_on: height
select_permissions:
- comment: ""
permission:
columns:
- coins
- height
- address
filter: {}
role: anonymous
12 changes: 12 additions & 0 deletions hasura/metadata/databases/default/tables/public_blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,15 @@ array_relationships:
table:
name: validator_voting_powers
schema: public
select_permissions:
- comment: ""
permission:
columns:
- height
- total_gas
- num_txs
- hash
- proposer_address
- timestamp
filter: {}
role: anonymous
10 changes: 10 additions & 0 deletions hasura/metadata/databases/default/tables/public_gov_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ object_relationships:
- name: block
using:
foreign_key_constraint_on: height
select_permissions:
- comment: ""
permission:
columns:
- height
- deposit_params
- tally_params
- voting_params
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,14 @@ object_relationships:
- name: proposal
using:
foreign_key_constraint_on: proposal_id
select_permissions:
- comment: ""
permission:
columns:
- amount
- height
- proposal_id
- depositor_address
- timestamp
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,13 @@ object_relationships:
- name: proposal
using:
foreign_key_constraint_on: proposal_id
select_permissions:
- comment: ""
permission:
columns:
- height
- proposal_id
- bonded_tokens
- not_bonded_tokens
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,15 @@ object_relationships:
- name: proposal
using:
foreign_key_constraint_on: proposal_id
select_permissions:
- comment: ""
permission:
columns:
- height
- proposal_id
- abstain
- no
- no_with_veto
- yes
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,16 @@ object_relationships:
- name: validator
using:
foreign_key_constraint_on: validator_address
select_permissions:
- comment: ""
permission:
columns:
- height
- voting_power
- jailed
- id
- proposal_id
- status
- validator_address
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,17 @@ object_relationships:
- name: proposal
using:
foreign_key_constraint_on: proposal_id
select_permissions:
- comment: ""
permission:
allow_aggregations: true
columns:
- height
- is_valid
- proposal_id
- option
- voter_address
- weight
- timestamp
filter: {}
role: anonymous
24 changes: 24 additions & 0 deletions hasura/metadata/databases/default/tables/public_proposals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,27 @@ computed_fields:
name: rejected_first
schema: public
name: rejected_first_order
select_permissions:
- comment: ""
permission:
allow_aggregations: true
columns:
- id
- content
- description
- proposal_route
- proposal_type
- proposer_address
- status
- title
- deposit_end_time
- submit_time
- voting_end_time
- voting_start_time
computed_fields:
- active_first_order
- failed_first_order
- passed_first_order
- rejected_first_order
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,13 @@ object_relationships:
- name: validatorByValidator
using:
foreign_key_constraint_on: validator
select_permissions:
- comment: ""
permission:
columns:
- amount
- height
- delegator
- validator
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,11 @@ configuration:
insert_one: insert_staking_param
select_by_pk: staking_param
update_by_pk: update_staking_param
select_permissions:
- comment: ""
permission:
columns:
- height
- params
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,12 @@ configuration:
insert_one: insert_staking_pool
select_by_pk: staking_pool
update_by_pk: update_staking_pool
select_permissions:
- comment: ""
permission:
columns:
- height
- bonded_tokens
- not_bonded_tokens
filter: {}
role: anonymous
8 changes: 8 additions & 0 deletions hasura/metadata/databases/default/tables/public_supplies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,11 @@ object_relationships:
- name: block
using:
foreign_key_constraint_on: height
select_permissions:
- comment: ""
permission:
columns:
- coins
- height
filter: {}
role: anonymous
18 changes: 18 additions & 0 deletions hasura/metadata/databases/default/tables/public_transactions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,21 @@ object_relationships:
- name: block
using:
foreign_key_constraint_on: height
select_permissions:
- comment: ""
permission:
columns:
- signatures
- gas_used
- gas_wanted
- height
- success
- fee
- logs
- messages
- signer_infos
- hash
- memo
- raw_log
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ object_relationships:
- name: validator_info
using:
foreign_key_constraint_on: validator_address
select_permissions:
- comment: ""
permission:
columns:
- height
- min_self_delegation
- commission
- validator_address
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,17 @@ object_relationships:
- name: validator_info
using:
foreign_key_constraint_on: validator_address
select_permissions:
- comment: ""
permission:
columns:
- height
- avatar_url
- details
- identity
- moniker
- security_contact
- validator_address
- website
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,15 @@ array_relationships:
table:
name: validator_voting_powers
schema: public
select_permissions:
- comment: ""
permission:
columns:
- height
- consensus_address
- max_change_rate
- max_rate
- operator_address
- self_delegate_address
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,13 @@ object_relationships:
- name: validator_info
using:
foreign_key_constraint_on: validator_address
select_permissions:
- comment: ""
permission:
columns:
- height
- jailed
- status
- validator_address
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ object_relationships:
- name: validator_info
using:
foreign_key_constraint_on: validator_address
select_permissions:
- comment: ""
permission:
columns:
- height
- voting_power
- validator_address
filter: {}
role: anonymous
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ array_relationships:
table:
name: staked_balances
schema: public
select_permissions:
- comment: ""
permission:
columns:
- consensus_address
- consensus_pubkey
filter: {}
role: anonymous
4 changes: 4 additions & 0 deletions src/apolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ console.log("[DEBUG] env", import.meta.env);
const httpLink = createHttpLink({
// You should use an absolute URL here
uri: import.meta.env.VITE_GRAPHQL_ENDPOINT ?? "https://graphql-devnet.govgen.dev/v1/graphql",

headers: {
"x-hasura-role": "anonymous",
},
});

// Cache implementation
Expand Down

0 comments on commit 3d26b7b

Please sign in to comment.