Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Polkassembly API integration #79

Merged
merged 23 commits into from
Jun 7, 2023
Merged

Introduce Polkassembly API integration #79

merged 23 commits into from
Jun 7, 2023

Conversation

rzadp
Copy link
Contributor

@rzadp rzadp commented Jun 7, 2023

This introduces a Polkassembly class that integrates with the Polkassembly API.
It works in two modes - with a Polkadot signer, and an Ethereum signer.

The Polkadot signer is to be used in production, and Ethereum signer was used to test it with the Moonbase Alpha.
Once we have another testnet with OpenGov and Polkassembly, we can remove the Ethereum portion.
For now I used Moonbase Alpha EMV chain to semi-manually test it.

@rzadp rzadp requested a review from a team as a code owner June 7, 2023 10:34
if (!loginBody.token) {
throw new Error("Login unsuccessful, the authentication token is missing.");
}
this.token = loginBody.token;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be worth adding some debug logs to login and signup?

src/polkassembly/polkassembly.ts Outdated Show resolved Hide resolved
void (async () => {
const condition = async (): Promise<boolean> => {
const lastReferendum = await polkassembly.getLastReferendumNumber(track.track.trackNo);
return lastReferendum !== undefined && lastReferendum >= referendumId.toNumber();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be vague and there's a chance that someone else right in the same moment posts a referendum to the same track, so we can endup with editing wrong post.
Small chance but exists
I'm curious if there would be more direct way to get a sense of referendum ID once we created this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, there is a small chance it goes wrong.

I don't (yet) know if we can get the ID from the transaction callbacks.

src/tip-opengov.ts Show resolved Hide resolved
@rzadp rzadp merged commit 5fc3d95 into master Jun 7, 2023
@rzadp rzadp deleted the rzadp/polkassembly branch June 7, 2023 16:00
@rzadp rzadp mentioned this pull request Jun 12, 2023
4 tasks
@rzadp
Copy link
Contributor Author

rzadp commented Jun 12, 2023

Note: I have listed some follow-up improvements here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants