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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
.env.default update and lint fix
  • Loading branch information
Jibz1 committed Jun 24, 2022
commit 423257a8cfc771b7b8e4ab81e8441195120e7d71
4 changes: 2 additions & 2 deletions wallet/configs/environment/.env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ API_ENV=staging
API_ENDPOINT_LOCAL=http://127.0.0.1:5001/
API_ENDPOINT_LOCAL_FULLNODE=http://127.0.0.1:9000/
API_ENDPOINT_DEV_NET=https://gateway.devnet.sui.io/
API_ENDPOINT_DEV_NET_FULLNODE=https://fullnode.devnet.sui.io:443/
API_ENDPOINT_DEV_NET_FULLNODE=https://fullnode.devnet.sui.io/
API_ENDPOINT_STAGING=https://gateway.staging.sui.io/
API_ENDPOINT_STAGING_FULLNODE=https://fullnode.staging.sui.io:443
API_ENDPOINT_STAGING_FULLNODE=https://fullnode.staging.sui.io/
EXPLORER_URL_LOCAL=http://localhost:8080/
EXPLORER_URL_DEV_NET=https://explorer.devnet.sui.io/
EXPLORER_URL_STAGING=https://explorer.staging.sui.io/
10 changes: 7 additions & 3 deletions wallet/src/ui/app/ApiProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const API_ENV_TO_INFO: Record<API_ENV, EnvInfo> = {
[API_ENV.staging]: { name: 'Staging', color: '#ff4a8d' },
};

export const ENV_TO_API: Record<API_ENV, ApiEndpoints > = {
export const ENV_TO_API: Record<API_ENV, ApiEndpoints> = {
[API_ENV.local]: {
gateway: process.env.API_ENDPOINT_LOCAL || '',
fullNode: process.env.API_ENDPOINT_LOCAL_FULLNODE || '',
Expand All @@ -37,7 +37,7 @@ export const ENV_TO_API: Record<API_ENV, ApiEndpoints > = {
},
[API_ENV.staging]: {
gateway: process.env.API_ENDPOINT_STAGING || '',
fullNode:process.env.API_ENDPOINT_STAGING_FULLNODE || '',
fullNode: process.env.API_ENDPOINT_STAGING_FULLNODE || '',
},
};

Expand All @@ -51,7 +51,11 @@ function getDefaultApiEnv() {

function getDefaultAPI(env: API_ENV) {
const apiEndpoint = ENV_TO_API[env];
if (!apiEndpoint || apiEndpoint.gateway === '' || apiEndpoint.fullNode === '') {
if (
!apiEndpoint ||
apiEndpoint.gateway === '' ||
apiEndpoint.fullNode === ''
) {
throw new Error(`API endpoint not found for API_ENV ${env}`);
}
return apiEndpoint;
Expand Down