rango-sdk 0.0.9 → 0.1.0
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/{LICENSE → lib/LICENSE} +0 -0
- package/{README.md → lib/README.md} +18 -3
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -21
- package/lib/package.json +37 -0
- package/lib/rango-sdk.cjs.development.js +612 -0
- package/lib/rango-sdk.cjs.development.js.map +1 -0
- package/lib/rango-sdk.cjs.production.min.js +2 -0
- package/lib/rango-sdk.cjs.production.min.js.map +1 -0
- package/lib/rango-sdk.esm.js +611 -0
- package/lib/rango-sdk.esm.js.map +1 -0
- package/lib/services/client.d.ts +18 -18
- package/lib/services/client.d.ts.map +1 -1
- package/lib/services/httpService.d.ts +1 -1
- package/lib/services/httpService.d.ts.map +1 -1
- package/lib/services/index.d.ts +1 -1
- package/lib/services/index.d.ts.map +1 -1
- package/lib/types/api/balance.d.ts +1 -38
- package/lib/types/api/balance.d.ts.map +1 -1
- package/lib/types/api/common.d.ts +1 -222
- package/lib/types/api/common.d.ts.map +1 -1
- package/lib/types/api/meta.d.ts +1 -165
- package/lib/types/api/meta.d.ts.map +1 -1
- package/lib/types/api/routing.d.ts +1 -146
- package/lib/types/api/routing.d.ts.map +1 -1
- package/lib/types/api/transactions.d.ts +1 -180
- package/lib/types/api/transactions.d.ts.map +1 -1
- package/lib/types/api/txs/cosmos.d.ts +1 -65
- package/lib/types/api/txs/cosmos.d.ts.map +1 -1
- package/lib/types/api/txs/evm.d.ts +1 -28
- package/lib/types/api/txs/evm.d.ts.map +1 -1
- package/lib/types/api/txs/index.d.ts +4 -4
- package/lib/types/api/txs/index.d.ts.map +1 -1
- package/lib/types/api/txs/solana.d.ts +1 -45
- package/lib/types/api/txs/solana.d.ts.map +1 -1
- package/lib/types/api/txs/transfer.d.ts +1 -23
- package/lib/types/api/txs/transfer.d.ts.map +1 -1
- package/lib/types/index.d.ts +6 -6
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +14 -25
- package/lib/index.js.map +0 -1
- package/lib/services/client.js +0 -164
- package/lib/services/client.js.map +0 -1
- package/lib/services/httpService.js +0 -11
- package/lib/services/httpService.js.map +0 -1
- package/lib/services/index.js +0 -6
- package/lib/services/index.js.map +0 -1
- package/lib/types/api/balance.js +0 -3
- package/lib/types/api/balance.js.map +0 -1
- package/lib/types/api/common.js +0 -3
- package/lib/types/api/common.js.map +0 -1
- package/lib/types/api/meta.js +0 -3
- package/lib/types/api/meta.js.map +0 -1
- package/lib/types/api/routing.js +0 -3
- package/lib/types/api/routing.js.map +0 -1
- package/lib/types/api/transactions.js +0 -23
- package/lib/types/api/transactions.js.map +0 -1
- package/lib/types/api/txs/cosmos.js +0 -3
- package/lib/types/api/txs/cosmos.js.map +0 -1
- package/lib/types/api/txs/evm.js +0 -3
- package/lib/types/api/txs/evm.js.map +0 -1
- package/lib/types/api/txs/index.js +0 -21
- package/lib/types/api/txs/index.js.map +0 -1
- package/lib/types/api/txs/solana.js +0 -3
- package/lib/types/api/txs/solana.js.map +0 -1
- package/lib/types/api/txs/transfer.js +0 -3
- package/lib/types/api/txs/transfer.js.map +0 -1
- package/lib/types/index.js +0 -23
- package/lib/types/index.js.map +0 -1
package/lib/services/client.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { MetaResponse, BestRouteRequest, BestRouteResponse, CheckApprovalResponse, CheckTxStatusRequest, TransactionStatusResponse, CreateTransactionRequest, CreateTransactionResponse, ReportTransactionRequest, WalletDetailsResponse } from
|
|
2
|
-
declare type WalletAddresses = {
|
|
3
|
-
blockchain: string;
|
|
4
|
-
address: string;
|
|
5
|
-
}[];
|
|
6
|
-
export declare class RangoClient {
|
|
7
|
-
private readonly deviceId;
|
|
8
|
-
private readonly apiKey;
|
|
9
|
-
constructor(apiKey: string);
|
|
10
|
-
getAllMetadata(): Promise<MetaResponse>;
|
|
11
|
-
getBestRoute(requestBody: BestRouteRequest): Promise<BestRouteResponse>;
|
|
12
|
-
checkApproval(requestId: string): Promise<CheckApprovalResponse>;
|
|
13
|
-
checkStatus(requestBody: CheckTxStatusRequest): Promise<TransactionStatusResponse>;
|
|
14
|
-
createTransaction(requestBody: CreateTransactionRequest): Promise<CreateTransactionResponse>;
|
|
15
|
-
reportFailure(requestBody: ReportTransactionRequest): Promise<void>;
|
|
16
|
-
getWalletsDetails(walletAddresses: WalletAddresses): Promise<WalletDetailsResponse>;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
1
|
+
import { MetaResponse, BestRouteRequest, BestRouteResponse, CheckApprovalResponse, CheckTxStatusRequest, TransactionStatusResponse, CreateTransactionRequest, CreateTransactionResponse, ReportTransactionRequest, WalletDetailsResponse } from '../types';
|
|
2
|
+
declare type WalletAddresses = {
|
|
3
|
+
blockchain: string;
|
|
4
|
+
address: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare class RangoClient {
|
|
7
|
+
private readonly deviceId;
|
|
8
|
+
private readonly apiKey;
|
|
9
|
+
constructor(apiKey: string);
|
|
10
|
+
getAllMetadata(): Promise<MetaResponse>;
|
|
11
|
+
getBestRoute(requestBody: BestRouteRequest): Promise<BestRouteResponse>;
|
|
12
|
+
checkApproval(requestId: string): Promise<CheckApprovalResponse>;
|
|
13
|
+
checkStatus(requestBody: CheckTxStatusRequest): Promise<TransactionStatusResponse>;
|
|
14
|
+
createTransaction(requestBody: CreateTransactionRequest): Promise<CreateTransactionResponse>;
|
|
15
|
+
reportFailure(requestBody: ReportTransactionRequest): Promise<void>;
|
|
16
|
+
getWalletsDetails(walletAddresses: WalletAddresses): Promise<WalletDetailsResponse>;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
19
19
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/services/client.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,UAAU,CAAA;AAEjB,aAAK,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAAA;AAEhE,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IAEjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;gBAEnB,MAAM,EAAE,MAAM;IAoBb,cAAc,IAAI,OAAO,CAAC,YAAY,CAAC;IAOvC,YAAY,CACvB,WAAW,EAAE,gBAAgB,GAC5B,OAAO,CAAC,iBAAiB,CAAC;IAShB,aAAa,CACxB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,qBAAqB,CAAC;IAOpB,WAAW,CACtB,WAAW,EAAE,oBAAoB,GAChC,OAAO,CAAC,yBAAyB,CAAC;IAQxB,iBAAiB,CAC5B,WAAW,EAAE,wBAAwB,GACpC,OAAO,CAAC,yBAAyB,CAAC;IAQxB,aAAa,CACxB,WAAW,EAAE,wBAAwB,GACpC,OAAO,CAAC,IAAI,CAAC;IAIH,iBAAiB,CAC5B,eAAe,EAAE,eAAe,GAC/B,OAAO,CAAC,qBAAqB,CAAC;CAWlC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const httpService: import("axios").AxiosInstance;
|
|
1
|
+
export declare const httpService: import("axios").AxiosInstance;
|
|
2
2
|
//# sourceMappingURL=httpService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpService.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"httpService.d.ts","sourceRoot":"","sources":["../src/services/httpService.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,+BAEtB,CAAA"}
|
package/lib/services/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { RangoClient } from './client';
|
|
1
|
+
export { RangoClient } from './client';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1,39 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Pair of the asset and its amount in wallet balance
|
|
4
|
-
*
|
|
5
|
-
* @property {Amount} amount
|
|
6
|
-
* @property {Asset} asset
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export declare type AssetAndAmount = {
|
|
10
|
-
amount: Amount;
|
|
11
|
-
asset: Asset;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Balance of a specific address inside a specific blockchain
|
|
15
|
-
*
|
|
16
|
-
* @property {boolean} failed - If true, Rango was not able to fetch balance of this wallet, maybe try again later
|
|
17
|
-
* @property {string} blockChain - Wallet blockchain
|
|
18
|
-
* @property {string} address - Wallet address
|
|
19
|
-
* @property {AssetAndAmount[] | null} balances - Examples: BSC, TERRA, OSMOSIS, ...
|
|
20
|
-
* @property {string} explorerUrl - The explorer url of the wallet, example: https://bscscan.com/address/0x7a3....fdsza
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
export declare type WalletDetail = {
|
|
24
|
-
failed: boolean;
|
|
25
|
-
blockChain: string;
|
|
26
|
-
address: string;
|
|
27
|
-
balances: AssetAndAmount[] | null;
|
|
28
|
-
explorerUrl: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Response of checking wallet balance
|
|
32
|
-
*
|
|
33
|
-
* @property {WalletDetail[]} wallets - list of wallet assets
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
export declare type WalletDetailsResponse = {
|
|
37
|
-
wallets: WalletDetail[];
|
|
38
|
-
};
|
|
1
|
+
export * from 'rango-types/lib/api/main/balance';
|
|
39
2
|
//# sourceMappingURL=balance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/types/api/balance.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA"}
|
|
@@ -1,223 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* An asset which is unique by (blockchain, symbol, address)
|
|
3
|
-
*
|
|
4
|
-
* @property {string} blockchain - The blockchain which this token belongs to
|
|
5
|
-
* @property {string | null} address - Smart contract address of token, null for native tokens
|
|
6
|
-
* @property {string} symbol - The display token symbol, e.g. USDT, BTC, ...
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export declare type Asset = {
|
|
10
|
-
blockchain: string;
|
|
11
|
-
address: string | null;
|
|
12
|
-
symbol: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* The amount of an asset, including value & decimals.
|
|
16
|
-
* The value is machine-readable, to make it human-readable it should be shifted by decimals.
|
|
17
|
-
*
|
|
18
|
-
* @property {string} amount - The machine-readable amount shifted by decimals, example: 1000000000000000000
|
|
19
|
-
* @property {number} decimals - The decimals of the token in blockchain, example: 18
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export declare type Amount = {
|
|
23
|
-
amount: string;
|
|
24
|
-
decimals: number;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Minimum required slippage of a step
|
|
28
|
-
*
|
|
29
|
-
* @property {boolean} error - If true, means that Rango failed to compute slippage for this step.
|
|
30
|
-
* @property {number} slippage - The slippage amount in percent, example: 5
|
|
31
|
-
*
|
|
32
|
-
*/
|
|
33
|
-
export declare type RecommendedSlippage = {
|
|
34
|
-
error: boolean;
|
|
35
|
-
slippage: number;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* A fee unit, including the type of asset and the amount of fee
|
|
39
|
-
*
|
|
40
|
-
* @property {string} name - A display name for this fee, example: Network Fee
|
|
41
|
-
* @property {Asset} asset - Underlying asset for paying fee, example: BNB for BSC blockchain
|
|
42
|
-
* @property {string} amount - The human readable amount of fee, example: 0.004
|
|
43
|
-
* @property {string} expenseType - Type of the fee, example: FROM_SOURCE_WALLET
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
export declare type SwapFee = {
|
|
47
|
-
name: string;
|
|
48
|
-
expenseType: 'FROM_SOURCE_WALLET' | 'DECREASE_FROM_OUTPUT' | 'FROM_DESTINATION_WALLET';
|
|
49
|
-
asset: Asset;
|
|
50
|
-
amount: string;
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Source or destination asset of a route step
|
|
54
|
-
*
|
|
55
|
-
* @property {string} blockchain - Blockchain of the source/destination asset of this step
|
|
56
|
-
* @property {string} symbol - Symbol of the source/destination asset of this step, example: OSMO
|
|
57
|
-
* @property {string | number} address - Contract address of the source/dest asset of this step, null for native token
|
|
58
|
-
* @property {number} decimals - Decimals of the source/destination asset of this step, example: 18
|
|
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
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
export declare type SwapResultAsset = {
|
|
64
|
-
blockchain: string;
|
|
65
|
-
address: string | null;
|
|
66
|
-
symbol: string;
|
|
67
|
-
logo: string;
|
|
68
|
-
decimals: number;
|
|
69
|
-
usdPrice: string | null;
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* A node of the swap path
|
|
73
|
-
*
|
|
74
|
-
* @property {string | null} marketId - Id of the market
|
|
75
|
-
* @property {string | null} marketName - Name of the market, example: Uniswap
|
|
76
|
-
* @property {number} percent - Percent of the allocation to this path, example: 45
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
|
-
export declare type SwapNode = {
|
|
80
|
-
marketId: string | null;
|
|
81
|
-
marketName: string;
|
|
82
|
-
percent: number;
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* A swap path from asset x (from) to asset y (to)
|
|
86
|
-
*
|
|
87
|
-
* @property {string} from - Symbol of the source asset
|
|
88
|
-
* @property {string | null} fromAddress - Contract address of source asset, null for native tokens
|
|
89
|
-
* @property {string} fromBlockchain - Blockchain of the source asset
|
|
90
|
-
* @property {string} fromLogo - Absolute path of logo of the source asset
|
|
91
|
-
*
|
|
92
|
-
* @property {string} to - Symbol of the destination asset
|
|
93
|
-
* @property {string | null} toAddress - Contract address of destination asset, null for native tokens
|
|
94
|
-
* @property {string} toBlockchain - Blockchain of the destination asset
|
|
95
|
-
* @property {string} toLogo - Absolute path of logo of the destination asset
|
|
96
|
-
*
|
|
97
|
-
* @property {SwapNode[]} nodes - List of intermediate nodes in a swap path
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
export declare type SwapSuperNode = {
|
|
101
|
-
from: string;
|
|
102
|
-
fromAddress: string | null;
|
|
103
|
-
fromBlockchain: string;
|
|
104
|
-
fromLogo: string;
|
|
105
|
-
to: string;
|
|
106
|
-
toAddress: string | null;
|
|
107
|
-
toBlockchain: string;
|
|
108
|
-
toLogo: string;
|
|
109
|
-
nodes: SwapNode[];
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Internal mechanism of a step
|
|
113
|
-
*
|
|
114
|
-
* @property {SwapSuperNode[] | null} nodes - List of parallel paths that splitting happens
|
|
115
|
-
*
|
|
116
|
-
*/
|
|
117
|
-
export declare type SwapRoute = {
|
|
118
|
-
nodes: SwapSuperNode[] | null;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Time estimation details for a step of swap route
|
|
122
|
-
*
|
|
123
|
-
* @property {number} min - The minimum duration (in seconds) that usually takes for related step
|
|
124
|
-
* @property {number} avg - The average duration (in seconds) that usually takes for related step
|
|
125
|
-
* @property {number} max - The maximum duration (in seconds) that usually takes for related step
|
|
126
|
-
*
|
|
127
|
-
*/
|
|
128
|
-
export declare type TimeStat = {
|
|
129
|
-
min: number;
|
|
130
|
-
avg: number;
|
|
131
|
-
max: number;
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* A step of a multi-step swap route
|
|
135
|
-
*
|
|
136
|
-
* @property {string} swapperId - Unique Id of swapper. example: 1INCH_BSC, TERRASWAP
|
|
137
|
-
*
|
|
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
|
|
141
|
-
*
|
|
142
|
-
* @property {SwapResultAsset} from - The source asset
|
|
143
|
-
*
|
|
144
|
-
* @property {SwapResultAsset} to - The destination asset
|
|
145
|
-
*
|
|
146
|
-
* @property {string} fromAmount - Estimated input amount of this step. Can be used for previewing to user and should
|
|
147
|
-
* not be used for real computation, since it may change when the real transaction happens due to volatility of the market
|
|
148
|
-
*
|
|
149
|
-
* @property {string} toAmount - Estimated output amount of this step. Can be used for previewing to user and should
|
|
150
|
-
* not be used for real computation, since it may change when the real transaction happens due to volatility of the market
|
|
151
|
-
*
|
|
152
|
-
* @property {SwapRoute[] | null} routes - The internal routing of this step showing how the initial swap request will
|
|
153
|
-
* be split and executed. This can be used for previewing purpose to give the user a sense of what's going to happen.
|
|
154
|
-
* Null indicates that there is no internal mechanism and swapping is simple and straight-forward.
|
|
155
|
-
*
|
|
156
|
-
* @property {SwapFee[]} fee - List of fees that are taken from user in this step
|
|
157
|
-
*
|
|
158
|
-
* @property {number | null} fromAmountMinValue - The minimum amount unit, the precision that will be applied to
|
|
159
|
-
* transaction amount in create transaction endpoint automatically by Rango. This field is informational and there is
|
|
160
|
-
* no need to apply it in client-side.
|
|
161
|
-
*
|
|
162
|
-
* @property {number | null} fromAmountMaxValue - Exactly the same as fromAmountMinValue, but for the maximum limit
|
|
163
|
-
*
|
|
164
|
-
* @property {number | null} fromAmountPrecision - The minimum amount unit, the precision that will be applied to
|
|
165
|
-
* transaction amount in create transaction endpoint automatically by Rango. This field is informational and there
|
|
166
|
-
* is no need to apply it in client-side
|
|
167
|
-
*
|
|
168
|
-
* @property {string} fromAmountRestrictionType - Specifies range for fromAmount (Min / Max) Value. for example if value
|
|
169
|
-
* is EXCLUSIVE and fromAmountMinValue is 20, user can execute transaction if inputValue > 20, but for INCLUSIVE
|
|
170
|
-
* inputValue >= 20 is valid. possible values: INCLUSIVE / EXCLUSIVE
|
|
171
|
-
*
|
|
172
|
-
* @property {number} estimatedTimeInSeconds - The estimated time (in seconds) that this step might take, beware that
|
|
173
|
-
* this number is just an estimation and should be used only for user preview, example: 15
|
|
174
|
-
*
|
|
175
|
-
* @property {TimeStat | null} timeStat - The minimum, avg and max estimation time for this step
|
|
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
|
-
*
|
|
181
|
-
* @property {RecommendedSlippage | null} recommendedSlippage
|
|
182
|
-
*
|
|
183
|
-
* @property {string[] | null} warnings - List of warnings for this swap step, usually null or empty
|
|
184
|
-
*
|
|
185
|
-
*/
|
|
186
|
-
export declare type SwapResult = {
|
|
187
|
-
swapperId: string;
|
|
188
|
-
swapperType: 'BRIDGE' | 'DEX' | 'AGGREGATOR';
|
|
189
|
-
swapChainType: 'INTER_CHAIN' | 'INTRA_CHAIN';
|
|
190
|
-
from: SwapResultAsset;
|
|
191
|
-
to: SwapResultAsset;
|
|
192
|
-
fromAmount: string;
|
|
193
|
-
toAmount: string;
|
|
194
|
-
routes: SwapRoute[] | null;
|
|
195
|
-
fee: SwapFee[];
|
|
196
|
-
fromAmountMaxValue: number | null;
|
|
197
|
-
fromAmountMinValue: number | null;
|
|
198
|
-
fromAmountPrecision: number | null;
|
|
199
|
-
fromAmountRestrictionType: 'EXCLUSIVE' | 'INCLUSIVE';
|
|
200
|
-
estimatedTimeInSeconds: number;
|
|
201
|
-
timeStat: TimeStat | null;
|
|
202
|
-
includesDestinationTx: boolean;
|
|
203
|
-
maxRequiredSign: number;
|
|
204
|
-
recommendedSlippage: RecommendedSlippage | null;
|
|
205
|
-
warnings: string[] | null;
|
|
206
|
-
};
|
|
207
|
-
/**
|
|
208
|
-
* An asset with its ticker
|
|
209
|
-
*
|
|
210
|
-
* @property {string} blockchain - Blockchain of asset
|
|
211
|
-
* @property {string | null} address - Contract address of the asset, null for native tokens
|
|
212
|
-
* @property {string} symbol - Symbol of an asset, example: BUSD
|
|
213
|
-
* @property {string} ticker - The ticker of the asset which normally is a combination of symbol and address,
|
|
214
|
-
* required by some javascript wallets
|
|
215
|
-
*
|
|
216
|
-
*/
|
|
217
|
-
export declare type AssetWithTicker = {
|
|
218
|
-
blockchain: string;
|
|
219
|
-
address: string | null;
|
|
220
|
-
symbol: string;
|
|
221
|
-
ticker: string;
|
|
222
|
-
};
|
|
1
|
+
export * from 'rango-types/lib/api/main/common';
|
|
223
2
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/api/common.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAA"}
|
package/lib/types/api/meta.d.ts
CHANGED
|
@@ -1,166 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { TransactionType } from './transactions';
|
|
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
|
|
85
|
-
*
|
|
86
|
-
* @property {string} name - Unique name of blockchain, this field is used in all endpoints as the identifier
|
|
87
|
-
* @property {number} defaultDecimals - The default decimals of blockchain, do not use it in computations, use Token.decimals instead
|
|
88
|
-
* @property {Asset[]} feeAssets - List of assets that can be used as fee in this blockchain
|
|
89
|
-
* @property {string[]} addressPatterns - List of all regex patterns for wallet addresses of this blockchain, can be
|
|
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
|
|
99
|
-
*
|
|
100
|
-
*/
|
|
101
|
-
export declare type BlockchainMeta = {
|
|
102
|
-
name: string;
|
|
103
|
-
shortName: string;
|
|
104
|
-
displayName: string;
|
|
105
|
-
defaultDecimals: number;
|
|
106
|
-
feeAssets: Asset[];
|
|
107
|
-
addressPatterns: string[];
|
|
108
|
-
logo: string;
|
|
109
|
-
color: string;
|
|
110
|
-
enabled: boolean;
|
|
111
|
-
type: TransactionType;
|
|
112
|
-
chainId: string | null;
|
|
113
|
-
info: EVMChainInfo | CosmosChainInfo | null;
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Metadata of Swapper
|
|
117
|
-
*/
|
|
118
|
-
export declare type SwapperMetaDto = {
|
|
119
|
-
id: string;
|
|
120
|
-
title: string;
|
|
121
|
-
logo: string;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* All metadata info for a token, unique by (blockchain, symbol, address) tuple
|
|
125
|
-
*
|
|
126
|
-
* @property {string} blockchain - The blockchain which this token belongs to
|
|
127
|
-
* @property {string | null} address - Smart contract address of token, null for native tokens
|
|
128
|
-
* @property {string} symbol - The token symbol, e.g: ADA
|
|
129
|
-
* @property {string | null} name - Display name of token, e.g: Cardano for ADA. It can be null
|
|
130
|
-
* @property {number} decimals - Decimals of token in blockchain, example: 18
|
|
131
|
-
* @property {string} image - Url of its image, example: https://api.rango.exchange/tokens/ETH/ETH.png
|
|
132
|
-
* @property {number | null} usdPrice - USD unit price of this token if available
|
|
133
|
-
* @property {boolean} isSecondaryCoin - If true, means that the token's trading is high risk. Better to warn user before proceeding
|
|
134
|
-
* @property {string | null} coinSource - If the token is secondary, coinSource indicates the third-party list
|
|
135
|
-
* that Rango found this token in, example: Pancake Extended List
|
|
136
|
-
* @property {string | null} coinSourceUrl - The absolute url of the source list that token was extracted from
|
|
137
|
-
*
|
|
138
|
-
*/
|
|
139
|
-
export declare type Token = {
|
|
140
|
-
blockchain: string;
|
|
141
|
-
address: string | null;
|
|
142
|
-
symbol: string;
|
|
143
|
-
name: string | null;
|
|
144
|
-
decimals: number;
|
|
145
|
-
image: string;
|
|
146
|
-
usdPrice: number | null;
|
|
147
|
-
isSecondaryCoin: boolean;
|
|
148
|
-
coinSource: string | null;
|
|
149
|
-
coinSourceUrl: string | null;
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Metadata info for all blockchains and tokens supported
|
|
153
|
-
*
|
|
154
|
-
* @property {BlockchainMeta[]} blockchains - List of all supported blockchains
|
|
155
|
-
* @property {Token[]} tokens - List of all tokens
|
|
156
|
-
* @property {Token[]} popularTokens - List of popular tokens, a subset of tokens field
|
|
157
|
-
* @property {SwapperMetaDto[]} swappers - List of all DEXes & Bridges
|
|
158
|
-
*
|
|
159
|
-
*/
|
|
160
|
-
export declare type MetaResponse = {
|
|
161
|
-
blockchains: BlockchainMeta[];
|
|
162
|
-
tokens: Token[];
|
|
163
|
-
popularTokens: Token[];
|
|
164
|
-
swappers: SwapperMetaDto[];
|
|
165
|
-
};
|
|
1
|
+
export * from 'rango-types/lib/api/main/meta';
|
|
166
2
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/types/api/meta.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
|
|
@@ -1,147 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { TransactionType } from './transactions';
|
|
3
|
-
/**
|
|
4
|
-
* All user wallets for a specific blockchain
|
|
5
|
-
*
|
|
6
|
-
* @property {string} blockchain - The blockchain that wallets belong to
|
|
7
|
-
* @property {string[]} addresses - List of user wallet addresses for the specified blockchain
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export declare type UserWalletBlockchain = {
|
|
11
|
-
blockchain: string;
|
|
12
|
-
addresses: string[];
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Full information of a path of multiple swaps that should be executed by user to swap X to Y
|
|
16
|
-
*
|
|
17
|
-
* @property {string} outputAmount - The estimation of Rango from output amount of Y
|
|
18
|
-
* @property {'OK' | 'HIGH_IMPACT' | 'NO_ROUTE' | 'INPUT_LIMIT_ISSUE'} resultType
|
|
19
|
-
* @property {SwapResult[]} swaps - List of required swaps to swap X to Y with the expected outputAmount
|
|
20
|
-
*
|
|
21
|
-
*/
|
|
22
|
-
export declare type SimulationResult = {
|
|
23
|
-
outputAmount: string;
|
|
24
|
-
resultType: 'OK' | 'HIGH_IMPACT' | 'NO_ROUTE' | 'INPUT_LIMIT_ISSUE';
|
|
25
|
-
swaps: SwapResult[];
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Describing a required Asset for swapping X to Y and check if the wallet has enough balance or not
|
|
29
|
-
*
|
|
30
|
-
* @property {Asset} asset - asset required for fee or balance
|
|
31
|
-
* @property {Asset} requiredAmount
|
|
32
|
-
* @property {Amount} currentAmount
|
|
33
|
-
* @property {boolean} ok - If true, means this requirement is fulfilled, false means swap may fail due to insufficient balance
|
|
34
|
-
* @property {string} reason - 'FEE' | 'FEE_AND_INPUT_ASSET' | 'INPUT_ASSET'
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
export declare type WalletRequiredAssets = {
|
|
38
|
-
asset: Asset;
|
|
39
|
-
requiredAmount: Amount;
|
|
40
|
-
currentAmount: Amount;
|
|
41
|
-
ok: boolean;
|
|
42
|
-
reason: 'FEE' | 'FEE_AND_INPUT_ASSET' | 'INPUT_ASSET';
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* The validation status of a wallet
|
|
46
|
-
*
|
|
47
|
-
* @property {string} address - The address of wallet
|
|
48
|
-
* @property {boolean} addressIsValid - If false, the wallet address is invalid for the given blockchain
|
|
49
|
-
* @property {WalletRequiredAssets[]} requiredAssets - The list of required assets for swapping X to Y in this wallet
|
|
50
|
-
* and the status to indicate whether these assets are missing or not
|
|
51
|
-
* @property {boolean} validResult - If false, Rango was unable to fetch the balance of this address to check the
|
|
52
|
-
* requiredAssets availability
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
export declare type WalletValidationStatus = {
|
|
56
|
-
address: string;
|
|
57
|
-
addressIsValid: boolean;
|
|
58
|
-
requiredAssets: WalletRequiredAssets[];
|
|
59
|
-
validResult: boolean;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* The blockchain that this validation data belongs to
|
|
63
|
-
*
|
|
64
|
-
* @property {string} blockchain - The blockchain of validation
|
|
65
|
-
* @property {WalletValidationStatus[]} wallets - The status of validation for all the wallets of the specific blockchain
|
|
66
|
-
*
|
|
67
|
-
*/
|
|
68
|
-
export declare type BlockchainValidationStatus = {
|
|
69
|
-
blockchain: string;
|
|
70
|
-
wallets: WalletValidationStatus[];
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Body of routing request
|
|
74
|
-
*
|
|
75
|
-
* @property {Asset} from - The source asset
|
|
76
|
-
* @property {Asset} to - The destination asset
|
|
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
|
|
80
|
-
* @property {boolean} checkPrerequisites - It should be false when client just likes to preview the route to user,
|
|
81
|
-
* and true when user really accepted to swap. If true, server will be much slower to respond, but will check some
|
|
82
|
-
* pre-requisites including balance of X and required fees in user's wallets
|
|
83
|
-
* @property {boolean} [forceExecution] - Use this flag if you want to ignore checkPrerequisites before executing the route
|
|
84
|
-
* @property {string | null} [affiliateRef] - The affiliate ref that client likes to send to Rango, so in cases of
|
|
85
|
-
* 1inch, Thorchain, etc. that support affiliation, the referrer will earn some money if user accept the route and
|
|
86
|
-
* signs the transactions. example: K3ldk3
|
|
87
|
-
* @property {boolean} [disableMultiStepTx] - It should be true when the client doesn't want multi-step transactions
|
|
88
|
-
* @property {string[]} [blockchains] - List of all accepted blockchains, an empty list means no filter is required
|
|
89
|
-
* @property {string[]} [swappers] - List of all accepted swappers, an empty list means no filter is required
|
|
90
|
-
* @property {string[]} [transactionTypes] - List of all accepted transaction types including [EVM, TRANSFER, COSMOS]
|
|
91
|
-
* @property {number} [maxLength] - Maximum number of steps in a route
|
|
92
|
-
* @property {boolean} contractCall - Mark it true if you are going to call this route via your own contract, so we
|
|
93
|
-
* will filter routes that are not possible to be called from a contract
|
|
94
|
-
*
|
|
95
|
-
*/
|
|
96
|
-
export declare type BestRouteRequest = {
|
|
97
|
-
from: Asset;
|
|
98
|
-
to: Asset;
|
|
99
|
-
amount: string;
|
|
100
|
-
connectedWallets: UserWalletBlockchain[];
|
|
101
|
-
selectedWallets: {
|
|
102
|
-
[key: string]: string;
|
|
103
|
-
};
|
|
104
|
-
checkPrerequisites: boolean;
|
|
105
|
-
forceExecution?: boolean;
|
|
106
|
-
affiliateRef?: string | null;
|
|
107
|
-
disableMultiStepTx?: boolean;
|
|
108
|
-
blockchains?: string[];
|
|
109
|
-
swappers?: string[];
|
|
110
|
-
transactionTypes?: TransactionType[];
|
|
111
|
-
maxLength?: number;
|
|
112
|
-
contractCall?: boolean;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* The response of best route, if the result fields is null, it means that no route is found
|
|
116
|
-
*
|
|
117
|
-
* @property {string} requestId - The unique requestId which is generated for this request by the server. It should be
|
|
118
|
-
* passed down to all other endpoints if this swap continues on. e.g. d10657ce-b13a-405c-825b-b47f8a5016ad
|
|
119
|
-
* @property {string} requestAmount - The human readable input amount from the request
|
|
120
|
-
* @property {Asset} from
|
|
121
|
-
* @property {Asset} to
|
|
122
|
-
* @property {SimulationResult | null} result
|
|
123
|
-
* @property {BlockchainValidationStatus[] | null} validationStatus - Pre-requisites check result. It will be null if
|
|
124
|
-
* the request checkPrerequisites was false
|
|
125
|
-
* @property {string[]} diagnosisMessages - list of string messages that might be cause of not finding the route.
|
|
126
|
-
* It's just for display purposes
|
|
127
|
-
* @property {string[]} missingBlockchains - List of all blockchains which are necessary to be present for the best
|
|
128
|
-
* route and user has not provided any connected wallets for it. A null or empty list indicates that there is no problem.
|
|
129
|
-
* @property {boolean} processingLimitReached - A warning indicates that it took too much time to find the best
|
|
130
|
-
* route and the server could not find any routes from X to Y
|
|
131
|
-
* @property {boolean} walletNotSupportingFromBlockchain - A warning indicates that none of your wallets have the same
|
|
132
|
-
* blockchain as X asset
|
|
133
|
-
*
|
|
134
|
-
*/
|
|
135
|
-
export declare type BestRouteResponse = {
|
|
136
|
-
requestId: string;
|
|
137
|
-
requestAmount: string;
|
|
138
|
-
from: Asset;
|
|
139
|
-
to: Asset;
|
|
140
|
-
result: SimulationResult | null;
|
|
141
|
-
validationStatus: BlockchainValidationStatus[] | null;
|
|
142
|
-
diagnosisMessages: string[] | null;
|
|
143
|
-
missingBlockchains: string[] | null;
|
|
144
|
-
processingLimitReached: boolean;
|
|
145
|
-
walletNotSupportingFromBlockchain: boolean;
|
|
146
|
-
};
|
|
1
|
+
export * from 'rango-types/lib/api/main/routing';
|
|
147
2
|
//# sourceMappingURL=routing.d.ts.map
|