@ref-finance/ref-sdk 1.1.4 → 1.1.6
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 +22 -6
- package/dist/constant.d.ts +32 -8
- package/dist/ref-sdk.cjs.development.js +544 -1379
- package/dist/ref-sdk.cjs.development.js.map +1 -1
- package/dist/ref-sdk.cjs.production.min.js +1 -1
- package/dist/ref-sdk.cjs.production.min.js.map +1 -1
- package/dist/ref-sdk.esm.js +490 -1320
- package/dist/ref-sdk.esm.js.map +1 -1
- package/dist/ref-sdk.umd.development.js +544 -1379
- package/dist/ref-sdk.umd.development.js.map +1 -1
- package/dist/ref-sdk.umd.production.min.js +1 -1
- package/dist/ref-sdk.umd.production.min.js.map +1 -1
- package/dist/ref.d.ts +24 -2
- package/dist/swap-widget/constant.d.ts +0 -1
- package/dist/swap-widget/defaultTokenList.d.ts +1 -1
- package/dist/v1-swap/pool.d.ts +1 -2
- package/package.json +1 -1
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
|
|
@@ -107,10 +120,12 @@ Response
|
|
|
107
120
|
|
|
108
121
|
Get tokens metadata and set token id as index.
|
|
109
122
|
|
|
123
|
+
Will fetch token matadata if the token not included in the allTokens.
|
|
124
|
+
|
|
110
125
|
Parameters
|
|
111
126
|
|
|
112
127
|
```plain
|
|
113
|
-
tokenIds: string[]
|
|
128
|
+
(tokenIds: string[], allTokens: Record<string, TokenMetadata>)
|
|
114
129
|
```
|
|
115
130
|
|
|
116
131
|
Example
|
|
@@ -119,7 +134,7 @@ Example
|
|
|
119
134
|
const tokensMetadata = await ftGetTokensMetadata([
|
|
120
135
|
'ref.fakes.testnet',
|
|
121
136
|
'wrap.testnet',
|
|
122
|
-
]);
|
|
137
|
+
],{});
|
|
123
138
|
```
|
|
124
139
|
|
|
125
140
|
Response
|
|
@@ -157,12 +172,13 @@ Fetch all existing pools, including vanilla/simple pools, stable pools and rated
|
|
|
157
172
|
|
|
158
173
|
Parameters
|
|
159
174
|
|
|
160
|
-
|
|
175
|
+
perPage?:number
|
|
161
176
|
|
|
162
177
|
Example
|
|
163
178
|
|
|
164
179
|
```plain
|
|
165
180
|
const { ratedPools, unRatedPools, simplePools } = await fetchAllPools();
|
|
181
|
+
const { ratedPools, unRatedPools, simplePools } = await fetchAllPools(200);
|
|
166
182
|
```
|
|
167
183
|
|
|
168
184
|
Response
|
|
@@ -650,7 +666,7 @@ Response
|
|
|
650
666
|
]
|
|
651
667
|
```
|
|
652
668
|
|
|
653
|
-
|
|
669
|
+
|
|
654
670
|
|
|
655
671
|
## Ref Swap Widget
|
|
656
672
|
|
|
@@ -682,7 +698,7 @@ A QuickStart of Ref Swap component.
|
|
|
682
698
|
```plain
|
|
683
699
|
export interface SwapWidgetProps {
|
|
684
700
|
theme?: Theme;
|
|
685
|
-
|
|
701
|
+
defaultTokenList?: string[];
|
|
686
702
|
onSwap: (transactionsRef: Transaction[]) => void;
|
|
687
703
|
onDisConnect: () => void;
|
|
688
704
|
width: string;
|
|
@@ -706,7 +722,7 @@ export interface SwapWidgetProps {
|
|
|
706
722
|
```
|
|
707
723
|
|
|
708
724
|
- theme: widget theme for customization.
|
|
709
|
-
-
|
|
725
|
+
- defaultTokenList: default tokens with ref whitelist into token list in the widget.
|
|
710
726
|
- onSwap: Swap button triggers this function.
|
|
711
727
|
- width: width of widget component.
|
|
712
728
|
- height: height of widget component.
|
package/dist/constant.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
28
|
-
export declare
|
|
29
|
-
export declare
|
|
30
|
-
export declare
|
|
31
|
-
export declare
|
|
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
|
+
};
|