Skip to content

[SDK][Subgraph] Implement staking utilities and GraphQL queries for staker#3440

Merged
portuu3 merged 16 commits intocontracts-v2from
feat/3413
Aug 29, 2025
Merged

[SDK][Subgraph] Implement staking utilities and GraphQL queries for staker#3440
portuu3 merged 16 commits intocontracts-v2from
feat/3413

Conversation

@flopez7
Copy link
Copy Markdown
Contributor

@flopez7 flopez7 commented Jul 1, 2025

Issue tracking

#3413

Context behind the change

Implement staking utilities and GraphQL queries for staker management

  • Added staking.py to define GraphQL queries for fetching staker data.
  • Introduced staking_utils.py for utility functions to retrieve staker information and handle filtering.
  • Created unit tests in test_staking_utils.py to ensure functionality of staking utilities.
  • Developed TypeScript examples in staking.ts to demonstrate usage of staking utilities.
  • Implemented GraphQL queries in staking.ts for TypeScript SDK to interact with staker data.
  • Added new Staker entity in subgraph to save all staker data instead of having it inside Operator
  • Updated subgraph tests

How has this been tested?

  • Ran unit tests
  • Deployed locally and make some requests

Release plan

Deploy new subgraph version and SDK

Potential risks; What to monitor; Rollback plan

Check if the new object is being created properly

- Added `staking.py` to define GraphQL queries for fetching staker data.
- Introduced `staking_utils.py` for utility functions to retrieve staker information and handle filtering.
- Created unit tests in `test_staking_utils.py` to ensure functionality of staking utilities.
- Developed TypeScript examples in `staking.ts` to demonstrate usage of staking utilities.
- Implemented GraphQL queries in `staking.ts` for TypeScript SDK to interact with staker data.
@vercel
Copy link
Copy Markdown

vercel bot commented Jul 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
human-app Ready Ready Preview Comment Aug 29, 2025 11:59am
human-dashboard-frontend Ready Ready Preview Comment Aug 29, 2025 11:59am
staking-dashboard Ready Ready Preview Comment Aug 29, 2025 11:59am
2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
faucet-frontend Ignored Ignored Preview Aug 29, 2025 11:59am
faucet-server Ignored Ignored Preview Aug 29, 2025 11:59am

@vercel vercel bot temporarily deployed to Preview – human-dashboard-frontend July 2, 2025 15:33 Inactive
@vercel vercel bot temporarily deployed to Preview – staking-dashboard July 2, 2025 15:33 Inactive
@vercel vercel bot temporarily deployed to Preview – human-app July 2, 2025 15:33 Inactive
Comment thread packages/sdk/typescript/subgraph/tests/staking/staking.test.ts Outdated
Comment thread packages/sdk/typescript/subgraph/src/mapping/StakingTemplate.ts
Comment thread packages/sdk/python/human-protocol-sdk/human_protocol_sdk/filter.py
Comment thread packages/sdk/python/human-protocol-sdk/scripts/run-unit-test.sh Outdated
Comment thread packages/sdk/python/human-protocol-sdk/example.py Outdated
Comment thread packages/sdk/typescript/human-protocol-sdk/example/operator.ts
…te getOperators to use POLYGON_AMOY and some other stuff used for tests
Copy link
Copy Markdown
Collaborator

@portuu3 portuu3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Update references to operator utils.
  • Change fields like amountStaked to stakedAmount (misspeling)

Comment thread packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts Outdated
Comment thread packages/sdk/typescript/subgraph/tests/staking/staking.test.ts Outdated
Comment thread packages/sdk/typescript/subgraph/src/mapping/StakingTemplate.ts
Comment thread packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/staking.py Outdated
  - `amountStaked` to `stakedAmount`
  - `amountLocked` to `lockedAmount`
  - `amountWithdrawn` to `withdrawnAmount`
  - `amountSlashed` to `slashedAmount`
Comment thread packages/sdk/python/human-protocol-sdk/example.py Dismissed
@vercel vercel bot temporarily deployed to Preview – staking-dashboard August 20, 2025 12:28 Inactive
@vercel vercel bot temporarily deployed to Preview – human-dashboard-frontend August 20, 2025 12:28 Inactive
@flopez7 flopez7 requested a review from portuu3 August 20, 2025 12:42
Comment thread packages/apps/human-app/frontend/package.json
Comment thread packages/apps/human-app/frontend/package.json
Comment thread packages/apps/dashboard/client/package.json
Comment thread packages/sdk/typescript/human-protocol-sdk/test/staking.test.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants