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

why are you limiting the app to specific networks? #324

Closed
sirpy opened this issue Dec 20, 2021 · 6 comments · Fixed by #325
Closed

why are you limiting the app to specific networks? #324

sirpy opened this issue Dec 20, 2021 · 6 comments · Fixed by #325

Comments

@sirpy
Copy link

sirpy commented Dec 20, 2021

is there a technical reason why it shouldnt run on any deployment of gnosis safe on any network?
why does it have to support only "official" ones?

@bh2smith
Copy link
Owner

bh2smith commented Dec 20, 2021

The app technically works on any EVM network that the safe is deployed. However, we do not host the app in the safe App Store. The App Store is hosted in a different repo (I'll try and remember to post the link here shortly) where the supported networks are configured. If there is a network missing that you're interested I. Having, you are more than welcome to include the necessary content here. Minimal info here is a token list (URL) for that network but I believe the application can even run without a provided token list (its just for displaying token icons). Also, it's nice to include a sample file specific to the network (although we haven't yet made this a requirement either). There is an open issue #321 to include sample files for each network.

@bh2smith
Copy link
Owner

Here is the repo where networks are configured and an example issue to show how new networks are added

safe-global/safe-apps-list#92

@sirpy
Copy link
Author

sirpy commented Dec 20, 2021

@bh2smith i'm not asking about safe-apps-list
i'm asking why is supported networks hardcoded.. it simply prevents using it on other networks where gnosis-safe is installed without going through a PR here first
for example I wanted to try this app on fuse.io and i'm not able to. obviously i can fork or add it.
i'm just saying that I dont think it should be hardcoded by default

@bh2smith
Copy link
Owner

Ok so I see that it seems you are referring to this network map

export const networkMap = new Map([
[1, "mainnet"],
[4, "rinkeby"],
[100, "xdai"],
[137, "polygon"],
[56, "bsc"],
]);

Note that we make use of this in a few different places

  1. Here in the app interface:
    {networkMap.has(safe.chainId) ? (
  2. Here when we fetch tokenlist
    export const fetchTokenList = async (chainId: number): Promise<TokenMap> => {
    let tokens: TokenInfo[];
    switch (chainId) {
    case 1:
    const mainnetTokenURL = "https://tokens.coingecko.com/uniswap/all.json";
    tokens = (await (await fetch(mainnetTokenURL)).json()).tokens;
    break;
    case 4:
    // Hardcoded this because the list provided at
    // https://github.com/Uniswap/default-token-list/blob/master/src/tokens/rinkeby.json
    // Doesn't have GNO or OWL and/or many others.
    tokens = rinkeby;
    break;
    case 100:
    tokens = xdaiTokens.tokens;
    break;
    default:
    console.warn(`Unimplemented token list for ${networkMap.get(chainId)} network`);
    tokens = [];
    }
    return tokenMap(tokens);
    };

The second point is merely used in a log message so could be removed, but the first (I would have to ask @schmanu if its actually necessary).

We can look into refactoring "hard-coded" network map. We do also hope to introduce sample files for "known" networks.

I guess the only problem is item number 1 above which we can try to remove and then you should be free to run this without any hassle on any network!

@bh2smith
Copy link
Owner

I have created a PR that should open this up to all networks. Let me know if it works for you.

@sirpy
Copy link
Author

sirpy commented Dec 20, 2021

cool thanks

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 a pull request may close this issue.

2 participants