Query subscriptions
Here is an example of how to query subscriptions given their respective index using sub2-sdk. As mentioned here, subscriptions are stored in one public array called subscriptions
and are uniquely identified by their index in the array. Since the array is public, we can query all the information of a subscription using their index. Assuming sub2-sdk is installed and initialised like shown here, we can query the subscription as follows:
Here, indices
has type bigint[]
.The getSubscription
function returns a promise with a Subscription[] array. Each Subscription object contains both the on-chain data and auxiliary information:
Now we have obtained all information about the subscriptions!
Last updated