Skip to content
Open
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
13 changes: 10 additions & 3 deletions src/constant.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TokenMetadata } from './types';
import { Config, TokenMetadata } from './types';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unused, please remove


export const FEE_DIVISOR = 10000;

Expand All @@ -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;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do you need this for?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I thought it should be like the INDEXER_URL, changed.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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) {
Expand Down
12 changes: 12 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unused, please remove