rango-sdk 0.1.44 → 0.1.45
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 +85 -33
- 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 +85 -33
- package/lib/rango-sdk.esm.js.map +1 -1
- package/lib/services/client.d.ts +3 -1
- package/lib/services/client.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/services/client.ts +28 -0
|
@@ -497,16 +497,16 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
497
497
|
}
|
|
498
498
|
return getBestRoute;
|
|
499
499
|
}();
|
|
500
|
-
_proto.
|
|
501
|
-
var
|
|
500
|
+
_proto.getAllRoutes = /*#__PURE__*/function () {
|
|
501
|
+
var _getAllRoutes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(requestBody, options) {
|
|
502
502
|
var axiosResponse;
|
|
503
503
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
504
504
|
while (1) switch (_context5.prev = _context5.next) {
|
|
505
505
|
case 0:
|
|
506
506
|
_context5.next = 2;
|
|
507
|
-
return this.httpService.
|
|
508
|
-
|
|
509
|
-
|
|
507
|
+
return this.httpService.post("/routing/bests?apiKey=" + this.apiKey, requestBody, _extends({
|
|
508
|
+
headers: {
|
|
509
|
+
'X-Rango-Id': this.deviceId
|
|
510
510
|
}
|
|
511
511
|
}, options));
|
|
512
512
|
case 2:
|
|
@@ -518,19 +518,23 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
518
518
|
}
|
|
519
519
|
}, _callee5, this);
|
|
520
520
|
}));
|
|
521
|
-
function
|
|
522
|
-
return
|
|
521
|
+
function getAllRoutes(_x7, _x8) {
|
|
522
|
+
return _getAllRoutes.apply(this, arguments);
|
|
523
523
|
}
|
|
524
|
-
return
|
|
524
|
+
return getAllRoutes;
|
|
525
525
|
}();
|
|
526
|
-
_proto.
|
|
527
|
-
var
|
|
526
|
+
_proto.confirmRouteRequest = /*#__PURE__*/function () {
|
|
527
|
+
var _confirmRouteRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(requestBody, options) {
|
|
528
528
|
var axiosResponse;
|
|
529
529
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
530
530
|
while (1) switch (_context6.prev = _context6.next) {
|
|
531
531
|
case 0:
|
|
532
532
|
_context6.next = 2;
|
|
533
|
-
return this.httpService.post("/
|
|
533
|
+
return this.httpService.post("/routing/confirm?apiKey=" + this.apiKey, requestBody, _extends({
|
|
534
|
+
headers: {
|
|
535
|
+
'X-Rango-Id': this.deviceId
|
|
536
|
+
}
|
|
537
|
+
}, options));
|
|
534
538
|
case 2:
|
|
535
539
|
axiosResponse = _context6.sent;
|
|
536
540
|
return _context6.abrupt("return", axiosResponse.data);
|
|
@@ -540,19 +544,23 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
540
544
|
}
|
|
541
545
|
}, _callee6, this);
|
|
542
546
|
}));
|
|
543
|
-
function
|
|
544
|
-
return
|
|
547
|
+
function confirmRouteRequest(_x9, _x10) {
|
|
548
|
+
return _confirmRouteRequest.apply(this, arguments);
|
|
545
549
|
}
|
|
546
|
-
return
|
|
550
|
+
return confirmRouteRequest;
|
|
547
551
|
}();
|
|
548
|
-
_proto.
|
|
549
|
-
var
|
|
552
|
+
_proto.checkApproval = /*#__PURE__*/function () {
|
|
553
|
+
var _checkApproval = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(requestId, txId, options) {
|
|
550
554
|
var axiosResponse;
|
|
551
555
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
552
556
|
while (1) switch (_context7.prev = _context7.next) {
|
|
553
557
|
case 0:
|
|
554
558
|
_context7.next = 2;
|
|
555
|
-
return this.httpService.
|
|
559
|
+
return this.httpService.get("/tx/" + requestId + "/check-approval?apiKey=" + this.apiKey, _extends({
|
|
560
|
+
params: {
|
|
561
|
+
txId: txId
|
|
562
|
+
}
|
|
563
|
+
}, options));
|
|
556
564
|
case 2:
|
|
557
565
|
axiosResponse = _context7.sent;
|
|
558
566
|
return _context7.abrupt("return", axiosResponse.data);
|
|
@@ -562,52 +570,96 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
562
570
|
}
|
|
563
571
|
}, _callee7, this);
|
|
564
572
|
}));
|
|
565
|
-
function
|
|
566
|
-
return
|
|
573
|
+
function checkApproval(_x11, _x12, _x13) {
|
|
574
|
+
return _checkApproval.apply(this, arguments);
|
|
567
575
|
}
|
|
568
|
-
return
|
|
576
|
+
return checkApproval;
|
|
569
577
|
}();
|
|
570
|
-
_proto.
|
|
571
|
-
var
|
|
578
|
+
_proto.checkStatus = /*#__PURE__*/function () {
|
|
579
|
+
var _checkStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(requestBody, options) {
|
|
580
|
+
var axiosResponse;
|
|
572
581
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
573
582
|
while (1) switch (_context8.prev = _context8.next) {
|
|
574
583
|
case 0:
|
|
575
584
|
_context8.next = 2;
|
|
576
|
-
return this.httpService.post("/tx/
|
|
585
|
+
return this.httpService.post("/tx/check-status?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
577
586
|
case 2:
|
|
587
|
+
axiosResponse = _context8.sent;
|
|
588
|
+
return _context8.abrupt("return", axiosResponse.data);
|
|
589
|
+
case 4:
|
|
578
590
|
case "end":
|
|
579
591
|
return _context8.stop();
|
|
580
592
|
}
|
|
581
593
|
}, _callee8, this);
|
|
582
594
|
}));
|
|
583
|
-
function
|
|
595
|
+
function checkStatus(_x14, _x15) {
|
|
596
|
+
return _checkStatus.apply(this, arguments);
|
|
597
|
+
}
|
|
598
|
+
return checkStatus;
|
|
599
|
+
}();
|
|
600
|
+
_proto.createTransaction = /*#__PURE__*/function () {
|
|
601
|
+
var _createTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(requestBody, options) {
|
|
602
|
+
var axiosResponse;
|
|
603
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
604
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
605
|
+
case 0:
|
|
606
|
+
_context9.next = 2;
|
|
607
|
+
return this.httpService.post("/tx/create?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
608
|
+
case 2:
|
|
609
|
+
axiosResponse = _context9.sent;
|
|
610
|
+
return _context9.abrupt("return", axiosResponse.data);
|
|
611
|
+
case 4:
|
|
612
|
+
case "end":
|
|
613
|
+
return _context9.stop();
|
|
614
|
+
}
|
|
615
|
+
}, _callee9, this);
|
|
616
|
+
}));
|
|
617
|
+
function createTransaction(_x16, _x17) {
|
|
618
|
+
return _createTransaction.apply(this, arguments);
|
|
619
|
+
}
|
|
620
|
+
return createTransaction;
|
|
621
|
+
}();
|
|
622
|
+
_proto.reportFailure = /*#__PURE__*/function () {
|
|
623
|
+
var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(requestBody, options) {
|
|
624
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
625
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
626
|
+
case 0:
|
|
627
|
+
_context10.next = 2;
|
|
628
|
+
return this.httpService.post("/tx/report-tx?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
629
|
+
case 2:
|
|
630
|
+
case "end":
|
|
631
|
+
return _context10.stop();
|
|
632
|
+
}
|
|
633
|
+
}, _callee10, this);
|
|
634
|
+
}));
|
|
635
|
+
function reportFailure(_x18, _x19) {
|
|
584
636
|
return _reportFailure.apply(this, arguments);
|
|
585
637
|
}
|
|
586
638
|
return reportFailure;
|
|
587
639
|
}();
|
|
588
640
|
_proto.getWalletsDetails = /*#__PURE__*/function () {
|
|
589
|
-
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
641
|
+
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(walletAddresses, options) {
|
|
590
642
|
var walletAddressesQueryParams, i, walletAddress, axiosResponse;
|
|
591
|
-
return _regeneratorRuntime().wrap(function
|
|
592
|
-
while (1) switch (
|
|
643
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
644
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
593
645
|
case 0:
|
|
594
646
|
walletAddressesQueryParams = '';
|
|
595
647
|
for (i = 0; i < walletAddresses.length; i++) {
|
|
596
648
|
walletAddress = walletAddresses[i];
|
|
597
649
|
walletAddressesQueryParams += "&address=" + walletAddress.blockchain + "." + walletAddress.address;
|
|
598
650
|
}
|
|
599
|
-
|
|
651
|
+
_context11.next = 4;
|
|
600
652
|
return this.httpService.get("/wallets/details?apiKey=" + this.apiKey + walletAddressesQueryParams, _extends({}, options));
|
|
601
653
|
case 4:
|
|
602
|
-
axiosResponse =
|
|
603
|
-
return
|
|
654
|
+
axiosResponse = _context11.sent;
|
|
655
|
+
return _context11.abrupt("return", axiosResponse.data);
|
|
604
656
|
case 6:
|
|
605
657
|
case "end":
|
|
606
|
-
return
|
|
658
|
+
return _context11.stop();
|
|
607
659
|
}
|
|
608
|
-
},
|
|
660
|
+
}, _callee11, this);
|
|
609
661
|
}));
|
|
610
|
-
function getWalletsDetails(
|
|
662
|
+
function getWalletsDetails(_x20, _x21) {
|
|
611
663
|
return _getWalletsDetails.apply(this, arguments);
|
|
612
664
|
}
|
|
613
665
|
return getWalletsDetails;
|
|
@@ -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} 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 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] - 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 '../index.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","checkApproval","_checkApproval","_callee5","requestId","txId","_callee5$","_context5","_x7","_x8","_x9","checkStatus","_checkStatus","_callee6","_callee6$","_context6","_x10","_x11","createTransaction","_createTransaction","_callee7","_callee7$","_context7","_x12","_x13","reportFailure","_reportFailure","_callee8","_callee8$","_context8","_x14","_x15","getWalletsDetails","_getWalletsDetails","_callee9","walletAddresses","walletAddressesQueryParams","walletAddress","_callee9$","_context9","length","_x16","_x17","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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cACzCoF,aAAa,GAAGF,eAAe,CAAClF,CAAC,CAAC;cACxCmF,0BAA0B,kBAAgBC,aAAa,CAACzF,UAAU,SAAIyF,aAAa,CAACnF,OAAS;;YAC9FqF,SAAA,CAAAtG,IAAA;YAAA,OAC2B,IAAI,CAAC3B,WAAW,CAACkC,GAAG,8BACnB,IAAI,CAAC5C,MAAM,GAAGwI,0BAA0B,EAAAlG,QAAA,KAC9Df,OAAO,CAAE,CACf;UAAA;YAHKM,aAAa,GAAA8G,SAAA,CAAA9F,IAAA;YAAA,OAAA8F,SAAA,CAAAlE,MAAA,WAIZ5C,aAAa,CAAC2C,IAAI;UAAA;UAAA;YAAA,OAAAmE,SAAA,CAAAjE,IAAA;;SAAA4D,QAAA;KAC1B;IAAA,SAAAF,kBAAAS,IAAA,EAAAC,IAAA;MAAA,OAAAT,kBAAA,CAAAxD,KAAA,OAAAC,SAAA;;IAAA,OAAAsD,iBAAA;;EAAA,OAAArI,WAAA;AAAA;;mBCnJ2B,2BAAAgJ;;;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 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] - 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 '../index.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","walletAdd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mBC/K2B,2BAAA8J;;;qDAIUC;;;AAGtC;;;AAKF;;;yDAI0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzD1C;;;;AAIA,AAAA;gCAAY;;;;;;ACJZ;;;AAGA,AAAA;;;;;;;;;AAUA,AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
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(){n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=Object.create((e&&e.prototype instanceof f?e:f).prototype),a=new k(n||[]);return o(i,"_invoke",{value:S(t,r,a)}),i}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=p;var h={};function f(){}function y(){}function v(){}var d={};u(d,a,(function(){return this}));var x=Object.getPrototypeOf,g=x&&x(x(N([])));g&&g!==e&&r.call(g,a)&&(d=g);var T=v.prototype=f.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;o(this,"_invoke",{value:function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var s=l(t[o],t,i);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(p).then((function(t){u.value=t,a(u)}),(function(t){return n("throw",t,a,c)}))}c(s.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}})}function S(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=O(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function O(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,O(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function E(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 b(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function N(t){if(t||""===t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=v,o(T,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:y,configurable:!0}),y.displayName=u(v,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u(t,s,"GeneratorFunction")),t.prototype=Object.create(T),t},t.awrap=function(t){return{__await:t}},m(w.prototype),u(w.prototype,c,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(p(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(T),u(T,s,"Generator"),u(T,a,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),t.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}},t.values=N,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(b),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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,h):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),h},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),b(r),h}},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;b(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:N(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function o(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 i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,s,"next",t)}function s(t){o(a,n,i,c,s,"throw",t)}c(void 0)}))}}function a(){return(a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}var c,s,u,p,l,h=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 o=t.prototype;return o.getAllMetadata=function(){var t=i(n().mark((function t(e,r){var o,i,c,s,u,p,l,h,f;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=a({},e,{blockchains:null==e||null==(o=e.blockchains)?void 0:o.join(),swappers:null==e||null==(i=e.swappers)?void 0:i.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,a({params:u},r));case 3:return l=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||[]}}))},h=l((p=t.sent).data.tokens),f=l(p.data.popularTokens),t.abrupt("return",a({},p.data,{tokens:h,popularTokens:f}));case 8:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),o.getBlockchains=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/blockchains?apiKey="+this.apiKey,a({},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)}}(),o.getSwappers=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/swappers?apiKey="+this.apiKey,a({},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)}}(),o.getBestRoute=function(){var t=i(n().mark((function t(e,r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/best?apiKey="+this.apiKey,e,a({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)}}(),o.checkApproval=function(){var t=i(n().mark((function t(e,r,o){return n().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,a({params:{txId:r}},o));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)}}(),o.checkStatus=function(){var t=i(n().mark((function t(e,r){return n().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,a({},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)}}(),o.createTransaction=function(){var t=i(n().mark((function t(e,r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/create?apiKey="+this.apiKey,e,a({},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)}}(),o.reportFailure=function(){var t=i(n().mark((function t(e,r){return n().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,a({},r));case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),o.getWalletsDetails=function(){var t=i(n().mark((function t(e,r){var o,i,c;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(o="",i=0;i<e.length;i++)o+="&address="+(c=e[i]).blockchain+"."+c.address;return t.next=4,this.httpService.get("/wallets/details?apiKey="+this.apiKey+o,a({},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)}}(),t}(),f=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",(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",(l=exports.TonChainID||(exports.TonChainID={})).MAINNET="-239",l.TESTNET="-3",exports.RangoClient=h,exports.cosmosBlockchains=function(t){return t.filter(y)},exports.evmBlockchains=function(t){return t.filter(f)},exports.isCosmosBlockchain=y,exports.isCosmosTransaction=function(t){return t.type===exports.TransactionType.COSMOS},exports.isEvmBlockchain=f,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.isStarknetTransaction=function(t){return t.type===exports.TransactionType.STARKNET},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)};
|
|
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(){n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=Object.create((e&&e.prototype instanceof l?e:l).prototype),a=new E(n||[]);return o(i,"_invoke",{value:S(t,r,a)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=p;var f={};function l(){}function y(){}function v(){}var d={};u(d,a,(function(){return this}));var x=Object.getPrototypeOf,g=x&&x(x(N([])));g&&g!==e&&r.call(g,a)&&(d=g);var T=v.prototype=l.prototype=Object.create(d);function m(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){var n;o(this,"_invoke",{value:function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var s=h(t[o],t,i);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(p).then((function(t){u.value=t,a(u)}),(function(t){return n("throw",t,a,c)}))}c(s.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}})}function S(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=b(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=h(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function b(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,b(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=h(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function O(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 k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function N(t){if(t||""===t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=v,o(T,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:y,configurable:!0}),y.displayName=u(v,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,u(t,s,"GeneratorFunction")),t.prototype=Object.create(T),t},t.awrap=function(t){return{__await:t}},m(w.prototype),u(w.prototype,c,(function(){return this})),t.AsyncIterator=w,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new w(p(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},m(T),u(T,s,"Generator"),u(T,a,(function(){return this})),u(T,"toString",(function(){return"[object Generator]"})),t.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}},t.values=N,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.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,f):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),f},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),k(r),f}},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;k(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:N(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function o(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 i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,s,"next",t)}function s(t){o(a,n,i,c,s,"throw",t)}c(void 0)}))}}function a(){return(a=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(this,arguments)}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 o=t.prototype;return o.getAllMetadata=function(){var t=i(n().mark((function t(e,r){var o,i,c,s,u,p,h,f,l;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=a({},e,{blockchains:null==e||null==(o=e.blockchains)?void 0:o.join(),swappers:null==e||null==(i=e.swappers)?void 0:i.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,a({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",a({},p.data,{tokens:f,popularTokens:l}));case 8:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),o.getBlockchains=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/blockchains?apiKey="+this.apiKey,a({},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)}}(),o.getSwappers=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/swappers?apiKey="+this.apiKey,a({},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)}}(),o.getBestRoute=function(){var t=i(n().mark((function t(e,r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/best?apiKey="+this.apiKey,e,a({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)}}(),o.getAllRoutes=function(){var t=i(n().mark((function t(e,r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/bests?apiKey="+this.apiKey,e,a({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)}}(),o.confirmRouteRequest=function(){var t=i(n().mark((function t(e,r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/confirm?apiKey="+this.apiKey,e,a({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)}}(),o.checkApproval=function(){var t=i(n().mark((function t(e,r,o){return n().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,a({params:{txId:r}},o));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)}}(),o.checkStatus=function(){var t=i(n().mark((function t(e,r){return n().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,a({},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)}}(),o.createTransaction=function(){var t=i(n().mark((function t(e,r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/create?apiKey="+this.apiKey,e,a({},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)}}(),o.reportFailure=function(){var t=i(n().mark((function t(e,r){return n().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,a({},r));case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),o.getWalletsDetails=function(){var t=i(n().mark((function t(e,r){var o,i,c;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(o="",i=0;i<e.length;i++)o+="&address="+(c=e[i]).blockchain+"."+c.address;return t.next=4,this.httpService.get("/wallets/details?apiKey="+this.apiKey+o,a({},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)}}(),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",(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.isStarknetTransaction=function(t){return t.type===exports.TransactionType.STARKNET},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} 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 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","checkApproval","_checkApproval","_callee5","requestId","txId","_context5","_x7","_x8","_x9","checkStatus","_checkStatus","_callee6","_context6","_x10","_x11","createTransaction","_createTransaction","_callee7","_context7","_x12","_x13","reportFailure","_reportFailure","_callee8","_context8","_x14","_x15","getWalletsDetails","_getWalletsDetails","_callee9","walletAddresses","walletAddressesQueryParams","walletAddress","_context9","length","_x16","_x17","blockchainMeta"],"mappings":"orOAwBaA,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,UAwIA,OAxIAD,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,UAA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AAC,GAAA,OAAAJ,EAAA5C,WAAAC,eAAA/D,EAEY+G,6BAAiB,IAAAC,EAAA5G,EAAAC,IAAAC,MAAvB,SAAA2G,EACLC,EACAzG,GAAwB,IAAA0G,EAAA9E,EAAA+E,EAAA,OAAA/G,IAAAc,eAAAkG,GAAA,cAAAA,EAAAhG,KAAAgG,EAAA/F,MAAA,OAGxB,IADI6F,EAA6B,GACxB9E,EAAI,EAAGA,EAAI6E,EAAgBI,OAAQjF,IAE1C8E,gBADMC,EAAgBF,EAAgB7E,IACkBL,eAAcoF,EAAc9E,QACrF,OAAA+E,EAAA/F,OAC2BnC,KAAKS,YAAYiC,+BAChB1C,KAAKF,OAASkI,EAA0B5F,KAC9Dd,IACN,OAHkB,OAAA4G,EAAA3D,gBAAA2D,EAAA7D,KAIEC,MAAI,OAAA,UAAA,OAAA4D,EAAA1D,UAAAsD,YAC1B,OAAA,SAAAM,EAAAC,GAAA,OAAAR,EAAAlD,WAAAC,eAAA/E,oDC/IqCyI,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 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":"orOA4BaA,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,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,Q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
494
|
+
_proto.getAllRoutes = /*#__PURE__*/function () {
|
|
495
|
+
var _getAllRoutes = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(requestBody, options) {
|
|
496
496
|
var axiosResponse;
|
|
497
497
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
498
498
|
while (1) switch (_context5.prev = _context5.next) {
|
|
499
499
|
case 0:
|
|
500
500
|
_context5.next = 2;
|
|
501
|
-
return this.httpService.
|
|
502
|
-
|
|
503
|
-
|
|
501
|
+
return this.httpService.post("/routing/bests?apiKey=" + this.apiKey, requestBody, _extends({
|
|
502
|
+
headers: {
|
|
503
|
+
'X-Rango-Id': this.deviceId
|
|
504
504
|
}
|
|
505
505
|
}, options));
|
|
506
506
|
case 2:
|
|
@@ -512,19 +512,23 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
512
512
|
}
|
|
513
513
|
}, _callee5, this);
|
|
514
514
|
}));
|
|
515
|
-
function
|
|
516
|
-
return
|
|
515
|
+
function getAllRoutes(_x7, _x8) {
|
|
516
|
+
return _getAllRoutes.apply(this, arguments);
|
|
517
517
|
}
|
|
518
|
-
return
|
|
518
|
+
return getAllRoutes;
|
|
519
519
|
}();
|
|
520
|
-
_proto.
|
|
521
|
-
var
|
|
520
|
+
_proto.confirmRouteRequest = /*#__PURE__*/function () {
|
|
521
|
+
var _confirmRouteRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(requestBody, options) {
|
|
522
522
|
var axiosResponse;
|
|
523
523
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
524
524
|
while (1) switch (_context6.prev = _context6.next) {
|
|
525
525
|
case 0:
|
|
526
526
|
_context6.next = 2;
|
|
527
|
-
return this.httpService.post("/
|
|
527
|
+
return this.httpService.post("/routing/confirm?apiKey=" + this.apiKey, requestBody, _extends({
|
|
528
|
+
headers: {
|
|
529
|
+
'X-Rango-Id': this.deviceId
|
|
530
|
+
}
|
|
531
|
+
}, options));
|
|
528
532
|
case 2:
|
|
529
533
|
axiosResponse = _context6.sent;
|
|
530
534
|
return _context6.abrupt("return", axiosResponse.data);
|
|
@@ -534,19 +538,23 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
534
538
|
}
|
|
535
539
|
}, _callee6, this);
|
|
536
540
|
}));
|
|
537
|
-
function
|
|
538
|
-
return
|
|
541
|
+
function confirmRouteRequest(_x9, _x10) {
|
|
542
|
+
return _confirmRouteRequest.apply(this, arguments);
|
|
539
543
|
}
|
|
540
|
-
return
|
|
544
|
+
return confirmRouteRequest;
|
|
541
545
|
}();
|
|
542
|
-
_proto.
|
|
543
|
-
var
|
|
546
|
+
_proto.checkApproval = /*#__PURE__*/function () {
|
|
547
|
+
var _checkApproval = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(requestId, txId, options) {
|
|
544
548
|
var axiosResponse;
|
|
545
549
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
546
550
|
while (1) switch (_context7.prev = _context7.next) {
|
|
547
551
|
case 0:
|
|
548
552
|
_context7.next = 2;
|
|
549
|
-
return this.httpService.
|
|
553
|
+
return this.httpService.get("/tx/" + requestId + "/check-approval?apiKey=" + this.apiKey, _extends({
|
|
554
|
+
params: {
|
|
555
|
+
txId: txId
|
|
556
|
+
}
|
|
557
|
+
}, options));
|
|
550
558
|
case 2:
|
|
551
559
|
axiosResponse = _context7.sent;
|
|
552
560
|
return _context7.abrupt("return", axiosResponse.data);
|
|
@@ -556,52 +564,96 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
556
564
|
}
|
|
557
565
|
}, _callee7, this);
|
|
558
566
|
}));
|
|
559
|
-
function
|
|
560
|
-
return
|
|
567
|
+
function checkApproval(_x11, _x12, _x13) {
|
|
568
|
+
return _checkApproval.apply(this, arguments);
|
|
561
569
|
}
|
|
562
|
-
return
|
|
570
|
+
return checkApproval;
|
|
563
571
|
}();
|
|
564
|
-
_proto.
|
|
565
|
-
var
|
|
572
|
+
_proto.checkStatus = /*#__PURE__*/function () {
|
|
573
|
+
var _checkStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(requestBody, options) {
|
|
574
|
+
var axiosResponse;
|
|
566
575
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
567
576
|
while (1) switch (_context8.prev = _context8.next) {
|
|
568
577
|
case 0:
|
|
569
578
|
_context8.next = 2;
|
|
570
|
-
return this.httpService.post("/tx/
|
|
579
|
+
return this.httpService.post("/tx/check-status?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
571
580
|
case 2:
|
|
581
|
+
axiosResponse = _context8.sent;
|
|
582
|
+
return _context8.abrupt("return", axiosResponse.data);
|
|
583
|
+
case 4:
|
|
572
584
|
case "end":
|
|
573
585
|
return _context8.stop();
|
|
574
586
|
}
|
|
575
587
|
}, _callee8, this);
|
|
576
588
|
}));
|
|
577
|
-
function
|
|
589
|
+
function checkStatus(_x14, _x15) {
|
|
590
|
+
return _checkStatus.apply(this, arguments);
|
|
591
|
+
}
|
|
592
|
+
return checkStatus;
|
|
593
|
+
}();
|
|
594
|
+
_proto.createTransaction = /*#__PURE__*/function () {
|
|
595
|
+
var _createTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(requestBody, options) {
|
|
596
|
+
var axiosResponse;
|
|
597
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
598
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
599
|
+
case 0:
|
|
600
|
+
_context9.next = 2;
|
|
601
|
+
return this.httpService.post("/tx/create?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
602
|
+
case 2:
|
|
603
|
+
axiosResponse = _context9.sent;
|
|
604
|
+
return _context9.abrupt("return", axiosResponse.data);
|
|
605
|
+
case 4:
|
|
606
|
+
case "end":
|
|
607
|
+
return _context9.stop();
|
|
608
|
+
}
|
|
609
|
+
}, _callee9, this);
|
|
610
|
+
}));
|
|
611
|
+
function createTransaction(_x16, _x17) {
|
|
612
|
+
return _createTransaction.apply(this, arguments);
|
|
613
|
+
}
|
|
614
|
+
return createTransaction;
|
|
615
|
+
}();
|
|
616
|
+
_proto.reportFailure = /*#__PURE__*/function () {
|
|
617
|
+
var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(requestBody, options) {
|
|
618
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
619
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
620
|
+
case 0:
|
|
621
|
+
_context10.next = 2;
|
|
622
|
+
return this.httpService.post("/tx/report-tx?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
623
|
+
case 2:
|
|
624
|
+
case "end":
|
|
625
|
+
return _context10.stop();
|
|
626
|
+
}
|
|
627
|
+
}, _callee10, this);
|
|
628
|
+
}));
|
|
629
|
+
function reportFailure(_x18, _x19) {
|
|
578
630
|
return _reportFailure.apply(this, arguments);
|
|
579
631
|
}
|
|
580
632
|
return reportFailure;
|
|
581
633
|
}();
|
|
582
634
|
_proto.getWalletsDetails = /*#__PURE__*/function () {
|
|
583
|
-
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
635
|
+
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(walletAddresses, options) {
|
|
584
636
|
var walletAddressesQueryParams, i, walletAddress, axiosResponse;
|
|
585
|
-
return _regeneratorRuntime().wrap(function
|
|
586
|
-
while (1) switch (
|
|
637
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
638
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
587
639
|
case 0:
|
|
588
640
|
walletAddressesQueryParams = '';
|
|
589
641
|
for (i = 0; i < walletAddresses.length; i++) {
|
|
590
642
|
walletAddress = walletAddresses[i];
|
|
591
643
|
walletAddressesQueryParams += "&address=" + walletAddress.blockchain + "." + walletAddress.address;
|
|
592
644
|
}
|
|
593
|
-
|
|
645
|
+
_context11.next = 4;
|
|
594
646
|
return this.httpService.get("/wallets/details?apiKey=" + this.apiKey + walletAddressesQueryParams, _extends({}, options));
|
|
595
647
|
case 4:
|
|
596
|
-
axiosResponse =
|
|
597
|
-
return
|
|
648
|
+
axiosResponse = _context11.sent;
|
|
649
|
+
return _context11.abrupt("return", axiosResponse.data);
|
|
598
650
|
case 6:
|
|
599
651
|
case "end":
|
|
600
|
-
return
|
|
652
|
+
return _context11.stop();
|
|
601
653
|
}
|
|
602
|
-
},
|
|
654
|
+
}, _callee11, this);
|
|
603
655
|
}));
|
|
604
|
-
function getWalletsDetails(
|
|
656
|
+
function getWalletsDetails(_x20, _x21) {
|
|
605
657
|
return _getWalletsDetails.apply(this, arguments);
|
|
606
658
|
}
|
|
607
659
|
return getWalletsDetails;
|
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} 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 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] - 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 '../index.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","checkApproval","_checkApproval","_callee5","requestId","txId","_callee5$","_context5","_x7","_x8","_x9","checkStatus","_checkStatus","_callee6","_callee6$","_context6","_x10","_x11","createTransaction","_createTransaction","_callee7","_callee7$","_context7","_x12","_x13","reportFailure","_reportFailure","_callee8","_callee8$","_context8","_x14","_x15","getWalletsDetails","_getWalletsDetails","_callee9","walletAddresses","walletAddressesQueryParams","walletAddress","_callee9$","_context9","length","_x16","_x17","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwBaA,WAAW;EAMtB,SAAAA,YAAYC,MAAc,EAAEC,MAAe;IACzC,IAAI,CAACA,MAAM,GAAGA,MAAM,IAAI,4BAA4B;IACpD,IAAI,CAACD,MAAM,GAAGA,MAAM;IACpB,IAAI;MACF,IAAI,OAAOE,MAAM,KAAK,WAAW,EAAE;QACjC,IAAMC,QAAQ,GAAGC,YAAY,CAACC,OAAO,CAAC,UAAU,CAAC;QACjD,IAAIF,QAAQ,EAAE;UACZ,IAAI,CAACA,QAAQ,GA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;MAAA,OAAAT,kBAAA,CAAAxD,KAAA,OAAAC,SAAA;;IAAA,OAAAsD,iBAAA;;EAAA,OAAArI,WAAA;AAAA;;mBCnJ2B,2BAAAgJ;;;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 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] - 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 '../index.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,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E;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;;;;;;;;;;;"}
|
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, SwapperMeta } from '../types';
|
|
1
|
+
import { MetaRequest, MetaResponse, BestRouteRequest, BestRouteResponse, CheckApprovalResponse, CheckTxStatusRequest, TransactionStatusResponse, CreateTransactionRequest, CreateTransactionResponse, ReportTransactionRequest, WalletDetailsResponse, RequestOptions, BlockchainMeta, SwapperMeta, MultiRouteRequest, MultiRouteResponse, ConfirmRouteResponse, ConfirmRouteRequest } from '../types';
|
|
2
2
|
declare type WalletAddresses = {
|
|
3
3
|
blockchain: string;
|
|
4
4
|
address: string;
|
|
@@ -13,6 +13,8 @@ export declare class RangoClient {
|
|
|
13
13
|
getBlockchains(options?: RequestOptions): Promise<BlockchainMeta[]>;
|
|
14
14
|
getSwappers(options?: RequestOptions): Promise<SwapperMeta[]>;
|
|
15
15
|
getBestRoute(requestBody: BestRouteRequest, options?: RequestOptions): Promise<BestRouteResponse>;
|
|
16
|
+
getAllRoutes(requestBody: MultiRouteRequest, options?: RequestOptions): Promise<MultiRouteResponse>;
|
|
17
|
+
confirmRouteRequest(requestBody: ConfirmRouteRequest, options?: RequestOptions): Promise<ConfirmRouteResponse>;
|
|
16
18
|
checkApproval(requestId: string, txId?: string, options?: RequestOptions): Promise<CheckApprovalResponse>;
|
|
17
19
|
checkStatus(requestBody: CheckTxStatusRequest, options?: RequestOptions): Promise<TransactionStatusResponse>;
|
|
18
20
|
createTransaction(requestBody: CreateTransactionRequest, options?: RequestOptions): Promise<CreateTransactionResponse>;
|
|
@@ -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,EACd,WAAW,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/services/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,Y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,CAAC,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,qBAAqB,CAAC;IAQpB,WAAW,CACtB,WAAW,EAAE,oBAAoB,EACjC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,yBAAyB,CAAC;IAUxB,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;CAYlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rango-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
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.2.6",
|
|
46
46
|
"bignumber.js": "^9.1.1",
|
|
47
|
-
"rango-types": "^0.1.
|
|
47
|
+
"rango-types": "^0.1.59",
|
|
48
48
|
"uuid-random": "^1.3.2"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
package/src/services/client.ts
CHANGED
|
@@ -17,6 +17,10 @@ import {
|
|
|
17
17
|
CompactMetaResponse,
|
|
18
18
|
CompactToken,
|
|
19
19
|
Token,
|
|
20
|
+
MultiRouteRequest,
|
|
21
|
+
MultiRouteResponse,
|
|
22
|
+
ConfirmRouteResponse,
|
|
23
|
+
ConfirmRouteRequest,
|
|
20
24
|
} from '../types'
|
|
21
25
|
import axios, { AxiosInstance } from 'axios'
|
|
22
26
|
|
|
@@ -121,6 +125,30 @@ export class RangoClient {
|
|
|
121
125
|
return axiosResponse.data
|
|
122
126
|
}
|
|
123
127
|
|
|
128
|
+
public async getAllRoutes(
|
|
129
|
+
requestBody: MultiRouteRequest,
|
|
130
|
+
options?: RequestOptions
|
|
131
|
+
): Promise<MultiRouteResponse> {
|
|
132
|
+
const axiosResponse = await this.httpService.post<MultiRouteResponse>(
|
|
133
|
+
`/routing/bests?apiKey=${this.apiKey}`,
|
|
134
|
+
requestBody,
|
|
135
|
+
{ headers: { 'X-Rango-Id': this.deviceId }, ...options }
|
|
136
|
+
)
|
|
137
|
+
return axiosResponse.data
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
public async confirmRouteRequest(
|
|
141
|
+
requestBody: ConfirmRouteRequest,
|
|
142
|
+
options?: RequestOptions
|
|
143
|
+
): Promise<ConfirmRouteResponse> {
|
|
144
|
+
const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(
|
|
145
|
+
`/routing/confirm?apiKey=${this.apiKey}`,
|
|
146
|
+
requestBody,
|
|
147
|
+
{ headers: { 'X-Rango-Id': this.deviceId }, ...options }
|
|
148
|
+
)
|
|
149
|
+
return axiosResponse.data
|
|
150
|
+
}
|
|
151
|
+
|
|
124
152
|
public async checkApproval(
|
|
125
153
|
requestId: string,
|
|
126
154
|
txId?: string,
|