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

use fullnode and gateway service #2697

Merged
merged 5 commits into from
Jun 24, 2022
Merged

use fullnode and gateway service #2697

merged 5 commits into from
Jun 24, 2022

Conversation

Jibz1
Copy link
Contributor

@Jibz1 Jibz1 commented Jun 23, 2022

Screen.Recording.2022-06-23.at.3.07.46.PM.mov

#2594

Copy link
Contributor

@pchrysochoidis pchrysochoidis left a 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

[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> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
export const ENV_TO_API: Record<API_ENV, object | undefined> = {
export const ENV_TO_API: Record<API_ENV, EnvToApi> = {

@@ -15,16 +15,30 @@ type EnvInfo = {
name: string;
color: string;
};

type EnvToApi = {
Copy link
Contributor

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

@@ -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;
Copy link
Contributor

@pchrysochoidis pchrysochoidis Jun 23, 2022

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

},
[API_ENV.devNet]: {
gateway: process.env.API_ENDPOINT_DEV_NET,
fullNode: process.env.API_ENDPOINT_FULLNODE,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fullNode: process.env.API_ENDPOINT_FULLNODE,
fullNode: process.env.API_ENDPOINT_DEV_NET_FULLNODE,

},
[API_ENV.staging]: {
gateway: process.env.API_ENDPOINT_STAGING,
fullNode: process.env.API_ENDPOINT_FULLNODE,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fullNode: process.env.API_ENDPOINT_FULLNODE,
fullNode: process.env.API_ENDPOINT_STAGING_FULLNODE,

Copy link
Contributor

@gegaowp gegaowp left a 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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
API_ENDPOINT_STAGING_FULLNODE=https://fullnode.staging.sui.io:443
API_ENDPOINT_STAGING_FULLNODE=https://fullnode.staging.sui.io:443/

@@ -11,20 +11,43 @@ export enum API_ENV {
staging = 'staging',
}

// fallback default to devNet if not set
const defaultRPCENV = {
Copy link
Contributor

@pchrysochoidis pchrysochoidis Jun 24, 2022

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

@Jibz1
Copy link
Contributor Author

Jibz1 commented Jun 24, 2022

@pchrysochoidis I added the fullnode service to the .env.default file

@pchrysochoidis
Copy link
Contributor

@pchrysochoidis I added the fullnode service to the .env.default file

@Jibz1 yeah I saw it, I just said we should remove the defaultRPCENV

(Also something else, I think we don't need the :443 for the endpoints since it's the default port for https)

@Jibz1 Jibz1 merged commit 36d3c32 into main Jun 24, 2022
@Jibz1 Jibz1 deleted the wallet-fullnode-and-fateway branch June 24, 2022 16:44
punwai pushed a commit that referenced this pull request Jun 30, 2022
* use fullnode and gateway service

* update

* use devnet as default

* remove default rpc endpoint

* .env.default update and lint fix
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