Sample queries for common use cases

List of available Assets

{
  assets {
    nodes {
      id
      name
      certificates {
        nodes {
          type
          expiry
        }
      }
    }
  }
}
{
  "data": {
    "assets": {
      "nodes": [
        {
          "id": "$ASSET_ID",
          "name": "Asset1",
          "certificates": {
            "nodes": [
              {
                "type": "KYA",
                "expiry": 1893456000000
              }
            ]
          }
        },
        {
          "id": "$ASSET_ID",
          "name": "Asset2",
          "certificates": {
            "nodes": [
              {
                "type": "KYA",
                "expiry": 4102444800000
              }
            ]
          }
        },
        {
          "id": "$ASSET_ID",
          "name": "Asset3",
          "certificates": {
            "nodes": [
              {
                "type": "KYA",
                "expiry": 4102444800000
              }
            ]
          }
        }
      ]
    }
  }
}

Get a specific User information

{
  users (filter: {key:"id", operator:EQ, value:"$USER_ID"}) {
    nodes {
      id
      name
      organizationId
      tokens {
        nodes {
          assetId
          quantity
        }
      }
      certificates  {
        nodes {
          expiry
          type
        }
      }
    }
  }
}
{
  "data": {
    "users": {
      "nodes": [
        {
          "id": "$USER_ID",
          "name": "User-1",
          "organizationId": "Organization-X",
          "tokens": {
            "nodes": [
              {
                "assetId": "Asset-1"
                "quantity": "50"
              },
              {
                "assetId": "Asset-2"
                "quantity": "200"
              },
              {
                "assetId": "Asset-3"
                "quantity": "1030"
              }
            ]
          },
          "certificates": {
            "nodes": [
              {
                "expiry": 1913016315891,
                "type": "KYC"
              }
            ]
          }
        }
      ]
    }
  }
}

Get the sum of a user's holdings in a specific Asset's tokens

{
  users (filter:{ key:"id", operator:EQ, value:"$USER_ID"}) {
    nodes {
      tokens (filter : {key:"assetId", operator:EQ, value:"$ASSET_ID"}) {
        nodes {
          quantity
        }
      }
      
    }
  }
}
{
  "data": {
    "users": {
      "nodes": [
        {
          "tokens": {
            "nodes": {
              "quantity": "450"
            }
          }
        }
      ]
    }
  }
}

Overview of Asset's tokens distribution across users (Cap Table)

capTable:assets(filter: {key: "id", operator:EQ, value:"$ASSET_ID"}){
    nodes {
      issuedTokens {
        nodes {
          userId
          quantity
        }
      }
    }
  }
}
{
  "data": {
    "capTable": {
      "nodes": [
        {
          "issuedTokens": {
            "nodes": [
              {
                "userId": "$USER_ID",
                "quantity": "200"
              },
              {
                "userId": "$USER_ID",
                "quantity": "100"
              }
            ]
          }
        }
      ]
    }
  }
}

Show the Organization's Assets ACL information i.e. with which organization on the FinP2P network the asset is shared with

{  
  ACL:organizations (filter:{key:"id", operator:EQ, value:"$NODE_ID"}) {
    nodes {
      assets {
        nodes {
      id
      metadata {
        acl
      }  
     }
    }
  }
}
}
{
  "data": {
    "ACL": {
      "nodes": [
        {
          "assets": {
            "nodes": [
              {
                "id": "$ASSET_ID",
                "metadata": {
                  "acl": [
                    "Organization-X",
                    "Organization-Y"
                  ]
                }
              },
              {
                "id": "$ASSET_ID",
                "metadata": {
                  "acl": []
                }
              },
              {
                "id": "$ASSET_ID",
                "metadata": {
                  "acl": [
                    "Organization-Y"                   
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  }
}

Get users ids which have a certificate of type "KYC\AML" and the certificate expiry greater then or equal to 1629192223296

{
  certificates(filter: [{key: "type",  operator: EQ, value:"KYC/AML"},
                            {key: "expiry",  operator: GTE, value:"1629192223296"}]) {
    nodes {
    profileId
    } 
}
}
{
  "data": {
    "certificates": {
      "nodes": [
        {
          "profileId": "$USER_ID"
        },
        {
          "profileId": "$USER_ID"
        },
        {
          "profileId": "$USER_ID"
        }
      ]
    }
  }
}

Get intent creator information using the IN filter

{
  assets(filter: {key:"id", operator:IN, value:"[\"ASSET_ID1\", \"ASSET_ID2\"]"}){
    nodes{
          name
            type
            intents {
            nodes {
              intent {
                __typename
                ... on PrimarySale {
                  issuerId
                }
                ... on BuyingIntent {
                  buyer
                }
                ... on SellingIntent {
                  seller
                }
              }
            }
          }
    }
  }
}
{
  "data": {
    "assets": {
      "nodes": [
        {
          "name": "ASSET_1",
          "type": "Company",
          "intents": {
            "nodes": [
              {
                "intent": {
                  "__typename": "PrimarySale",
                  "issuerId": "ISSUER_ID"
                }
              }
            ]
          }
        },
        {
          "name": "ASSET_2",
          "type": "Debt",
          "intents": {
            "nodes": [
              {
                "intent": {
                  "__typename": "BuyingIntent",
                  "buyer": "BUYER_ID"
                }
              }
            ]
          }
        }
      ]
    }
  }
}