diff --git a/src/constant.ts b/src/constant.ts index b045b88..4b39d25 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -14,15 +14,16 @@ 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, + nodeUrl: string | undefined = "" + ) { ENV = env; INDEXER_URL = indexerUrl; switch (env) { case 'mainnet': return { networkId: 'mainnet', - nodeUrl: 'https://rpc.mainnet.near.org', + nodeUrl: nodeUrl || 'https://rpc.mainnet.near.org', walletUrl: 'https://wallet.near.org', WRAP_NEAR_CONTRACT_ID: 'wrap.near', REF_FI_CONTRACT_ID: 'v2.ref-finance.near', @@ -34,7 +35,7 @@ export function getConfig( case 'testnet': return { networkId: 'testnet', - nodeUrl: 'https://rpc.testnet.near.org', + nodeUrl: nodeUrl || 'https://rpc.testnet.near.org', walletUrl: 'https://wallet.testnet.near.org', indexerUrl: indexerUrl || 'https://testnet-indexer.ref-finance.com', WRAP_NEAR_CONTRACT_ID: 'wrap.testnet', @@ -46,7 +47,7 @@ export function getConfig( case 'dev': return { networkId: 'testnet', - nodeUrl: 'https://rpc.testnet.near.org', + nodeUrl: nodeUrl || 'https://rpc.testnet.near.org', walletUrl: 'https://wallet.testnet.near.org', indexerUrl: indexerUrl || 'https://dev-indexer.ref-finance.com', WRAP_NEAR_CONTRACT_ID: 'wrap.testnet', @@ -58,7 +59,7 @@ export function getConfig( default: return { networkId: 'mainnet', - nodeUrl: 'https://rpc.mainnet.near.org', + nodeUrl: nodeUrl || 'https://rpc.mainnet.near.org', walletUrl: 'https://wallet.near.org', REF_FI_CONTRACT_ID: 'v2.ref-finance.near', WRAP_NEAR_CONTRACT_ID: 'wrap.near', diff --git a/src/ref.ts b/src/ref.ts index 000729b..5b88a1b 100644 --- a/src/ref.ts +++ b/src/ref.ts @@ -47,11 +47,11 @@ let near = new Near({ headers: {}, ...getConfig(), }); -export const init_env = (env: string, indexerUrl?: string) => { +export const init_env = (env: string, indexerUrl?: string, nodeUrl?: string) => { near = new Near({ keyStore: getKeyStore(), headers: {}, - ...getConfig(env, indexerUrl), + ...getConfig(env, indexerUrl, nodeUrl), }); return switchEnv(); }; diff --git a/src/utils.ts b/src/utils.ts index d4e92ff..3472431 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -29,7 +29,6 @@ import { STORAGE_TO_REGISTER_WITH_MFT, } from './constant'; import Big from 'big.js'; -import { SignAndSendTransactionsParams } from '@near-wallet-selector/core/lib/wallet'; import { TokenMetadata } from './types'; import { PoolMode } from './v1-swap/swap'; import { getSwappedAmount } from './stable-swap'; @@ -289,7 +288,7 @@ export const WalletSelectorTransactions = ( }; }); - return { transactions: parsedTransactions } as SignAndSendTransactionsParams; + return { transactions: parsedTransactions } ; }; export const separateRoutes = (