Skip to content

Commit

Permalink
Merge pull request #594 from input-output-hk/feature/expose-all-rewar…
Browse files Browse the repository at this point in the history
…d-types

feature: include all reward types in Reward model, adds `type` field
  • Loading branch information
rhyslbw authored Sep 17, 2021
2 parents 0a13e5b + 6f1ddd9 commit 8fa2893
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ SELECT
reward.amount,
stake_address.view AS "address",
reward.earned_epoch AS "earnedInEpochNo",
reward.pool_id AS pool_hash_id
reward.pool_id AS pool_hash_id,
reward.type AS "type"
FROM reward
JOIN stake_address on reward.addr_id = stake_address.id
WHERE type = 'member';
JOIN stake_address on reward.addr_id = stake_address.id;

CREATE VIEW "Script" AS
SELECT
Expand Down
5 changes: 4 additions & 1 deletion packages/api-cardano-db-hasura/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,8 @@ type Reward {
address: StakeAddress!
amount: String!
earnedIn: Epoch!
stakePool: StakePool!
stakePool: StakePool
type: String!
}

type Reward_aggregate {
Expand Down Expand Up @@ -648,13 +649,15 @@ input Reward_bool_exp {
amount: text_comparison_exp
earnedIn: Epoch_bool_exp
stakePool: StakePool_bool_exp
type: text_comparison_exp
}

input Reward_order_by {
address: order_by
amount: order_by
earnedIn: Epoch_order_by
stakePool: StakePool_order_by
type: order_by
}

type Script {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ query rewardsForAddress (
earnedIn {
number
}
type
}
}
1 change: 1 addition & 0 deletions packages/api-cardano-db-hasura/test/rewards.query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ describe('rewards', () => {
expect(rewards.length).toBe(5)
expect(rewards[0].stakePool.hash).toBeDefined()
expect(rewards[0].earnedIn.number).toBeDefined()
expect(rewards[0].type).toBeDefined()
})

it('can return aggregated data on all delegations', async () => {
Expand Down

0 comments on commit 8fa2893

Please sign in to comment.