DeployedAndInitialized

This query retrieves deployed and initialized Diamond instances from the subgraph. The query allows for filtering, ordering, and pagination of results.

Definition

query DeployedAndInitialized($deployedAndInitializedFilter: DiamondDeployedAndInitialized_filter, $first: Int, $skip: Int) {
  diamondDeployedAndInitializeds(
    where: $deployedAndInitializedFilter,
    orderBy: blockTimestamp,
    orderDirection: desc,
    first: $first,
    skip: $skip
  ) {
    id
    diamondAddress
    admin
    blockNumber
    blockTimestamp
    transactionHash
  }
}

Parameters

  • $deployedAndInitializedFilter: A filter object for narrowing down the query results based on specific criteria.
  • $first: The number of records to retrieve.
  • $skip: The number of records to skip.

Returns

  • id: The unique identifier of the deployed and initialized Diamond instance.
  • diamondAddress: The address of the Diamond contract.
  • admin: The address of the admin who deployed and initialized the Diamond instance.
  • blockNumber: The block number at which the Diamond instance was deployed and initialized.
  • blockTimestamp: The timestamp of the block at which the Diamond instance was deployed and initialized.
  • transactionHash: The transaction hash of the deployment and initialization transaction.

Usage Example

This example demonstrates how to use the DeployedAndInitialized query to retrieve the first 10 deployed and initialized Diamond instances administered by a specific address. The results are ordered by the block timestamp in descending order.

To use the DeployedAndInitialized query in your client-side code, you can use the getSubgraphSDK function to get the GraphQL client and then perform the query as shown below:

import { getSubgraphSDK } from 'cts-tokenizer-sdk';
import { ChainId } from 'cts-tokenizer-sdk';

// Define the chain ID
const chainId: ChainId = 11155111;

// Get the subgraph SDK
const subgraphSdk = getSubgraphSDK(chainId);

// Define the query parameters
const queryVariables = {
  deployedAndInitializedFilter: { admin: "0xAdminAddress" },
  first: 10,
  skip: 0,
};

// Perform the query
subgraphSdk.DeployedAndInitialized(queryVariables).then(response => {
  console.log(response);
}).catch(error => {
  console.error(error);
});