rango-sdk 0.1.55 → 0.1.56
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 +72 -43
- 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 +72 -43
- package/lib/rango-sdk.esm.js.map +1 -1
- package/lib/services/client.d.ts +1 -0
- package/lib/services/client.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/services/client.ts +13 -0
|
@@ -567,17 +567,20 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
567
567
|
return _confirmRoute.apply(this, arguments);
|
|
568
568
|
}
|
|
569
569
|
return confirmRoute;
|
|
570
|
-
}()
|
|
571
|
-
|
|
572
|
-
|
|
570
|
+
}() // @deprecated use confirmRoute instead
|
|
571
|
+
;
|
|
572
|
+
_proto.confirmRouteRequest =
|
|
573
|
+
/*#__PURE__*/
|
|
574
|
+
function () {
|
|
575
|
+
var _confirmRouteRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(requestBody, options) {
|
|
573
576
|
var axiosResponse;
|
|
574
577
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
575
578
|
while (1) switch (_context8.prev = _context8.next) {
|
|
576
579
|
case 0:
|
|
577
580
|
_context8.next = 2;
|
|
578
|
-
return this.httpService.
|
|
579
|
-
|
|
580
|
-
|
|
581
|
+
return this.httpService.post("/routing/confirm?apiKey=" + this.apiKey, requestBody, _extends({
|
|
582
|
+
headers: {
|
|
583
|
+
'X-Rango-Id': this.deviceId
|
|
581
584
|
}
|
|
582
585
|
}, options));
|
|
583
586
|
case 2:
|
|
@@ -589,19 +592,23 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
589
592
|
}
|
|
590
593
|
}, _callee8, this);
|
|
591
594
|
}));
|
|
592
|
-
function
|
|
593
|
-
return
|
|
595
|
+
function confirmRouteRequest(_x13, _x14) {
|
|
596
|
+
return _confirmRouteRequest.apply(this, arguments);
|
|
594
597
|
}
|
|
595
|
-
return
|
|
598
|
+
return confirmRouteRequest;
|
|
596
599
|
}();
|
|
597
|
-
_proto.
|
|
598
|
-
var
|
|
600
|
+
_proto.checkApproval = /*#__PURE__*/function () {
|
|
601
|
+
var _checkApproval = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(requestId, txId, options) {
|
|
599
602
|
var axiosResponse;
|
|
600
603
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
601
604
|
while (1) switch (_context9.prev = _context9.next) {
|
|
602
605
|
case 0:
|
|
603
606
|
_context9.next = 2;
|
|
604
|
-
return this.httpService.
|
|
607
|
+
return this.httpService.get("/tx/" + requestId + "/check-approval?apiKey=" + this.apiKey, _extends({
|
|
608
|
+
params: {
|
|
609
|
+
txId: txId
|
|
610
|
+
}
|
|
611
|
+
}, options));
|
|
605
612
|
case 2:
|
|
606
613
|
axiosResponse = _context9.sent;
|
|
607
614
|
return _context9.abrupt("return", axiosResponse.data);
|
|
@@ -611,19 +618,19 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
611
618
|
}
|
|
612
619
|
}, _callee9, this);
|
|
613
620
|
}));
|
|
614
|
-
function
|
|
615
|
-
return
|
|
621
|
+
function checkApproval(_x15, _x16, _x17) {
|
|
622
|
+
return _checkApproval.apply(this, arguments);
|
|
616
623
|
}
|
|
617
|
-
return
|
|
624
|
+
return checkApproval;
|
|
618
625
|
}();
|
|
619
|
-
_proto.
|
|
620
|
-
var
|
|
626
|
+
_proto.checkStatus = /*#__PURE__*/function () {
|
|
627
|
+
var _checkStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(requestBody, options) {
|
|
621
628
|
var axiosResponse;
|
|
622
629
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
623
630
|
while (1) switch (_context10.prev = _context10.next) {
|
|
624
631
|
case 0:
|
|
625
632
|
_context10.next = 2;
|
|
626
|
-
return this.httpService.post("/tx/
|
|
633
|
+
return this.httpService.post("/tx/check-status?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
627
634
|
case 2:
|
|
628
635
|
axiosResponse = _context10.sent;
|
|
629
636
|
return _context10.abrupt("return", axiosResponse.data);
|
|
@@ -633,76 +640,98 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
633
640
|
}
|
|
634
641
|
}, _callee10, this);
|
|
635
642
|
}));
|
|
636
|
-
function
|
|
637
|
-
return
|
|
643
|
+
function checkStatus(_x18, _x19) {
|
|
644
|
+
return _checkStatus.apply(this, arguments);
|
|
638
645
|
}
|
|
639
|
-
return
|
|
646
|
+
return checkStatus;
|
|
640
647
|
}();
|
|
641
|
-
_proto.
|
|
642
|
-
var
|
|
648
|
+
_proto.createTransaction = /*#__PURE__*/function () {
|
|
649
|
+
var _createTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(requestBody, options) {
|
|
650
|
+
var axiosResponse;
|
|
643
651
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
644
652
|
while (1) switch (_context11.prev = _context11.next) {
|
|
645
653
|
case 0:
|
|
646
654
|
_context11.next = 2;
|
|
647
|
-
return this.httpService.post("/tx/
|
|
655
|
+
return this.httpService.post("/tx/create?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
648
656
|
case 2:
|
|
657
|
+
axiosResponse = _context11.sent;
|
|
658
|
+
return _context11.abrupt("return", axiosResponse.data);
|
|
659
|
+
case 4:
|
|
649
660
|
case "end":
|
|
650
661
|
return _context11.stop();
|
|
651
662
|
}
|
|
652
663
|
}, _callee11, this);
|
|
653
664
|
}));
|
|
654
|
-
function
|
|
665
|
+
function createTransaction(_x20, _x21) {
|
|
666
|
+
return _createTransaction.apply(this, arguments);
|
|
667
|
+
}
|
|
668
|
+
return createTransaction;
|
|
669
|
+
}();
|
|
670
|
+
_proto.reportFailure = /*#__PURE__*/function () {
|
|
671
|
+
var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(requestBody, options) {
|
|
672
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
673
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
674
|
+
case 0:
|
|
675
|
+
_context12.next = 2;
|
|
676
|
+
return this.httpService.post("/tx/report-tx?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
677
|
+
case 2:
|
|
678
|
+
case "end":
|
|
679
|
+
return _context12.stop();
|
|
680
|
+
}
|
|
681
|
+
}, _callee12, this);
|
|
682
|
+
}));
|
|
683
|
+
function reportFailure(_x22, _x23) {
|
|
655
684
|
return _reportFailure.apply(this, arguments);
|
|
656
685
|
}
|
|
657
686
|
return reportFailure;
|
|
658
687
|
}();
|
|
659
688
|
_proto.getWalletsDetails = /*#__PURE__*/function () {
|
|
660
|
-
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
689
|
+
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(walletAddresses, options) {
|
|
661
690
|
var walletAddressesQueryParams, i, walletAddress, axiosResponse;
|
|
662
|
-
return _regeneratorRuntime().wrap(function
|
|
663
|
-
while (1) switch (
|
|
691
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
692
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
664
693
|
case 0:
|
|
665
694
|
walletAddressesQueryParams = '';
|
|
666
695
|
for (i = 0; i < walletAddresses.length; i++) {
|
|
667
696
|
walletAddress = walletAddresses[i];
|
|
668
697
|
walletAddressesQueryParams += "&address=" + walletAddress.blockchain + "." + walletAddress.address;
|
|
669
698
|
}
|
|
670
|
-
|
|
699
|
+
_context13.next = 4;
|
|
671
700
|
return this.httpService.get("/wallets/details?apiKey=" + this.apiKey + walletAddressesQueryParams, _extends({}, options));
|
|
672
701
|
case 4:
|
|
673
|
-
axiosResponse =
|
|
674
|
-
return
|
|
702
|
+
axiosResponse = _context13.sent;
|
|
703
|
+
return _context13.abrupt("return", axiosResponse.data);
|
|
675
704
|
case 6:
|
|
676
705
|
case "end":
|
|
677
|
-
return
|
|
706
|
+
return _context13.stop();
|
|
678
707
|
}
|
|
679
|
-
},
|
|
708
|
+
}, _callee13, this);
|
|
680
709
|
}));
|
|
681
|
-
function getWalletsDetails(
|
|
710
|
+
function getWalletsDetails(_x24, _x25) {
|
|
682
711
|
return _getWalletsDetails.apply(this, arguments);
|
|
683
712
|
}
|
|
684
713
|
return getWalletsDetails;
|
|
685
714
|
}();
|
|
686
715
|
_proto.getTokenBalance = /*#__PURE__*/function () {
|
|
687
|
-
var _getTokenBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
716
|
+
var _getTokenBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(tokenBalanceRequest, options) {
|
|
688
717
|
var axiosResponse;
|
|
689
|
-
return _regeneratorRuntime().wrap(function
|
|
690
|
-
while (1) switch (
|
|
718
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
719
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
691
720
|
case 0:
|
|
692
|
-
|
|
721
|
+
_context14.next = 2;
|
|
693
722
|
return this.httpService.get("/wallets/token-balance?apiKey=" + this.apiKey, _extends({
|
|
694
723
|
params: tokenBalanceRequest
|
|
695
724
|
}, options));
|
|
696
725
|
case 2:
|
|
697
|
-
axiosResponse =
|
|
698
|
-
return
|
|
726
|
+
axiosResponse = _context14.sent;
|
|
727
|
+
return _context14.abrupt("return", axiosResponse.data);
|
|
699
728
|
case 4:
|
|
700
729
|
case "end":
|
|
701
|
-
return
|
|
730
|
+
return _context14.stop();
|
|
702
731
|
}
|
|
703
|
-
},
|
|
732
|
+
}, _callee14, this);
|
|
704
733
|
}));
|
|
705
|
-
function getTokenBalance(
|
|
734
|
+
function getTokenBalance(_x26, _x27) {
|
|
706
735
|
return _getTokenBalance.apply(this, arguments);
|
|
707
736
|
}
|
|
708
737
|
return getTokenBalance;
|
|
@@ -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 CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n HIGH_IMPACT_FOR_CREATE_TX = 'HIGH_IMPACT_FOR_CREATE_TX',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n TON = 'TON',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'USER_CANCELED_TX'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'TX_FAILED_IN_BLOCKCHAIN'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n | 'INSUFFICIENT_APPROVE'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'USER_CANCELED_TX',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'TX_FAILED_IN_BLOCKCHAIN',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n 'INSUFFICIENT_APPROVE',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} [step] - Step number in which failure happened\n * @property {string} [reason] - Reason or message for the error\n * @property {[key: string]: string} [data] - @deprecated A list of key-value for extra details\n * @property {wallet?: string, errorCode? string} [tags] - A list of key-value for pre-defined tags\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n tags?: { wallet?: string; errorCode?: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n * You could stop check approval if:\n * 1- approved successfully\n * => isApproved = true\n * 2- approval transaction failed\n * => isApproved = false && txStatus === 'failed'\n * 3- approval transaction succeeded but currentApprovedAmount is still less than requiredApprovedAmount\n * (e.g. user changed transaction data and enter another approve amount in MetaMask)\n * => isApproved = false && txStatus == 'success'\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n * @property {string | null} requiredApprovedAmount - required amount to be approved by user\n * @property {string | null} currentApprovedAmount - current approved amount by user\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n requiredApprovedAmount: string | null\n currentApprovedAmount: string | null\n}\n","import { TransactionType } from '../transactions.js'\nimport { BaseTransaction } from './base.js'\n\nexport enum TonChainID {\n MAINNET = '-239',\n TESTNET = '-3',\n}\n\n/**\n * @property {string} address - Receiver's address\n * @property {string} amount - Amount to send in nanoTon\n * @property {string} [stateInit] - Contract specific data to add to the transaction\n * @property {string} [payload] - Contract specific data to add to the transaction\n */\nexport interface TonMessage {\n address: string\n amount: string\n stateInit?: string\n payload?: string\n}\n\n/**\n * This type of transaction is used for all Ton transactions\n *\n * @property {TransactionType} type - This field equals to TON for all Ton transactions\n * @property {number} validUntil - Sending transaction deadline in unix epoch seconds\n * @property {TonChainID} [network] - The network (mainnet or testnet) where DApp intends to send the transaction. If not set, the transaction is sent to the network currently set in the wallet, but this is not safe and DApp should always strive to set the network. If the network parameter is set, but the wallet has a different network set, the wallet should show an alert and DO NOT ALLOW TO SEND this transaction\n * @property {string} [from] - The sender address in '<wc>:<hex>' format from which DApp intends to send the transaction. Current account.address by default\n * @property {TonMessage[]} messages - Messages to send: min is 1, max is 4\n */\nexport interface TonTransaction extends BaseTransaction {\n type: TransactionType.TON\n validUntil: number\n network?: TonChainID\n from?: string\n messages: TonMessage[]\n}\n\nexport const isTonTransaction = (transaction: {\n type: TransactionType\n}): transaction is TonTransaction => transaction.type === TransactionType.TON\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_callee$","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","sent","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_callee2$","_context2","_x3","getSwappers","_getSwappers","_callee3","_callee3$","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_callee4$","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_callee5$","_context5","post","headers","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_callee6$","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_callee7$","_context7","_x11","_x12","checkApproval","_checkApproval","_callee8","requestId","txId","_callee8$","_context8","_x13","_x14","_x15","checkStatus","_checkStatus","_callee9","_callee9$","_context9","_x16","_x17","createTransaction","_createTransaction","_callee10","_callee10$","_context10","_x18","_x19","reportFailure","_reportFailure","_callee11","_callee11$","_context11","_x20","_x21","getWalletsDetails","_getWalletsDetails","_callee12","walletAddresses","walletAddressesQueryParams","walletAddress","_callee12$","_context12","length","_x22","_x23","getTokenBalance","_getTokenBalance","_callee13","tokenBal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jG,MAAA,WAIZ5C,aAAa,CAAC2C,IAAI;UAAA;UAAA;YAAA,OAAAkG,UAAA,CAAAhG,IAAA;;SAAA6F,SAAA;KAC1B;IAAA,SAAAF,gBAAAM,IAAA,EAAAC,IAAA;MAAA,OAAAN,gBAAA,CAAAzF,KAAA,OAAAC,SAAA;;IAAA,OAAAuF,eAAA;;EAAA,OAAAtK,WAAA;AAAA;;mBCzM2B,2BAAA8K;;;qDAIUC;;;AAGtC;;;AAKF;;;yDAI0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzD1C;;;;AAIA,AAAA;gCAAY;;;;;;;ACJZ;;;AAGA,AAAA;;;;;;;;;AAUA,AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"rango-sdk.cjs.development.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts","../../../node_modules/rango-types/src/api/shared/txs/ton.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n // @deprecated use confirmRoute instead\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 public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n HIGH_IMPACT_FOR_CREATE_TX = 'HIGH_IMPACT_FOR_CREATE_TX',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n TON = 'TON',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'USER_CANCELED_TX'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'TX_FAILED_IN_BLOCKCHAIN'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n | 'INSUFFICIENT_APPROVE'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'USER_CANCELED_TX',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'TX_FAILED_IN_BLOCKCHAIN',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n 'INSUFFICIENT_APPROVE',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} [step] - Step number in which failure happened\n * @property {string} [reason] - Reason or message for the error\n * @property {[key: string]: string} [data] - @deprecated A list of key-value for extra details\n * @property {wallet?: string, errorCode? string} [tags] - A list of key-value for pre-defined tags\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n tags?: { wallet?: string; errorCode?: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n * You could stop check approval if:\n * 1- approved successfully\n * => isApproved = true\n * 2- approval transaction failed\n * => isApproved = false && txStatus === 'failed'\n * 3- approval transaction succeeded but currentApprovedAmount is still less than requiredApprovedAmount\n * (e.g. user changed transaction data and enter another approve amount in MetaMask)\n * => isApproved = false && txStatus == 'success'\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n * @property {string | null} requiredApprovedAmount - required amount to be approved by user\n * @property {string | null} currentApprovedAmount - current approved amount by user\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n requiredApprovedAmount: string | null\n currentApprovedAmount: string | null\n}\n","import { TransactionType } from '../transactions.js'\nimport { BaseTransaction } from './base.js'\n\nexport enum TonChainID {\n MAINNET = '-239',\n TESTNET = '-3',\n}\n\n/**\n * @property {string} address - Receiver's address\n * @property {string} amount - Amount to send in nanoTon\n * @property {string} [stateInit] - Contract specific data to add to the transaction\n * @property {string} [payload] - Contract specific data to add to the transaction\n */\nexport interface TonMessage {\n address: string\n amount: string\n stateInit?: string\n payload?: string\n}\n\n/**\n * This type of transaction is used for all Ton transactions\n *\n * @property {TransactionType} type - This field equals to TON for all Ton transactions\n * @property {number} validUntil - Sending transaction deadline in unix epoch seconds\n * @property {TonChainID} [network] - The network (mainnet or testnet) where DApp intends to send the transaction. If not set, the transaction is sent to the network currently set in the wallet, but this is not safe and DApp should always strive to set the network. If the network parameter is set, but the wallet has a different network set, the wallet should show an alert and DO NOT ALLOW TO SEND this transaction\n * @property {string} [from] - The sender address in '<wc>:<hex>' format from which DApp intends to send the transaction. Current account.address by default\n * @property {TonMessage[]} messages - Messages to send: min is 1, max is 4\n */\nexport interface TonTransaction extends BaseTransaction {\n type: TransactionType.TON\n validUntil: number\n network?: TonChainID\n from?: string\n messages: TonMessage[]\n}\n\nexport const isTonTransaction = (transaction: {\n type: TransactionType\n}): transaction is TonTransaction => transaction.type === TransactionType.TON\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_callee$","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","sent","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_callee2$","_context2","_x3","getSwappers","_getSwappers","_callee3","_callee3$","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_callee4$","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_callee5$","_context5","post","headers","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_callee6$","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_callee7$","_context7","_x11","_x12","confirmRouteRequest","_confirmRouteRequest","_callee8","_callee8$","_context8","_x13","_x14","checkApproval","_checkApproval","_callee9","requestId","txId","_callee9$","_context9","_x15","_x16","_x17","checkStatus","_checkStatus","_callee10","_callee10$","_context10","_x18","_x19","createTransaction","_createTransaction","_callee11","_callee11$","_context11","_x20","_x21","reportFailure","_reportFailure","_callee12","_callee12$","_context12","_x22","_x23","getWalletsDetails","_getWalletsDetails","_callee13","walletAddresses","walletAddressesQueryParams","walletAddress","_callee13$","_context13","length","_x24","_x25","getTokenBalance","_getTokenBalance","_callee14","tokenBalanceRequest","_callee14$","_context14","_x26","_x27","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCaA,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,I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C1CV,MAAM,EAAEmJ;eAAwBxJ,OAAO,CAAE,CAC5C;UAAA;YAHKM,aAAa,GAAAoJ,UAAA,CAAApI,IAAA;YAAA,OAAAoI,UAAA,CAAAxG,MAAA,WAIZ5C,aAAa,CAAC2C,IAAI;UAAA;UAAA;YAAA,OAAAyG,UAAA,CAAAvG,IAAA;;SAAAoG,SAAA;KAC1B;IAAA,SAAAF,gBAAAM,IAAA,EAAAC,IAAA;MAAA,OAAAN,gBAAA,CAAAhG,KAAA,OAAAC,SAAA;;IAAA,OAAA8F,eAAA;;EAAA,OAAA7K,WAAA;AAAA;;mBCtN2B,2BAAAqL;;;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(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,s,"next",t)}function s(t){n(a,o,i,c,s,"throw",t)}c(void 0)}))}}function i(){return(i=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(null,arguments)}function a(){a=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=Object.create((e&&e.prototype instanceof x?e:x).prototype),a=new R(n||[]);return o(i,"_invoke",{value:O(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var l="suspendedStart",y="executing",v="completed",d={};function x(){}function g(){}function T(){}var m={};p(m,c,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(A([])));S&&S!==r&&n.call(S,c)&&(m=S);var k=T.prototype=x.prototype=Object.create(m);function b(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,a,c){var s=f(t[o],t,i);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(p).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=l;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=N(c,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?v:"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function N(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,N(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function A(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=T,o(k,"constructor",{value:T,configurable:!0}),o(T,"constructor",{value:g,configurable:!0}),g.displayName=p(T,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,T):(t.__proto__=T,p(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},b(E.prototype),p(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new E(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(k),p(k,u,"Generator"),p(k,c,(function(){return this})),p(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}var c,s,u,p,h,f=function(){function t(t,n){this.apiUrl=n||"https://api.rango.exchange",this.apiKey=t;try{if("undefined"!=typeof window){var o=localStorage.getItem("deviceId");if(o)this.deviceId=o;else{var i=e();localStorage.setItem("deviceId",i),this.deviceId=i}}else this.deviceId=e()}catch(t){this.deviceId=e()}this.httpService=r.create({baseURL:this.apiUrl})}var n=t.prototype;return n.getAllMetadata=function(){var t=o(a().mark((function t(e,r){var n,o,c,s,u,p,h,f,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=i({},e,{blockchains:null==e||null==(n=e.blockchains)?void 0:n.join(),swappers:null==e||null==(o=e.swappers)?void 0:o.join(),swappersGroups:null==e||null==(c=e.swappersGroups)?void 0:c.join(),transactionTypes:null==e||null==(s=e.transactionTypes)?void 0:s.join()}),t.next=3,this.httpService.get("/meta/compact?apiKey="+this.apiKey,i({params:u},r));case 3:return h=function(t){return t.map((function(t){return{blockchain:t.b,symbol:t.s,image:t.i,address:t.a||null,usdPrice:t.p||null,isSecondaryCoin:t.is||!1,coinSource:t.c||null,coinSourceUrl:t.cu||null,name:t.n||null,decimals:t.d,isPopular:t.ip||!1,supportedSwappers:t.ss||[]}}))},f=h((p=t.sent).data.tokens),l=h(p.data.popularTokens),t.abrupt("return",i({},p.data,{tokens:f,popularTokens:l}));case 8:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getBlockchains=function(){var t=o(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/blockchains?apiKey="+this.apiKey,i({},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getSwappers=function(){var t=o(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/swappers?apiKey="+this.apiKey,i({},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getCustomToken=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/custom-token?apiKey="+this.apiKey,i({params:e},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getBestRoute=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/best?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getAllRoutes=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/bests?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.confirmRoute=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/confirm?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.checkApproval=function(){var t=o(a().mark((function t(e,r,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/tx/"+e+"/check-approval?apiKey="+this.apiKey,i({params:{txId:r}},n));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),n.checkStatus=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/check-status?apiKey="+this.apiKey,e,i({},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.createTransaction=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/create?apiKey="+this.apiKey,e,i({},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.reportFailure=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/report-tx?apiKey="+this.apiKey,e,i({},r));case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getWalletsDetails=function(){var t=o(a().mark((function t(e,r){var n,o,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n="",o=0;o<e.length;o++)n+="&address="+(c=e[o]).blockchain+"."+c.address;return t.next=4,this.httpService.get("/wallets/details?apiKey="+this.apiKey+n,i({},r));case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getTokenBalance=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/wallets/token-balance?apiKey="+this.apiKey,i({params:e},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}(),l=function(t){return"EVM"===t.type},y=function(t){return"COSMOS"===t.type},v=function(t){return"SOLANA"===t.type},d=function(t){return"TRON"===t.type},x=function(t){return"TRANSFER"===t.type},g=function(t){return"STARKNET"===t.type},T=function(t){return"TON"===t.type};(c=exports.RoutingResultType||(exports.RoutingResultType={})).OK="OK",c.HIGH_IMPACT="HIGH_IMPACT",c.NO_ROUTE="NO_ROUTE",c.INPUT_LIMIT_ISSUE="INPUT_LIMIT_ISSUE",c.HIGH_IMPACT_FOR_CREATE_TX="HIGH_IMPACT_FOR_CREATE_TX",(s=exports.TransactionType||(exports.TransactionType={})).EVM="EVM",s.TRANSFER="TRANSFER",s.COSMOS="COSMOS",s.SOLANA="SOLANA",s.TRON="TRON",s.STARKNET="STARKNET",s.TON="TON",(u=exports.GenericTransactionType||(exports.GenericTransactionType={})).EVM="EVM",u.TRANSFER="TRANSFER",u.COSMOS="COSMOS",u.SOLANA="SOLANA",(p=exports.TransactionStatus||(exports.TransactionStatus={})).FAILED="failed",p.RUNNING="running",p.SUCCESS="success",(h=exports.TonChainID||(exports.TonChainID={})).MAINNET="-239",h.TESTNET="-3",exports.RangoClient=f,exports.cosmosBlockchains=function(t){return t.filter(y)},exports.evmBlockchains=function(t){return t.filter(l)},exports.isCosmosBlockchain=y,exports.isCosmosTransaction=function(t){return t.type===exports.TransactionType.COSMOS},exports.isEvmBlockchain=l,exports.isEvmTransaction=function(t){return t.type===exports.TransactionType.EVM},exports.isSolanaBlockchain=v,exports.isSolanaTransaction=function(t){return t.type===exports.TransactionType.SOLANA},exports.isStarknetBlockchain=g,exports.isTonBlockchain=T,exports.isTonTransaction=function(t){return t.type===exports.TransactionType.TON},exports.isTransferBlockchain=x,exports.isTransferTransaction=function(t){return t.type===exports.TransactionType.TRANSFER},exports.isTronBlockchain=d,exports.isTronTransaction=function(t){return t.type===exports.TransactionType.TRON},exports.solanaBlockchain=function(t){return t.filter(v)},exports.starknetBlockchain=function(t){return t.filter(g)},exports.tonBlockchain=function(t){return t.filter(T)},exports.transferBlockchains=function(t){return t.filter(x)},exports.tronBlockchain=function(t){return t.filter(d)};
|
|
1
|
+
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("uuid-random")),r=t(require("axios"));function n(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function o(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function c(t){n(a,o,i,c,s,"next",t)}function s(t){n(a,o,i,c,s,"throw",t)}c(void 0)}))}}function i(){return(i=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t}).apply(null,arguments)}function a(){a=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(t){p=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var i=Object.create((e&&e.prototype instanceof x?e:x).prototype),a=new L(n||[]);return o(i,"_invoke",{value:O(t,r,a)}),i}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var l="suspendedStart",y="executing",v="completed",d={};function x(){}function g(){}function m(){}var T={};p(T,c,(function(){return this}));var w=Object.getPrototypeOf,S=w&&w(w(A([])));S&&S!==r&&n.call(S,c)&&(T=S);var k=m.prototype=x.prototype=Object.create(T);function b(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(o,i,a,c){var s=f(t[o],t,i);if("throw"!==s.type){var u=s.arg,p=u.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(p).then((function(t){u.value=t,a(u)}),(function(t){return r("throw",t,a,c)}))}c(s.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function O(e,r,n){var o=l;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var s=I(c,n);if(s){if(s===d)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var u=f(e,r,n);if("normal"===u.type){if(o=n.done?v:"suspendedYield",u.arg===d)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(o=v,n.method="throw",n.arg=u.arg)}}}function I(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,I(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=f(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,d;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,d):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,d)}function N(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 R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function A(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return g.prototype=m,o(k,"constructor",{value:m,configurable:!0}),o(m,"constructor",{value:g,configurable:!0}),g.displayName=p(m,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===g||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,p(t,u,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},b(E.prototype),p(E.prototype,s,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new E(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(k),p(k,u,"Generator"),p(k,c,(function(){return this})),p(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=A,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(R),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(s&&u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),d},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),R(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;R(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:A(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}var c,s,u,p,h,f=function(){function t(t,n){this.apiUrl=n||"https://api.rango.exchange",this.apiKey=t;try{if("undefined"!=typeof window){var o=localStorage.getItem("deviceId");if(o)this.deviceId=o;else{var i=e();localStorage.setItem("deviceId",i),this.deviceId=i}}else this.deviceId=e()}catch(t){this.deviceId=e()}this.httpService=r.create({baseURL:this.apiUrl})}var n=t.prototype;return n.getAllMetadata=function(){var t=o(a().mark((function t(e,r){var n,o,c,s,u,p,h,f,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=i({},e,{blockchains:null==e||null==(n=e.blockchains)?void 0:n.join(),swappers:null==e||null==(o=e.swappers)?void 0:o.join(),swappersGroups:null==e||null==(c=e.swappersGroups)?void 0:c.join(),transactionTypes:null==e||null==(s=e.transactionTypes)?void 0:s.join()}),t.next=3,this.httpService.get("/meta/compact?apiKey="+this.apiKey,i({params:u},r));case 3:return h=function(t){return t.map((function(t){return{blockchain:t.b,symbol:t.s,image:t.i,address:t.a||null,usdPrice:t.p||null,isSecondaryCoin:t.is||!1,coinSource:t.c||null,coinSourceUrl:t.cu||null,name:t.n||null,decimals:t.d,isPopular:t.ip||!1,supportedSwappers:t.ss||[]}}))},f=h((p=t.sent).data.tokens),l=h(p.data.popularTokens),t.abrupt("return",i({},p.data,{tokens:f,popularTokens:l}));case 8:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getBlockchains=function(){var t=o(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/blockchains?apiKey="+this.apiKey,i({},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getSwappers=function(){var t=o(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/swappers?apiKey="+this.apiKey,i({},e));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getCustomToken=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/meta/custom-token?apiKey="+this.apiKey,i({params:e},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getBestRoute=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/best?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getAllRoutes=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/bests?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.confirmRoute=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/confirm?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.confirmRouteRequest=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/routing/confirm?apiKey="+this.apiKey,e,i({headers:{"X-Rango-Id":this.deviceId}},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.checkApproval=function(){var t=o(a().mark((function t(e,r,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/tx/"+e+"/check-approval?apiKey="+this.apiKey,i({params:{txId:r}},n));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r,n){return t.apply(this,arguments)}}(),n.checkStatus=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/check-status?apiKey="+this.apiKey,e,i({},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.createTransaction=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/create?apiKey="+this.apiKey,e,i({},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.reportFailure=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.post("/tx/report-tx?apiKey="+this.apiKey,e,i({},r));case 2:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getWalletsDetails=function(){var t=o(a().mark((function t(e,r){var n,o,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n="",o=0;o<e.length;o++)n+="&address="+(c=e[o]).blockchain+"."+c.address;return t.next=4,this.httpService.get("/wallets/details?apiKey="+this.apiKey+n,i({},r));case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),n.getTokenBalance=function(){var t=o(a().mark((function t(e,r){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.httpService.get("/wallets/token-balance?apiKey="+this.apiKey,i({params:e},r));case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(e,r){return t.apply(this,arguments)}}(),t}(),l=function(t){return"EVM"===t.type},y=function(t){return"COSMOS"===t.type},v=function(t){return"SOLANA"===t.type},d=function(t){return"TRON"===t.type},x=function(t){return"TRANSFER"===t.type},g=function(t){return"STARKNET"===t.type},m=function(t){return"TON"===t.type};(c=exports.RoutingResultType||(exports.RoutingResultType={})).OK="OK",c.HIGH_IMPACT="HIGH_IMPACT",c.NO_ROUTE="NO_ROUTE",c.INPUT_LIMIT_ISSUE="INPUT_LIMIT_ISSUE",c.HIGH_IMPACT_FOR_CREATE_TX="HIGH_IMPACT_FOR_CREATE_TX",(s=exports.TransactionType||(exports.TransactionType={})).EVM="EVM",s.TRANSFER="TRANSFER",s.COSMOS="COSMOS",s.SOLANA="SOLANA",s.TRON="TRON",s.STARKNET="STARKNET",s.TON="TON",(u=exports.GenericTransactionType||(exports.GenericTransactionType={})).EVM="EVM",u.TRANSFER="TRANSFER",u.COSMOS="COSMOS",u.SOLANA="SOLANA",(p=exports.TransactionStatus||(exports.TransactionStatus={})).FAILED="failed",p.RUNNING="running",p.SUCCESS="success",(h=exports.TonChainID||(exports.TonChainID={})).MAINNET="-239",h.TESTNET="-3",exports.RangoClient=f,exports.cosmosBlockchains=function(t){return t.filter(y)},exports.evmBlockchains=function(t){return t.filter(l)},exports.isCosmosBlockchain=y,exports.isCosmosTransaction=function(t){return t.type===exports.TransactionType.COSMOS},exports.isEvmBlockchain=l,exports.isEvmTransaction=function(t){return t.type===exports.TransactionType.EVM},exports.isSolanaBlockchain=v,exports.isSolanaTransaction=function(t){return t.type===exports.TransactionType.SOLANA},exports.isStarknetBlockchain=g,exports.isTonBlockchain=m,exports.isTonTransaction=function(t){return t.type===exports.TransactionType.TON},exports.isTransferBlockchain=x,exports.isTransferTransaction=function(t){return t.type===exports.TransactionType.TRANSFER},exports.isTronBlockchain=d,exports.isTronTransaction=function(t){return t.type===exports.TransactionType.TRON},exports.solanaBlockchain=function(t){return t.filter(v)},exports.starknetBlockchain=function(t){return t.filter(g)},exports.tonBlockchain=function(t){return t.filter(m)},exports.transferBlockchains=function(t){return t.filter(x)},exports.tronBlockchain=function(t){return t.filter(d)};
|
|
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 CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n"],"names":["RangoClient","apiKey","apiUrl","this","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","sent","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_context2","_x3","getSwappers","_getSwappers","_callee3","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_context5","post","headers","X-Rango-Id","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_context7","_x11","_x12","checkApproval","_checkApproval","_callee8","requestId","txId","_context8","_x13","_x14","_x15","checkStatus","_checkStatus","_callee9","_context9","_x16","_x17","createTransaction","_createTransaction","_callee10","_context10","_x18","_x19","reportFailure","_reportFailure","_callee11","_context11","_x20","_x21","getWalletsDetails","_getWalletsDetails","_callee12","walletAddresses","walletAddressesQueryParams","walletAddress","_context12","length","_x22","_x23","getTokenBalance","_getTokenBalance","_callee13","tokenBalanceRequest","_context13","_x24","_x25","blockchainMeta"],"mappings":"ikOAgCaA,aAMX,SAAAA,EAAYC,EAAgBC,GAC1BC,KAAKD,OAASA,GAAU,6BACxBC,KAAKF,OAASA,EACd,IACE,GAAsB,oBAAXG,OAAwB,CACjC,IAAMC,EAAWC,aAAaC,QAAQ,YACtC,GA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AAAwI,EACLC,EACAtI,GAAwB,OAAAJ,IAAAc,eAAA6H,GAAA,cAAAA,EAAA3H,KAAA2H,EAAA1H,MAAA,OAAA,OAAA0H,EAAA1H,OAEInC,KAAKS,YAAYiC,qCACV1C,KAAKF,OAAMsC,GAC1CT,OAAQiI,GAAwBtI,IACnC,OAHkB,OAAAuI,EAAAtF,gBAAAsF,EAAAxF,KAIEC,MAAI,OAAA,UAAA,OAAAuF,EAAArF,UAAAmF,YAC1B,OAAA,SAAAG,EAAAC,GAAA,OAAAL,EAAA/E,WAAAC,eAAA/E,oDCrMqCmK,mHAYEA"}
|
|
1
|
+
{"version":3,"file":"rango-sdk.cjs.production.min.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n // @deprecated use confirmRoute instead\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 public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n"],"names":["RangoClient","apiKey","apiUrl","this","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","sent","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_context2","_x3","getSwappers","_getSwappers","_callee3","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_context5","post","headers","X-Rango-Id","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_context7","_x11","_x12","confirmRouteRequest","_confirmRouteRequest","_callee8","_context8","_x13","_x14","checkApproval","_checkApproval","_callee9","requestId","txId","_context9","_x15","_x16","_x17","checkStatus","_checkStatus","_callee10","_context10","_x18","_x19","createTransaction","_createTransaction","_callee11","_context11","_x20","_x21","reportFailure","_reportFailure","_callee12","_context12","_x22","_x23","getWalletsDetails","_getWalletsDetails","_callee13","walletAddresses","walletAddressesQueryParams","walletAddress","_context13","length","_x24","_x25","getTokenBalance","_getTokenBalance","_callee14","tokenBalanceRequest","_context14","_x26","_x27","blockchainMeta"],"mappings":"ikOAgCaA,aAMX,SAAAA,EAAYC,EAAgBC,GAC1BC,KAAKD,OAASA,GAAU,6BACxBC,KAAKF,OAASA,EACd,IACE,GAAsB,oBAAXG,OAAwB,CACjC,IAAMC,EAAWC,aAAaC,QAAQ,YACtC,GAAIF,EACFF,KAAKE,SAAWA,MACX,CACL,IAAMG,EAAcC,IACpBH,aAAaI,QAAQ,WAAYF,GACjCL,KAAKE,SAAWG,QAGlBL,KAAKE,SAAWI,IAElB,MAAOE,GACPR,KAAKE,SAAWI,IAElBN,KAAKS,YAAcC,EAAMC,OAAO,CAC9BC,QAASZ,KAAKD,SAEjB,IAAAc,EAAAhB,EAAAiB,UAmMA,OAnMAD,EAEYE,0BAAc,IAAAC,EAAAC,EAAAC,IAAAC,MAApB,SAAAC,EACLC,EACAC,GAAwB,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC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eAAA/D,EAEYkJ,2BAAe,IAAAC,EAAA/I,EAAAC,IAAAC,MAArB,SAAA8I,EACLC,EACA5I,GAAwB,OAAAJ,IAAAc,eAAAmI,GAAA,cAAAA,EAAAjI,KAAAiI,EAAAhI,MAAA,OAAA,OAAAgI,EAAAhI,OAEInC,KAAKS,YAAYiC,qCACV1C,KAAKF,OAAMsC,GAC1CT,OAAQuI,GAAwB5I,IACnC,OAHkB,OAAA6I,EAAA5F,gBAAA4F,EAAA9F,KAIEC,MAAI,OAAA,UAAA,OAAA6F,EAAA3F,UAAAyF,YAC1B,OAAA,SAAAG,EAAAC,GAAA,OAAAL,EAAArF,WAAAC,eAAA/E,oDClNqCyK,mHAYEA"}
|
package/lib/rango-sdk.esm.js
CHANGED
|
@@ -561,17 +561,20 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
561
561
|
return _confirmRoute.apply(this, arguments);
|
|
562
562
|
}
|
|
563
563
|
return confirmRoute;
|
|
564
|
-
}()
|
|
565
|
-
|
|
566
|
-
|
|
564
|
+
}() // @deprecated use confirmRoute instead
|
|
565
|
+
;
|
|
566
|
+
_proto.confirmRouteRequest =
|
|
567
|
+
/*#__PURE__*/
|
|
568
|
+
function () {
|
|
569
|
+
var _confirmRouteRequest = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(requestBody, options) {
|
|
567
570
|
var axiosResponse;
|
|
568
571
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
569
572
|
while (1) switch (_context8.prev = _context8.next) {
|
|
570
573
|
case 0:
|
|
571
574
|
_context8.next = 2;
|
|
572
|
-
return this.httpService.
|
|
573
|
-
|
|
574
|
-
|
|
575
|
+
return this.httpService.post("/routing/confirm?apiKey=" + this.apiKey, requestBody, _extends({
|
|
576
|
+
headers: {
|
|
577
|
+
'X-Rango-Id': this.deviceId
|
|
575
578
|
}
|
|
576
579
|
}, options));
|
|
577
580
|
case 2:
|
|
@@ -583,19 +586,23 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
583
586
|
}
|
|
584
587
|
}, _callee8, this);
|
|
585
588
|
}));
|
|
586
|
-
function
|
|
587
|
-
return
|
|
589
|
+
function confirmRouteRequest(_x13, _x14) {
|
|
590
|
+
return _confirmRouteRequest.apply(this, arguments);
|
|
588
591
|
}
|
|
589
|
-
return
|
|
592
|
+
return confirmRouteRequest;
|
|
590
593
|
}();
|
|
591
|
-
_proto.
|
|
592
|
-
var
|
|
594
|
+
_proto.checkApproval = /*#__PURE__*/function () {
|
|
595
|
+
var _checkApproval = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(requestId, txId, options) {
|
|
593
596
|
var axiosResponse;
|
|
594
597
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
595
598
|
while (1) switch (_context9.prev = _context9.next) {
|
|
596
599
|
case 0:
|
|
597
600
|
_context9.next = 2;
|
|
598
|
-
return this.httpService.
|
|
601
|
+
return this.httpService.get("/tx/" + requestId + "/check-approval?apiKey=" + this.apiKey, _extends({
|
|
602
|
+
params: {
|
|
603
|
+
txId: txId
|
|
604
|
+
}
|
|
605
|
+
}, options));
|
|
599
606
|
case 2:
|
|
600
607
|
axiosResponse = _context9.sent;
|
|
601
608
|
return _context9.abrupt("return", axiosResponse.data);
|
|
@@ -605,19 +612,19 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
605
612
|
}
|
|
606
613
|
}, _callee9, this);
|
|
607
614
|
}));
|
|
608
|
-
function
|
|
609
|
-
return
|
|
615
|
+
function checkApproval(_x15, _x16, _x17) {
|
|
616
|
+
return _checkApproval.apply(this, arguments);
|
|
610
617
|
}
|
|
611
|
-
return
|
|
618
|
+
return checkApproval;
|
|
612
619
|
}();
|
|
613
|
-
_proto.
|
|
614
|
-
var
|
|
620
|
+
_proto.checkStatus = /*#__PURE__*/function () {
|
|
621
|
+
var _checkStatus = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(requestBody, options) {
|
|
615
622
|
var axiosResponse;
|
|
616
623
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
617
624
|
while (1) switch (_context10.prev = _context10.next) {
|
|
618
625
|
case 0:
|
|
619
626
|
_context10.next = 2;
|
|
620
|
-
return this.httpService.post("/tx/
|
|
627
|
+
return this.httpService.post("/tx/check-status?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
621
628
|
case 2:
|
|
622
629
|
axiosResponse = _context10.sent;
|
|
623
630
|
return _context10.abrupt("return", axiosResponse.data);
|
|
@@ -627,76 +634,98 @@ var RangoClient = /*#__PURE__*/function () {
|
|
|
627
634
|
}
|
|
628
635
|
}, _callee10, this);
|
|
629
636
|
}));
|
|
630
|
-
function
|
|
631
|
-
return
|
|
637
|
+
function checkStatus(_x18, _x19) {
|
|
638
|
+
return _checkStatus.apply(this, arguments);
|
|
632
639
|
}
|
|
633
|
-
return
|
|
640
|
+
return checkStatus;
|
|
634
641
|
}();
|
|
635
|
-
_proto.
|
|
636
|
-
var
|
|
642
|
+
_proto.createTransaction = /*#__PURE__*/function () {
|
|
643
|
+
var _createTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(requestBody, options) {
|
|
644
|
+
var axiosResponse;
|
|
637
645
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
638
646
|
while (1) switch (_context11.prev = _context11.next) {
|
|
639
647
|
case 0:
|
|
640
648
|
_context11.next = 2;
|
|
641
|
-
return this.httpService.post("/tx/
|
|
649
|
+
return this.httpService.post("/tx/create?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
642
650
|
case 2:
|
|
651
|
+
axiosResponse = _context11.sent;
|
|
652
|
+
return _context11.abrupt("return", axiosResponse.data);
|
|
653
|
+
case 4:
|
|
643
654
|
case "end":
|
|
644
655
|
return _context11.stop();
|
|
645
656
|
}
|
|
646
657
|
}, _callee11, this);
|
|
647
658
|
}));
|
|
648
|
-
function
|
|
659
|
+
function createTransaction(_x20, _x21) {
|
|
660
|
+
return _createTransaction.apply(this, arguments);
|
|
661
|
+
}
|
|
662
|
+
return createTransaction;
|
|
663
|
+
}();
|
|
664
|
+
_proto.reportFailure = /*#__PURE__*/function () {
|
|
665
|
+
var _reportFailure = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(requestBody, options) {
|
|
666
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
667
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
668
|
+
case 0:
|
|
669
|
+
_context12.next = 2;
|
|
670
|
+
return this.httpService.post("/tx/report-tx?apiKey=" + this.apiKey, requestBody, _extends({}, options));
|
|
671
|
+
case 2:
|
|
672
|
+
case "end":
|
|
673
|
+
return _context12.stop();
|
|
674
|
+
}
|
|
675
|
+
}, _callee12, this);
|
|
676
|
+
}));
|
|
677
|
+
function reportFailure(_x22, _x23) {
|
|
649
678
|
return _reportFailure.apply(this, arguments);
|
|
650
679
|
}
|
|
651
680
|
return reportFailure;
|
|
652
681
|
}();
|
|
653
682
|
_proto.getWalletsDetails = /*#__PURE__*/function () {
|
|
654
|
-
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
683
|
+
var _getWalletsDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(walletAddresses, options) {
|
|
655
684
|
var walletAddressesQueryParams, i, walletAddress, axiosResponse;
|
|
656
|
-
return _regeneratorRuntime().wrap(function
|
|
657
|
-
while (1) switch (
|
|
685
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
686
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
658
687
|
case 0:
|
|
659
688
|
walletAddressesQueryParams = '';
|
|
660
689
|
for (i = 0; i < walletAddresses.length; i++) {
|
|
661
690
|
walletAddress = walletAddresses[i];
|
|
662
691
|
walletAddressesQueryParams += "&address=" + walletAddress.blockchain + "." + walletAddress.address;
|
|
663
692
|
}
|
|
664
|
-
|
|
693
|
+
_context13.next = 4;
|
|
665
694
|
return this.httpService.get("/wallets/details?apiKey=" + this.apiKey + walletAddressesQueryParams, _extends({}, options));
|
|
666
695
|
case 4:
|
|
667
|
-
axiosResponse =
|
|
668
|
-
return
|
|
696
|
+
axiosResponse = _context13.sent;
|
|
697
|
+
return _context13.abrupt("return", axiosResponse.data);
|
|
669
698
|
case 6:
|
|
670
699
|
case "end":
|
|
671
|
-
return
|
|
700
|
+
return _context13.stop();
|
|
672
701
|
}
|
|
673
|
-
},
|
|
702
|
+
}, _callee13, this);
|
|
674
703
|
}));
|
|
675
|
-
function getWalletsDetails(
|
|
704
|
+
function getWalletsDetails(_x24, _x25) {
|
|
676
705
|
return _getWalletsDetails.apply(this, arguments);
|
|
677
706
|
}
|
|
678
707
|
return getWalletsDetails;
|
|
679
708
|
}();
|
|
680
709
|
_proto.getTokenBalance = /*#__PURE__*/function () {
|
|
681
|
-
var _getTokenBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
710
|
+
var _getTokenBalance = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(tokenBalanceRequest, options) {
|
|
682
711
|
var axiosResponse;
|
|
683
|
-
return _regeneratorRuntime().wrap(function
|
|
684
|
-
while (1) switch (
|
|
712
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
713
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
685
714
|
case 0:
|
|
686
|
-
|
|
715
|
+
_context14.next = 2;
|
|
687
716
|
return this.httpService.get("/wallets/token-balance?apiKey=" + this.apiKey, _extends({
|
|
688
717
|
params: tokenBalanceRequest
|
|
689
718
|
}, options));
|
|
690
719
|
case 2:
|
|
691
|
-
axiosResponse =
|
|
692
|
-
return
|
|
720
|
+
axiosResponse = _context14.sent;
|
|
721
|
+
return _context14.abrupt("return", axiosResponse.data);
|
|
693
722
|
case 4:
|
|
694
723
|
case "end":
|
|
695
|
-
return
|
|
724
|
+
return _context14.stop();
|
|
696
725
|
}
|
|
697
|
-
},
|
|
726
|
+
}, _callee14, this);
|
|
698
727
|
}));
|
|
699
|
-
function getTokenBalance(
|
|
728
|
+
function getTokenBalance(_x26, _x27) {
|
|
700
729
|
return _getTokenBalance.apply(this, arguments);
|
|
701
730
|
}
|
|
702
731
|
return getTokenBalance;
|
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 CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string,\n txId?: string,\n options?: RequestOptions\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await this.httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`,\n { params: { txId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest,\n options?: RequestOptions\n ): Promise<TransactionStatusResponse> {\n const axiosResponse =\n await this.httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest,\n options?: RequestOptions\n ): Promise<CreateTransactionResponse> {\n const axiosResponse =\n await this.httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.httpService.post(\n `/tx/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n ...options,\n }\n )\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses,\n options?: RequestOptions\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await this.httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n HIGH_IMPACT_FOR_CREATE_TX = 'HIGH_IMPACT_FOR_CREATE_TX',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n TON = 'TON',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'USER_CANCELED_TX'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'TX_FAILED_IN_BLOCKCHAIN'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n | 'INSUFFICIENT_APPROVE'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'USER_CANCELED_TX',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'TX_FAILED_IN_BLOCKCHAIN',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n 'INSUFFICIENT_APPROVE',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} [step] - Step number in which failure happened\n * @property {string} [reason] - Reason or message for the error\n * @property {[key: string]: string} [data] - @deprecated A list of key-value for extra details\n * @property {wallet?: string, errorCode? string} [tags] - A list of key-value for pre-defined tags\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n tags?: { wallet?: string; errorCode?: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n * You could stop check approval if:\n * 1- approved successfully\n * => isApproved = true\n * 2- approval transaction failed\n * => isApproved = false && txStatus === 'failed'\n * 3- approval transaction succeeded but currentApprovedAmount is still less than requiredApprovedAmount\n * (e.g. user changed transaction data and enter another approve amount in MetaMask)\n * => isApproved = false && txStatus == 'success'\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n * @property {string | null} requiredApprovedAmount - required amount to be approved by user\n * @property {string | null} currentApprovedAmount - current approved amount by user\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n requiredApprovedAmount: string | null\n currentApprovedAmount: string | null\n}\n","import { TransactionType } from '../transactions.js'\nimport { BaseTransaction } from './base.js'\n\nexport enum TonChainID {\n MAINNET = '-239',\n TESTNET = '-3',\n}\n\n/**\n * @property {string} address - Receiver's address\n * @property {string} amount - Amount to send in nanoTon\n * @property {string} [stateInit] - Contract specific data to add to the transaction\n * @property {string} [payload] - Contract specific data to add to the transaction\n */\nexport interface TonMessage {\n address: string\n amount: string\n stateInit?: string\n payload?: string\n}\n\n/**\n * This type of transaction is used for all Ton transactions\n *\n * @property {TransactionType} type - This field equals to TON for all Ton transactions\n * @property {number} validUntil - Sending transaction deadline in unix epoch seconds\n * @property {TonChainID} [network] - The network (mainnet or testnet) where DApp intends to send the transaction. If not set, the transaction is sent to the network currently set in the wallet, but this is not safe and DApp should always strive to set the network. If the network parameter is set, but the wallet has a different network set, the wallet should show an alert and DO NOT ALLOW TO SEND this transaction\n * @property {string} [from] - The sender address in '<wc>:<hex>' format from which DApp intends to send the transaction. Current account.address by default\n * @property {TonMessage[]} messages - Messages to send: min is 1, max is 4\n */\nexport interface TonTransaction extends BaseTransaction {\n type: TransactionType.TON\n validUntil: number\n network?: TonChainID\n from?: string\n messages: TonMessage[]\n}\n\nexport const isTonTransaction = (transaction: {\n type: TransactionType\n}): transaction is TonTransaction => transaction.type === TransactionType.TON\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_callee$","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","sent","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_callee2$","_context2","_x3","getSwappers","_getSwappers","_callee3","_callee3$","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_callee4$","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_callee5$","_context5","post","headers","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_callee6$","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_callee7$","_context7","_x11","_x12","checkApproval","_checkApproval","_callee8","requestId","txId","_callee8$","_context8","_x13","_x14","_x15","checkStatus","_checkStatus","_callee9","_callee9$","_context9","_x16","_x17","createTransaction","_createTransaction","_callee10","_callee10$","_context10","_x18","_x19","reportFailure","_reportFailure","_callee11","_callee11$","_context11","_x20","_x21","getWalletsDetails","_getWalletsDetails","_callee12","walletAddresses","walletAddressesQueryParams","walletAddress","_callee12$","_context12","length","_x22","_x23","getTokenBalance","_getTokenBalance","_callee13","tokenBalanceRequest","_callee13$","_context13","_x24","_x25","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCaA,WAAW;EAMtB,SAAAA,YAAYC,MAAc,EAAEC,MAAe;IACzC,IAAI,CAACA,MAAM,GAAGA,MAAM,IAAI,4BAA4B;IACpD,IAAI,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,GAAGA,QAAQ;SACzB,MAAM;UACL,IAAMG,WAAW,GAAGC,IAAI,EAAE;UAC1BH,YAAY,CAACI,OAAO,CAAC,UAAU,EAAEF,WAAW,CAAC;UAC7C,IAAI,CAACH,QAAQ,GAAGG,WAAW;;OAE9B,MAAM;QACL,IAAI,CAACH,QAAQ,GAAGI,IAAI,EAAE;;KAEzB,CAAC,OAAOE,CAAC,EAAE;MACV,IAAI,CAACN,QAAQ,GAAGI,IAAI,EAAE;;IAExB,IAAI,CAACG,WAAW,GAAGC,KAAK,CAACC,MA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AAwBjJ,OAAO,CAAE,CAC5C;UAAA;YAHKM,aAAa,GAAA6I,UAAA,CAAA7H,IAAA;YAAA,OAAA6H,UAAA,CAAAjG,MAAA,WAIZ5C,aAAa,CAAC2C,IAAI;UAAA;UAAA;YAAA,OAAAkG,UAAA,CAAAhG,IAAA;;SAAA6F,SAAA;KAC1B;IAAA,SAAAF,gBAAAM,IAAA,EAAAC,IAAA;MAAA,OAAAN,gBAAA,CAAAzF,KAAA,OAAAC,SAAA;;IAAA,OAAAuF,eAAA;;EAAA,OAAAtK,WAAA;AAAA;;mBCzM2B,2BAAA8K;;;qDAIUC;;;AAGtC;;;AAKF;;;yDAI0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzD1C;;;;AAIA;AAAA;gCAAY;;;;;;;ACJZ;;;AAGA;AAAA;;;;;;;;;AAUA;;;;AAIA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"rango-sdk.esm.js","sources":["../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts","../../../node_modules/rango-types/src/api/shared/txs/ton.ts"],"sourcesContent":["import uuid from 'uuid-random'\nimport {\n MetaRequest,\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n RequestOptions,\n BlockchainMeta,\n CompactMetaResponse,\n CompactToken,\n Token,\n MultiRouteRequest,\n MultiRouteResponse,\n ConfirmRouteResponse,\n ConfirmRouteRequest,\n CustomTokenRequest,\n CustomTokenResponse,\n TokenBalanceResponse,\n TokenBalanceRequest,\n SwapperMetaExtended,\n} from '../types'\nimport axios, { AxiosInstance } from 'axios'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n private readonly apiKey: string\n private readonly apiUrl: string\n private readonly httpService: AxiosInstance\n\n constructor(apiKey: string, apiUrl?: string) {\n this.apiUrl = apiUrl || 'https://api.rango.exchange'\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = uuid()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = uuid()\n }\n } catch (e) {\n this.deviceId = uuid()\n }\n this.httpService = axios.create({\n baseURL: this.apiUrl,\n })\n }\n\n public async getAllMetadata(\n metaRequest?: MetaRequest,\n options?: RequestOptions\n ): Promise<MetaResponse> {\n const params = {\n ...metaRequest,\n blockchains: metaRequest?.blockchains?.join(),\n swappers: metaRequest?.swappers?.join(),\n swappersGroups: metaRequest?.swappersGroups?.join(),\n transactionTypes: metaRequest?.transactionTypes?.join(),\n }\n const axiosResponse = await this.httpService.get<CompactMetaResponse>(\n `/meta/compact?apiKey=${this.apiKey}`,\n {\n params,\n ...options,\n }\n )\n const reformatTokens = (tokens: CompactToken[]): Token[] =>\n tokens.map((tm) => ({\n blockchain: tm.b,\n symbol: tm.s,\n image: tm.i,\n address: tm.a || null,\n usdPrice: tm.p || null,\n isSecondaryCoin: tm.is || false,\n coinSource: tm.c || null,\n coinSourceUrl: tm.cu || null,\n name: tm.n || null,\n decimals: tm.d,\n isPopular: tm.ip || false,\n supportedSwappers: tm.ss || [],\n }))\n\n const tokens = reformatTokens(axiosResponse.data.tokens)\n const popularTokens = reformatTokens(axiosResponse.data.popularTokens)\n return { ...axiosResponse.data, tokens, popularTokens }\n }\n\n public async getBlockchains(\n options?: RequestOptions\n ): Promise<BlockchainMeta[]> {\n const axiosResponse = await this.httpService.get<BlockchainMeta[]>(\n `/meta/blockchains?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getSwappers(options?: RequestOptions): Promise<SwapperMetaExtended[]> {\n const axiosResponse = await this.httpService.get<SwapperMetaExtended[]>(\n `/meta/swappers?apiKey=${this.apiKey}`,\n { ...options }\n )\n return axiosResponse.data\n }\n\n public async getCustomToken(\n customTokenRequest?: CustomTokenRequest,\n options?: RequestOptions\n ): Promise<CustomTokenResponse> {\n const axiosResponse = await this.httpService.get<CustomTokenResponse>(\n `/meta/custom-token?apiKey=${this.apiKey}`,\n { params: customTokenRequest, ...options }\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest,\n options?: RequestOptions\n ): Promise<BestRouteResponse> {\n const axiosResponse = await this.httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async getAllRoutes(\n requestBody: MultiRouteRequest,\n options?: RequestOptions\n ): Promise<MultiRouteResponse> {\n const axiosResponse = await this.httpService.post<MultiRouteResponse>(\n `/routing/bests?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n public async confirmRoute(\n requestBody: ConfirmRouteRequest,\n options?: RequestOptions\n ): Promise<ConfirmRouteResponse> {\n const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(\n `/routing/confirm?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId }, ...options }\n )\n return axiosResponse.data\n }\n\n // @deprecated use confirmRoute instead\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 public async getTokenBalance(\n tokenBalanceRequest: TokenBalanceRequest,\n options?: RequestOptions\n ): Promise<TokenBalanceResponse> {\n const axiosResponse = await this.httpService.get<TokenBalanceResponse>(\n `/wallets/token-balance?apiKey=${this.apiKey}`,\n { params: tokenBalanceRequest, ...options }\n )\n return axiosResponse.data\n }\n}\n","import {\n BlockchainMeta,\n CosmosBlockchainMeta,\n EvmBlockchainMeta,\n SolanaBlockchainMeta,\n StarkNetBlockchainMeta,\n TonBlockchainMeta,\n TransferBlockchainMeta,\n TronBlockchainMeta,\n} from './meta.js'\n\nexport const isEvmBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is EvmBlockchainMeta => blockchainMeta.type === 'EVM'\n\nexport const isCosmosBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is CosmosBlockchainMeta => blockchainMeta.type === 'COSMOS'\n\nexport const isSolanaBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is SolanaBlockchainMeta => blockchainMeta.type === 'SOLANA'\n\nexport const isTronBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TronBlockchainMeta => blockchainMeta.type === 'TRON'\n\nexport const isTransferBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TransferBlockchainMeta =>\n blockchainMeta.type === 'TRANSFER'\n\nexport const isStarknetBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is StarkNetBlockchainMeta =>\n blockchainMeta.type === 'STARKNET'\n\nexport const isTonBlockchain = (\n blockchainMeta: BlockchainMeta\n): blockchainMeta is TonBlockchainMeta => blockchainMeta.type === 'TON'\n\nexport const evmBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isEvmBlockchain)\n\nexport const solanaBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isSolanaBlockchain)\n\nexport const starknetBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isStarknetBlockchain)\n\nexport const tronBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTronBlockchain)\n\nexport const cosmosBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isCosmosBlockchain)\n\nexport const transferBlockchains = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTransferBlockchain)\n\nexport const tonBlockchain = (blockchains: BlockchainMeta[]) =>\n blockchains.filter(isTonBlockchain)\n","/**\n * Routing Result Type\n *\n */\nexport enum RoutingResultType {\n OK = 'OK',\n HIGH_IMPACT = 'HIGH_IMPACT',\n NO_ROUTE = 'NO_ROUTE',\n INPUT_LIMIT_ISSUE = 'INPUT_LIMIT_ISSUE',\n HIGH_IMPACT_FOR_CREATE_TX = 'HIGH_IMPACT_FOR_CREATE_TX',\n}\n","/**\n * The type of transaction\n */\nexport enum TransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n TRON = 'TRON',\n STARKNET = 'STARKNET',\n TON = 'TON',\n}\n\n/**\n * The type of transaction\n * @deprecated use TransactionType instead\n */\nexport enum GenericTransactionType {\n EVM = 'EVM',\n TRANSFER = 'TRANSFER',\n COSMOS = 'COSMOS',\n SOLANA = 'SOLANA',\n}\n\n/**\n * A transaction's url that can be displayed to advanced user to track the progress\n *\n * @property {string} url - Url of the transaction in blockchain explorer. example: https://etherscan.io/tx/0xa1a3...\n * @property {string | null} description - A custom display name to help user distinguish the transactions from each\n * other. Example: Inbound, Outbound, Bridge, or null\n *\n */\nexport type SwapExplorerUrl = {\n description: string | null\n url: string\n}\n\n/**\n * APIErrorCode\n *\n * Error code of a swap failure\n *\n */\nexport type APIErrorCode =\n | 'TX_FAIL'\n | 'TX_EXPIRED'\n | 'FETCH_TX_FAILED'\n | 'USER_REJECT'\n | 'USER_CANCEL'\n | 'USER_CANCELED_TX'\n | 'CALL_WALLET_FAILED'\n | 'SEND_TX_FAILED'\n | 'CALL_OR_SEND_FAILED'\n | 'TX_FAILED_IN_BLOCKCHAIN'\n | 'CLIENT_UNEXPECTED_BEHAVIOUR'\n | 'INSUFFICIENT_APPROVE'\n\n/**\n * The function checks if a given string value is a valid API error code.\n * @param {string} value - a string that represents a possible API error code.\n * @returns A boolean value is being returned, indicating whether the input `value` is of type\n * `APIErrorCode` or not.\n */\nexport function isAPIErrorCode(value: string): value is APIErrorCode {\n return [\n 'TX_FAIL',\n 'TX_EXPIRED',\n 'FETCH_TX_FAILED',\n 'USER_REJECT',\n 'USER_CANCEL',\n 'USER_CANCELED_TX',\n 'CALL_WALLET_FAILED',\n 'SEND_TX_FAILED',\n 'CALL_OR_SEND_FAILED',\n 'TX_FAILED_IN_BLOCKCHAIN',\n 'CLIENT_UNEXPECTED_BEHAVIOUR',\n 'INSUFFICIENT_APPROVE',\n ].includes(value)\n}\n\n/**\n * ReportTransactionRequest\n *\n * It should be used when an error happened in client and we want to inform server that transaction failed,\n * E.g. user rejected the transaction dialog or and an RPC error raised during signing tx by user.\n *\n * @property {string} requestId - The requestId from best route endpoint\n * @property {APIErrorCode} eventType - Type of the event that happened, example: USER_REJECT\n * @property {number} [step] - Step number in which failure happened\n * @property {string} [reason] - Reason or message for the error\n * @property {[key: string]: string} [data] - @deprecated A list of key-value for extra details\n * @property {wallet?: string, errorCode? string} [tags] - A list of key-value for pre-defined tags\n *\n */\nexport type ReportTransactionRequest = {\n requestId: string\n eventType: APIErrorCode\n step?: number\n reason?: string\n data?: { [key: string]: string }\n tags?: { wallet?: string; errorCode?: string }\n}\n\n/**\n * The status of transaction in tracking\n */\nexport enum TransactionStatus {\n FAILED = 'failed',\n RUNNING = 'running',\n SUCCESS = 'success',\n}\n\n/**\n * Response body of check-approval\n * You could stop check approval if:\n * 1- approved successfully\n * => isApproved = true\n * 2- approval transaction failed\n * => isApproved = false && txStatus === 'failed'\n * 3- approval transaction succeeded but currentApprovedAmount is still less than requiredApprovedAmount\n * (e.g. user changed transaction data and enter another approve amount in MetaMask)\n * => isApproved = false && txStatus == 'success'\n *\n * @property {boolean} isApproved - A flag which indicates that the approve tx is done or not\n * @property {TransactionStatus | null} txStatus - Status of approve transaction in blockchain,\n * if isArppoved is false and txStatus is failed, it seems that approve transaction failed in blockchain\n * @property {string | null} requiredApprovedAmount - required amount to be approved by user\n * @property {string | null} currentApprovedAmount - current approved amount by user\n *\n */\nexport type CheckApprovalResponse = {\n isApproved: boolean\n txStatus: TransactionStatus | null\n requiredApprovedAmount: string | null\n currentApprovedAmount: string | null\n}\n","import { TransactionType } from '../transactions.js'\nimport { BaseTransaction } from './base.js'\n\nexport enum TonChainID {\n MAINNET = '-239',\n TESTNET = '-3',\n}\n\n/**\n * @property {string} address - Receiver's address\n * @property {string} amount - Amount to send in nanoTon\n * @property {string} [stateInit] - Contract specific data to add to the transaction\n * @property {string} [payload] - Contract specific data to add to the transaction\n */\nexport interface TonMessage {\n address: string\n amount: string\n stateInit?: string\n payload?: string\n}\n\n/**\n * This type of transaction is used for all Ton transactions\n *\n * @property {TransactionType} type - This field equals to TON for all Ton transactions\n * @property {number} validUntil - Sending transaction deadline in unix epoch seconds\n * @property {TonChainID} [network] - The network (mainnet or testnet) where DApp intends to send the transaction. If not set, the transaction is sent to the network currently set in the wallet, but this is not safe and DApp should always strive to set the network. If the network parameter is set, but the wallet has a different network set, the wallet should show an alert and DO NOT ALLOW TO SEND this transaction\n * @property {string} [from] - The sender address in '<wc>:<hex>' format from which DApp intends to send the transaction. Current account.address by default\n * @property {TonMessage[]} messages - Messages to send: min is 1, max is 4\n */\nexport interface TonTransaction extends BaseTransaction {\n type: TransactionType.TON\n validUntil: number\n network?: TonChainID\n from?: string\n messages: TonMessage[]\n}\n\nexport const isTonTransaction = (transaction: {\n type: TransactionType\n}): transaction is TonTransaction => transaction.type === TransactionType.TON\n"],"names":["RangoClient","apiKey","apiUrl","window","deviceId","localStorage","getItem","generatedId","uuid","setItem","e","httpService","axios","create","baseURL","_proto","prototype","getAllMetadata","_getAllMetadata","_asyncToGenerator","_regeneratorRuntime","mark","_callee","metaRequest","options","_metaRequest$blockcha","_metaRequest$swappers","_metaRequest$swappers2","_metaRequest$transact","params","axiosResponse","reformatTokens","tokens","popularTokens","wrap","_callee$","_context","prev","next","_extends","blockchains","join","swappers","swappersGroups","transactionTypes","get","sent","map","tm","blockchain","b","symbol","s","image","i","address","a","usdPrice","p","isSecondaryCoin","is","coinSource","c","coinSourceUrl","cu","name","n","decimals","d","isPopular","ip","supportedSwappers","ss","data","abrupt","stop","_x","_x2","apply","arguments","getBlockchains","_getBlockchains","_callee2","_callee2$","_context2","_x3","getSwappers","_getSwappers","_callee3","_callee3$","_context3","_x4","getCustomToken","_getCustomToken","_callee4","customTokenRequest","_callee4$","_context4","_x5","_x6","getBestRoute","_getBestRoute","_callee5","requestBody","_callee5$","_context5","post","headers","_x7","_x8","getAllRoutes","_getAllRoutes","_callee6","_callee6$","_context6","_x9","_x10","confirmRoute","_confirmRoute","_callee7","_callee7$","_context7","_x11","_x12","confirmRouteRequest","_confirmRouteRequest","_callee8","_callee8$","_context8","_x13","_x14","checkApproval","_checkApproval","_callee9","requestId","txId","_callee9$","_context9","_x15","_x16","_x17","checkStatus","_checkStatus","_callee10","_callee10$","_context10","_x18","_x19","createTransaction","_createTransaction","_callee11","_callee11$","_context11","_x20","_x21","reportFailure","_reportFailure","_callee12","_callee12$","_context12","_x22","_x23","getWalletsDetails","_getWalletsDetails","_callee13","walletAddresses","walletAddressesQueryParams","walletAddress","_callee13$","_context13","length","_x24","_x25","getTokenBalance","_getTokenBalance","_callee14","tokenBalanceRequest","_callee14$","_context14","_x26","_x27","isEvmBlockchain","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgCaA,WAAW;EAMtB,SAAAA,YAAYC,MAAc,EAAEC,MAAe;IACzC,IAAI,CAACA,MAAM,GAAGA,MAAM,IAAI,4BAA4B;IACpD,IAAI,CAAC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OAEI,IAAI,CAAC3B,WAAW,CAACkC,GAAG,oCACb,IAAI,CAAC5C,MAAM,EAAAsC,QAAA;cAC1CV,MAAM,EAAEmJ;eAAwBxJ,OAAO,CAAE,CAC5C;UAAA;YAHKM,aAAa,GAAAoJ,UAAA,CAAApI,IAAA;YAAA,OAAAoI,UAAA,CAAAxG,MAAA,WAIZ5C,aAAa,CAAC2C,IAAI;UAAA;UAAA;YAAA,OAAAyG,UAAA,CAAAvG,IAAA;;SAAAoG,SAAA;KAC1B;IAAA,SAAAF,gBAAAM,IAAA,EAAAC,IAAA;MAAA,OAAAN,gBAAA,CAAAhG,KAAA,OAAAC,SAAA;;IAAA,OAAA8F,eAAA;;EAAA,OAAA7K,WAAA;AAAA;;mBCtN2B,2BAAAqL;;;qDAIUC;;;AAGtC;;;AAKF;;;yDAI0CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACzD1C;;;;AAIA;AAAA;gCAAY;;;;;;;ACJZ;;;AAGA;AAAA;;;;;;;;;AAUA;;;;AAIA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACqBA;;;;;;;;;;;"}
|
package/lib/services/client.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare class RangoClient {
|
|
|
16
16
|
getBestRoute(requestBody: BestRouteRequest, options?: RequestOptions): Promise<BestRouteResponse>;
|
|
17
17
|
getAllRoutes(requestBody: MultiRouteRequest, options?: RequestOptions): Promise<MultiRouteResponse>;
|
|
18
18
|
confirmRoute(requestBody: ConfirmRouteRequest, options?: RequestOptions): Promise<ConfirmRouteResponse>;
|
|
19
|
+
confirmRouteRequest(requestBody: ConfirmRouteRequest, options?: RequestOptions): Promise<ConfirmRouteResponse>;
|
|
19
20
|
checkApproval(requestId: string, txId?: string, options?: RequestOptions): Promise<CheckApprovalResponse>;
|
|
20
21
|
checkStatus(requestBody: CheckTxStatusRequest, options?: RequestOptions): Promise<TransactionStatusResponse>;
|
|
21
22
|
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,EAId,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,UAAU,CAAA;AAGjB,aAAK,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,CAAA;AAEhE,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAQ;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAe;gBAE/B,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAwB9B,cAAc,CACzB,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,YAAY,CAAC;IAoCX,cAAc,CACzB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,cAAc,EAAE,CAAC;IAQf,WAAW,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAQrE,cAAc,CACzB,kBAAkB,CAAC,EAAE,kBAAkB,EACvC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,mBAAmB,CAAC;IAQlB,YAAY,CACvB,WAAW,EAAE,gBAAgB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,iBAAiB,CAAC;IAShB,YAAY,CACvB,WAAW,EAAE,iBAAiB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,kBAAkB,CAAC;IASjB,YAAY,CACvB,WAAW,EAAE,mBAAmB,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;IASnB,aAAa,CACxB,SAAS,EAAE,MAAM,EACjB,IAAI,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;IAapB,eAAe,CAC1B,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;CAOjC"}
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/services/client.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,wBAAwB,EACxB,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,cAAc,EAId,iBAAiB,EACjB,kBAAkB,EAClB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AAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;IASnB,aAAa,CACxB,SAAS,EAAE,MAAM,EACjB,IAAI,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;IAapB,eAAe,CAC1B,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;CAOjC"}
|
package/package.json
CHANGED
package/src/services/client.ts
CHANGED
|
@@ -164,6 +164,19 @@ export class RangoClient {
|
|
|
164
164
|
return axiosResponse.data
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
+
// @deprecated use confirmRoute instead
|
|
168
|
+
public async confirmRouteRequest(
|
|
169
|
+
requestBody: ConfirmRouteRequest,
|
|
170
|
+
options?: RequestOptions
|
|
171
|
+
): Promise<ConfirmRouteResponse> {
|
|
172
|
+
const axiosResponse = await this.httpService.post<ConfirmRouteResponse>(
|
|
173
|
+
`/routing/confirm?apiKey=${this.apiKey}`,
|
|
174
|
+
requestBody,
|
|
175
|
+
{ headers: { 'X-Rango-Id': this.deviceId }, ...options }
|
|
176
|
+
)
|
|
177
|
+
return axiosResponse.data
|
|
178
|
+
}
|
|
179
|
+
|
|
167
180
|
public async checkApproval(
|
|
168
181
|
requestId: string,
|
|
169
182
|
txId?: string,
|