snapshot-labs / sx-monorepo

Snapshot monorepo
https://snapshot.box
MIT License
14 stars 12 forks source link

feat: move non-network action and api out of networks module #359

Open wa0x6e opened 4 months ago

wa0x6e commented 4 months ago

Context: https://github.com/snapshot-labs/sx-monorepo/pull/293#discussion_r1609551308

Some actions, such as

And api:

are not network specific, as it will always use sequencer from v1 as source of truth. Later, some user profile related actions/api, as well as email notifications handling would also fall in this use case.

Those actions and api would benefit from being moved out of networks, to avoid duplicated code, and move to a dedicated module/namespace(?)

wa0x6e commented 4 months ago

One implementation option would be to have a new dedicated SnapshotId/Profile package, which will handle everything related to the profile, like on Starknet.

This package will handle the actions (follow/unfollow/setAlias), as well as the api (loadFollows, loadAlias), so we can use it easily via something like:

import Profile from '...'

const profile = new Profile(userAddress);

const ids = profile.loadFollows();

profile.unfollow(spaceName);
profile.follow(spaceName);

const aliases = profile.loadAliases();

profile.setAlias(newAddress);