Skip to content

Commit

Permalink
fix: hardcoded provider id pass on env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
annipi committed Jan 14, 2025
1 parent 7e8bae9 commit 378ec8c
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .env.local.test
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ VUE_APP_DEBUG_MODE='true'
NODE_ENV=test
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30

VUE_APP_FLYOVER_PROVIDER_ID=2
1 change: 1 addition & 0 deletions .github/workflows/deploy_MainNet_UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
VUE_APP_LBC_ADDRESS='0xAA9cAf1e3967600578727F975F283446A3Da6612'
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
npm run-script build
- name: Configure AWS credentials
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_TestNet_UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
VUE_APP_LBC_ADDRESS='0xc2A630c053D12D63d32b025082f6Ba268db18300'
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
npm run-script build
- name: Configure AWS credentials
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_staging_MainNet_UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
VUE_APP_LBC_ADDRESS='0xAA9cAf1e3967600578727F975F283446A3Da6612'
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=2
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
npm run-script build
- name: Configure AWS credentials
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deploy_staging_TestNet_UI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
VUE_APP_LBC_ADDRESS='0xc2A630c053D12D63d32b025082f6Ba268db18300'
VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE=20
VUE_APP_RECAPTCHA_NEW_TOKEN_TIME=30
VUE_APP_FLYOVER_PROVIDER_ID=2
npm run-script build
- name: Configure AWS credentials
Expand Down
1 change: 1 addition & 0 deletions ENV_VARIABLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The value of these variables are used in **environment-variables.ts** file.
|VUE_APP_DEBUG_MODE | `false` | enable developer messages for debuging |
|VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE | `2` | Defines quote difference percentage to 2% so it requieres the user to review condition only for a difference bigger that this percentage |
|VUE_APP_RECAPTCHA_NEW_TOKEN_TIME | `30` | Specifies the time (in seconds) to temporarily disable the flyover between new transactions. This accounts for the time required by Google reCAPTCHA to regenerate a challenge token |
|VUE_APP_FLYOVER_PROVIDER_ID | `1` | Sets up the provider id to be use for flyover status search. |

## Example for .env.local.test file

Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default {
script-src 'self' 'nonce-${vuetifyNonce}' 'unsafe-eval';
script-src-elem 'self' 'unsafe-inline' https://script.hotjar.com https://www.clarity.ms/s/* https://static.hotjar.com https://*.hotjar.com https://*.hotjar.io https://api.coingecko.com/ https://*.clarity.ms https://www.clarity.ms/ https://www.gstatic.com/ https://www.google.com/recaptcha/;
img-src data: https:;
connect-src 'self' 'unsafe-inline' https://www.clarity.ms/s/0.7.16/clarity.js wss://* https://*.hotjar.com https://*.hotjar.io https://www.clarity.ms/s/* wss://*.hotjar.com ${envVariables.vueAppApiBaseUrl} ${envVariables.vueAppRskNodeHost} https://lps.flyover.rif.technology https://lps.tekscapital.com https://staging.lps.tekscapital.com https://api.coingecko.com https://*.clarity.ms https://www.clarity.ms/* ;
connect-src 'self' 'unsafe-inline' https://www.clarity.ms/s/0.7.16/clarity.js wss://* https://*.hotjar.com https://*.hotjar.io https://www.clarity.ms/s/* wss://*.hotjar.com ${envVariables.vueAppApiBaseUrl} ${envVariables.vueAppRskNodeHost} https://lps.tekscapital.com https://testnet.lps.tekscapital.com https://staging.lps.tekscapital.com https://api.coingecko.com/* https://*.clarity.ms https://www.clarity.ms/* ;
object-src 'none';
frame-src https://connect.trezor.io https://www.google.com/;
worker-src 'none';
Expand Down
4 changes: 4 additions & 0 deletions src/common/types/environment-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export class EnvironmentVariables {

public grecaptchaTime: number;

public flyoverProviderId: number;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor(defaultValues: any = {}) {
this.vueAppCoin = process.env.VUE_APP_COIN || defaultValues.vueAppCoin;
Expand Down Expand Up @@ -100,6 +102,8 @@ export class EnvironmentVariables {
.VUE_APP_FLYOVER_PEGOUT_QUOTE_DIFF_PERCENTAGE) || defaultValues.flyoverPegoutDiffPercentage;
this.grecaptchaTime = Number(process.env.VUE_APP_RECAPTCHA_NEW_TOKEN_TIME)
|| defaultValues.grecaptchaTime;
this.flyoverProviderId = Number(process.env.VUE_APP_FLYOVER_PROVIDER_ID)
|| defaultValues.flyoverProviderId;
}

public get chainId(): number {
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const defaultEnvironmentVariables = {
burnDustValue: 2000,
flyoverGetProvidersTimeout: 5000,
flyoverPegoutDiffPercentage: 2,
flyoverProviderId: 2,
grecaptchaTime: constants.RECAPTCHA_NEW_TOKEN_TIME,
};

Expand Down
6 changes: 4 additions & 2 deletions src/status/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,15 @@ export const actions: ActionTree<TxStatus, RootState> = {
if (state.type === TxStatusType.FLYOVER_PEGIN) {
const flyoverService = rootState.flyoverPegin?.flyoverService;
await dispatch(`flyoverPegin/${constants.FLYOVER_PEGIN_INIT}`, null, { root: true });
flyoverService?.useLiquidityProvider(2);
flyoverService?.useLiquidityProvider(EnvironmentAccessorService.getEnvironmentVariables()
.flyoverProviderId);
status = await flyoverService?.getPeginStatus(quoteHash);
}
if (state.type === TxStatusType.FLYOVER_PEGOUT) {
const flyoverService = rootState.flyoverPegout?.flyoverService;
await dispatch(`flyoverPegout/${constants.FLYOVER_PEGOUT_INIT}`, {}, { root: true });
flyoverService?.useLiquidityProvider(2);
flyoverService?.useLiquidityProvider(EnvironmentAccessorService.getEnvironmentVariables()
.flyoverProviderId);
status = await rootState.flyoverPegout?.flyoverService.getPegoutStatus(quoteHash);
}
} catch (e) {
Expand Down

0 comments on commit 378ec8c

Please sign in to comment.