@ref-finance/ref-sdk 1.1.4 → 1.1.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
@@ -66,6 +66,19 @@ export function getConfig(
66
66
 
67
67
  ```
68
68
 
69
+
70
+
71
+ 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.
72
+
73
+ Example
74
+
75
+ ```
76
+ init_env('testnet');
77
+ init_env('mainnet');
78
+ ```
79
+
80
+
81
+
69
82
  ## Ref V1 Swap
70
83
 
71
84
  ### Tokens
@@ -157,12 +170,13 @@ Fetch all existing pools, including vanilla/simple pools, stable pools and rated
157
170
 
158
171
  Parameters
159
172
 
160
- None
173
+ perPage?:number
161
174
 
162
175
  Example
163
176
 
164
177
  ```plain
165
178
  const { ratedPools, unRatedPools, simplePools } = await fetchAllPools();
179
+ const { ratedPools, unRatedPools, simplePools } = await fetchAllPools(200);
166
180
  ```
167
181
 
168
182
  Response
@@ -650,7 +664,7 @@ Response
650
664
  ]
651
665
  ```
652
666
 
653
- #
667
+
654
668
 
655
669
  ## Ref Swap Widget
656
670
 
@@ -2,6 +2,8 @@ import { TokenMetadata } from './types';
2
2
  export declare const FEE_DIVISOR = 10000;
3
3
  export declare const STABLE_LP_TOKEN_DECIMALS = 18;
4
4
  export declare const RATED_POOL_LP_TOKEN_DECIMALS = 24;
5
+ export declare const STORAGE_TO_REGISTER_WITH_MFT = "0.1";
6
+ export declare const ONE_YOCTO_NEAR = "0.000000000000000000000001";
5
7
  export declare function getConfig(env?: string | undefined): {
6
8
  networkId: string;
7
9
  nodeUrl: string;
@@ -13,7 +15,7 @@ export declare function getConfig(env?: string | undefined): {
13
15
  explorerUrl: string;
14
16
  REF_DCL_SWAP_CONTRACT_ID: string;
15
17
  };
16
- export declare const config: {
18
+ export declare let config: {
17
19
  networkId: string;
18
20
  nodeUrl: string;
19
21
  walletUrl: string;
@@ -24,13 +26,11 @@ export declare const config: {
24
26
  explorerUrl: string;
25
27
  REF_DCL_SWAP_CONTRACT_ID: string;
26
28
  };
27
- export declare const REF_FI_CONTRACT_ID: string;
28
- export declare const WRAP_NEAR_CONTRACT_ID: string;
29
- export declare const REF_TOKEN_ID: string;
30
- export declare const STORAGE_TO_REGISTER_WITH_MFT = "0.1";
31
- export declare const ONE_YOCTO_NEAR = "0.000000000000000000000001";
32
- export declare const WNEAR_META_DATA: TokenMetadata;
33
- export declare const REF_META_DATA: {
29
+ export declare let REF_FI_CONTRACT_ID: string;
30
+ export declare let WRAP_NEAR_CONTRACT_ID: string;
31
+ export declare let REF_TOKEN_ID: string;
32
+ export declare let WNEAR_META_DATA: TokenMetadata;
33
+ export declare let REF_META_DATA: {
34
34
  decimals: number;
35
35
  icon: string;
36
36
  id: string;
@@ -42,3 +42,27 @@ export declare const TokenLinks: Record<string, string>;
42
42
  export declare const CONSTANT_D = 1.0001;
43
43
  export declare const POINTLEFTRANGE = -800000;
44
44
  export declare const POINTRIGHTRANGE = 800000;
45
+ export declare const switchEnv: () => {
46
+ config: {
47
+ networkId: string;
48
+ nodeUrl: string;
49
+ walletUrl: string;
50
+ WRAP_NEAR_CONTRACT_ID: string;
51
+ REF_FI_CONTRACT_ID: string;
52
+ REF_TOKEN_ID: string;
53
+ indexerUrl: string;
54
+ explorerUrl: string;
55
+ REF_DCL_SWAP_CONTRACT_ID: string;
56
+ };
57
+ REF_FI_CONTRACT_ID: string;
58
+ WRAP_NEAR_CONTRACT_ID: string;
59
+ REF_TOKEN_ID: string;
60
+ REF_META_DATA: {
61
+ decimals: number;
62
+ icon: string;
63
+ id: string;
64
+ name: string;
65
+ symbol: string;
66
+ };
67
+ WNEAR_META_DATA: TokenMetadata;
68
+ };