Skip to main content

OneSource Playground

Key Features

  • Autocomplete & Validation: Get suggestions and error messages as you type, ensuring your requests are correct.
  • Query Templates: The playground is preloaded with a selection of query templates to get you started right away.
  • Pre-configured for OneSource: Our Ethereum endpoint is pre-configured so that you can simply input your API key upon page load and start playing.

Accessing the Playground

To access the OneSource Playground:

  1. Login to your OneSource account and copy your API key value (BP-{KEYVALUE} only).
  2. Navigate your browser to playground.onesource.io.
  3. Paste your API key value into the prompt that appears upon loading the playground and push 'OK'.
OneSource Playground Enter API Key
note

You must have an active API key to use the playground. If you don't have one, refer to Get an API Key for information on how to get one.

Should you make a mistake when pasting your API key value into the prompt, navigate to the playground settings via the gear wheel icon in the upper right and correct your API key value.

OneSource Playground Settings

Using the Playground

Execute the Preloaded Queries

The playground is preloaded with three query templates with query variables ready to execute:

  1. Get Token: Retrieves data pertaining to a particular ERC-721 token.
  2. Get Token with Image: Retrieves data and images pertaining to a particular ERC-721 token.
  3. Get Owner by Balances by Contract: Retrieves balances data pertaining to a particular ERC-721 token for a specific wallet address.

Get started with the playground by executing the preloaded query templates with query variables using the play button in the middle of the interface and evaluating the responses that appear in the right panel.

OneSource Playground Customize Preloaded Query

Customize Preloaded Query Variables

Try replacing the query variables with variables more relevant to your interests or project and executing the queries again.

OneSource Playground Preloaded Query

Write a Custom Query

To begin writing a custom query, click the + button to open a new tab.

OneSource Playground Custom Query

For guidance on how to write and structure a custom query, refer to the OneSource Web3 API Reference. You may also refer to the DOCS and SCHEMA tabs on the right side of the playground for reference when writing custom queries.

OneSource Playground Docs/Schema Tabs

History

The playground saves every query that you run throughout your session. Click the HISTORY button to view and revert back to previously executed queries from your current session.

OneSource Playground History

You can STAR specific queries to make them easier to find in your session history.

Query Templates

Use these query templates to get acquainted with OneSource.

Please refer to the OneSource Web3 API Reference for comprehensive documentation of all available queries to use as guidance when building your own queries.

Get ERC-20 Token Details

This query fetches all available data about a given ERC-20 token contract.

query Contract($contractId: ID!) {
contract(id: $contractId) {
id
type
name
symbol
decimals
createdAt
createdBlock
holders
}
}

Variables

{
"contractId": "contract-address-here"
}

Get NFT Token Details

This query fetches the name, description, medium thumbnail image, and contract address and type of a given NFT token.

query Token($contract: ID!, $tokenID: ID!) {
token(contract: $contract, tokenID: $tokenID) {
name
description
image {
thumbnails(where: { preset: MEDIUM }) {
url
}
}
contract {
id
isERC721
isERC1155
}
}
}

Variables

{
"contract": "NFT-contract-address-here",
"tokenID": "123"
}

Get NFT Token Details With Image

This query fetches the name, symbol, and type of an NFT contract as well as its token URI and every available media thumbnail size with dimensions and type of each.

query GetTokenWithImage(
$contract: ID!
$tokenID: ID!
) {
token(
contract: $contract
tokenID: $tokenID
) {
contract {
id
type
name
symbol
decimals
}
tokenID
tokenURI
tokenURIStatus
image {
status
url
contentType
width
height
thumbnails {
preset
status
url
width
height
contentType
createdAt
}
createdAt
errorMsg
}
createdAt
createdBlock
}
}

Variables

{
"contract": "NFT-contract-address-here",
"tokenID": "123"
}

Get Wallet Token Balance

This query fetches a wallet's balance of a given ERC-20 token contract as well as the ERC-20 token contract's name, symbol and type. This query could be amended for an ERC-721 or ERC-1155 token by adding the tokenID argument to the query and variables.

query Balance($owner: ID!, $contract: ID!) {
balance(owner: $owner, contract: $contract) {
value
contract {
name
symbol
}
contractType
owner
}
}

Variables

{ "owner": "wallet-address-here",
"contract": "erc-20-contract-address-here"
}

Get All Tokens With Name Containing a Word

This query fetches all tokens with a name containing a word or string of characters.

query Contracts($where: ContractFilter) {
contracts(where: $where) {
contracts {
name
symbol
type
id
}
}
}

Variables

{
"where": {
"name_like": "word-here"
}
}