rango-sdk 0.0.8 → 0.0.10
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/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -21
- package/lib/rango-sdk.cjs.development.js +609 -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 +608 -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 -143
- 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 +21 -20
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rango-sdk.esm.js","sources":["../node_modules/uuid/dist/esm-browser/rng.js","../node_modules/uuid/dist/esm-browser/stringify.js","../node_modules/uuid/dist/esm-browser/native.js","../node_modules/uuid/dist/esm-browser/v4.js","../src/services/httpService.ts","../src/services/client.ts","../node_modules/rango-types/src/api/shared/transactions.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import axios from 'axios'\n\nexport const httpService = axios.create({\n baseURL: 'https://api.rango.exchange',\n})\n","import { v4 } from 'uuid'\n\nimport { httpService } from './httpService'\nimport {\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse\n} from \"../types\"\n\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n\n private readonly apiKey: string\n\n constructor(apiKey: string) {\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = v4()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = v4()\n }\n } catch (e) {\n this.deviceId = v4()\n }\n }\n\n public async getAllMetadata(): Promise<MetaResponse> {\n const axiosResponse = await httpService.get<MetaResponse>(\n `/meta?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest\n ): Promise<BestRouteResponse> {\n const axiosResponse = await httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId } }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest\n ): Promise<TransactionStatusResponse> {\n const axiosResponse = await httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest\n ): Promise<CreateTransactionResponse> {\n const axiosResponse = await httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest\n ): Promise<void> {\n await httpService.post(`/tx/report-tx?apiKey=${this.apiKey}`, requestBody)\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`\n )\n return axiosResponse.data\n }\n}\n",null],"names":["httpService","axios","create","baseURL","RangoClient","apiKey","window","deviceId","localStorage","getItem","generatedId","v4","setItem","e","getAllMetadata","get","axiosResponse","data","getBestRoute","requestBody","post","headers","checkApproval","requestId","checkStatus","createTransaction","reportFailure","getWalletsDetails","walletAddresses","walletAddressesQueryParams","i","length","walletAddress","blockchain","address"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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services/client.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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 {};
|
|
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;AAGjB,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"}
|