-
Notifications
You must be signed in to change notification settings - Fork 26
Add support for custom config #50
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { TokenMetadata } from './types'; | ||
| import { Config, TokenMetadata } from './types'; | ||
|
|
||
| export const FEE_DIVISOR = 10000; | ||
|
|
||
|
|
@@ -10,12 +10,19 @@ export const FT_MINIMUM_STORAGE_BALANCE_LARGE = "12500000000000000000000" | |
| export const ONE_YOCTO_NEAR = '0.000000000000000000000001'; | ||
| let ENV: string | undefined = ''; | ||
| let INDEXER_URL: string | undefined = ''; | ||
| let CONFIG: Config | undefined = undefined; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this for?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it should be like the INDEXER_URL, changed.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok this is needed so it can get no value |
||
| export function getConfig( | ||
| env: string | undefined = ENV || | ||
| process.env.NEAR_ENV || | ||
| process.env.REACT_APP_REF_SDK_ENV, | ||
| indexerUrl: string | undefined = INDEXER_URL | ||
| ) { | ||
| indexerUrl: string | undefined = INDEXER_URL, | ||
| custom_config: Config | undefined = CONFIG | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use camelCase, not snake case |
||
| ): Config { | ||
| if (custom_config) { | ||
| CONFIG = custom_config; | ||
| return custom_config; | ||
| } | ||
| { | ||
| ENV = env; | ||
| INDEXER_URL = indexerUrl; | ||
| switch (env) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,3 +139,15 @@ export interface FTStorageBalance { | |
| total: string; | ||
| available: string; | ||
| } | ||
|
|
||
| export type Config = { | ||
| networkId: string; | ||
| nodeUrl: string; | ||
| walletUrl: string; | ||
| WRAP_NEAR_CONTRACT_ID: string; | ||
| REF_FI_CONTRACT_ID: string; | ||
| REF_TOKEN_ID: string; | ||
| indexerUrl: string; | ||
| explorerUrl: string; | ||
| REF_DCL_SWAP_CONTRACT_ID: string; | ||
| }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unused, please remove |
||
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.
Unused, please remove