rango-sdk 0.0.5 → 0.0.8
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 +1 -7
- package/lib/types/api/common.d.ts +14 -3
- package/lib/types/api/common.d.ts.map +1 -1
- package/lib/types/api/meta.d.ts +98 -1
- package/lib/types/api/meta.d.ts.map +1 -1
- package/lib/types/api/routing.d.ts +7 -3
- package/lib/types/api/routing.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
# Rango Exchange SDK
|
|
1
|
+
# Rango Exchange SDK
|
|
2
2
|
|
|
3
3
|
[](https://badge.fury.io/js/rango-sdk)
|
|
4
4
|
[](https://github.com/rango-exchange/rango-sdk/blob/master/LICENSE)
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
This is the first phase of Rango SDK which only wraps Rest API calls. In the next phase, we will handle connecting to the wallet providers.
|
|
8
|
-
|
|
9
6
|
> **WARNING:** The Rango SDK is still beta. Please use it on your own risk.
|
|
10
7
|
|
|
11
|
-
> **WARNING:** The Rango SDK has not stabilized yet, and we might make some breaking changes.
|
|
12
|
-
|
|
13
|
-
|
|
14
8
|
## Installation
|
|
15
9
|
|
|
16
10
|
```shell
|
|
@@ -45,7 +45,7 @@ export declare type RecommendedSlippage = {
|
|
|
45
45
|
*/
|
|
46
46
|
export declare type SwapFee = {
|
|
47
47
|
name: string;
|
|
48
|
-
expenseType: 'FROM_SOURCE_WALLET' | 'DECREASE_FROM_OUTPUT';
|
|
48
|
+
expenseType: 'FROM_SOURCE_WALLET' | 'DECREASE_FROM_OUTPUT' | 'FROM_DESTINATION_WALLET';
|
|
49
49
|
asset: Asset;
|
|
50
50
|
amount: string;
|
|
51
51
|
};
|
|
@@ -57,6 +57,7 @@ export declare type SwapFee = {
|
|
|
57
57
|
* @property {string | number} address - Contract address of the source/dest asset of this step, null for native token
|
|
58
58
|
* @property {number} decimals - Decimals of the source/destination asset of this step, example: 18
|
|
59
59
|
* @property {string} logo - Absolute path of the logo of the source/destination asset of this step
|
|
60
|
+
* @property {string | null} usdPrice - Usd price unit for the asset if available
|
|
60
61
|
*
|
|
61
62
|
*/
|
|
62
63
|
export declare type SwapResultAsset = {
|
|
@@ -65,6 +66,7 @@ export declare type SwapResultAsset = {
|
|
|
65
66
|
symbol: string;
|
|
66
67
|
logo: string;
|
|
67
68
|
decimals: number;
|
|
69
|
+
usdPrice: string | null;
|
|
68
70
|
};
|
|
69
71
|
/**
|
|
70
72
|
* A node of the swap path
|
|
@@ -133,7 +135,9 @@ export declare type TimeStat = {
|
|
|
133
135
|
*
|
|
134
136
|
* @property {string} swapperId - Unique Id of swapper. example: 1INCH_BSC, TERRASWAP
|
|
135
137
|
*
|
|
136
|
-
* @property {
|
|
138
|
+
* @property {'BRIDGE' | 'DEX' | 'AGGREGATOR'} swapperType - Type of swapper. example: BRIDGE, DEX, AGGREGATOR
|
|
139
|
+
*
|
|
140
|
+
* @property {'INTER_CHAIN' | 'INTRA_CHAIN'} swapChainType - Type of swapping. It could be inter chain or intra chain
|
|
137
141
|
*
|
|
138
142
|
* @property {SwapResultAsset} from - The source asset
|
|
139
143
|
*
|
|
@@ -170,6 +174,10 @@ export declare type TimeStat = {
|
|
|
170
174
|
*
|
|
171
175
|
* @property {TimeStat | null} timeStat - The minimum, avg and max estimation time for this step
|
|
172
176
|
*
|
|
177
|
+
* @property {boolean} includesDestinationTx - Is it required to sign a transaction on the destination chain or not
|
|
178
|
+
*
|
|
179
|
+
* @property {number} maxRequiredSign - Max number of transaction signing required by the user
|
|
180
|
+
*
|
|
173
181
|
* @property {RecommendedSlippage | null} recommendedSlippage
|
|
174
182
|
*
|
|
175
183
|
* @property {string[] | null} warnings - List of warnings for this swap step, usually null or empty
|
|
@@ -177,7 +185,8 @@ export declare type TimeStat = {
|
|
|
177
185
|
*/
|
|
178
186
|
export declare type SwapResult = {
|
|
179
187
|
swapperId: string;
|
|
180
|
-
swapperType:
|
|
188
|
+
swapperType: 'BRIDGE' | 'DEX' | 'AGGREGATOR';
|
|
189
|
+
swapChainType: 'INTER_CHAIN' | 'INTRA_CHAIN';
|
|
181
190
|
from: SwapResultAsset;
|
|
182
191
|
to: SwapResultAsset;
|
|
183
192
|
fromAmount: string;
|
|
@@ -190,6 +199,8 @@ export declare type SwapResult = {
|
|
|
190
199
|
fromAmountRestrictionType: 'EXCLUSIVE' | 'INCLUSIVE';
|
|
191
200
|
estimatedTimeInSeconds: number;
|
|
192
201
|
timeStat: TimeStat | null;
|
|
202
|
+
includesDestinationTx: boolean;
|
|
203
|
+
maxRequiredSign: number;
|
|
193
204
|
recommendedSlippage: RecommendedSlippage | null;
|
|
194
205
|
warnings: string[] | null;
|
|
195
206
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/api/common.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,oBAAY,KAAK,GAAG;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED;;;;;;;GAOG;AACH,oBAAY,MAAM,GAAG;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;GAMG;AACH,oBAAY,mBAAmB,GAAG;IAChC,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;;;;;;;GAQG;AACH,oBAAY,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/api/common.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,oBAAY,KAAK,GAAG;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,GAAG,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ClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;CACf,CAAA"}
|
package/lib/types/api/meta.d.ts
CHANGED
|
@@ -1,19 +1,116 @@
|
|
|
1
1
|
import type { Asset } from './common';
|
|
2
|
+
import { TransactionType } from './transactions';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
+
* EVM Chain Info
|
|
5
|
+
*
|
|
6
|
+
* @property {string} chainName - Chain name, e.g. Polygon Mainnet
|
|
7
|
+
* @property {name: string, symbol: string, decimals: null} nativeCurrency
|
|
8
|
+
* @property {string[]} rpcUrls - e.g. "https://polygon-rpc.com"
|
|
9
|
+
* @property {string[]} blockExplorerUrls - e.g. "https://polygonscan.com"
|
|
10
|
+
* @property {string} addressUrl - Explorer address base url for this blockchain,
|
|
11
|
+
* e.g. "https://bscscan.com/address/{wallet}"
|
|
12
|
+
* @property {string} transactionUrl - Explorer transaction base url for this blockchain,
|
|
13
|
+
* e.g. "https://bscscan.com/tx/{txHash}"
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export declare type EVMChainInfo = {
|
|
17
|
+
chainName: string;
|
|
18
|
+
nativeCurrency: {
|
|
19
|
+
name: string;
|
|
20
|
+
symbol: string;
|
|
21
|
+
decimals: number;
|
|
22
|
+
};
|
|
23
|
+
rpcUrls: string[];
|
|
24
|
+
blockExplorerUrls: string[];
|
|
25
|
+
addressUrl: string;
|
|
26
|
+
transactionUrl: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Cosmos Chain Info - Used for adding experimental chains to keplr if needed
|
|
30
|
+
*
|
|
31
|
+
* @see https://github.com/osmosis-labs/osmosis-frontend/blob/0b88e39740cb087be576f464bfcd6cc2971ed2fd/packages/web/config/chain-infos.ts
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
export declare type CosmosChainInfo = {
|
|
35
|
+
experimental: boolean;
|
|
36
|
+
rpc: string;
|
|
37
|
+
rest: string;
|
|
38
|
+
cosmostationLcdUrl: string | null;
|
|
39
|
+
cosmostationApiUrl: string | null;
|
|
40
|
+
cosmostationDenomTracePath: string;
|
|
41
|
+
mintScanName: string | null;
|
|
42
|
+
chainName: string;
|
|
43
|
+
stakeCurrency: {
|
|
44
|
+
coinDenom: string;
|
|
45
|
+
coinMinimalDenom: string;
|
|
46
|
+
coinDecimals: number;
|
|
47
|
+
coinGeckoId: string;
|
|
48
|
+
coinImageUrl: string;
|
|
49
|
+
};
|
|
50
|
+
bip44: {
|
|
51
|
+
coinType: number;
|
|
52
|
+
};
|
|
53
|
+
bech32Config: {
|
|
54
|
+
bech32PrefixAccAddr: string;
|
|
55
|
+
bech32PrefixAccPub: string;
|
|
56
|
+
bech32PrefixValAddr: string;
|
|
57
|
+
bech32PrefixValPub: string;
|
|
58
|
+
bech32PrefixConsAddr: string;
|
|
59
|
+
bech32PrefixConsPub: string;
|
|
60
|
+
};
|
|
61
|
+
currencies: {
|
|
62
|
+
coinDenom: string;
|
|
63
|
+
coinMinimalDenom: string;
|
|
64
|
+
coinDecimals: number;
|
|
65
|
+
coinGeckoId: string;
|
|
66
|
+
coinImageUrl: string;
|
|
67
|
+
}[];
|
|
68
|
+
feeCurrencies: {
|
|
69
|
+
coinDenom: string;
|
|
70
|
+
coinMinimalDenom: string;
|
|
71
|
+
coinDecimals: number;
|
|
72
|
+
coinGeckoId: string;
|
|
73
|
+
coinImageUrl: string;
|
|
74
|
+
}[];
|
|
75
|
+
features: string[];
|
|
76
|
+
explorerUrlToTx: string;
|
|
77
|
+
gasPriceStep: {
|
|
78
|
+
low: number;
|
|
79
|
+
average: number;
|
|
80
|
+
high: number;
|
|
81
|
+
} | null;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Blockchain Meta Information
|
|
4
85
|
*
|
|
5
86
|
* @property {string} name - Unique name of blockchain, this field is used in all endpoints as the identifier
|
|
6
87
|
* @property {number} defaultDecimals - The default decimals of blockchain, do not use it in computations, use Token.decimals instead
|
|
7
88
|
* @property {Asset[]} feeAssets - List of assets that can be used as fee in this blockchain
|
|
8
89
|
* @property {string[]} addressPatterns - List of all regex patterns for wallet addresses of this blockchain, can be
|
|
9
90
|
* used for input validation, example: [ "^(0x)[0-9A-Fa-f]{40}$" ]
|
|
91
|
+
* @property {string} logo - Logo of the blockchain
|
|
92
|
+
* @property {string} displayName - Display name for the blockchain
|
|
93
|
+
* @property {string} shortName - Short name for the blockchain
|
|
94
|
+
* @property {string} color - Suggested color for the blockchain
|
|
95
|
+
* @property {boolean} enabled - Is blockchain enabled or not in Rango
|
|
96
|
+
* @property {TransactionType} type - Type of the blockchain
|
|
97
|
+
* @property {string | null} chainId - e.g. "0xa86a" for Avax, "osmosis-1" for Osmosis, etc.
|
|
98
|
+
* @property {EVMChainInfo | CosmosChainInfo | null} info - Chain specific information
|
|
10
99
|
*
|
|
11
100
|
*/
|
|
12
101
|
export declare type BlockchainMeta = {
|
|
13
102
|
name: string;
|
|
103
|
+
shortName: string;
|
|
104
|
+
displayName: string;
|
|
14
105
|
defaultDecimals: number;
|
|
15
106
|
feeAssets: Asset[];
|
|
16
107
|
addressPatterns: string[];
|
|
108
|
+
logo: string;
|
|
109
|
+
color: string;
|
|
110
|
+
enabled: boolean;
|
|
111
|
+
type: TransactionType;
|
|
112
|
+
chainId: string | null;
|
|
113
|
+
info: EVMChainInfo | CosmosChainInfo | null;
|
|
17
114
|
};
|
|
18
115
|
/**
|
|
19
116
|
* Metadata of Swapper
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/types/api/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/types/api/meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAA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MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,eAAe,EAAE,OAAO,CAAA;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAC7B,CAAA;AAED;;;;;;;;GAQG;AACH,oBAAY,YAAY,GAAG;IACzB,WAAW,EAAE,cAAc,EAAE,CAAA;IAC7B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,aAAa,EAAE,KAAK,EAAE,CAAA;IACtB,QAAQ,EAAE,cAAc,EAAE,CAAA;CAC3B,CAAA"}
|
|
@@ -15,11 +15,13 @@ export declare type UserWalletBlockchain = {
|
|
|
15
15
|
* Full information of a path of multiple swaps that should be executed by user to swap X to Y
|
|
16
16
|
*
|
|
17
17
|
* @property {string} outputAmount - The estimation of Rango from output amount of Y
|
|
18
|
+
* @property {'OK' | 'HIGH_IMPACT' | 'NO_ROUTE' | 'INPUT_LIMIT_ISSUE'} resultType
|
|
18
19
|
* @property {SwapResult[]} swaps - List of required swaps to swap X to Y with the expected outputAmount
|
|
19
20
|
*
|
|
20
21
|
*/
|
|
21
22
|
export declare type SimulationResult = {
|
|
22
23
|
outputAmount: string;
|
|
24
|
+
resultType: 'OK' | 'HIGH_IMPACT' | 'NO_ROUTE' | 'INPUT_LIMIT_ISSUE';
|
|
23
25
|
swaps: SwapResult[];
|
|
24
26
|
};
|
|
25
27
|
/**
|
|
@@ -73,11 +75,12 @@ export declare type BlockchainValidationStatus = {
|
|
|
73
75
|
* @property {Asset} from - The source asset
|
|
74
76
|
* @property {Asset} to - The destination asset
|
|
75
77
|
* @property {string} amount - The human-readable amount of asset X that is going to be swapped, example: 0.28
|
|
78
|
+
* @property {{ [key: string]: string }} selectedWallets - Map of blockchain to selected address
|
|
79
|
+
* @property {UserWalletBlockchain[]} connectedWallets - List of all user connected wallet addresses per each blockchain
|
|
76
80
|
* @property {boolean} checkPrerequisites - It should be false when client just likes to preview the route to user,
|
|
77
81
|
* and true when user really accepted to swap. If true, server will be much slower to respond, but will check some
|
|
78
82
|
* pre-requisites including balance of X and required fees in user's wallets
|
|
79
|
-
* @property {
|
|
80
|
-
* @property {UserWalletBlockchain[]} connectedWallets - List of all user connected wallet addresses per each blockchain
|
|
83
|
+
* @property {boolean} [forceExecution] - Use this flag if you want to ignore checkPrerequisites before executing the route
|
|
81
84
|
* @property {string | null} [affiliateRef] - The affiliate ref that client likes to send to Rango, so in cases of
|
|
82
85
|
* 1inch, Thorchain, etc. that support affiliation, the referrer will earn some money if user accept the route and
|
|
83
86
|
* signs the transactions. example: K3ldk3
|
|
@@ -92,11 +95,12 @@ export declare type BestRouteRequest = {
|
|
|
92
95
|
from: Asset;
|
|
93
96
|
to: Asset;
|
|
94
97
|
amount: string;
|
|
95
|
-
checkPrerequisites: boolean;
|
|
96
98
|
connectedWallets: UserWalletBlockchain[];
|
|
97
99
|
selectedWallets: {
|
|
98
100
|
[key: string]: string;
|
|
99
101
|
};
|
|
102
|
+
checkPrerequisites: boolean;
|
|
103
|
+
forceExecution?: boolean;
|
|
100
104
|
affiliateRef?: string | null;
|
|
101
105
|
disableMultiStepTx?: boolean;
|
|
102
106
|
blockchains?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../../src/types/api/routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAErD;;;;;;GAMG;AACH,oBAAY,oBAAoB,GAAG;IACjC,UAAU,EAAE,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AA;IACX,EAAE,EAAE,KAAK,CAAA;IACT,MAAM,EAAE,MAAM,CAAA;IACd,gBAAgB,EAAE,oBAAoB,EAAE,CAAA;IACxC,eAAe,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IAC1C,kBAAkB,EAAE,OAAO,CAAA;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAA;IACpC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oBAAY,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,KAAK,CAAA;IACX,EAAE,EAAE,KAAK,CAAA;IACT,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAA;IAC/B,gBAAgB,EAAE,0BAA0B,EAAE,GAAG,IAAI,CAAA;IACrD,iBAAiB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAClC,kBAAkB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IACnC,sBAAsB,EAAE,OAAO,CAAA;IAC/B,iCAAiC,EAAE,OAAO,CAAA;CAC3C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rango-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Rango Exchange SDK for dApps",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"scripts": {
|
|
16
16
|
"test": "jest --config jestconfig.json",
|
|
17
17
|
"build": "tsc",
|
|
18
|
-
"format": "prettier --write ./src",
|
|
19
18
|
"lint": "eslint */**/*.{js,ts} --quiet --fix",
|
|
20
|
-
"semantic-release": "semantic-release"
|
|
19
|
+
"semantic-release": "semantic-release",
|
|
20
|
+
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
|
|
21
21
|
},
|
|
22
22
|
"keywords": [
|
|
23
23
|
"Rango Exchange",
|