Skip to content

feat(wallet): integrate wallet + enforce chain, update /blockchain dev page - #65

Open
zohersahli wants to merge 12 commits into
Kattenelvis:devfrom
zohersahli:dev-blockchain-v2
Open

feat(wallet): integrate wallet + enforce chain, update /blockchain dev page#65
zohersahli wants to merge 12 commits into
Kattenelvis:devfrom
zohersahli:dev-blockchain-v2

Conversation

@zohersahli

Copy link
Copy Markdown

feat(wallet): integrate wallet + enforce chain, update /blockchain dev page

Switch GroupThumbnail, GroupSidebar, and CreateEditGroup to V2 membership service.
Use group.blockchain_id for on-chain calls and keep backend id for API routes.
Add membership.ts + Polls.v2 ABI under web3/frontend.
Update GroupDetails type to include blockchain_id.
Comment thread src/lib/Delegation/Delegation.svelte Outdated
Comment thread src/lib/Delegation/Delegation.svelte Outdated
Comment thread src/lib/Delegation/Delegation.svelte Outdated
Comment thread src/lib/Delegation/Delegation.svelte Outdated
Comment thread src/lib/Delegation/Delegation.svelte Outdated
Comment thread src/lib/web3/frontend/membership.ts
Comment thread src/routes/blockchain/+page.svelte Outdated
Comment thread src/routes/blockchain/+page.svelte Outdated
Comment thread src/routes/user/settings/+page.svelte Outdated
Comment thread src/routes/user/settings/+page.svelte Outdated
extract on-chain delegation logic into separate file

simplify delegation component responsibilities

remove unnecessary helper and as any usage

improve null safety for group and groupUser

clarify backend desync handling after on-chain success

remove finally block and make loading state explicit
clean blockchain checks, remove unnecessary helper/comment, and improve backend desync handling
clean ES6 style, remove duplication, and improve contract typings
group local state declarations and replace inline styles with Tailwind classes
move wallet variables to top-level declarations and use shared ErrorHandlerStore
convert delegations and wallet helpers to ES6 arrow function style

let group: Group | undefined,
groups: Group[] = [],
groupUser: GroupUser | undefined,

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why are we removing type safety?

const createDelegationPool = async () => {
if (!group) {
ErrorHandlerStore.set({
message: 'Missing group. Cannot create delegation pool.',

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This just isn't needed if group is never undefined

Comment thread src/lib/Delegation/Delegation.svelte
error: unknown,
fallbackMessage: string
): string => {
if (typeof error === 'object' && error !== null) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

do you think "if (error)" is enough?

const deleteDelegation = async () => {
await deleteDelegationPool();
const success = await deleteDelegationPool();
if (!success) return;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

do we also add ErrorMessage?

Makes the currently logged in user no longer a delegate(pool)
*/
const deleteDelegationPool = async () => {
const deleteDelegationPool = async (): Promise<boolean> => {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The function appears to be returning boolean, not Promise<boolean>, am I getting that right?

address: string,
groupId: bigint
) => Promise<boolean>;
};

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What am I even looking at 🫪

pollId = 8,
proposalId = 1;

let connecting = false;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This one looks a bit lonely

let connecting = false;

async function refreshNetwork() {
if (typeof window === 'undefined' || !window?.ethereum) return;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

typeof window === 'undefined'?

@Kattenelvis
Kattenelvis force-pushed the dev branch 5 times, most recently from bb57c5c to d798a39 Compare June 15, 2026 19:19
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.

2 participants