Decentralized DAB by NFID Labs

Thanks for the update, @nadiein ! With the following script I am able to list 30 SNS index canisters:

#!/bin/bash
export DFX_WARNING="-mainnet_plaintext_identity"
ROOT_CANISTERS=$(curl -s "https://sns-api.internetcomputer.org/api/v1/snses?max_sns_index=99&offset=0&limit=100&include_swap_lifecycle=LIFECYCLE_COMMITTED" | jq -r ".data[].root_canister_id")
for root_canister in ${ROOT_CANISTERS};
do
  data=$(curl -s "https://sns-api.internetcomputer.org/api/v1/snses/$root_canister")
  name=$(printf "%-20s%s\n" `echo $data | jq -r ".name"`)
  canister_type_and_id=$(echo ${data} | jq -cr '.canisters[] | "\(.canister_type):\(.canister_id)"')
  for id in $canister_type_and_id
  do
    if [[ $id == *"index"* ]]
    then
      name=$(echo $name | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//' | sed 's/ /-/g' | tr '[:lower:]' '[:upper:]')
      echo -e "$name: \t$id" | sed 's/index://g'
    fi
  done
done

Based on what you wrote and your screenshot, I cannot say where the issue is. Maybe you’re not specifying a large enough limit, and only get information from 20 SNSs in the response to your query?

There is ongoing work on the ICRC-106 standard that allows for retrieving information about the index canister ID from its ledger canister. There’s also some discussion around it in this forum thread. At this time I would expect the functionality to be available in January 2025.

Since there is currently no standard for the ledger index, ICRC-106 is more of a stop-gap solution for supporting existing use cases. There are plans to work on an index standard as a follow-up.

2 Likes