-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
use fullnode and gateway service #2697
Conversation
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 we also need to add the new env variables for the fullnode endpoints in the .env.defaults otherwise they will be empty by default
wallet/src/ui/app/ApiProvider.ts
Outdated
[API_ENV.local]: process.env.API_ENDPOINT_LOCAL, | ||
[API_ENV.devNet]: process.env.API_ENDPOINT_DEV_NET, | ||
[API_ENV.staging]: process.env.API_ENDPOINT_STAGING, | ||
export const ENV_TO_API: Record<API_ENV, object | undefined> = { |
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.
export const ENV_TO_API: Record<API_ENV, object | undefined> = { | |
export const ENV_TO_API: Record<API_ENV, EnvToApi> = { |
wallet/src/ui/app/ApiProvider.ts
Outdated
@@ -15,16 +15,30 @@ type EnvInfo = { | |||
name: string; | |||
color: string; | |||
}; | |||
|
|||
type EnvToApi = { |
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.
Probably we need to find a better name, maybe ApiEndpoints
or ApiGroup
wallet/src/ui/app/ApiProvider.ts
Outdated
@@ -40,26 +54,36 @@ function getDefaultAPI(env: API_ENV) { | |||
if (!apiEndpoint) { | |||
throw new Error(`API endpoint not found for API_ENV ${env}`); | |||
} | |||
return apiEndpoint; | |||
return apiEndpoint as EnvToApi; |
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 doing the suggested change above the as EnvToApi
is not necessary
wallet/src/ui/app/ApiProvider.ts
Outdated
}, | ||
[API_ENV.devNet]: { | ||
gateway: process.env.API_ENDPOINT_DEV_NET, | ||
fullNode: process.env.API_ENDPOINT_FULLNODE, |
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.
fullNode: process.env.API_ENDPOINT_FULLNODE, | |
fullNode: process.env.API_ENDPOINT_DEV_NET_FULLNODE, |
wallet/src/ui/app/ApiProvider.ts
Outdated
}, | ||
[API_ENV.staging]: { | ||
gateway: process.env.API_ENDPOINT_STAGING, | ||
fullNode: process.env.API_ENDPOINT_FULLNODE, |
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.
fullNode: process.env.API_ENDPOINT_FULLNODE, | |
fullNode: process.env.API_ENDPOINT_STAGING_FULLNODE, |
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.
looks great, thanks for the quick fix!
API_ENDPOINT_STAGING=https://gateway.staging.sui.io/ | ||
API_ENDPOINT_STAGING_FULLNODE=https://fullnode.staging.sui.io:443 |
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.
API_ENDPOINT_STAGING_FULLNODE=https://fullnode.staging.sui.io:443 | |
API_ENDPOINT_STAGING_FULLNODE=https://fullnode.staging.sui.io:443/ |
wallet/src/ui/app/ApiProvider.ts
Outdated
@@ -11,20 +11,43 @@ export enum API_ENV { | |||
staging = 'staging', | |||
} | |||
|
|||
// fallback default to devNet if not set | |||
const defaultRPCENV = { |
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 don't think we need this. Without this we have all the endpoints in one place .env.default
(and maybe .env
if we want to override something). We just need to make sure we have all the env variables defined. We can add some tests if you want but I think relying on getDefaultAPI
to throw, should be enough. Also with this we don't have a way to detect that we haven't defined an endpoint for some envs and using for different environments devNet as default doesn't sound right
@pchrysochoidis I added the fullnode service to the .env.default file |
@Jibz1 yeah I saw it, I just said we should remove the (Also something else, I think we don't need the :443 for the endpoints since it's the default port for https) |
* use fullnode and gateway service * update * use devnet as default * remove default rpc endpoint * .env.default update and lint fix
Screen.Recording.2022-06-23.at.3.07.46.PM.mov
#2594