You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Different chains come with different spender track configurations, which unfortunately is not available on-chain, but rather as hard-coded values. By default, referenda SDK will use the values from polkadot, but other chains might have others. To use kusama, you can import the kusama configuration and pass it into the options parameter:
41
+
Different chains have their own spender track configurations, which unfortunately are hard-coded and not available on-chain. By default, the Referenda SDK uses Polkadot's configuration. For Kusama, you can import the Kusama configuration and pass it into the options parameter:
There are many origins to choose when creating a referendum, each one have[specific purposes](https://wiki.polkadot.network/docs/learn-polkadot-opengov-origins#origins-and-tracks-info).
53
+
There are multiple origins to choose from when creating a referendum, each with[specific purposes](https://wiki.polkadot.network/docs/learn-polkadot-opengov-origins#origins-and-tracks-info).
53
54
54
-
For creating a referendum that requires a treasury spend of a certain value, this Referenda SDK will choose the appropriate origin for you:
55
+
For creating a referendum that requires a treasury spend, the SDK automatically selects the appropriate origin:
When creating a referendum, if the call is not too long it can be inlined in the same referendum submit call, otherwise it needs to be registered as a preimage.
98
-
99
-
The Referenda SDK for both cases (createReferenda and createSpenderReferenda) will inline the call as long as the call data falls within that limit, otherwise it will automatically create a batch call that will do both creating the preimage and submitting the referendum with the same transaction.
98
+
When creating a referendum, if the call is short it can be inlined directly in the referendum submit call. Otherwise, it must be registered as a preimage. The SDK automatically handles this, inlining the call if possible or creating a batch transaction to register the preimage and submit the referendum with just one transaction.
100
99
101
-
## Get ongoing referenda
100
+
## Fetching Ongoing Referenda
102
101
103
-
Referenda get mostly removed from chain once they are closed. Referenda SDK relies with on-chain data, so currently it will list the ongoing referenda from on-chain data.
102
+
Closed referenda are mostly removed from the chain. The Referenda SDK lists ongoing referenda based from on-chain data:
`OngoingReferendum`represents an ongoing referendum, and adds a few methods to work with it.
108
+
`OngoingReferendum`provides helpful methods to interact with proposals.
110
109
111
110
First of all, the proposal on a referendum can be inlined or through a preimage. `OngoingReferendum` unwraps this to get the raw call data or even the decoded call data:
console.log(awaitreferenda[0].proposal.resolve());// Binary with the call data
115
+
console.log(awaitreferenda[0].proposal.decodedCall());// Decoded call data
117
116
```
118
117
119
-
It also adds a couple of functions to get the expected block this referendum will enter confirmation or finish confirmation:
118
+
You can also check when the referendum enters or finishes the confirmation phase:
120
119
121
120
```ts
122
-
console.log(awaitreferenda[0].getConfirmationStart()) // number | null
123
-
console.log(awaitreferenda[0].getConfirmationEnd()) // number | null
121
+
console.log(awaitreferenda[0].getConfirmationStart());// number | null
122
+
console.log(awaitreferenda[0].getConfirmationEnd()); // number | null
124
123
```
125
124
126
-
Lastly, there is some useful information that's not available on-chain, but through the public forums (e.g. OpenGov or subsquare). To get the title of a referendum, the one you would see in either of the forums, you can use a [Subscan API Key](https://support.subscan.io) to fetch that information for you:
125
+
Lastly, there is some useful information that's not available on-chain, but through the public forums (e.g. OpenGov or subsquare). To fetch this information, like the referendum title, you can use a [Subscan API Key](https://support.subscan.io):
0 commit comments