-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
[dapp-kit] Add ability to configure networks to SuiClientProvider #13342
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
5 Ignored Deployments
|
af535a4
to
38ebb26
Compare
38ebb26
to
02af9d4
Compare
|
341beff
to
9f2cd6b
Compare
new SuiClient({ | ||
url: props.url ?? getFullnodeUrl('devnet'), | ||
}); | ||
const DEFAULT_NETWORKS = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I said this in another comment but IMO this default either should be more comprehensive, or only be localnet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed this to localnet for now
}; | ||
|
||
export function SuiClientProvider<T extends NetworkConfigs>(props: SuiClientProviderProps<T>) { | ||
const networks = props.networks ?? (DEFAULT_NETWORKS as never); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as never casting here is weirding me out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can change this to (props.networks ?? DEFAULT_NETWORKS) as T
which is the same thing, since props.networks is T, this will throw away the DEFAULT_NETWORKS
part of the union effectively making it never.
1e35807
to
af2c4ad
Compare
…3342) ## Description This is getting into react stuff where I am not very confident I know what I am doing. The goal here is to provide a Context provider that supports switching between networks, and allows providing either pre-configured SuiClients for each network, or a config object (with customizable options) that can be used to create a client. ## Test Plan How did you test the new or updated feature? --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
Description
This is getting into react stuff where I am not very confident I know what I am doing. The goal here is to provide a Context provider that supports switching between networks, and allows providing either pre-configured SuiClients for each network, or a config object (with customizable options) that can be used to create a client.
Test Plan
How did you test the new or updated feature?
If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.
Type of Change (Check all that apply)
Release notes