👩‍💻
Builder Portal
  • Sovryn Builder Portal
    • Contribution
  • Design System
    • Design principles
    • Structure
    • Usage by Sovryn
  • UI Library
    • Overview
    • Getting Started
    • Atoms
      • Accordion
      • Badge
      • HealthBar
      • Button
      • DynamicValue
      • Heading
      • ErrorBadge
      • Icon
      • Input
      • Lottie
      • Paragraph
      • Toggle
      • Link
      • Checkbox
    • Molecules
      • AmountInput
      • ContextLink
      • Dialog
      • Dropdown
      • ErrorList
      • Footer
      • FormGroup
      • Header
      • HelperButton
      • Menu
      • NavMenuItem
      • Notification
      • Overlay
      • Pagination
      • RadioButton
      • RadioButtonGroup
      • Select
      • SimpleTable
      • StatusItem
      • Table
      • TableBase
      • Tabs
      • Tooltip
      • TransactionId
      • VerticalTabs
      • VerticalTabsMobile
      • WalletContainer
      • WalletIdentity
    • Working with Components
    • Links
    • Contribution
  • Sovryn SDK
    • Smart Router
      • Creating a New Swap Route
      • Available routes
        • AMM
        • MoC integration
        • MYNT bAsset
        • MYNT fixed rate
    • Sovryn Onboard
      • Installation
      • Usage
      • Custom Connectors
      • Custom UI
      • Contribution
    • The Graph
      • Overview
      • Usage
      • Sovryn Subgraphs
      • Advanced Usage
  • sovryn.app
    • Overview
    • Sovryn UI Library Usage
    • The Graph Usage
    • Links
    • Contribution
    • Dapp specific components
      • MaxButton
  • Smart Contracts
    • Overview
    • AMM
      • Liquidity
        • V1 Converters
        • V2 Converters
      • Conversion
      • Wrapper
        • V1 liquidity
        • V2 liquidity
        • Swaps
    • Sovryn Protocol
      • Lending
        • Mint
        • Burn
      • Borrowing
        • Borrow
        • Repay
      • Margin Trading
        • Open
        • Close
      • Collateral Management
    • Liquidity Mining
      • Deposit
      • Withdraw
      • Rewards
    • FastBTC
      • RSK->BTC
    • Bitocracy
      • Staking
      • Governor
      • Fee Sharing
      • Vesting
    • Zero
      • Borrower operations
      • Trove Manager
      • Satability Pool
      • Rewards
    • Mynt & DLLR
      • Basset to Masset Conversion
      • Masset to Basset Conversion
      • MOC Integration Conversion
Powered by GitBook
On this page
  1. Sovryn SDK
  2. The Graph

Usage

PreviousOverviewNextSovryn Subgraphs

Last updated 1 year ago

Example on how to use a simple subgraph request

  1. Go to the subgraph explorer:

  1. Decide what you want to query. For this example, we want to see how much SOV each user has voluntarily staked on the Staking contract.

  2. Use the schema explorer to find the correct entities to query:

{
  users {
    id
    stakeHistory {
      totalRemaining
    }
  }
}
  1. Write your query in the left-hand column of the explorer. Read the GraphQL or Graph Protocol documentation for help with the graphQL syntax

  2. Run your query. Take a look at the results:

  1. Edit query if needed. This result probably isn’t what you were looking for - here we are listing all users in alphabetical order by wallet address, even if they do not have any voluntarily staked SOV. We can change the query to this:

{
    userStakeHistories(orderBy: totalRemaining, orderDirection: desc) {
        id
        totalRemaining
      }
}

This query returns results only for users who have voluntarily staked SOV, and orders the results with the largest current SOV staked amount first.

https://subgraph.sovryn.app/subgraphs/name/DistributedCollective/sovryn-subgraph/graphql