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

feat: Add setBroviderUrl before getProvider #1090

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

EthanOK
Copy link

@EthanOK EthanOK commented Nov 29, 2024

Fixes # .

Changes proposed in this pull request:

  • Add setBroviderUrl

const provider_DEFAULT = snapshot.utils.getProvider('1');
console.log(provider_DEFAULT.connection.url == 'https://rpc.snapshot.org/1');

snapshot.utils.setBroviderUrl('https://rpc.custom.org');
Copy link
Member

Choose a reason for hiding this comment

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

You can actually use second param in getProvider to pass a different brovider URL, you tried?

Copy link
Author

Choose a reason for hiding this comment

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

I tried.
I'm using getVp and validate, but I want to use my own provider rpc. https://github.com/snapshot-labs/snapshot-strategies/blob/master/src/utils/vp.ts#L22
https://github.com/snapshot-labs/snapshot-strategies/blob/master/src/validations/basic/index.ts#L11

I use snapshot-strategies package, don't direct add second param in getProvider.
So:

import strategies from '@snapshot-labs/strategies';
import snapshot from "@snapshot-labs/snapshot.js";

// change custom rpc
snapshot.utils.setBroviderUrl('https://rpc.custom.org');
// It use my custom rpc in getVp 
strategies.utils.getVp(...)

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