App Ids
are core to the dev experience on Avail DA, and we highly recommend you understand how they work before you start working with them.
You can check out our docs for the same.
Fetch the next available App ID on Avail DA
On-chain name of method: dataAvailablity_nextAppId
app_ids
, once registered, cannot be claimed by another dev.
You can use this method to fetch the next available app_id
for your awesome rollup :)
Parameters
- None
Returns
app_id
: The next available App ID
Minimal example (Fetch the next available app_id
)
-
You will need to set up the dev enviornment required to run this example. For instructions, check out our docs here.
-
If you're sending an extrinsic (i.e conducting a transaction) you will need to replace the demo seed phrase with your own seed phrase. The rest of the code should work as is.
- Inside
your-file-name.ts
, add the following code:
avail-js
import { SDK } from "avail-js-sdk"
const main = async () => {
const providerEndpoint = "wss://turing-rpc.avail.so/ws"
const sdk = await SDK.New(providerEndpoint)
const value = await sdk.api.query.dataAvailability.nextAppId()
console.log(value.toHuman())
process.exit()
}
main()
- Run the code using:
ts-node your-file-name.ts
Sample Response:
99