@ref-finance/ref-sdk 1.3.3 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -70,13 +70,15 @@ export function getConfig(
70
70
 
71
71
 
72
72
 
73
- Also, the SDK provides `init_env` to switch application environment. We'd better call it at the entrance of the application, then the entire application environment switch takes effect. If you're not sure where to call, you can call in more than one place.
73
+ Also, the SDK provides `init_env` to switch application environment. there is an optional parameter indexerUrl that you can use to replace the one in the SDK with your own deployed indexer service. We'd better call it at the entrance of the application, then the entire application environment switch takes effect. If you're not sure where to call, you can call in more than one place.
74
74
 
75
75
  Example
76
76
 
77
77
  ```
78
78
  init_env('testnet');
79
79
  init_env('mainnet');
80
+ init_env('testnet', 'https://xx-xx.xx-xxx.com');
81
+ init_env('mainnet', 'https://xx-xx.xx-xxx.com');
80
82
  ```
81
83
 
82
84
 
@@ -4,7 +4,7 @@ export declare const STABLE_LP_TOKEN_DECIMALS = 18;
4
4
  export declare const RATED_POOL_LP_TOKEN_DECIMALS = 24;
5
5
  export declare const STORAGE_TO_REGISTER_WITH_MFT = "0.1";
6
6
  export declare const ONE_YOCTO_NEAR = "0.000000000000000000000001";
7
- export declare function getConfig(env?: string | undefined): {
7
+ export declare function getConfig(env?: string | undefined, indexerUrl?: string | undefined): {
8
8
  networkId: string;
9
9
  nodeUrl: string;
10
10
  walletUrl: string;
@@ -35,11 +35,16 @@ var RATED_POOL_LP_TOKEN_DECIMALS = 24;
35
35
  var STORAGE_TO_REGISTER_WITH_MFT = '0.1';
36
36
  var ONE_YOCTO_NEAR = '0.000000000000000000000001';
37
37
  var ENV = '';
38
- function getConfig(env) {
38
+ var INDEXER_URL = '';
39
+ function getConfig(env, indexerUrl) {
39
40
  if (env === void 0) {
40
41
  env = ENV || process.env.NEAR_ENV || process.env.REACT_APP_REF_SDK_ENV;
41
42
  }
43
+ if (indexerUrl === void 0) {
44
+ indexerUrl = INDEXER_URL;
45
+ }
42
46
  ENV = env;
47
+ INDEXER_URL = indexerUrl;
43
48
  switch (env) {
44
49
  case 'mainnet':
45
50
  return {
@@ -49,7 +54,7 @@ function getConfig(env) {
49
54
  WRAP_NEAR_CONTRACT_ID: 'wrap.near',
50
55
  REF_FI_CONTRACT_ID: 'v2.ref-finance.near',
51
56
  REF_TOKEN_ID: 'token.v2.ref-finance.near',
52
- indexerUrl: 'https://indexer.ref.finance',
57
+ indexerUrl: indexerUrl || 'https://indexer.ref.finance',
53
58
  explorerUrl: 'https://testnet.nearblocks.io',
54
59
  REF_DCL_SWAP_CONTRACT_ID: 'dclv2.ref-labs.near'
55
60
  };
@@ -58,7 +63,7 @@ function getConfig(env) {
58
63
  networkId: 'testnet',
59
64
  nodeUrl: 'https://rpc.testnet.near.org',
60
65
  walletUrl: 'https://wallet.testnet.near.org',
61
- indexerUrl: 'https://testnet-indexer.ref-finance.com',
66
+ indexerUrl: indexerUrl || 'https://testnet-indexer.ref-finance.com',
62
67
  WRAP_NEAR_CONTRACT_ID: 'wrap.testnet',
63
68
  REF_FI_CONTRACT_ID: 'ref-finance-101.testnet',
64
69
  REF_TOKEN_ID: 'ref.fakes.testnet',
@@ -73,7 +78,7 @@ function getConfig(env) {
73
78
  REF_FI_CONTRACT_ID: 'v2.ref-finance.near',
74
79
  WRAP_NEAR_CONTRACT_ID: 'wrap.near',
75
80
  REF_TOKEN_ID: 'token.v2.ref-finance.near',
76
- indexerUrl: 'https://indexer.ref.finance',
81
+ indexerUrl: indexerUrl || 'https://indexer.ref.finance',
77
82
  explorerUrl: 'https://nearblocks.io',
78
83
  REF_DCL_SWAP_CONTRACT_ID: 'dclv2.ref-labs.near'
79
84
  };
@@ -3918,11 +3923,11 @@ var near = /*#__PURE__*/new nearApiJs.Near( /*#__PURE__*/_extends({
3918
3923
  keyStore: /*#__PURE__*/getKeyStore(),
3919
3924
  headers: {}
3920
3925
  }, /*#__PURE__*/getConfig()));
3921
- var init_env = function init_env(env) {
3926
+ var init_env = function init_env(env, indexerUrl) {
3922
3927
  near = new nearApiJs.Near(_extends({
3923
3928
  keyStore: getKeyStore(),
3924
3929
  headers: {}
3925
- }, getConfig(env)));
3930
+ }, getConfig(env, indexerUrl)));
3926
3931
  return switchEnv();
3927
3932
  };
3928
3933
  var refFiViewFunction = /*#__PURE__*/function () {
@@ -7532,6 +7537,24 @@ var DefaultMainnetTokenList = [{
7532
7537
  reference_hash: null,
7533
7538
  decimals: 6,
7534
7539
  id: 'usdt.tether-token.near'
7540
+ }, {
7541
+ spec: 'ft-1.0.0',
7542
+ name: 'NEAT',
7543
+ symbol: 'NEAT',
7544
+ icon: "data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='40' height='40' rx='4.8' fill='%23202020'/%3E%3Crect width='40' height='40' rx='4.8' fill='url(%23paint0_linear_1_5571)'/%3E%3Crect x='10.4' y='12.6001' width='4.8' height='4.8' fill='white'/%3E%3Crect x='15.2' y='12.6001' width='4.8' height='4.8' fill='white'/%3E%3Crect x='24.8' y='12.6001' width='4.8' height='4.8' fill='white'/%3E%3Crect x='10.4' y='17.4001' width='4.8' height='4.8' fill='white'/%3E%3Crect x='24.8' y='17.4001' width='4.8' height='4.8' fill='white'/%3E%3Crect x='10.4' y='22.2002' width='4.8' height='4.8' fill='white'/%3E%3Crect x='24.8' y='22.2002' width='4.8' height='4.8' fill='white'/%3E%3Crect x='20' y='22.2002' width='4.8' height='4.8' fill='white'/%3E%3Crect x='17.6' y='17.4001' width='4.8' height='4.8' fill='white'/%3E%3Cdefs%3E%3ClinearGradient id='paint0_linear_1_5571' x1='20' y1='0' x2='20' y2='40' gradientUnits='userSpaceOnUse'%3E%3Cstop stop-color='%23262626'/%3E%3Cstop offset='1' stop-color='%23121212'/%3E%3C/linearGradient%3E%3C/defs%3E%3C/svg%3E%0A",
7545
+ reference: null,
7546
+ reference_hash: null,
7547
+ decimals: 8,
7548
+ id: 'neat.nrc-20.near'
7549
+ }, {
7550
+ spec: 'ft-1.0.0',
7551
+ name: 'USMeme',
7552
+ symbol: 'USM',
7553
+ icon: 'https://storage.herewallet.app/upload/13151331-8f9c-4851-8038-36794688c693.jpg',
7554
+ reference: null,
7555
+ reference_hash: null,
7556
+ decimals: 8,
7557
+ id: 'usmeme.tg'
7535
7558
  }];
7536
7559
  function getDefaultTokenList() {
7537
7560
  var env = getConfig().networkId;