All phases of Avail's unification drop have now ended, 👉👉 check out this page 👈👈 for more information.

API reference
Fetch App IDs from Avail DA

Fetch App IDs from Avail DA

On-chain name of method: dataAvailablity_appKeys

Parameters

parametertypeoptionaldescription
keystringtrueThe app_id associated with this key will be fetched

Return value

On failure, a reason for failure is returned. On sucess, the returned JSON object contains:

  1. Owner: The owner of the app_id
  2. AppId: The numerical index of the app_id

Minimal example (Fetch a particular app_id)

You will need to set up the dev enviornment required to run this example. For instructions, check out our docs here.

  1. Inside your-file-name.ts, add the following code:
avail-deno
import { SDK } from "https://raw.githubusercontent.com/availproject/avail/main/avail-deno/src/sdk.ts";
 
const providerEndpoint = "wss://turing-rpc.avail.so/ws";
const sdk = await SDK.New(providerEndpoint);
 
const key = "Reserved-2";
const value = await sdk.api.query.dataAvailability.appKeys(key);
console.log(value.toHuman());
 
Deno.exit();
  1. Run the code using:
deno run --allow-net your-file-name.ts

Sample Response:
{ owner: "5CK87QdvhcSJvVa7ZACcEfd5i7J1GqoqbEFB2kzNn3Ms13fE", id: "2" }

Another example (Fetch all available app_ids registered on Avail DA)

  1. Think of the dataAvailablity_appKeys as a method that returns all the app_ids registered on Avail DA as a mapping of their names to their owner and index.
  2. In most cases a dev will be interested in fetching only a particular app_id and not all of them.
  3. We are however including both scenarios here.
  1. Inside your-file-name.ts, add the following code:
avail-deno
import { SDK } from "https://raw.githubusercontent.com/availproject/avail/main/avail-deno/src/sdk.ts";
 
const providerEndpoint = "wss://turing-rpc.avail.so/ws";
const sdk = await SDK.New(providerEndpoint);
 
const appKeys = await sdk.api.query.dataAvailability.appKeys.entries();
for (const [key, value] of appKeys) {
	console.log(key.toHuman());
	console.log(value.toHuman());
}
 
Deno.exit();   
  1. Run the code using:
deno run --allow-net your-file-name.ts