rango-sdk 0.0.1
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 +674 -0
- package/README.md +25 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +17 -0
- package/lib/index.js.map +1 -0
- package/lib/services/client.d.ts +22 -0
- package/lib/services/client.d.ts.map +1 -0
- package/lib/services/client.js +159 -0
- package/lib/services/client.js.map +1 -0
- package/lib/services/httpService.d.ts +2 -0
- package/lib/services/httpService.d.ts.map +1 -0
- package/lib/services/httpService.js +11 -0
- package/lib/services/httpService.js.map +1 -0
- package/lib/services/index.d.ts +2 -0
- package/lib/services/index.d.ts.map +1 -0
- package/lib/services/index.js +6 -0
- package/lib/services/index.js.map +1 -0
- package/lib/types/api/balance.d.ts +39 -0
- package/lib/types/api/balance.d.ts.map +1 -0
- package/lib/types/api/balance.js +3 -0
- package/lib/types/api/balance.js.map +1 -0
- package/lib/types/api/common.d.ts +212 -0
- package/lib/types/api/common.d.ts.map +1 -0
- package/lib/types/api/common.js +3 -0
- package/lib/types/api/common.js.map +1 -0
- package/lib/types/api/meta.d.ts +69 -0
- package/lib/types/api/meta.d.ts.map +1 -0
- package/lib/types/api/meta.js +3 -0
- package/lib/types/api/meta.js.map +1 -0
- package/lib/types/api/routing.d.ts +137 -0
- package/lib/types/api/routing.d.ts.map +1 -0
- package/lib/types/api/routing.js +3 -0
- package/lib/types/api/routing.js.map +1 -0
- package/lib/types/api/transactions.d.ts +169 -0
- package/lib/types/api/transactions.d.ts.map +1 -0
- package/lib/types/api/transactions.js +22 -0
- package/lib/types/api/transactions.js.map +1 -0
- package/lib/types/api/txs/cosmos.d.ts +66 -0
- package/lib/types/api/txs/cosmos.d.ts.map +1 -0
- package/lib/types/api/txs/cosmos.js +3 -0
- package/lib/types/api/txs/cosmos.js.map +1 -0
- package/lib/types/api/txs/evm.d.ts +29 -0
- package/lib/types/api/txs/evm.d.ts.map +1 -0
- package/lib/types/api/txs/evm.js +3 -0
- package/lib/types/api/txs/evm.js.map +1 -0
- package/lib/types/api/txs/index.d.ts +4 -0
- package/lib/types/api/txs/index.d.ts.map +1 -0
- package/lib/types/api/txs/index.js +16 -0
- package/lib/types/api/txs/index.js.map +1 -0
- package/lib/types/api/txs/transfer.d.ts +24 -0
- package/lib/types/api/txs/transfer.d.ts.map +1 -0
- package/lib/types/api/txs/transfer.js +3 -0
- package/lib/types/api/txs/transfer.js.map +1 -0
- package/lib/types/index.d.ts +7 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +19 -0
- package/lib/types/index.js.map +1 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Rango Exchange SDK (BETA)
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/rango-sdk)
|
|
4
|
+
[](https://github.com/rango-exchange/rango-sdk/blob/master/LICENSE)
|
|
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
|
+
> **WARNING:** The Rango SDK is still beta. Please use it on your own risk.
|
|
10
|
+
|
|
11
|
+
> **WARNING:** The Rango SDK has not stabilized yet, and we might make some breaking changes.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```shell
|
|
17
|
+
npm install rango-sdk --save
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Please checkout the examples' folder for sample usage of the SDK. We will add more examples there soon.
|
|
23
|
+
|
|
24
|
+
- [API Documentation](https://rango.exchange/apis/docs)
|
|
25
|
+
- [Examples](https://github.com/rango-exchange/rango-sdk/tree/master/exmaples/)
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,cAAc,SAAS,CAAA"}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.RangoClient = void 0;
|
|
14
|
+
var services_1 = require("./services");
|
|
15
|
+
Object.defineProperty(exports, "RangoClient", { enumerable: true, get: function () { return services_1.RangoClient; } });
|
|
16
|
+
__exportStar(require("./types"), exports);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,uCAAwC;AAA/B,uGAAA,WAAW,OAAA;AACpB,0CAAuB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MetaResponse } from '../types/api/meta';
|
|
2
|
+
import type { BestRouteRequest, BestRouteResponse } from '../types/api/routing';
|
|
3
|
+
import type { CheckApprovalResponse, CheckTxStatusRequest, CreateTransactionRequest, CreateTransactionResponse, ReportTransactionRequest, TransactionStatusResponse } from '../types/api/transactions';
|
|
4
|
+
import type { WalletDetailsResponse } from '../types/api/balance';
|
|
5
|
+
declare type WalletAddresses = {
|
|
6
|
+
blockchain: string;
|
|
7
|
+
address: string;
|
|
8
|
+
}[];
|
|
9
|
+
export declare class RangoClient {
|
|
10
|
+
private readonly deviceId;
|
|
11
|
+
private readonly apiKey;
|
|
12
|
+
constructor(apiKey: string);
|
|
13
|
+
getAllMetadata(): Promise<MetaResponse>;
|
|
14
|
+
getBestRoute(requestBody: BestRouteRequest): Promise<BestRouteResponse>;
|
|
15
|
+
checkApproval(requestId: string): Promise<CheckApprovalResponse>;
|
|
16
|
+
checkStatus(requestBody: CheckTxStatusRequest): Promise<TransactionStatusResponse>;
|
|
17
|
+
createTransaction(requestBody: CreateTransactionRequest): Promise<CreateTransactionResponse>;
|
|
18
|
+
reportFailure(requestBody: ReportTransactionRequest): Promise<void>;
|
|
19
|
+
getWalletsDetails(walletAddresses: WalletAddresses): Promise<WalletDetailsResponse>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAC/E,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAEjE,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;IAgBb,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"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.RangoClient = void 0;
|
|
40
|
+
var uuid_1 = require("uuid");
|
|
41
|
+
var httpService_1 = require("./httpService");
|
|
42
|
+
var RangoClient = /** @class */ (function () {
|
|
43
|
+
function RangoClient(apiKey) {
|
|
44
|
+
this.apiKey = apiKey;
|
|
45
|
+
if (window != undefined) {
|
|
46
|
+
var deviceId = localStorage.getItem('deviceId');
|
|
47
|
+
if (deviceId) {
|
|
48
|
+
this.deviceId = deviceId;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
var generatedId = (0, uuid_1.v4)();
|
|
52
|
+
localStorage.setItem('deviceId', generatedId);
|
|
53
|
+
this.deviceId = generatedId;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.deviceId = (0, uuid_1.v4)();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
RangoClient.prototype.getAllMetadata = function () {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
62
|
+
var axiosResponse;
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0: return [4 /*yield*/, httpService_1.httpService.get("/meta?apiKey=".concat(this.apiKey))];
|
|
66
|
+
case 1:
|
|
67
|
+
axiosResponse = _a.sent();
|
|
68
|
+
return [2 /*return*/, axiosResponse.data];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
RangoClient.prototype.getBestRoute = function (requestBody) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
var axiosResponse;
|
|
76
|
+
return __generator(this, function (_a) {
|
|
77
|
+
switch (_a.label) {
|
|
78
|
+
case 0: return [4 /*yield*/, httpService_1.httpService.post("/routing/best?apiKey=".concat(this.apiKey), requestBody, { headers: { 'X-Rango-Id': this.deviceId } })];
|
|
79
|
+
case 1:
|
|
80
|
+
axiosResponse = _a.sent();
|
|
81
|
+
return [2 /*return*/, axiosResponse.data];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
RangoClient.prototype.checkApproval = function (requestId) {
|
|
87
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
88
|
+
var axiosResponse;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0: return [4 /*yield*/, httpService_1.httpService.get("/tx/".concat(requestId, "/check-approval?apiKey=").concat(this.apiKey))];
|
|
92
|
+
case 1:
|
|
93
|
+
axiosResponse = _a.sent();
|
|
94
|
+
return [2 /*return*/, axiosResponse.data];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
RangoClient.prototype.checkStatus = function (requestBody) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
101
|
+
var axiosResponse;
|
|
102
|
+
return __generator(this, function (_a) {
|
|
103
|
+
switch (_a.label) {
|
|
104
|
+
case 0: return [4 /*yield*/, httpService_1.httpService.post("/tx/check-status?apiKey=".concat(this.apiKey), requestBody)];
|
|
105
|
+
case 1:
|
|
106
|
+
axiosResponse = _a.sent();
|
|
107
|
+
return [2 /*return*/, axiosResponse.data];
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
RangoClient.prototype.createTransaction = function (requestBody) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
var axiosResponse;
|
|
115
|
+
return __generator(this, function (_a) {
|
|
116
|
+
switch (_a.label) {
|
|
117
|
+
case 0: return [4 /*yield*/, httpService_1.httpService.post("/tx/create?apiKey=".concat(this.apiKey), requestBody)];
|
|
118
|
+
case 1:
|
|
119
|
+
axiosResponse = _a.sent();
|
|
120
|
+
return [2 /*return*/, axiosResponse.data];
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
RangoClient.prototype.reportFailure = function (requestBody) {
|
|
126
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
127
|
+
return __generator(this, function (_a) {
|
|
128
|
+
switch (_a.label) {
|
|
129
|
+
case 0: return [4 /*yield*/, httpService_1.httpService.post("/tx/report-tx?apiKey=".concat(this.apiKey), requestBody)];
|
|
130
|
+
case 1:
|
|
131
|
+
_a.sent();
|
|
132
|
+
return [2 /*return*/];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
RangoClient.prototype.getWalletsDetails = function (walletAddresses) {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
+
var walletAddressesQueryParams, i, walletAddress, axiosResponse;
|
|
140
|
+
return __generator(this, function (_a) {
|
|
141
|
+
switch (_a.label) {
|
|
142
|
+
case 0:
|
|
143
|
+
walletAddressesQueryParams = '';
|
|
144
|
+
for (i = 0; i < walletAddresses.length; i++) {
|
|
145
|
+
walletAddress = walletAddresses[i];
|
|
146
|
+
walletAddressesQueryParams += "&address=".concat(walletAddress.blockchain, ".").concat(walletAddress.address);
|
|
147
|
+
}
|
|
148
|
+
return [4 /*yield*/, httpService_1.httpService.get("/wallets/details?apiKey=".concat(this.apiKey).concat(walletAddressesQueryParams))];
|
|
149
|
+
case 1:
|
|
150
|
+
axiosResponse = _a.sent();
|
|
151
|
+
return [2 /*return*/, axiosResponse.data];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
156
|
+
return RangoClient;
|
|
157
|
+
}());
|
|
158
|
+
exports.RangoClient = RangoClient;
|
|
159
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/services/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpService.d.ts","sourceRoot":"","sources":["../../src/services/httpService.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,+BAEtB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.httpService = void 0;
|
|
7
|
+
var axios_1 = __importDefault(require("axios"));
|
|
8
|
+
exports.httpService = axios_1.default.create({
|
|
9
|
+
baseURL: 'https://api.rango.exchange',
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=httpService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpService.js","sourceRoot":"","sources":["../../src/services/httpService.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAyB;AAEZ,QAAA,WAAW,GAAG,eAAK,CAAC,MAAM,CAAC;IACtC,OAAO,EAAE,4BAA4B;CACtC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RangoClient = void 0;
|
|
4
|
+
var client_1 = require("./client");
|
|
5
|
+
Object.defineProperty(exports, "RangoClient", { enumerable: true, get: function () { return client_1.RangoClient; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AAA7B,qGAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Asset, Amount } from './common';
|
|
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
|
+
};
|
|
39
|
+
//# sourceMappingURL=balance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../src/types/api/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAE7C;;;;;;GAMG;AACH,oBAAY,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,KAAK,CAAA;CACb,CAAA;AAED;;;;;;;;;GASG;AACH,oBAAY,YAAY,GAAG;IACzB,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,CAAA;IACjC,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED;;;;;GAKG;AACH,oBAAY,qBAAqB,GAAG;IAClC,OAAO,EAAE,YAAY,EAAE,CAAA;CACxB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../../src/types/api/balance.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,212 @@
|
|
|
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';
|
|
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
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
export declare type SwapResultAsset = {
|
|
63
|
+
blockchain: string;
|
|
64
|
+
address: string | null;
|
|
65
|
+
symbol: string;
|
|
66
|
+
logo: string;
|
|
67
|
+
decimals: number;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* A node of the swap path
|
|
71
|
+
*
|
|
72
|
+
* @property {string | null} marketId - Id of the market
|
|
73
|
+
* @property {string | null} marketName - Name of the market, example: Uniswap
|
|
74
|
+
* @property {number} percent - Percent of the allocation to this path, example: 45
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
export declare type SwapNode = {
|
|
78
|
+
marketId: string | null;
|
|
79
|
+
marketName: string;
|
|
80
|
+
percent: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* A swap path from asset x (from) to asset y (to)
|
|
84
|
+
*
|
|
85
|
+
* @property {string} from - Symbol of the source asset
|
|
86
|
+
* @property {string | null} fromAddress - Contract address of source asset, null for native tokens
|
|
87
|
+
* @property {string} fromBlockchain - Blockchain of the source asset
|
|
88
|
+
* @property {string} fromLogo - Absolute path of logo of the source asset
|
|
89
|
+
*
|
|
90
|
+
* @property {string} to - Symbol of the destination asset
|
|
91
|
+
* @property {string | null} toAddress - Contract address of destination asset, null for native tokens
|
|
92
|
+
* @property {string} toBlockchain - Blockchain of the destination asset
|
|
93
|
+
* @property {string} toLogo - Absolute path of logo of the destination asset
|
|
94
|
+
*
|
|
95
|
+
* @property {SwapNode[]} nodes - List of intermediate nodes in a swap path
|
|
96
|
+
*
|
|
97
|
+
*/
|
|
98
|
+
export declare type SwapSuperNode = {
|
|
99
|
+
from: string;
|
|
100
|
+
fromAddress: string | null;
|
|
101
|
+
fromBlockchain: string;
|
|
102
|
+
fromLogo: string;
|
|
103
|
+
to: string;
|
|
104
|
+
toAddress: string | null;
|
|
105
|
+
toBlockchain: string;
|
|
106
|
+
toLogo: string;
|
|
107
|
+
nodes: SwapNode[];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Internal mechanism of a step
|
|
111
|
+
*
|
|
112
|
+
* @property {SwapSuperNode[] | null} nodes - List of parallel paths that splitting happens
|
|
113
|
+
*
|
|
114
|
+
*/
|
|
115
|
+
export declare type SwapRoute = {
|
|
116
|
+
nodes: SwapSuperNode[] | null;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Time estimation details for a step of swap route
|
|
120
|
+
*
|
|
121
|
+
* @property {number} min - The minimum duration (in seconds) that usually takes for related step
|
|
122
|
+
* @property {number} avg - The average duration (in seconds) that usually takes for related step
|
|
123
|
+
* @property {number} max - The maximum duration (in seconds) that usually takes for related step
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
126
|
+
export declare type TimeStat = {
|
|
127
|
+
min: number;
|
|
128
|
+
avg: number;
|
|
129
|
+
max: number;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* A step of a multi-step swap route
|
|
133
|
+
*
|
|
134
|
+
* @property {string} swapperId - Unique Id of swapper. example: 1INCH_BSC, TERRASWAP
|
|
135
|
+
*
|
|
136
|
+
* @property {string} swapperType - Type of swapper. example: BRIDGE, DEX
|
|
137
|
+
*
|
|
138
|
+
* @property {SwapResultAsset} from - The source asset
|
|
139
|
+
*
|
|
140
|
+
* @property {SwapResultAsset} to - The destination asset
|
|
141
|
+
*
|
|
142
|
+
* @property {string} fromAmount - Estimated input amount of this step. Can be used for previewing to user and should
|
|
143
|
+
* not be used for real computation, since it may change when the real transaction happens due to volatility of the market
|
|
144
|
+
*
|
|
145
|
+
* @property {string} toAmount - Estimated output amount of this step. Can be used for previewing to user and should
|
|
146
|
+
* not be used for real computation, since it may change when the real transaction happens due to volatility of the market
|
|
147
|
+
*
|
|
148
|
+
* @property {SwapRoute[] | null} routes - The internal routing of this step showing how the initial swap request will
|
|
149
|
+
* be split and executed. This can be used for previewing purpose to give the user a sense of what's going to happen.
|
|
150
|
+
* Null indicates that there is no internal mechanism and swapping is simple and straight-forward.
|
|
151
|
+
*
|
|
152
|
+
* @property {SwapFee[]} fee - List of fees that are taken from user in this step
|
|
153
|
+
*
|
|
154
|
+
* @property {number | null} fromAmountMinValue - The minimum amount unit, the precision that will be applied to
|
|
155
|
+
* transaction amount in create transaction endpoint automatically by Rango. This field is informational and there is
|
|
156
|
+
* no need to apply it in client-side.
|
|
157
|
+
*
|
|
158
|
+
* @property {number | null} fromAmountMaxValue - Exactly the same as fromAmountMinValue, but for the maximum limit
|
|
159
|
+
*
|
|
160
|
+
* @property {number | null} fromAmountPrecision - The minimum amount unit, the precision that will be applied to
|
|
161
|
+
* transaction amount in create transaction endpoint automatically by Rango. This field is informational and there
|
|
162
|
+
* is no need to apply it in client-side
|
|
163
|
+
*
|
|
164
|
+
* @property {string} fromAmountRestrictionType - Specifies range for fromAmount (Min / Max) Value. for example if value
|
|
165
|
+
* is EXCLUSIVE and fromAmountMinValue is 20, user can execute transaction if inputValue > 20, but for INCLUSIVE
|
|
166
|
+
* inputValue >= 20 is valid. possible values: INCLUSIVE / EXCLUSIVE
|
|
167
|
+
*
|
|
168
|
+
* @property {number} estimatedTimeInSeconds - The estimated time (in seconds) that this step might take, beware that
|
|
169
|
+
* this number is just an estimation and should be used only for user preview, example: 15
|
|
170
|
+
*
|
|
171
|
+
* @property {TimeStat | null} timeStat - The minimum, avg and max estimation time for this step
|
|
172
|
+
*
|
|
173
|
+
* @property {RecommendedSlippage | null} recommendedSlippage
|
|
174
|
+
*
|
|
175
|
+
* @property {string[] | null} warnings - List of warnings for this swap step, usually null or empty
|
|
176
|
+
*
|
|
177
|
+
*/
|
|
178
|
+
export declare type SwapResult = {
|
|
179
|
+
swapperId: string;
|
|
180
|
+
swapperType: string;
|
|
181
|
+
from: SwapResultAsset;
|
|
182
|
+
to: SwapResultAsset;
|
|
183
|
+
fromAmount: string;
|
|
184
|
+
toAmount: string;
|
|
185
|
+
routes: SwapRoute[] | null;
|
|
186
|
+
fee: SwapFee[];
|
|
187
|
+
fromAmountMaxValue: number | null;
|
|
188
|
+
fromAmountMinValue: number | null;
|
|
189
|
+
fromAmountPrecision: number | null;
|
|
190
|
+
fromAmountRestrictionType: 'EXCLUSIVE' | 'INCLUSIVE';
|
|
191
|
+
estimatedTimeInSeconds: number;
|
|
192
|
+
timeStat: TimeStat | null;
|
|
193
|
+
recommendedSlippage: RecommendedSlippage | null;
|
|
194
|
+
warnings: string[] | null;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* An asset with its ticker
|
|
198
|
+
*
|
|
199
|
+
* @property {string} blockchain - Blockchain of asset
|
|
200
|
+
* @property {string | null} address - Contract address of the asset, null for native tokens
|
|
201
|
+
* @property {string} symbol - Symbol of an asset, example: BUSD
|
|
202
|
+
* @property {string} ticker - The ticker of the asset which normally is a combination of symbol and address,
|
|
203
|
+
* required by some javascript wallets
|
|
204
|
+
*
|
|
205
|
+
*/
|
|
206
|
+
export declare type AssetWithTicker = {
|
|
207
|
+
blockchain: string;
|
|
208
|
+
address: string | null;
|
|
209
|
+
symbol: string;
|
|
210
|
+
ticker: string;
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/types/api/common.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/types/api/common.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Asset } from './common';
|
|
2
|
+
/**
|
|
3
|
+
* Blockchain information
|
|
4
|
+
*
|
|
5
|
+
* @property {string} name - Unique name of blockchain, this field is used in all endpoints as the identifier
|
|
6
|
+
* @property {number} defaultDecimals - The default decimals of blockchain, do not use it in computations, use Token.decimals instead
|
|
7
|
+
* @property {Asset[]} feeAssets - List of assets that can be used as fee in this blockchain
|
|
8
|
+
* @property {string[]} addressPatterns - List of all regex patterns for wallet addresses of this blockchain, can be
|
|
9
|
+
* used for input validation, example: [ "^(0x)[0-9A-Fa-f]{40}$" ]
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare type BlockchainMeta = {
|
|
13
|
+
name: string;
|
|
14
|
+
defaultDecimals: number;
|
|
15
|
+
feeAssets: Asset[];
|
|
16
|
+
addressPatterns: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Metadata of Swapper
|
|
20
|
+
*/
|
|
21
|
+
export declare type SwapperMetaDto = {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
logo: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* All metadata info for a token, unique by (blockchain, symbol, address) tuple
|
|
28
|
+
*
|
|
29
|
+
* @property {string} blockchain - The blockchain which this token belongs to
|
|
30
|
+
* @property {string | null} address - Smart contract address of token, null for native tokens
|
|
31
|
+
* @property {string} symbol - The token symbol, e.g: ADA
|
|
32
|
+
* @property {string | null} name - Display name of token, e.g: Cardano for ADA. It can be null
|
|
33
|
+
* @property {number} decimals - Decimals of token in blockchain, example: 18
|
|
34
|
+
* @property {string} image - Url of its image, example: https://api.rango.exchange/tokens/ETH/ETH.png
|
|
35
|
+
* @property {number | null} usdPrice - USD unit price of this token if available
|
|
36
|
+
* @property {boolean} isSecondaryCoin - If true, means that the token's trading is high risk. Better to warn user before proceeding
|
|
37
|
+
* @property {string | null} coinSource - If the token is secondary, coinSource indicates the third-party list
|
|
38
|
+
* that Rango found this token in, example: Pancake Extended List
|
|
39
|
+
* @property {string | null} coinSourceUrl - The absolute url of the source list that token was extracted from
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
export declare type Token = {
|
|
43
|
+
blockchain: string;
|
|
44
|
+
address: string | null;
|
|
45
|
+
symbol: string;
|
|
46
|
+
name: string | null;
|
|
47
|
+
decimals: number;
|
|
48
|
+
image: string;
|
|
49
|
+
usdPrice: number | null;
|
|
50
|
+
isSecondaryCoin: boolean;
|
|
51
|
+
coinSource: string | null;
|
|
52
|
+
coinSourceUrl: string | null;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Metadata info for all blockchains and tokens supported
|
|
56
|
+
*
|
|
57
|
+
* @property {BlockchainMeta[]} blockChains - List of all supported blockchains
|
|
58
|
+
* @property {Token[]} tokens - List of all tokens
|
|
59
|
+
* @property {Token[]} popularTokens - List of popular tokens, a subset of tokens field
|
|
60
|
+
* @property {SwapperMetaDto[]} swappers - List of all DEXes & Bridges
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
export declare type MetaResponse = {
|
|
64
|
+
blockChains: BlockchainMeta[];
|
|
65
|
+
tokens: Token[];
|
|
66
|
+
popularTokens: Token[];
|
|
67
|
+
swappers: SwapperMetaDto[];
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -0,0 +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;AAErC;;;;;;;;;GASG;AACH,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,KAAK,EAAE,CAAA;IAClB,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B,CAAA;AAED;;GAEG;AACH,oBAAY,cAAc,GAAG;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,oBAAY,KAAK,GAAG;IAClB,UAAU,EAAE,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","sourceRoot":"","sources":["../../../src/types/api/meta.ts"],"names":[],"mappings":""}
|