rango-sdk 0.1.50 → 0.1.52
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/rango-sdk.cjs.development.js +103 -54
- package/lib/rango-sdk.cjs.development.js.map +1 -1
- package/lib/rango-sdk.cjs.production.min.js +1 -1
- package/lib/rango-sdk.cjs.production.min.js.map +1 -1
- package/lib/rango-sdk.esm.js +103 -54
- package/lib/rango-sdk.esm.js.map +1 -1
- package/lib/services/client.d.ts +5 -3
- package/lib/services/client.d.ts.map +1 -1
- package/lib/types/api/meta.d.ts +1 -1
- package/lib/types/api/meta.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/services/client.ts +30 -4
- package/src/types/api/meta.ts +1 -1
|
@@ -466,17 +466,15 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
466
466
|
}
|
|
467
467
|
return getSwappers;
|
|
468
468
|
}();
|
|
469
|
-
_proto.
|
|
470
|
-
var
|
|
469
|
+
_proto.getCustomToken = /*#__PURE__*/function () {
|
|
470
|
+
var _getCustomToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(customTokenRequest, options) {
|
|
471
471
|
var axiosResponse;
|
|
472
472
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
473
473
|
while (1) switch (_context4.prev = _context4.next) {
|
|
474
474
|
case 0:
|
|
475
475
|
_context4.next = 2;
|
|
476
|
-
return this.httpService.
|
|
477
|
-
|
|
478
|
-
'X-Rango-Id': this.deviceId
|
|
479
|
-
}
|
|
476
|
+
return this.httpService.get("/meta/custom-token?apiKey=" + this.apiKey, _extends({
|
|
477
|
+
params: customTokenRequest
|
|
480
478
|
}, options));
|
|
481
479
|
case 2:
|
|
482
480
|
axiosResponse = _context4.sent;
|
|
@@ -487,19 +485,19 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
487
485
|
}
|
|
488
486
|
}, _callee4, this);
|
|
489
487
|
}));
|
|
490
|
-
function
|
|
491
|
-
return
|
|
488
|
+
function getCustomToken(_x5, _x6) {
|
|
489
|
+
return _getCustomToken.apply(this, arguments);
|
|
492
490
|
}
|
|
493
|
-
return
|
|
491
|
+
return getCustomToken;
|
|
494
492
|
}();
|
|
495
|
-
_proto.
|
|
496
|
-
var
|
|
493
|
+
_proto.getBestRoute = /*#__PURE__*/function () {
|
|
494
|
+
var _getBestRoute = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(requestBody, options) {
|
|
497
495
|
var axiosResponse;
|
|
498
496
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
499
497
|
while (1) switch (_context5.prev = _context5.next) {
|
|
500
498
|
case 0:
|
|
501
499
|
_context5.next = 2;
|
|
502
|
-
return this.httpService.post("/routing/
|
|
500
|
+
return this.httpService.post("/routing/best?apiKey=" + this.apiKey, requestBody, _extends({
|
|
503
501
|
headers: {
|
|
504
502
|
'X-Rango-Id': this.deviceId
|
|
505
503
|
}
|
|
@@ -513,19 +511,19 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
513
511
|
}
|
|
514
512
|
}, _callee5, this);
|
|
515
513
|
}));
|
|
516
|
-
function
|
|
517
|
-
return
|
|
514
|
+
function getBestRoute(_x7, _x8) {
|
|
515
|
+
return _getBestRoute.apply(this, arguments);
|
|
518
516
|
}
|
|
519
|
-
return
|
|
517
|
+
return getBestRoute;
|
|
520
518
|
}();
|
|
521
|
-
_proto.
|
|
522
|
-
var
|
|
519
|
+
_proto.getAllRoutes = /*#__PURE__*/function () {
|
|
520
|
+
var _getAllRoutes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(requestBody, options) {
|
|
523
521
|
var axiosResponse;
|
|
524
522
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
525
523
|
while (1) switch (_context6.prev = _context6.next) {
|
|
526
524
|
case 0:
|
|
527
525
|
_context6.next = 2;
|
|
528
|
-
return this.httpService.post("/routing/
|
|
526
|
+
return this.httpService.post("/routing/bests?apiKey=" + this.apiKey, requestBody, _extends({
|
|
529
527
|
headers: {
|
|
530
528
|
'X-Rango-Id': this.deviceId
|
|
531
529
|
}
|
|
@@ -539,21 +537,21 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
539
537
|
}
|
|
540
538
|
}, _callee6, this);
|
|
541
539
|
}));
|
|
542
|
-
function
|
|
543
|
-
return
|
|
540
|
+
function getAllRoutes(_x9, _x10) {
|
|
541
|
+
return _getAllRoutes.apply(this, arguments);
|
|
544
542
|
}
|
|
545
|
-
return
|
|
543
|
+
return getAllRoutes;
|
|
546
544
|
}();
|
|
547
|
-
_proto.
|
|
548
|
-
var
|
|
545
|
+
_proto.confirmRoute = /*#__PURE__*/function () {
|
|
546
|
+
var _confirmRoute = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(requestBody, options) {
|
|
549
547
|
var axiosResponse;
|
|
550
548
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
551
549
|
while (1) switch (_context7.prev = _context7.next) {
|
|
552
550
|
case 0:
|
|
553
551
|
_context7.next = 2;
|
|
554
|
-
return this.httpService.
|
|
555
|
-
|
|
556
|
-
|
|
552
|
+
return this.httpService.post("/routing/confirm?apiKey=" + this.apiKey, requestBody, _extends({
|
|
553
|
+
headers: {
|
|
554
|
+
'X-Rango-Id': this.deviceId
|
|
557
555
|
}
|
|
558
556
|
}, options));
|
|
559
557
|
case 2:
|
|
@@ -565,19 +563,23 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
565
563
|
}
|
|
566
564
|
}, _callee7, this);
|
|
567
565
|
}));
|
|
568
|
-
function
|
|
569
|
-
return
|
|
566
|
+
function confirmRoute(_x11, _x12) {
|
|
567
|
+
return _confirmRoute.apply(this, arguments);
|
|
570
568
|
}
|
|
571
|
-
return
|
|
569
|
+
return confirmRoute;
|
|
572
570
|
}();
|
|
573
|
-
_proto.
|
|
574
|
-
var
|
|
571
|
+
_proto.checkApproval = /*#__PURE__*/function () {
|
|
572
|
+
var _checkApproval = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(requestId, txId, options) {
|
|
575
573
|
var axiosResponse;
|
|
576
574
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
577
575
|
while (1) switch (_context8.prev = _context8.next) {
|
|
578
576
|
case 0:
|
|
579
577
|
_context8.next = 2;
|
|
580
|
-
return this.httpService.
|
|
578
|
+
return this.httpService.get("/tx/" + requestId + "/check-approval?apiKey=" + this.apiKey, _extends({
|
|
579
|
+
params: {
|
|
580
|
+
txId: txId
|
|
581
|
+
}
|
|
582
|
+
}, options));
|
|
581
583
|
case 2:
|
|
582
584
|
axiosResponse = _context8.sent;
|
|
583
585
|
return _context8.abrupt("return", axiosResponse.data);
|
|
@@ -587,19 +589,19 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
587
589
|
}
|
|
588
590
|
}, _callee8, this);
|
|
589
591
|
}));
|
|
590
|
-
function
|
|
591
|
-
return
|
|
592
|
+
function checkApproval(_x13, _x14, _x15) {
|
|
593
|
+
return _checkApproval.apply(this, arguments);
|
|
592
594
|
}
|
|
593
|
-
return
|
|
595
|
+
return checkApproval;
|
|
594
596
|
}();
|
|
595
|
-
_proto.
|
|
596
|
-
var
|
|
597
|
+
_proto.checkStatus = /*#__PURE__*/function () {
|
|
598
|
+
var _checkStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(requestBody, options) {
|
|
597
599
|
var axiosResponse;
|
|
598
600
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
599
601
|
while (1) switch (_context9.prev = _context9.next) {
|
|
600
602
|
case 0:
|
|
601
603
|
_context9.next = 2;
|
|
602
|
-
return this.httpService.post("/tx/
|
|
604
|
+
return this.httpService.post("/tx/check-status?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
603
605
|
case 2:
|
|
604
606
|
axiosResponse = _context9.sent;
|
|
605
607
|
return _context9.abrupt("return", axiosResponse.data);
|
|
@@ -609,56 +611,102 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
609
611
|
}
|
|
610
612
|
}, _callee9, this);
|
|
611
613
|
}));
|
|
612
|
-
function
|
|
613
|
-
return
|
|
614
|
+
function checkStatus(_x16, _x17) {
|
|
615
|
+
return _checkStatus.apply(this, arguments);
|
|
614
616
|
}
|
|
615
|
-
return
|
|
617
|
+
return checkStatus;
|
|
616
618
|
}();
|
|
617
|
-
_proto.
|
|
618
|
-
var
|
|
619
|
+
_proto.createTransaction = /*#__PURE__*/function () {
|
|
620
|
+
var _createTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(requestBody, options) {
|
|
621
|
+
var axiosResponse;
|
|
619
622
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
620
623
|
while (1) switch (_context10.prev = _context10.next) {
|
|
621
624
|
case 0:
|
|
622
625
|
_context10.next = 2;
|
|
623
|
-
return this.httpService.post("/tx/
|
|
626
|
+
return this.httpService.post("/tx/create?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
624
627
|
case 2:
|
|
628
|
+
axiosResponse = _context10.sent;
|
|
629
|
+
return _context10.abrupt("return", axiosResponse.data);
|
|
630
|
+
case 4:
|
|
625
631
|
case "end":
|
|
626
632
|
return _context10.stop();
|
|
627
633
|
}
|
|
628
634
|
}, _callee10, this);
|
|
629
635
|
}));
|
|
630
|
-
function
|
|
636
|
+
function createTransaction(_x18, _x19) {
|
|
637
|
+
return _createTransaction.apply(this, arguments);
|
|
638
|
+
}
|
|
639
|
+
return createTransaction;
|
|
640
|
+
}();
|
|
641
|
+
_proto.reportFailure = /*#__PURE__*/function () {
|
|
642
|
+
var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(requestBody, options) {
|
|
643
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
644
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
645
|
+
case 0:
|
|
646
|
+
_context11.next = 2;
|
|
647
|
+
return this.httpService.post("/tx/report-tx?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
648
|
+
case 2:
|
|
649
|
+
case "end":
|
|
650
|
+
return _context11.stop();
|
|
651
|
+
}
|
|
652
|
+
}, _callee11, this);
|
|
653
|
+
}));
|
|
654
|
+
function reportFailure(_x20, _x21) {
|
|
631
655
|
return _reportFailure.apply(this, arguments);
|
|
632
656
|
}
|
|
633
657
|
return reportFailure;
|
|
634
658
|
}();
|
|
635
659
|
_proto.getWalletsDetails = /*#__PURE__*/function () {
|
|
636
|
-
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
660
|
+
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(walletAddresses, options) {
|
|
637
661
|
var walletAddressesQueryParams, i, walletAddress, axiosResponse;
|
|
638
|
-
return _regeneratorRuntime().wrap(function
|
|
639
|
-
while (1) switch (
|
|
662
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
663
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
640
664
|
case 0:
|
|
641
665
|
walletAddressesQueryParams = '';
|
|
642
666
|
for (i = 0; i < walletAddresses.length; i++) {
|
|
643
667
|
walletAddress = walletAddresses[i];
|
|
644
668
|
walletAddressesQueryParams += "&address=" + walletAddress.blockchain + "." + walletAddress.address;
|
|
645
669
|
}
|
|
646
|
-
|
|
670
|
+
_context12.next = 4;
|
|
647
671
|
return this.httpService.get("/wallets/details?apiKey=" + this.apiKey + walletAddressesQueryParams, _extends({}, options));
|
|
648
672
|
case 4:
|
|
649
|
-
axiosResponse =
|
|
650
|
-
return
|
|
673
|
+
axiosResponse = _context12.sent;
|
|
674
|
+
return _context12.abrupt("return", axiosResponse.data);
|
|
651
675
|
case 6:
|
|
652
676
|
case "end":
|
|
653
|
-
return
|
|
677
|
+
return _context12.stop();
|
|
654
678
|
}
|
|
655
|
-
},
|
|
679
|
+
}, _callee12, this);
|
|
656
680
|
}));
|
|
657
|
-
function getWalletsDetails(
|
|
681
|
+
function getWalletsDetails(_x22, _x23) {
|
|
658
682
|
return _getWalletsDetails.apply(this, arguments);
|
|
659
683
|
}
|
|
660
684
|
return getWalletsDetails;
|
|
661
685
|
}();
|
|
686
|
+
_proto.getTokenBalance = /*#__PURE__*/function () {
|
|
687
|
+
var _getTokenBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(tokenBalanceRequest, options) {
|
|
688
|
+
var axiosResponse;
|
|
689
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
690
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
691
|
+
case 0:
|
|
692
|
+
_context13.next = 2;
|
|
693
|
+
return this.httpService.get("/wallets/token-balance?apiKey=" + this.apiKey, _extends({
|
|
694
|
+
params: tokenBalanceRequest
|
|
695
|
+
}, options));
|
|
696
|
+
case 2:
|
|
697
|
+
axiosResponse = _context13.sent;
|
|
698
|
+
return _context13.abrupt("return", axiosResponse.data);
|
|
699
|
+
case 4:
|
|
700
|
+
case "end":
|
|
701
|
+
return _context13.stop();
|
|
702
|
+
}
|
|
703
|
+
}, _callee13, this);
|
|
704
|
+
}));
|
|
705
|
+
function getTokenBalance(_x24, _x25) {
|
|
706
|
+
return _getTokenBalance.apply(this, arguments);
|
|
707
|
+
}
|
|
708
|
+
return getTokenBalance;
|
|
709
|
+
}();
|
|
662
710
|
return RangoClient;
|
|
663
711
|
}();
|
|
664
712
|
|
|
@@ -714,6 +762,7 @@ var tonBlockchain = function tonBlockchain(blockchains) {
|
|
|
714
762
|
RoutingResultType["HIGH_IMPACT"] = "HIGH_IMPACT";
|
|
715
763
|
RoutingResultType["NO_ROUTE"] = "NO_ROUTE";
|
|
716
764
|
RoutingResultType["INPUT_LIMIT_ISSUE"] = "INPUT_LIMIT_ISSUE";
|
|
765
|
+
RoutingResultType["HIGH_IMPACT_FOR_CREATE_TX"] = "HIGH_IMPACT_FOR_CREATE_TX";
|
|
717
766
|
})(exports.RoutingResultType || (exports.RoutingResultType = {}));
|
|
718
767
|
|
|
719
768
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rango-sdk.cjs.development.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts","../../../node_modules/rango-types/src/api/shared/txs/ton.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n SwapperMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\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 = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMeta[]> {\n const axiosResponse = await this.httpService.get<SwapperMeta[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRouteRequest(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\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 this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n TON = 'TON',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'USER_CANCELED_TX'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'TX_FAILED_IN_BLOCKCHAIN'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n | 'INSUFFICIENT_APPROVE'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'USER_CANCELED_TX',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'TX_FAILED_IN_BLOCKCHAIN',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n 'INSUFFICIENT_APPROVE',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} [step] - Step number in which failure happened\n * @property {string} [reason] - Reason or message for the error\n * @property {[key: string]: string} [data] - @deprecated A list of key-value for extra details\n * @property {wallet?: string, errorCode? string} [tags] - A list of key-value for pre-defined tags\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n tags?: { wallet?: string; errorCode?: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n * You could stop check approval if:\n * 1- approved successfully\n * => isApproved = true\n * 2- approval transaction failed\n * => isApproved = false && txStatus === 'failed'\n * 3- approval transaction succeeded but currentApprovedAmount is still less than requiredApprovedAmount\n * (e.g. user changed transaction data and enter another approve amount in MetaMask)\n * => isApproved = false && txStatus == 'success'\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n * @property {string | null} requiredApprovedAmount - required amount to be approved by user\n * @property {string | null} currentApprovedAmount - current approved amount by user\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n requiredApprovedAmount: string | null\n currentApprovedAmount: string | null\n}\n","import { TransactionType } from '../transactions.js'\nimport { BaseTransaction } from './base.js'\n\nexport enum TonChainID {\n MAINNET = '-239',\n TESTNET = '-3',\n}\n\n/**\n * @property {string} address - Receiver's address\n * @property {string} amount - Amount to send in nanoTon\n * @property {string} [stateInit] - Contract specific data to add to the transaction\n * @property {string} [payload] - Contract specific data to add to the transaction\n */\nexport interface TonMessage {\n address: string\n amount: string\n stateInit?: string\n payload?: string\n}\n\n/**\n * This type of transaction is used for all Ton transactions\n *\n * @property {TransactionType} type - This field equals to TON for all Ton transactions\n * @property {number} validUntil - Sending transaction deadline in unix epoch seconds\n * @property {TonChainID} [network] - The network (mainnet or testnet) where DApp intends to send the transaction. If not set, the transaction is sent to the network currently set in the wallet, but this is not safe and DApp should always strive to set the network. If the network parameter is set, but the wallet has a different network set, the wallet should show an alert and DO NOT ALLOW TO SEND this transaction\n * @property {string} [from] - The sender address in '<wc>:<hex>' format from which DApp intends to send the transaction. Current account.address by default\n * @property {TonMessage[]} messages - Messages to send: min is 1, max is 4\n */\nexport interface TonTransaction extends BaseTransaction {\n type: TransactionType.TON\n validUntil: number\n network?: TonChainID\n from?: string\n messages: TonMessage[]\n}\n\nexport const isTonTransaction = (transaction: {\n type: TransactionType\n}): transaction is TonTransaction => transaction.type === TransactionType.TON\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_callee$","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","sent","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_callee2$","_context2","_x3","getSwappers","_getSwappers","_callee3","_callee3$","_context3","_x4","getBestRoute","_getBestRoute","_callee4","requestBody","_callee4$","_context4","post","headers","_x5","_x6","getAllRoutes","_getAllRoutes","_callee5","_callee5$","_context5","_x7","_x8","confirmRouteRequest","_confirmRouteRequest","_callee6","_callee6$","_context6","_x9","_x10","checkApproval","_checkApproval","_callee7","requestId","txId","_callee7$","_context7","_x11","_x12","_x13","checkStatus","_checkStatus","_callee8","_callee8$","_context8","_x14","_x15","createTransaction","_createTransaction","_callee9","_callee9$","_context9","_x16","_x17","reportFailure","_reportFailure","_callee10","_callee10$","_context10","_x18","_x19","getWalletsDetails","_getWalletsDetails","_callee11","walletAddresses","walletAddressesQueryParams","walletAddress","_callee11$","_context11","length","_x20","_x21","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4BaA,WAAW;EAMtB,SAAAA,YAAYC,MAAc,EAAEC,MAAe;IACzC,IAAI,CAACA,MAAM,GAAGA,MAAM,IAAI,4BAA4B;IACpD,IAAI,CAACD,MAA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,CAAC,EAAE,EAAE;cACzCkG,aAAa,GAAGF,eAAe,CAAChG,CAAC,CAAC;cACxCiG,0BAA0B,kBAAgBC,aAAa,CAACvG,UAAU,SAAIuG,aAAa,CAACjG,OAAS;;YAC9FmG,UAAA,CAAApH,IAAA;YAAA,OAC2B,IAAI,CAAC3B,WAAW,CAACkC,GAAG,8BACnB,IAAI,CAAC5C,MAAM,GAAGsJ,0BAA0B,EAAAhH,QAAA,KAC9Df,OAAO,CAAE,CACf;UAAA;YAHKM,aAAa,GAAA4H,UAAA,CAAA5G,IAAA;YAAA,OAAA4G,UAAA,CAAAhF,MAAA,WAIZ5C,aAAa,CAAC2C,IAAI;UAAA;UAAA;YAAA,OAAAiF,UAAA,CAAA/E,IAAA;;SAAA0E,SAAA;KAC1B;IAAA,SAAAF,kBAAAS,IAAA,EAAAC,IAAA;MAAA,OAAAT,kBAAA,CAAAtE,KAAA,OAAAC,SAAA;;IAAA,OAAAoE,iBAAA;;EAAA,OAAAnJ,WAAA;AAAA;;mBC/K2B,2BAAA8J;;;qDAIUC;;;AAGtC;;;AAKF;;;yDAI0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzD1C;;;;AAIA,AAAA;gCAAY;;;;;;ACJZ;;;AAGA,AAAA;;;;;;;;;AAUA,AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"rango-sdk.cjs.development.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts","../../../node_modules/rango-types/src/api/shared/txs/ton.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\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 = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\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 this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n HIGH_IMPACT_FOR_CREATE_TX = 'HIGH_IMPACT_FOR_CREATE_TX',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n TON = 'TON',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'USER_CANCELED_TX'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'TX_FAILED_IN_BLOCKCHAIN'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n | 'INSUFFICIENT_APPROVE'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'USER_CANCELED_TX',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'TX_FAILED_IN_BLOCKCHAIN',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n 'INSUFFICIENT_APPROVE',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} [step] - Step number in which failure happened\n * @property {string} [reason] - Reason or message for the error\n * @property {[key: string]: string} [data] - @deprecated A list of key-value for extra details\n * @property {wallet?: string, errorCode? string} [tags] - A list of key-value for pre-defined tags\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n tags?: { wallet?: string; errorCode?: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n * You could stop check approval if:\n * 1- approved successfully\n * => isApproved = true\n * 2- approval transaction failed\n * => isApproved = false && txStatus === 'failed'\n * 3- approval transaction succeeded but currentApprovedAmount is still less than requiredApprovedAmount\n * (e.g. user changed transaction data and enter another approve amount in MetaMask)\n * => isApproved = false && txStatus == 'success'\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n * @property {string | null} requiredApprovedAmount - required amount to be approved by user\n * @property {string | null} currentApprovedAmount - current approved amount by user\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n requiredApprovedAmount: string | null\n currentApprovedAmount: string | null\n}\n","import { TransactionType } from '../transactions.js'\nimport { BaseTransaction } from './base.js'\n\nexport enum TonChainID {\n MAINNET = '-239',\n TESTNET = '-3',\n}\n\n/**\n * @property {string} address - Receiver's address\n * @property {string} amount - Amount to send in nanoTon\n * @property {string} [stateInit] - Contract specific data to add to the transaction\n * @property {string} [payload] - Contract specific data to add to the transaction\n */\nexport interface TonMessage {\n address: string\n amount: string\n stateInit?: string\n payload?: string\n}\n\n/**\n * This type of transaction is used for all Ton transactions\n *\n * @property {TransactionType} type - This field equals to TON for all Ton transactions\n * @property {number} validUntil - Sending transaction deadline in unix epoch seconds\n * @property {TonChainID} [network] - The network (mainnet or testnet) where DApp intends to send the transaction. If not set, the transaction is sent to the network currently set in the wallet, but this is not safe and DApp should always strive to set the network. If the network parameter is set, but the wallet has a different network set, the wallet should show an alert and DO NOT ALLOW TO SEND this transaction\n * @property {string} [from] - The sender address in '<wc>:<hex>' format from which DApp intends to send the transaction. Current account.address by default\n * @property {TonMessage[]} messages - Messages to send: min is 1, max is 4\n */\nexport interface TonTransaction extends BaseTransaction {\n type: TransactionType.TON\n validUntil: number\n network?: TonChainID\n from?: string\n messages: TonMessage[]\n}\n\nexport const isTonTransaction = (transaction: {\n type: TransactionType\n}): transaction is TonTransaction => transaction.type === TransactionType.TON\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_callee$","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","sent","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_callee2$","_context2","_x3","getSwappers","_getSwappers","_callee3","_callee3$","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_callee4$","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_callee5$","_context5","post","headers","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_callee6$","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_callee7$","_context7","_x11","_x12","checkApproval","_checkApproval","_callee8","requestId","txId","_callee8$","_context8","_x13","_x14","_x15","checkStatus","_checkStatus","_callee9","_callee9$","_context9","_x16","_x17","createTransaction","_createTransaction","_callee10","_callee10$","_context10","_x18","_x19","reportFailure","_reportFailure","_callee11","_callee11$","_context11","_x20","_x21","getWalletsDetails","_getWalletsDetails","_callee12","walletAddresses","walletAddressesQueryParams","walletAddress","_callee12$","_context12","length","_x22","_x23","getTokenBalance","_getTokenBalance","_callee13","tokenBalanceRequest","_callee13$","_context13","_x24","_x25","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCaA,WAAW;EAMtB,SAAAA,YAAYC,MAAc,EAAEC,MAAe;IACzC,IAAI,CAACA,MAAM,GAAGA,MAAM,IAAI,4BAA4B;IACpD,IAAI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}Object.defineProperty(exports,"__esModule",{value:!0});var r=t(require("uuid-random")),e=t(require("axios"));function n(t,r,e,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void e(t)}c.done?r(s):Promise.resolve(s).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,s,"next",t)}function s(t){n(a,o,i,c,s,"throw",t)}c(void 0)}))}}function i(){return(i=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)({}).hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t}).apply(null,arguments)}function a(){a=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function p(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{p({},"")}catch(t){p=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var i=Object.create((r&&r.prototype instanceof x?r:x).prototype),a=new R(n||[]);return o(i,"_invoke",{value:E(t,e,a)}),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=h;var l="suspendedStart",y="executing",v="completed",d={};function x(){}function g(){}function m(){}var T={};p(T,c,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(A([])));S&&S!==e&&n.call(S,c)&&(T=S);var b=m.prototype=x.prototype=Object.create(T);function O(t){["next","throw","return"].forEach((function(r){p(t,r,(function(t){return this._invoke(r,t)}))}))}function k(t,r){function e(o,i,a,c){var s=f(t[o],t,i);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?r.resolve(p.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(p).then((function(t){u.value=t,a(u)}),(function(t){return e("throw",t,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return i=i?i.then(o,o):o()}})}function E(r,e,n){var o=l;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=N(c,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=f(r,e,n);if("normal"===u.type){if(o=n.done?v:"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function N(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,N(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=f(o,r.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var a=i.arg;return a?a.done?(e[r.resultName]=a.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,d):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function L(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function I(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function A(r){if(r||""===r){var e=r[c];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return i.next=i}}throw new TypeError(typeof r+" is not iterable")}return g.prototype=m,o(b,"constructor",{value:m,configurable:!0}),o(m,"constructor",{value:g,configurable:!0}),g.displayName=p(m,u,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===g||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,p(t,u,"GeneratorFunction")),t.prototype=Object.create(b),t},r.awrap=function(t){return{__await:t}},O(k.prototype),p(k.prototype,s,(function(){return this})),r.AsyncIterator=k,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new k(h(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(b),p(b,u,"Generator"),p(b,c,(function(){return this})),p(b,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=A,R.prototype={constructor:R,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(I),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return c.type="throw",c.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),I(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;I(e)}return o}}throw Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:A(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),d}},r}var c,s,u,p,h,f=function(){function t(t,n){this.apiUrl=n||"https://api.rango.exchange",this.apiKey=t;try{if("undefined"!=typeof window){var o=localStorage.getItem("deviceId");if(o)this.deviceId=o;else{var i=r();localStorage.setItem("deviceId",i),this.deviceId=i}}else this.deviceId=r()}catch(t){this.deviceId=r()}this.httpService=e.create({baseURL:this.apiUrl})}var n=t.prototype;return n.getAllMetadata=function(){var t=o(a().mark((function t(r,e){var n,o,c,s,u,p,h,f,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=i({},r,{blockchains:null==r||null==(n=r.blockchains)?void 0:n.join(),swappers:null==r||null==(o=r.swappers)?void 0:o.join(),swappersGroups:null==r||null==(c=r.swappersGroups)?void 0:c.join(),transactionTypes:null==r||null==(s=r.transactionTypes)?void 0:s.join()}),t.next=3,this.httpService.get("/meta/compact?apiKey="+this.apiKey,i({params:u},e));case 3:return h=function(t){return t.map((function(t){return{blockchain:t.b,symbol:t.s,image:t.i,address:t.a||null,usdPrice:t.p||null,isSecondaryCoin:t.is||!1,coinSource:t.c||null,coinSourceUrl:t.cu||null,name:t.n||null,decimals:t.d,isPopular:t.ip||!1,supportedSwappers:t.ss||[]}}))},f=h((p=t.sent).data.tokens),l=h(p.data.popularTokens),t.abrupt("return",i({},p.data,{tokens:f,popularTokens:l}));case 8:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),n.getBlockchains=function(){var t=o(a().mark((function t(r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/blockchains?apiKey="+this.apiKey,i({},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),n.getSwappers=function(){var t=o(a().mark((function t(r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/swappers?apiKey="+this.apiKey,i({},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),n.getBestRoute=function(){var t=o(a().mark((function t(r,e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/best?apiKey="+this.apiKey,r,i({headers:{"X-Rango-Id":this.deviceId}},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),n.getAllRoutes=function(){var t=o(a().mark((function t(r,e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/bests?apiKey="+this.apiKey,r,i({headers:{"X-Rango-Id":this.deviceId}},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),n.confirmRouteRequest=function(){var t=o(a().mark((function t(r,e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/confirm?apiKey="+this.apiKey,r,i({headers:{"X-Rango-Id":this.deviceId}},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),n.checkApproval=function(){var t=o(a().mark((function t(r,e,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/tx/"+r+"/check-approval?apiKey="+this.apiKey,i({params:{txId:e}},n));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r,e,n){return t.apply(this,arguments)}}(),n.checkStatus=function(){var t=o(a().mark((function t(r,e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/check-status?apiKey="+this.apiKey,r,i({},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),n.createTransaction=function(){var t=o(a().mark((function t(r,e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/create?apiKey="+this.apiKey,r,i({},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),n.reportFailure=function(){var t=o(a().mark((function t(r,e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/report-tx?apiKey="+this.apiKey,r,i({},e));case 2:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),n.getWalletsDetails=function(){var t=o(a().mark((function t(r,e){var n,o,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n="",o=0;o<r.length;o++)n+="&address="+(c=r[o]).blockchain+"."+c.address;return t.next=4,this.httpService.get("/wallets/details?apiKey="+this.apiKey+n,i({},e));case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t,this)})));return function(r,e){return t.apply(this,arguments)}}(),t}(),l=function(t){return"EVM"===t.type},y=function(t){return"COSMOS"===t.type},v=function(t){return"SOLANA"===t.type},d=function(t){return"TRON"===t.type},x=function(t){return"TRANSFER"===t.type},g=function(t){return"STARKNET"===t.type},m=function(t){return"TON"===t.type};(c=exports.RoutingResultType||(exports.RoutingResultType={})).OK="OK",c.HIGH_IMPACT="HIGH_IMPACT",c.NO_ROUTE="NO_ROUTE",c.INPUT_LIMIT_ISSUE="INPUT_LIMIT_ISSUE",(s=exports.TransactionType||(exports.TransactionType={})).EVM="EVM",s.TRANSFER="TRANSFER",s.COSMOS="COSMOS",s.SOLANA="SOLANA",s.TRON="TRON",s.STARKNET="STARKNET",s.TON="TON",(u=exports.GenericTransactionType||(exports.GenericTransactionType={})).EVM="EVM",u.TRANSFER="TRANSFER",u.COSMOS="COSMOS",u.SOLANA="SOLANA",(p=exports.TransactionStatus||(exports.TransactionStatus={})).FAILED="failed",p.RUNNING="running",p.SUCCESS="success",(h=exports.TonChainID||(exports.TonChainID={})).MAINNET="-239",h.TESTNET="-3",exports.RangoClient=f,exports.cosmosBlockchains=function(t){return t.filter(y)},exports.evmBlockchains=function(t){return t.filter(l)},exports.isCosmosBlockchain=y,exports.isCosmosTransaction=function(t){return t.type===exports.TransactionType.COSMOS},exports.isEvmBlockchain=l,exports.isEvmTransaction=function(t){return t.type===exports.TransactionType.EVM},exports.isSolanaBlockchain=v,exports.isSolanaTransaction=function(t){return t.type===exports.TransactionType.SOLANA},exports.isStarknetBlockchain=g,exports.isTonBlockchain=m,exports.isTonTransaction=function(t){return t.type===exports.TransactionType.TON},exports.isTransferBlockchain=x,exports.isTransferTransaction=function(t){return t.type===exports.TransactionType.TRANSFER},exports.isTronBlockchain=d,exports.isTronTransaction=function(t){return t.type===exports.TransactionType.TRON},exports.solanaBlockchain=function(t){return t.filter(v)},exports.starknetBlockchain=function(t){return t.filter(g)},exports.tonBlockchain=function(t){return t.filter(m)},exports.transferBlockchains=function(t){return t.filter(x)},exports.tronBlockchain=function(t){return t.filter(d)};
|
|
1
|
+
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("uuid-random")),r=t(require("axios"));function n(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,s,"next",t)}function s(t){n(a,o,i,c,s,"throw",t)}c(void 0)}))}}function i(){return(i=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(null,arguments)}function a(){a=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=Object.create((e&&e.prototype instanceof x?e:x).prototype),a=new R(n||[]);return o(i,"_invoke",{value:O(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var l="suspendedStart",y="executing",v="completed",d={};function x(){}function g(){}function T(){}var m={};p(m,c,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(A([])));S&&S!==r&&n.call(S,c)&&(m=S);var k=T.prototype=x.prototype=Object.create(m);function b(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,a,c){var s=f(t[o],t,i);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(p).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=l;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=N(c,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?v:"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function N(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function A(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=T,o(k,"constructor",{value:T,configurable:!0}),o(T,"constructor",{value:g,configurable:!0}),g.displayName=p(T,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,T):(t.__proto__=T,p(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},b(E.prototype),p(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new E(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(k),p(k,u,"Generator"),p(k,c,(function(){return this})),p(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}var c,s,u,p,h,f=function(){function t(t,n){this.apiUrl=n||"https://api.rango.exchange",this.apiKey=t;try{if("undefined"!=typeof window){var o=localStorage.getItem("deviceId");if(o)this.deviceId=o;else{var i=e();localStorage.setItem("deviceId",i),this.deviceId=i}}else this.deviceId=e()}catch(t){this.deviceId=e()}this.httpService=r.create({baseURL:this.apiUrl})}var n=t.prototype;return n.getAllMetadata=function(){var t=o(a().mark((function t(e,r){var n,o,c,s,u,p,h,f,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=i({},e,{blockchains:null==e||null==(n=e.blockchains)?void 0:n.join(),swappers:null==e||null==(o=e.swappers)?void 0:o.join(),swappersGroups:null==e||null==(c=e.swappersGroups)?void 0:c.join(),transactionTypes:null==e||null==(s=e.transactionTypes)?void 0:s.join()}),t.next=3,this.httpService.get("/meta/compact?apiKey="+this.apiKey,i({params:u},r));case 3:return h=function(t){return t.map((function(t){return{blockchain:t.b,symbol:t.s,image:t.i,address:t.a||null,usdPrice:t.p||null,isSecondaryCoin:t.is||!1,coinSource:t.c||null,coinSourceUrl:t.cu||null,name:t.n||null,decimals:t.d,isPopular:t.ip||!1,supportedSwappers:t.ss||[]}}))},f=h((p=t.sent).data.tokens),l=h(p.data.popularTokens),t.abrupt("return",i({},p.data,{tokens:f,popularTokens:l}));case 8:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getBlockchains=function(){var t=o(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/blockchains?apiKey="+this.apiKey,i({},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getSwappers=function(){var t=o(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/swappers?apiKey="+this.apiKey,i({},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getCustomToken=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/custom-token?apiKey="+this.apiKey,i({params:e},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getBestRoute=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/best?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getAllRoutes=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/bests?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.confirmRoute=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/confirm?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.checkApproval=function(){var t=o(a().mark((function t(e,r,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/tx/"+e+"/check-approval?apiKey="+this.apiKey,i({params:{txId:r}},n));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),n.checkStatus=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/check-status?apiKey="+this.apiKey,e,i({},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.createTransaction=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/create?apiKey="+this.apiKey,e,i({},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.reportFailure=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/report-tx?apiKey="+this.apiKey,e,i({},r));case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getWalletsDetails=function(){var t=o(a().mark((function t(e,r){var n,o,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n="",o=0;o<e.length;o++)n+="&address="+(c=e[o]).blockchain+"."+c.address;return t.next=4,this.httpService.get("/wallets/details?apiKey="+this.apiKey+n,i({},r));case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getTokenBalance=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/wallets/token-balance?apiKey="+this.apiKey,i({params:e},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}(),l=function(t){return"EVM"===t.type},y=function(t){return"COSMOS"===t.type},v=function(t){return"SOLANA"===t.type},d=function(t){return"TRON"===t.type},x=function(t){return"TRANSFER"===t.type},g=function(t){return"STARKNET"===t.type},T=function(t){return"TON"===t.type};(c=exports.RoutingResultType||(exports.RoutingResultType={})).OK="OK",c.HIGH_IMPACT="HIGH_IMPACT",c.NO_ROUTE="NO_ROUTE",c.INPUT_LIMIT_ISSUE="INPUT_LIMIT_ISSUE",c.HIGH_IMPACT_FOR_CREATE_TX="HIGH_IMPACT_FOR_CREATE_TX",(s=exports.TransactionType||(exports.TransactionType={})).EVM="EVM",s.TRANSFER="TRANSFER",s.COSMOS="COSMOS",s.SOLANA="SOLANA",s.TRON="TRON",s.STARKNET="STARKNET",s.TON="TON",(u=exports.GenericTransactionType||(exports.GenericTransactionType={})).EVM="EVM",u.TRANSFER="TRANSFER",u.COSMOS="COSMOS",u.SOLANA="SOLANA",(p=exports.TransactionStatus||(exports.TransactionStatus={})).FAILED="failed",p.RUNNING="running",p.SUCCESS="success",(h=exports.TonChainID||(exports.TonChainID={})).MAINNET="-239",h.TESTNET="-3",exports.RangoClient=f,exports.cosmosBlockchains=function(t){return t.filter(y)},exports.evmBlockchains=function(t){return t.filter(l)},exports.isCosmosBlockchain=y,exports.isCosmosTransaction=function(t){return t.type===exports.TransactionType.COSMOS},exports.isEvmBlockchain=l,exports.isEvmTransaction=function(t){return t.type===exports.TransactionType.EVM},exports.isSolanaBlockchain=v,exports.isSolanaTransaction=function(t){return t.type===exports.TransactionType.SOLANA},exports.isStarknetBlockchain=g,exports.isTonBlockchain=T,exports.isTonTransaction=function(t){return t.type===exports.TransactionType.TON},exports.isTransferBlockchain=x,exports.isTransferTransaction=function(t){return t.type===exports.TransactionType.TRANSFER},exports.isTronBlockchain=d,exports.isTronTransaction=function(t){return t.type===exports.TransactionType.TRON},exports.solanaBlockchain=function(t){return t.filter(v)},exports.starknetBlockchain=function(t){return t.filter(g)},exports.tonBlockchain=function(t){return t.filter(T)},exports.transferBlockchains=function(t){return t.filter(x)},exports.tronBlockchain=function(t){return t.filter(d)};
|
|
2
2
|
//# sourceMappingURL=rango-sdk.cjs.production.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rango-sdk.cjs.production.min.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n SwapperMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\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 = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMeta[]> {\n const axiosResponse = await this.httpService.get<SwapperMeta[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRouteRequest(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\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 this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n"],"names":["RangoClient","apiKey","apiUrl","this","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","sent","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_context2","_x3","getSwappers","_getSwappers","_callee3","_context3","_x4","getBestRoute","_getBestRoute","_callee4","requestBody","_context4","post","headers","X-Rango-Id","_x5","_x6","getAllRoutes","_getAllRoutes","_callee5","_context5","_x7","_x8","confirmRouteRequest","_confirmRouteRequest","_callee6","_context6","_x9","_x10","checkApproval","_checkApproval","_callee7","requestId","txId","_context7","_x11","_x12","_x13","checkStatus","_checkStatus","_callee8","_context8","_x14","_x15","createTransaction","_createTransaction","_callee9","_context9","_x16","_x17","reportFailure","_reportFailure","_callee10","_context10","_x18","_x19","getWalletsDetails","_getWalletsDetails","_callee11","walletAddresses","walletAddressesQueryParams","walletAddress","_context11","length","_x20","_x21","blockchainMeta"],"mappings":"ikOA4BaA,aAMX,SAAAA,EAAYC,EAAgBC,GAC1BC,KAAKD,OAASA,GAAU,6BACxBC,KAAKF,OAASA,EACd,IACE,GAAsB,oBAAXG,OAAwB,CACjC,IAAMC,EAAWC,aAAaC,QAAQ,YACtC,GAAIF,EACFF,KAAKE,SAAWA,MACX,CACL,IAAMG,EAAcC,IACpBH,aAAaI,QAAQ,WAAYF,GACjCL,KAAKE,SAAWG,QAGlBL,KAAKE,SAAWI,IAElB,MAAOE,GACPR,KAAKE,SAAWI,IAElBN,KAAKS,YAAcC,EAAMC,OAAO,CAC9BC,QAASZ,KAAKD,SAEjB,IAAAc,EAAAhB,EAAAiB,UAgKA,OAhKAD,EAEYE,0BAAc,IAAAC,EAAAC,EAAAC,IAAAC,MAApB,SAAAC,EACLC,EACAC,GAAwB,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAb,IAAAc,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAOiC,OALnDR,EAAMS,KACPf,GACHgB,kBAAahB,UAAWE,EAAXF,EAAagB,oBAAbd,EAA0Be,OACvCC,eAAUlB,UAAWG,EAAXH,EAAakB,iBAAbf,EAAuBc,OACjCE,qBAAgBnB,UAAWI,EAAXJ,EAAamB,uBAAbf,EAA6Ba,OAC7CG,uBAAkBpB,UAAWK,EAAXL,EAAaoB,yBAAbf,EAA+BY,SAAML,EAAAE,O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,OAAAR,EAAA9D,WAAAC,eAAA/E,oDC3KqCqJ,mHAYEA"}
|
|
1
|
+
{"version":3,"file":"rango-sdk.cjs.production.min.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\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 = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\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 this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n"],"names":["RangoClient","apiKey","apiUrl","this","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","sent","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_context2","_x3","getSwappers","_getSwappers","_callee3","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_context5","post","headers","X-Rango-Id","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_context7","_x11","_x12","checkApproval","_checkApproval","_callee8","requestId","txId","_context8","_x13","_x14","_x15","checkStatus","_checkStatus","_callee9","_context9","_x16","_x17","createTransaction","_createTransaction","_callee10","_context10","_x18","_x19","reportFailure","_reportFailure","_callee11","_context11","_x20","_x21","getWalletsDetails","_getWalletsDetails","_callee12","walletAddresses","walletAddressesQueryParams","walletAddress","_context12","length","_x22","_x23","getTokenBalance","_getTokenBalance","_callee13","tokenBalanceRequest","_context13","_x24","_x25","blockchainMeta"],"mappings":"ikOAgCaA,aAMX,SAAAA,EAAYC,EAAgBC,GAC1BC,KAAKD,OAASA,GAAU,6BACxBC,KAAKF,OAASA,EACd,IACE,GAAsB,oBAAXG,OAAwB,CACjC,IAAMC,EAAWC,aAAaC,QAAQ,YACtC,GAAIF,EACFF,KAAKE,SAAWA,MACX,CACL,IAAMG,EAAcC,IACpBH,aAAaI,QAAQ,WAAYF,GACjCL,KAAKE,SAAWG,QAGlBL,KAAKE,SAAWI,IAElB,MAAOE,GACPR,KAAKE,SAAWI,IAElBN,KAAKS,YAAcC,EAAMC,OAAO,CAC9BC,QAASZ,KAAKD,SAEjB,IAAAc,EAAAhB,EAAAiB,UAsLA,OAtLAD,EAEYE,0BAAc,IAAAC,EAAAC,EAAAC,IAAAC,MAApB,SAAAC,EACLC,EACAC,GAAwB,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAA,OAAAb,IAAAc,eAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,OAOiC,OALnDR,EAAMS,KACPf,GACHgB,kBAAahB,UAAWE,EAAXF,EAAagB,oBAAbd,EAA0Be,OACvCC,eAAUlB,UAAWG,EAAXH,EAAakB,iBAAbf,EAAuBc,OACjCE,qBAAgBnB,UAAWI,EAAXJ,EAAamB,uBAAbf,EAA6Ba,OAC7CG,uBAAkBpB,UAAWK,EAAXL,EAAaoB,yBAAbf,EAA+BY,SAAML,EAAAE,OAE7BnC,KAAKS,YAAYiC,4BACnB1C,KAAKF,OAAMsC,GAEjCT,OAAAA,GACGL,IAEN,OAkBqE,OAjBhEO,EAAiB,SAACC,GAAsB,OAC5CA,EAAOa,KAAI,SAACC,GAAE,MAAM,CAClBC,WAAYD,EAAGE,EACfC,OAAQH,EAAGI,EACXC,MAAOL,EAAGM,EACVC,QAASP,EAAGQ,GAAK,KACjBC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,OAASqJ,EAA0B/G,KAC9Dd,IACN,OAHkB,OAAA+H,EAAA9E,gBAAA8E,EAAAhF,KAIEC,MAAI,OAAA,UAAA,OAAA+E,EAAA7E,UAAAyE,YAC1B,OAAA,SAAAM,EAAAC,GAAA,OAAAR,EAAArE,WAAAC,eAAA/D,EAEY4I,2BAAe,IAAAC,EAAAzI,EAAAC,IAAAC,MAArB,SAAAwI,EACLC,EACAtI,GAAwB,OAAAJ,IAAAc,eAAA6H,GAAA,cAAAA,EAAA3H,KAAA2H,EAAA1H,MAAA,OAAA,OAAA0H,EAAA1H,OAEInC,KAAKS,YAAYiC,qCACV1C,KAAKF,OAAMsC,GAC1CT,OAAQiI,GAAwBtI,IACnC,OAHkB,OAAAuI,EAAAtF,gBAAAsF,EAAAxF,KAIEC,MAAI,OAAA,UAAA,OAAAuF,EAAArF,UAAAmF,YAC1B,OAAA,SAAAG,EAAAC,GAAA,OAAAL,EAAA/E,WAAAC,eAAA/E,oDCrMqCmK,mHAYEA"}
|
package/lib/rango-sdk.esm.js
CHANGED
|
@@ -460,17 +460,15 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
460
460
|
}
|
|
461
461
|
return getSwappers;
|
|
462
462
|
}();
|
|
463
|
-
_proto.
|
|
464
|
-
var
|
|
463
|
+
_proto.getCustomToken = /*#__PURE__*/function () {
|
|
464
|
+
var _getCustomToken = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(customTokenRequest, options) {
|
|
465
465
|
var axiosResponse;
|
|
466
466
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
467
467
|
while (1) switch (_context4.prev = _context4.next) {
|
|
468
468
|
case 0:
|
|
469
469
|
_context4.next = 2;
|
|
470
|
-
return this.httpService.
|
|
471
|
-
|
|
472
|
-
'X-Rango-Id': this.deviceId
|
|
473
|
-
}
|
|
470
|
+
return this.httpService.get("/meta/custom-token?apiKey=" + this.apiKey, _extends({
|
|
471
|
+
params: customTokenRequest
|
|
474
472
|
}, options));
|
|
475
473
|
case 2:
|
|
476
474
|
axiosResponse = _context4.sent;
|
|
@@ -481,19 +479,19 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
481
479
|
}
|
|
482
480
|
}, _callee4, this);
|
|
483
481
|
}));
|
|
484
|
-
function
|
|
485
|
-
return
|
|
482
|
+
function getCustomToken(_x5, _x6) {
|
|
483
|
+
return _getCustomToken.apply(this, arguments);
|
|
486
484
|
}
|
|
487
|
-
return
|
|
485
|
+
return getCustomToken;
|
|
488
486
|
}();
|
|
489
|
-
_proto.
|
|
490
|
-
var
|
|
487
|
+
_proto.getBestRoute = /*#__PURE__*/function () {
|
|
488
|
+
var _getBestRoute = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(requestBody, options) {
|
|
491
489
|
var axiosResponse;
|
|
492
490
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
493
491
|
while (1) switch (_context5.prev = _context5.next) {
|
|
494
492
|
case 0:
|
|
495
493
|
_context5.next = 2;
|
|
496
|
-
return this.httpService.post("/routing/
|
|
494
|
+
return this.httpService.post("/routing/best?apiKey=" + this.apiKey, requestBody, _extends({
|
|
497
495
|
headers: {
|
|
498
496
|
'X-Rango-Id': this.deviceId
|
|
499
497
|
}
|
|
@@ -507,19 +505,19 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
507
505
|
}
|
|
508
506
|
}, _callee5, this);
|
|
509
507
|
}));
|
|
510
|
-
function
|
|
511
|
-
return
|
|
508
|
+
function getBestRoute(_x7, _x8) {
|
|
509
|
+
return _getBestRoute.apply(this, arguments);
|
|
512
510
|
}
|
|
513
|
-
return
|
|
511
|
+
return getBestRoute;
|
|
514
512
|
}();
|
|
515
|
-
_proto.
|
|
516
|
-
var
|
|
513
|
+
_proto.getAllRoutes = /*#__PURE__*/function () {
|
|
514
|
+
var _getAllRoutes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(requestBody, options) {
|
|
517
515
|
var axiosResponse;
|
|
518
516
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
519
517
|
while (1) switch (_context6.prev = _context6.next) {
|
|
520
518
|
case 0:
|
|
521
519
|
_context6.next = 2;
|
|
522
|
-
return this.httpService.post("/routing/
|
|
520
|
+
return this.httpService.post("/routing/bests?apiKey=" + this.apiKey, requestBody, _extends({
|
|
523
521
|
headers: {
|
|
524
522
|
'X-Rango-Id': this.deviceId
|
|
525
523
|
}
|
|
@@ -533,21 +531,21 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
533
531
|
}
|
|
534
532
|
}, _callee6, this);
|
|
535
533
|
}));
|
|
536
|
-
function
|
|
537
|
-
return
|
|
534
|
+
function getAllRoutes(_x9, _x10) {
|
|
535
|
+
return _getAllRoutes.apply(this, arguments);
|
|
538
536
|
}
|
|
539
|
-
return
|
|
537
|
+
return getAllRoutes;
|
|
540
538
|
}();
|
|
541
|
-
_proto.
|
|
542
|
-
var
|
|
539
|
+
_proto.confirmRoute = /*#__PURE__*/function () {
|
|
540
|
+
var _confirmRoute = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(requestBody, options) {
|
|
543
541
|
var axiosResponse;
|
|
544
542
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
545
543
|
while (1) switch (_context7.prev = _context7.next) {
|
|
546
544
|
case 0:
|
|
547
545
|
_context7.next = 2;
|
|
548
|
-
return this.httpService.
|
|
549
|
-
|
|
550
|
-
|
|
546
|
+
return this.httpService.post("/routing/confirm?apiKey=" + this.apiKey, requestBody, _extends({
|
|
547
|
+
headers: {
|
|
548
|
+
'X-Rango-Id': this.deviceId
|
|
551
549
|
}
|
|
552
550
|
}, options));
|
|
553
551
|
case 2:
|
|
@@ -559,19 +557,23 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
559
557
|
}
|
|
560
558
|
}, _callee7, this);
|
|
561
559
|
}));
|
|
562
|
-
function
|
|
563
|
-
return
|
|
560
|
+
function confirmRoute(_x11, _x12) {
|
|
561
|
+
return _confirmRoute.apply(this, arguments);
|
|
564
562
|
}
|
|
565
|
-
return
|
|
563
|
+
return confirmRoute;
|
|
566
564
|
}();
|
|
567
|
-
_proto.
|
|
568
|
-
var
|
|
565
|
+
_proto.checkApproval = /*#__PURE__*/function () {
|
|
566
|
+
var _checkApproval = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(requestId, txId, options) {
|
|
569
567
|
var axiosResponse;
|
|
570
568
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
571
569
|
while (1) switch (_context8.prev = _context8.next) {
|
|
572
570
|
case 0:
|
|
573
571
|
_context8.next = 2;
|
|
574
|
-
return this.httpService.
|
|
572
|
+
return this.httpService.get("/tx/" + requestId + "/check-approval?apiKey=" + this.apiKey, _extends({
|
|
573
|
+
params: {
|
|
574
|
+
txId: txId
|
|
575
|
+
}
|
|
576
|
+
}, options));
|
|
575
577
|
case 2:
|
|
576
578
|
axiosResponse = _context8.sent;
|
|
577
579
|
return _context8.abrupt("return", axiosResponse.data);
|
|
@@ -581,19 +583,19 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
581
583
|
}
|
|
582
584
|
}, _callee8, this);
|
|
583
585
|
}));
|
|
584
|
-
function
|
|
585
|
-
return
|
|
586
|
+
function checkApproval(_x13, _x14, _x15) {
|
|
587
|
+
return _checkApproval.apply(this, arguments);
|
|
586
588
|
}
|
|
587
|
-
return
|
|
589
|
+
return checkApproval;
|
|
588
590
|
}();
|
|
589
|
-
_proto.
|
|
590
|
-
var
|
|
591
|
+
_proto.checkStatus = /*#__PURE__*/function () {
|
|
592
|
+
var _checkStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(requestBody, options) {
|
|
591
593
|
var axiosResponse;
|
|
592
594
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
593
595
|
while (1) switch (_context9.prev = _context9.next) {
|
|
594
596
|
case 0:
|
|
595
597
|
_context9.next = 2;
|
|
596
|
-
return this.httpService.post("/tx/
|
|
598
|
+
return this.httpService.post("/tx/check-status?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
597
599
|
case 2:
|
|
598
600
|
axiosResponse = _context9.sent;
|
|
599
601
|
return _context9.abrupt("return", axiosResponse.data);
|
|
@@ -603,56 +605,102 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
603
605
|
}
|
|
604
606
|
}, _callee9, this);
|
|
605
607
|
}));
|
|
606
|
-
function
|
|
607
|
-
return
|
|
608
|
+
function checkStatus(_x16, _x17) {
|
|
609
|
+
return _checkStatus.apply(this, arguments);
|
|
608
610
|
}
|
|
609
|
-
return
|
|
611
|
+
return checkStatus;
|
|
610
612
|
}();
|
|
611
|
-
_proto.
|
|
612
|
-
var
|
|
613
|
+
_proto.createTransaction = /*#__PURE__*/function () {
|
|
614
|
+
var _createTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(requestBody, options) {
|
|
615
|
+
var axiosResponse;
|
|
613
616
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
614
617
|
while (1) switch (_context10.prev = _context10.next) {
|
|
615
618
|
case 0:
|
|
616
619
|
_context10.next = 2;
|
|
617
|
-
return this.httpService.post("/tx/
|
|
620
|
+
return this.httpService.post("/tx/create?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
618
621
|
case 2:
|
|
622
|
+
axiosResponse = _context10.sent;
|
|
623
|
+
return _context10.abrupt("return", axiosResponse.data);
|
|
624
|
+
case 4:
|
|
619
625
|
case "end":
|
|
620
626
|
return _context10.stop();
|
|
621
627
|
}
|
|
622
628
|
}, _callee10, this);
|
|
623
629
|
}));
|
|
624
|
-
function
|
|
630
|
+
function createTransaction(_x18, _x19) {
|
|
631
|
+
return _createTransaction.apply(this, arguments);
|
|
632
|
+
}
|
|
633
|
+
return createTransaction;
|
|
634
|
+
}();
|
|
635
|
+
_proto.reportFailure = /*#__PURE__*/function () {
|
|
636
|
+
var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(requestBody, options) {
|
|
637
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
638
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
639
|
+
case 0:
|
|
640
|
+
_context11.next = 2;
|
|
641
|
+
return this.httpService.post("/tx/report-tx?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
642
|
+
case 2:
|
|
643
|
+
case "end":
|
|
644
|
+
return _context11.stop();
|
|
645
|
+
}
|
|
646
|
+
}, _callee11, this);
|
|
647
|
+
}));
|
|
648
|
+
function reportFailure(_x20, _x21) {
|
|
625
649
|
return _reportFailure.apply(this, arguments);
|
|
626
650
|
}
|
|
627
651
|
return reportFailure;
|
|
628
652
|
}();
|
|
629
653
|
_proto.getWalletsDetails = /*#__PURE__*/function () {
|
|
630
|
-
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
654
|
+
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(walletAddresses, options) {
|
|
631
655
|
var walletAddressesQueryParams, i, walletAddress, axiosResponse;
|
|
632
|
-
return _regeneratorRuntime().wrap(function
|
|
633
|
-
while (1) switch (
|
|
656
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
657
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
634
658
|
case 0:
|
|
635
659
|
walletAddressesQueryParams = '';
|
|
636
660
|
for (i = 0; i < walletAddresses.length; i++) {
|
|
637
661
|
walletAddress = walletAddresses[i];
|
|
638
662
|
walletAddressesQueryParams += "&address=" + walletAddress.blockchain + "." + walletAddress.address;
|
|
639
663
|
}
|
|
640
|
-
|
|
664
|
+
_context12.next = 4;
|
|
641
665
|
return this.httpService.get("/wallets/details?apiKey=" + this.apiKey + walletAddressesQueryParams, _extends({}, options));
|
|
642
666
|
case 4:
|
|
643
|
-
axiosResponse =
|
|
644
|
-
return
|
|
667
|
+
axiosResponse = _context12.sent;
|
|
668
|
+
return _context12.abrupt("return", axiosResponse.data);
|
|
645
669
|
case 6:
|
|
646
670
|
case "end":
|
|
647
|
-
return
|
|
671
|
+
return _context12.stop();
|
|
648
672
|
}
|
|
649
|
-
},
|
|
673
|
+
}, _callee12, this);
|
|
650
674
|
}));
|
|
651
|
-
function getWalletsDetails(
|
|
675
|
+
function getWalletsDetails(_x22, _x23) {
|
|
652
676
|
return _getWalletsDetails.apply(this, arguments);
|
|
653
677
|
}
|
|
654
678
|
return getWalletsDetails;
|
|
655
679
|
}();
|
|
680
|
+
_proto.getTokenBalance = /*#__PURE__*/function () {
|
|
681
|
+
var _getTokenBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(tokenBalanceRequest, options) {
|
|
682
|
+
var axiosResponse;
|
|
683
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
684
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
685
|
+
case 0:
|
|
686
|
+
_context13.next = 2;
|
|
687
|
+
return this.httpService.get("/wallets/token-balance?apiKey=" + this.apiKey, _extends({
|
|
688
|
+
params: tokenBalanceRequest
|
|
689
|
+
}, options));
|
|
690
|
+
case 2:
|
|
691
|
+
axiosResponse = _context13.sent;
|
|
692
|
+
return _context13.abrupt("return", axiosResponse.data);
|
|
693
|
+
case 4:
|
|
694
|
+
case "end":
|
|
695
|
+
return _context13.stop();
|
|
696
|
+
}
|
|
697
|
+
}, _callee13, this);
|
|
698
|
+
}));
|
|
699
|
+
function getTokenBalance(_x24, _x25) {
|
|
700
|
+
return _getTokenBalance.apply(this, arguments);
|
|
701
|
+
}
|
|
702
|
+
return getTokenBalance;
|
|
703
|
+
}();
|
|
656
704
|
return RangoClient;
|
|
657
705
|
}();
|
|
658
706
|
|
|
@@ -709,6 +757,7 @@ var RoutingResultType;
|
|
|
709
757
|
RoutingResultType["HIGH_IMPACT"] = "HIGH_IMPACT";
|
|
710
758
|
RoutingResultType["NO_ROUTE"] = "NO_ROUTE";
|
|
711
759
|
RoutingResultType["INPUT_LIMIT_ISSUE"] = "INPUT_LIMIT_ISSUE";
|
|
760
|
+
RoutingResultType["HIGH_IMPACT_FOR_CREATE_TX"] = "HIGH_IMPACT_FOR_CREATE_TX";
|
|
712
761
|
})(RoutingResultType || (RoutingResultType = {}));
|
|
713
762
|
|
|
714
763
|
/**
|
package/lib/rango-sdk.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rango-sdk.esm.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts","../../../node_modules/rango-types/src/api/shared/txs/ton.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n SwapperMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\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 = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMeta[]> {\n const axiosResponse = await this.httpService.get<SwapperMeta[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRouteRequest(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\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 this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n TON = 'TON',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'USER_CANCELED_TX'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'TX_FAILED_IN_BLOCKCHAIN'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n | 'INSUFFICIENT_APPROVE'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'USER_CANCELED_TX',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'TX_FAILED_IN_BLOCKCHAIN',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n 'INSUFFICIENT_APPROVE',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} [step] - Step number in which failure happened\n * @property {string} [reason] - Reason or message for the error\n * @property {[key: string]: string} [data] - @deprecated A list of key-value for extra details\n * @property {wallet?: string, errorCode? string} [tags] - A list of key-value for pre-defined tags\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n tags?: { wallet?: string; errorCode?: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n * You could stop check approval if:\n * 1- approved successfully\n * => isApproved = true\n * 2- approval transaction failed\n * => isApproved = false && txStatus === 'failed'\n * 3- approval transaction succeeded but currentApprovedAmount is still less than requiredApprovedAmount\n * (e.g. user changed transaction data and enter another approve amount in MetaMask)\n * => isApproved = false && txStatus == 'success'\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n * @property {string | null} requiredApprovedAmount - required amount to be approved by user\n * @property {string | null} currentApprovedAmount - current approved amount by user\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n requiredApprovedAmount: string | null\n currentApprovedAmount: string | null\n}\n","import { TransactionType } from '../transactions.js'\nimport { BaseTransaction } from './base.js'\n\nexport enum TonChainID {\n MAINNET = '-239',\n TESTNET = '-3',\n}\n\n/**\n * @property {string} address - Receiver's address\n * @property {string} amount - Amount to send in nanoTon\n * @property {string} [stateInit] - Contract specific data to add to the transaction\n * @property {string} [payload] - Contract specific data to add to the transaction\n */\nexport interface TonMessage {\n address: string\n amount: string\n stateInit?: string\n payload?: string\n}\n\n/**\n * This type of transaction is used for all Ton transactions\n *\n * @property {TransactionType} type - This field equals to TON for all Ton transactions\n * @property {number} validUntil - Sending transaction deadline in unix epoch seconds\n * @property {TonChainID} [network] - The network (mainnet or testnet) where DApp intends to send the transaction. If not set, the transaction is sent to the network currently set in the wallet, but this is not safe and DApp should always strive to set the network. If the network parameter is set, but the wallet has a different network set, the wallet should show an alert and DO NOT ALLOW TO SEND this transaction\n * @property {string} [from] - The sender address in '<wc>:<hex>' format from which DApp intends to send the transaction. Current account.address by default\n * @property {TonMessage[]} messages - Messages to send: min is 1, max is 4\n */\nexport interface TonTransaction extends BaseTransaction {\n type: TransactionType.TON\n validUntil: number\n network?: TonChainID\n from?: string\n messages: TonMessage[]\n}\n\nexport const isTonTransaction = (transaction: {\n type: TransactionType\n}): transaction is TonTransaction => transaction.type === TransactionType.TON\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_callee$","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","sent","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_callee2$","_context2","_x3","getSwappers","_getSwappers","_callee3","_callee3$","_context3","_x4","getBestRoute","_getBestRoute","_callee4","requestBody","_callee4$","_context4","post","headers","_x5","_x6","getAllRoutes","_getAllRoutes","_callee5","_callee5$","_context5","_x7","_x8","confirmRouteRequest","_confirmRouteRequest","_callee6","_callee6$","_context6","_x9","_x10","checkApproval","_checkApproval","_callee7","requestId","txId","_callee7$","_context7","_x11","_x12","_x13","checkStatus","_checkStatus","_callee8","_callee8$","_context8","_x14","_x15","createTransaction","_createTransaction","_callee9","_callee9$","_context9","_x16","_x17","reportFailure","_reportFailure","_callee10","_callee10$","_context10","_x18","_x19","getWalletsDetails","_getWalletsDetails","_callee11","walletAddresses","walletAddressesQueryParams","walletAddress","_callee11$","_context11","length","_x20","_x21","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A;QAAA,kBAAAA,UAAA,CAAArH,IAAA,GAAAqH,UAAA,CAAApH,IAAA;UAAA;YAEpBiH,0BAA0B,GAAG,EAAE;YACnC,KAASjG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGgG,eAAe,CAACK,MAAM,EAAErG,CAAC,EAAE,EAAE;cACzCkG,aAAa,GAAGF,eAAe,CAAChG,CAAC,CAAC;cACxCiG,0BAA0B,kBAAgBC,aAAa,CAACvG,UAAU,SAAIuG,aAAa,CAACjG,OAAS;;YAC9FmG,UAAA,CAAApH,IAAA;YAAA,OAC2B,IAAI,CAAC3B,WAAW,CAACkC,GAAG,8BACnB,IAAI,CAAC5C,MAAM,GAAGsJ,0BAA0B,EAAAhH,QAAA,KAC9Df,OAAO,CAAE,CACf;UAAA;YAHKM,aAAa,GAAA4H,UAAA,CAAA5G,IAAA;YAAA,OAAA4G,UAAA,CAAAhF,MAAA,WAIZ5C,aAAa,CAAC2C,IAAI;UAAA;UAAA;YAAA,OAAAiF,UAAA,CAAA/E,IAAA;;SAAA0E,SAAA;KAC1B;IAAA,SAAAF,kBAAAS,IAAA,EAAAC,IAAA;MAAA,OAAAT,kBAAA,CAAAtE,KAAA,OAAAC,SAAA;;IAAA,OAAAoE,iBAAA;;EAAA,OAAAnJ,WAAA;AAAA;;mBC/K2B,2BAAA8J;;;qDAIUC;;;AAGtC;;;AAKF;;;yDAI0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzD1C;;;;AAIA;AAAA;gCAAY;;;;;;ACJZ;;;AAGA;AAAA;;;;;;;;;AAUA;;;;AAIA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"rango-sdk.esm.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts","../../../node_modules/rango-types/src/api/shared/txs/ton.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\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 = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\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 this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n HIGH_IMPACT_FOR_CREATE_TX = 'HIGH_IMPACT_FOR_CREATE_TX',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n TON = 'TON',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'USER_CANCELED_TX'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'TX_FAILED_IN_BLOCKCHAIN'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n | 'INSUFFICIENT_APPROVE'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'USER_CANCELED_TX',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'TX_FAILED_IN_BLOCKCHAIN',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n 'INSUFFICIENT_APPROVE',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} [step] - Step number in which failure happened\n * @property {string} [reason] - Reason or message for the error\n * @property {[key: string]: string} [data] - @deprecated A list of key-value for extra details\n * @property {wallet?: string, errorCode? string} [tags] - A list of key-value for pre-defined tags\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n tags?: { wallet?: string; errorCode?: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n * You could stop check approval if:\n * 1- approved successfully\n * => isApproved = true\n * 2- approval transaction failed\n * => isApproved = false && txStatus === 'failed'\n * 3- approval transaction succeeded but currentApprovedAmount is still less than requiredApprovedAmount\n * (e.g. user changed transaction data and enter another approve amount in MetaMask)\n * => isApproved = false && txStatus == 'success'\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n * @property {string | null} requiredApprovedAmount - required amount to be approved by user\n * @property {string | null} currentApprovedAmount - current approved amount by user\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n requiredApprovedAmount: string | null\n currentApprovedAmount: string | null\n}\n","import { TransactionType } from '../transactions.js'\nimport { BaseTransaction } from './base.js'\n\nexport enum TonChainID {\n MAINNET = '-239',\n TESTNET = '-3',\n}\n\n/**\n * @property {string} address - Receiver's address\n * @property {string} amount - Amount to send in nanoTon\n * @property {string} [stateInit] - Contract specific data to add to the transaction\n * @property {string} [payload] - Contract specific data to add to the transaction\n */\nexport interface TonMessage {\n address: string\n amount: string\n stateInit?: string\n payload?: string\n}\n\n/**\n * This type of transaction is used for all Ton transactions\n *\n * @property {TransactionType} type - This field equals to TON for all Ton transactions\n * @property {number} validUntil - Sending transaction deadline in unix epoch seconds\n * @property {TonChainID} [network] - The network (mainnet or testnet) where DApp intends to send the transaction. If not set, the transaction is sent to the network currently set in the wallet, but this is not safe and DApp should always strive to set the network. If the network parameter is set, but the wallet has a different network set, the wallet should show an alert and DO NOT ALLOW TO SEND this transaction\n * @property {string} [from] - The sender address in '<wc>:<hex>' format from which DApp intends to send the transaction. Current account.address by default\n * @property {TonMessage[]} messages - Messages to send: min is 1, max is 4\n */\nexport interface TonTransaction extends BaseTransaction {\n type: TransactionType.TON\n validUntil: number\n network?: TonChainID\n from?: string\n messages: TonMessage[]\n}\n\nexport const isTonTransaction = (transaction: {\n type: TransactionType\n}): transaction is TonTransaction => transaction.type === TransactionType.TON\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_callee$","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","sent","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_callee2$","_context2","_x3","getSwappers","_getSwappers","_callee3","_callee3$","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_callee4$","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_callee5$","_context5","post","headers","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_callee6$","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_callee7$","_context7","_x11","_x12","checkApproval","_checkApproval","_callee8","requestId","txId","_callee8$","_context8","_x13","_x14","_x15","checkStatus","_checkStatus","_callee9","_callee9$","_context9","_x16","_x17","createTransaction","_createTransaction","_callee10","_callee10$","_context10","_x18","_x19","reportFailure","_reportFailure","_callee11","_callee11$","_context11","_x20","_x21","getWalletsDetails","_getWalletsDetails","_callee12","walletAddresses","walletAddressesQueryParams","walletAddress","_callee12$","_context12","length","_x22","_x23","getTokenBalance","_getTokenBalance","_callee13","tokenBalanceRequest","_callee13$","_context13","_x24","_x25","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA;;;;;;;;;;;"}
|
package/lib/services/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MetaRequest, MetaResponse, BestRouteRequest, BestRouteResponse, CheckApprovalResponse, CheckTxStatusRequest, TransactionStatusResponse, CreateTransactionRequest, CreateTransactionResponse, ReportTransactionRequest, WalletDetailsResponse, RequestOptions, BlockchainMeta,
|
|
1
|
+
import { MetaRequest, MetaResponse, BestRouteRequest, BestRouteResponse, CheckApprovalResponse, CheckTxStatusRequest, TransactionStatusResponse, CreateTransactionRequest, CreateTransactionResponse, ReportTransactionRequest, WalletDetailsResponse, RequestOptions, BlockchainMeta, MultiRouteRequest, MultiRouteResponse, ConfirmRouteResponse, ConfirmRouteRequest, CustomTokenRequest, CustomTokenResponse, TokenBalanceResponse, TokenBalanceRequest, SwapperMetaExtended } from '../types';
|
|
2
2
|
declare type WalletAddresses = {
|
|
3
3
|
blockchain: string;
|
|
4
4
|
address: string;
|
|
@@ -11,15 +11,17 @@ export declare class RangoClient {
|
|
|
11
11
|
constructor(apiKey: string, apiUrl?: string);
|
|
12
12
|
getAllMetadata(metaRequest?: MetaRequest, options?: RequestOptions): Promise<MetaResponse>;
|
|
13
13
|
getBlockchains(options?: RequestOptions): Promise<BlockchainMeta[]>;
|
|
14
|
-
getSwappers(options?: RequestOptions): Promise<
|
|
14
|
+
getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]>;
|
|
15
|
+
getCustomToken(customTokenRequest?: CustomTokenRequest, options?: RequestOptions): Promise<CustomTokenResponse>;
|
|
15
16
|
getBestRoute(requestBody: BestRouteRequest, options?: RequestOptions): Promise<BestRouteResponse>;
|
|
16
17
|
getAllRoutes(requestBody: MultiRouteRequest, options?: RequestOptions): Promise<MultiRouteResponse>;
|
|
17
|
-
|
|
18
|
+
confirmRoute(requestBody: ConfirmRouteRequest, options?: RequestOptions): Promise<ConfirmRouteResponse>;
|
|
18
19
|
checkApproval(requestId: string, txId?: string, options?: RequestOptions): Promise<CheckApprovalResponse>;
|
|
19
20
|
checkStatus(requestBody: CheckTxStatusRequest, options?: RequestOptions): Promise<TransactionStatusResponse>;
|
|
20
21
|
createTransaction(requestBody: CreateTransactionRequest, options?: RequestOptions): Promise<CreateTransactionResponse>;
|
|
21
22
|
reportFailure(requestBody: ReportTransactionRequest, options?: RequestOptions): Promise<void>;
|
|
22
23
|
getWalletsDetails(walletAddresses: WalletAddresses, options?: RequestOptions): Promise<WalletDetailsResponse>;
|
|
24
|
+
getTokenBalance(tokenBalanceRequest: TokenBalanceRequest, options?: RequestOptions): Promise<TokenBalanceResponse>;
|
|
23
25
|
}
|
|
24
26
|
export {};
|
|
25
27
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/services/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,cAAc,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/services/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,cAAc,EAId,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,UAAU,CAAA;AAGjB,aAAK,eAAe,GAAG;IAAE,UAAU,EAAE,MAA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,iBAAiB,CAC5B,WAAW,EAAE,wBAAwB,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,yBAAyB,CAAC;IAUxB,aAAa,CACxB,WAAW,EAAE,wBAAwB,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC;IAUH,iBAAiB,CAC5B,eAAe,EAAE,eAAe,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,qBAAqB,CAAC;IAapB,eAAe,CAC1B,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;CAOjC"}
|
package/lib/types/api/meta.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from 'rango-types/lib/api/main/meta';
|
|
2
2
|
export * from 'rango-types/lib/api/shared/type-gaurds';
|
|
3
|
-
export type { MetaRequest } from 'rango-types/lib/api/shared/meta';
|
|
3
|
+
export type { MetaRequest, SwapperMetaExtended } from 'rango-types/lib/api/shared/meta';
|
|
4
4
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/types/api/meta.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wCAAwC,CAAA;AACtD,YAAY,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA"}
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/types/api/meta.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wCAAwC,CAAA;AACtD,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rango-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
4
4
|
"description": "Rango Exchange SDK for dApps",
|
|
5
5
|
"module": "lib/rango-sdk.esm.js",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"axios": "^1.7.2",
|
|
46
46
|
"bignumber.js": "^9.1.1",
|
|
47
|
-
"rango-types": "^0.1.
|
|
47
|
+
"rango-types": "^0.1.72",
|
|
48
48
|
"uuid-random": "^1.3.2"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
package/src/services/client.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
WalletDetailsResponse,
|
|
14
14
|
RequestOptions,
|
|
15
15
|
BlockchainMeta,
|
|
16
|
-
SwapperMeta,
|
|
17
16
|
CompactMetaResponse,
|
|
18
17
|
CompactToken,
|
|
19
18
|
Token,
|
|
@@ -21,6 +20,11 @@ import {
|
|
|
21
20
|
MultiRouteResponse,
|
|
22
21
|
ConfirmRouteResponse,
|
|
23
22
|
ConfirmRouteRequest,
|
|
23
|
+
CustomTokenRequest,
|
|
24
|
+
CustomTokenResponse,
|
|
25
|
+
TokenBalanceResponse,
|
|
26
|
+
TokenBalanceRequest,
|
|
27
|
+
SwapperMetaExtended,
|
|
24
28
|
} from '../types'
|
|
25
29
|
import axios, { AxiosInstance } from 'axios'
|
|
26
30
|
|
|
@@ -105,14 +109,25 @@ export class RangoClient {
|
|
|
105
109
|
return axiosResponse.data
|
|
106
110
|
}
|
|
107
111
|
|
|
108
|
-
public async getSwappers(options?: RequestOptions): Promise<
|
|
109
|
-
const axiosResponse = await this.httpService.get<
|
|
112
|
+
public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {
|
|
113
|
+
const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(
|
|
110
114
|
`/meta/swappers?apiKey=${this.apiKey}`,
|
|
111
115
|
{ ...options }
|
|
112
116
|
)
|
|
113
117
|
return axiosResponse.data
|
|
114
118
|
}
|
|
115
119
|
|
|
120
|
+
public async getCustomToken(
|
|
121
|
+
customTokenRequest?: CustomTokenRequest,
|
|
122
|
+
options?: RequestOptions
|
|
123
|
+
): Promise<CustomTokenResponse> {
|
|
124
|
+
const axiosResponse = await this.httpService.get<CustomTokenResponse>(
|
|
125
|
+
`/meta/custom-token?apiKey=${this.apiKey}`,
|
|
126
|
+
{ params: customTokenRequest, ...options }
|
|
127
|
+
)
|
|
128
|
+
return axiosResponse.data
|
|
129
|
+
}
|
|
130
|
+
|
|
116
131
|
public async getBestRoute(
|
|
117
132
|
requestBody: BestRouteRequest,
|
|
118
133
|
options?: RequestOptions
|
|
@@ -137,7 +152,7 @@ export class RangoClient {
|
|
|
137
152
|
return axiosResponse.data
|
|
138
153
|
}
|
|
139
154
|
|
|
140
|
-
public async
|
|
155
|
+
public async confirmRoute(
|
|
141
156
|
requestBody: ConfirmRouteRequest,
|
|
142
157
|
options?: RequestOptions
|
|
143
158
|
): Promise<ConfirmRouteResponse> {
|
|
@@ -215,4 +230,15 @@ export class RangoClient {
|
|
|
215
230
|
)
|
|
216
231
|
return axiosResponse.data
|
|
217
232
|
}
|
|
233
|
+
|
|
234
|
+
public async getTokenBalance(
|
|
235
|
+
tokenBalanceRequest: TokenBalanceRequest,
|
|
236
|
+
options?: RequestOptions
|
|
237
|
+
): Promise<TokenBalanceResponse> {
|
|
238
|
+
const axiosResponse = await this.httpService.get<TokenBalanceResponse>(
|
|
239
|
+
`/wallets/token-balance?apiKey=${this.apiKey}`,
|
|
240
|
+
{ params: tokenBalanceRequest, ...options }
|
|
241
|
+
)
|
|
242
|
+
return axiosResponse.data
|
|
243
|
+
}
|
|
218
244
|
}
|
package/src/types/api/meta.ts
CHANGED