rango-sdk 0.1.0 → 0.1.2

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.
File without changes
@@ -1,18 +1,5 @@
1
1
  # Rango Exchange SDK
2
2
 
3
- ## Basic SDK (Single Step Tx)
4
-
5
- [![npm version](https://badge.fury.io/js/rango-sdk-basic.svg)](https://badge.fury.io/js/rango-sdk-basic)
6
- [![license](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://github.com/rango-exchange/rango-sdk/blob/master/LICENSE)
7
-
8
- ### Installation
9
-
10
- ```shell
11
- yarn add rango-sdk-basic
12
- # or
13
- npm install rango-sdk-basic --save
14
- ```
15
-
16
3
  ## Main SDK (Multi Step Tx)
17
4
 
18
5
  [![npm version](https://badge.fury.io/js/rango-sdk.svg)](https://badge.fury.io/js/rango-sdk)
@@ -31,4 +18,4 @@
31
18
  Please checkout the examples' folder for sample usage of the SDK. We will add more examples there soon.
32
19
 
33
20
  - [Documents](https://docs.rango.exchange/integration/overview)
34
- - [Examples](https://github.com/rango-exchange/rango-sdk/tree/master/examples/)
21
+ - [Examples](https://github.com/rango-exchange/rango-sdk/tree/master/examples/multi/)
@@ -585,11 +585,53 @@ var RangoClient = /*#__PURE__*/function () {
585
585
  return RangoClient;
586
586
  }();
587
587
 
588
- var MetaInfoType;
589
- (function (MetaInfoType) {
590
- MetaInfoType["CosmosMetaInfo"] = "CosmosMetaInfo";
591
- MetaInfoType["EvmMetaInfo"] = "EvmMetaInfo";
592
- })(MetaInfoType || (MetaInfoType = {}));
588
+ var isEvmBlockchain = function isEvmBlockchain(blockchainMeta) {
589
+ return blockchainMeta.type === 'EVM';
590
+ };
591
+ var isCosmosBlockchain = function isCosmosBlockchain(blockchainMeta) {
592
+ return blockchainMeta.type === 'COSMOS';
593
+ };
594
+ var isSolanaBlockchain = function isSolanaBlockchain(blockchainMeta) {
595
+ return blockchainMeta.type === 'SOLANA';
596
+ };
597
+ var isTronBlockchain = function isTronBlockchain(blockchainMeta) {
598
+ return blockchainMeta.type === 'TRON';
599
+ };
600
+ var isTransferBlockchain = function isTransferBlockchain(blockchainMeta) {
601
+ return blockchainMeta.type === 'TRANSFER';
602
+ };
603
+ var isStarknetBlockchain = function isStarknetBlockchain(blockchainMeta) {
604
+ return blockchainMeta.type === 'STARKNET';
605
+ };
606
+ var evmBlockchains = function evmBlockchains(blockchains) {
607
+ return blockchains.filter(isEvmBlockchain);
608
+ };
609
+ var solanaBlockchain = function solanaBlockchain(blockchains) {
610
+ return blockchains.filter(isSolanaBlockchain);
611
+ };
612
+ var starknetBlockchain = function starknetBlockchain(blockchains) {
613
+ return blockchains.filter(isStarknetBlockchain);
614
+ };
615
+ var tronBlockchain = function tronBlockchain(blockchains) {
616
+ return blockchains.filter(isTronBlockchain);
617
+ };
618
+ var cosmosBlockchains = function cosmosBlockchains(blockchains) {
619
+ return blockchains.filter(isCosmosBlockchain);
620
+ };
621
+ var transferBlockchains = function transferBlockchains(blockchains) {
622
+ return blockchains.filter(isTransferBlockchain);
623
+ };
624
+
625
+ /**
626
+ * Routing Result Type
627
+ *
628
+ */
629
+ (function (RoutingResultType) {
630
+ RoutingResultType["OK"] = "OK";
631
+ RoutingResultType["HIGH_IMPACT"] = "HIGH_IMPACT";
632
+ RoutingResultType["NO_ROUTE"] = "NO_ROUTE";
633
+ RoutingResultType["INPUT_LIMIT_ISSUE"] = "INPUT_LIMIT_ISSUE";
634
+ })(exports.RoutingResultType || (exports.RoutingResultType = {}));
593
635
 
594
636
  /**
595
637
  * The type of transaction
@@ -602,11 +644,29 @@ var MetaInfoType;
602
644
  TransactionType["TRON"] = "TRON";
603
645
  TransactionType["STARKNET"] = "STARKNET";
604
646
  })(exports.TransactionType || (exports.TransactionType = {}));
647
+ /**
648
+ * The type of transaction
649
+ * @deprecated use TransactionType instead
650
+ */
651
+ var GenericTransactionType = exports.TransactionType;
605
652
  (function (TransactionStatus) {
606
653
  TransactionStatus["FAILED"] = "failed";
607
654
  TransactionStatus["RUNNING"] = "running";
608
655
  TransactionStatus["SUCCESS"] = "success";
609
656
  })(exports.TransactionStatus || (exports.TransactionStatus = {}));
610
657
 
658
+ exports.GenericTransactionType = GenericTransactionType;
611
659
  exports.RangoClient = RangoClient;
660
+ exports.cosmosBlockchains = cosmosBlockchains;
661
+ exports.evmBlockchains = evmBlockchains;
662
+ exports.isCosmosBlockchain = isCosmosBlockchain;
663
+ exports.isEvmBlockchain = isEvmBlockchain;
664
+ exports.isSolanaBlockchain = isSolanaBlockchain;
665
+ exports.isStarknetBlockchain = isStarknetBlockchain;
666
+ exports.isTransferBlockchain = isTransferBlockchain;
667
+ exports.isTronBlockchain = isTronBlockchain;
668
+ exports.solanaBlockchain = solanaBlockchain;
669
+ exports.starknetBlockchain = starknetBlockchain;
670
+ exports.transferBlockchains = transferBlockchains;
671
+ exports.tronBlockchain = tronBlockchain;
612
672
  //# sourceMappingURL=rango-sdk.cjs.development.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rango-sdk.cjs.development.js","sources":["../../../node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../node_modules/uuid/dist/esm-browser/native.js","../../../node_modules/uuid/dist/esm-browser/v4.js","../src/services/httpService.ts","../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import axios from 'axios'\n\nexport const httpService = axios.create({\n baseURL: 'https://api.rango.exchange',\n})\n","import { v4 } from 'uuid'\n\nimport { httpService } from './httpService'\nimport {\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n} from '../types'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n\n private readonly apiKey: string\n\n constructor(apiKey: string) {\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = v4()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = v4()\n }\n } catch (e) {\n this.deviceId = v4()\n }\n }\n\n public async getAllMetadata(): Promise<MetaResponse> {\n const axiosResponse = await httpService.get<MetaResponse>(\n `/meta?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest\n ): Promise<BestRouteResponse> {\n const axiosResponse = await httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId } }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest\n ): Promise<TransactionStatusResponse> {\n const axiosResponse = await httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest\n ): Promise<CreateTransactionResponse> {\n const axiosResponse = await httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest\n ): Promise<void> {\n await httpService.post(`/tx/report-tx?apiKey=${this.apiKey}`, requestBody)\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`\n )\n return axiosResponse.data\n }\n}\n",null],"names":["getRandomValues","rnds8","Uint8Array","rng","crypto","bind","Error","byteToHex","i","push","toString","slice","unsafeStringify","arr","offset","toLowerCase","randomUUID","v4","options","buf","native","rnds","random","httpService","axios","create","baseURL","RangoClient","apiKey","window","deviceId","localStorage","getItem","generatedId","setItem","e","getAllMetadata","get","axiosResponse","data","getBestRoute","requestBody","post","headers","checkApproval","requestId","checkStatus","createTransaction","reportFailure","getWalletsDetails","walletAddresses","walletAddressesQueryParams","length","walletAddress","blockchain","address"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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UAAA;YAAA;YAAA,OAE/BlB,WAAW,CAACmB,IAAI,2BAAyB,IAAI,CAACd,MAAM,EAAIa,WAAW,CAAC;UAAA;UAAA;YAAA;;;KAC3E;IAAA;MAAA;;IAAA;;EAAA,OAEYQ,iBAAiB;IAAA,iGAAvB,kBACLC,eAAgC;MAAA;MAAA;QAAA;UAAA;YAE5BC,0BAA0B,GAAG,EAAE;YACnC,KAAS3C,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG0C,eAAe,CAACE,MAAM,EAAE5C,CAAC,EAAE,EAAE;cACzC6C,aAAa,GAAGH,eAAe,CAAC1C,CAAC,CAAC;cACxC2C,0BAA0B,kBAAgBE,aAAa,CAACC,UAAU,SAAID,aAAa,CAACE,OAAS;;YAC9F;YAAA,OAC2BhC,WAAW,CAACc,GAAG,8BACd,IAAI,CAACT,MAAM,GAAGuB,0BAA0B,CACpE;UAAA;YAFKb,aAAa;YAAA,kCAGZA,aAAa,CAACC,IAAI;UAAA;UAAA;YAAA;;;KAC1B;IAAA;MAAA;;IAAA;;EAAA;AAAA;;;;;;;;AC5GH;;;AAGA,AAAA;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"rango-sdk.cjs.development.js","sources":["../../../node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../node_modules/uuid/dist/esm-browser/native.js","../../../node_modules/uuid/dist/esm-browser/v4.js","../src/services/httpService.ts","../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import axios from 'axios'\n\nexport const httpService = axios.create({\n baseURL: 'https://api.rango.exchange',\n})\n","import { v4 } from 'uuid'\n\nimport { httpService } from './httpService'\nimport {\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n} from '../types'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n\n private readonly apiKey: string\n\n constructor(apiKey: string) {\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = v4()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = v4()\n }\n } catch (e) {\n this.deviceId = v4()\n }\n }\n\n public async getAllMetadata(): Promise<MetaResponse> {\n const axiosResponse = await httpService.get<MetaResponse>(\n `/meta?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest\n ): Promise<BestRouteResponse> {\n const axiosResponse = await httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId } }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest\n ): Promise<TransactionStatusResponse> {\n const axiosResponse = await httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest\n ): Promise<CreateTransactionResponse> {\n const axiosResponse = await httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest\n ): Promise<void> {\n await httpService.post(`/tx/report-tx?apiKey=${this.apiKey}`, requestBody)\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`\n )\n return axiosResponse.data\n }\n}\n",null,null,null],"names":["getRandomValues","rnds8","Uint8Array","rng","crypto","bind","Error","byteToHex","i","push","toString","slice","unsafeStringify","arr","offset","toLowerCase","randomUUID","v4","options","buf","native","rnds","random","httpService","axios","create","baseURL","RangoClient","apiKey","window","deviceId","localStorage","getItem","generatedId","setItem","e","getAllMetadata","get","axiosResponse","data","getBestRoute","requestBody","post","headers","checkApproval","requestId","checkStatus","createTransaction","reportFailure","getWalletsDetails","walletAddresses","walletAddressesQueryParams","length","walletAddress","blockchain","address","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAI,CAACd,MAAM,EAChCa,WAAW,CACZ;UAAA;YAHKH,aAAa;YAAA,kCAIZA,aAAa,CAACC,IAAI;UAAA;UAAA;YAAA;;;KAC1B;IAAA;MAAA;;IAAA;;EAAA,OAEYS,aAAa;IAAA,6FAAnB,kBACLP,WAAqC;MAAA;QAAA;UAAA;YAAA;YAAA,OAE/BlB,WAAW,CAACmB,IAAI,2BAAyB,IAAI,CAACd,MAAM,EAAIa,WAAW,CAAC;UAAA;UAAA;YAAA;;;KAC3E;IAAA;MAAA;;IAAA;;EAAA,OAEYQ,iBAAiB;IAAA,iGAAvB,kBACLC,eAAgC;MAAA;MAAA;QAAA;UAAA;YAE5BC,0BAA0B,GAAG,EAAE;YACnC,KAAS3C,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG0C,eAAe,CAACE,MAAM,EAAE5C,CAAC,EAAE,EAAE;cACzC6C,aAAa,GAAGH,eAAe,CAAC1C,CAAC,CAAC;cACxC2C,0BAA0B,kBAAgBE,aAAa,CAACC,UAAU,SAAID,aAAa,CAACE,OAAS;;YAC9F;YAAA,OAC2BhC,WAAW,CAACc,GAAG,8BACd,IAAI,CAACT,MAAM,GAAGuB,0BAA0B,CACpE;UAAA;YAFKb,aAAa;YAAA,kCAGZA,aAAa,CAACC,IAAI;UAAA;UAAA;YAAA;;;KAC1B;IAAA;MAAA;;IAAA;;EAAA;AAAA;;mBCxE2B,2BAAA;;;qDAIUiB;;;AAGtC;;;AAKF;;;yDAI0CA;;;;;;;;;;;;;;;;;;;;;;;;;ACpD1C;;;;AAIA,AAAA;gCAAY;;;;;;ACJZ;;;AAGA,AAAA;;;;;;;;AASA;;;;AAIA;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,e,r=(t=require("axios"))&&"object"==typeof t&&"default"in t?t.default:t;function n(){n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=Object.create((e&&e.prototype instanceof l?e:l).prototype),a=new O(n||[]);return o(i,"_invoke",{value:E(t,r,a)}),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var h={};function l(){}function d(){}function v(){}var y={};s(y,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(k([])));m&&m!==e&&r.call(m,a)&&(y=m);var w=v.prototype=l.prototype=Object.create(y);function x(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){var n;o(this,"_invoke",{value:function(o,i){function a(){return new e((function(n,a){!function n(o,i,a,c){var u=p(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=L(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=p(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function L(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var o=p(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,h;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function S(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 I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function k(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:T}}function T(){return{value:void 0,done:!0}}return d.prototype=v,o(w,"constructor",{value:v,configurable:!0}),o(v,"constructor",{value:d,configurable:!0}),d.displayName=s(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},x(b.prototype),s(b.prototype,c,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},x(w),s(w,u,"Generator"),s(w,a,(function(){return this})),s(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=k,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),I(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;I(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:k(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}var a=new Uint8Array(16);function c(){if(!e&&!(e="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return e(a)}for(var u=[],s=0;s<256;++s)u.push((s+256).toString(16).slice(1));var f={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function p(t,e,r){if(f.randomUUID&&!e&&!t)return f.randomUUID();var n=(t=t||{}).random||(t.rng||c)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,e){r=r||0;for(var o=0;o<16;++o)e[r+o]=n[o];return e}return function(t,e){return void 0===e&&(e=0),(u[t[e+0]]+u[t[e+1]]+u[t[e+2]]+u[t[e+3]]+"-"+u[t[e+4]]+u[t[e+5]]+"-"+u[t[e+6]]+u[t[e+7]]+"-"+u[t[e+8]]+u[t[e+9]]+"-"+u[t[e+10]]+u[t[e+11]]+u[t[e+12]]+u[t[e+13]]+u[t[e+14]]+u[t[e+15]]).toLowerCase()}(n)}var h,l,d,v=r.create({baseURL:"https://api.rango.exchange"}),y=function(){function t(t){this.apiKey=t;try{if("undefined"!=typeof window){var e=localStorage.getItem("deviceId");if(e)this.deviceId=e;else{var r=p();localStorage.setItem("deviceId",r),this.deviceId=r}}else this.deviceId=p()}catch(t){this.deviceId=p()}}var e=t.prototype;return e.getAllMetadata=function(){var t=i(n().mark((function t(){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v.get("/meta?apiKey="+this.apiKey);case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),e.getBestRoute=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v.post("/routing/best?apiKey="+this.apiKey,e,{headers:{"X-Rango-Id":this.deviceId}});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)}}(),e.checkApproval=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v.get("/tx/"+e+"/check-approval?apiKey="+this.apiKey);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)}}(),e.checkStatus=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v.post("/tx/check-status?apiKey="+this.apiKey,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)}}(),e.createTransaction=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v.post("/tx/create?apiKey="+this.apiKey,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)}}(),e.reportFailure=function(){var t=i(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,v.post("/tx/report-tx?apiKey="+this.apiKey,e);case 2:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),e.getWalletsDetails=function(){var t=i(n().mark((function t(e){var r,o,i;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(r="",o=0;o<e.length;o++)r+="&address="+(i=e[o]).blockchain+"."+i.address;return t.next=4,v.get("/wallets/details?apiKey="+this.apiKey+r);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),t}();!function(t){t.CosmosMetaInfo="CosmosMetaInfo",t.EvmMetaInfo="EvmMetaInfo"}(h||(h={})),(l=exports.TransactionType||(exports.TransactionType={})).EVM="EVM",l.TRANSFER="TRANSFER",l.COSMOS="COSMOS",l.SOLANA="SOLANA",l.TRON="TRON",l.STARKNET="STARKNET",(d=exports.TransactionStatus||(exports.TransactionStatus={})).FAILED="failed",d.RUNNING="running",d.SUCCESS="success",exports.RangoClient=y;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,r,e=(t=require("axios"))&&"object"==typeof t&&"default"in t?t.default:t;function n(){n=function(){return t};var t={},r=Object.prototype,e=r.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{s({},"")}catch(t){s=function(t,r,e){return t[r]=e}}function p(t,r,e,n){var i=Object.create((r&&r.prototype instanceof l?r:l).prototype),a=new k(n||[]);return o(i,"_invoke",{value:b(t,e,a)}),i}function f(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=p;var h={};function l(){}function d(){}function y(){}var v={};s(v,a,(function(){return this}));var g=Object.getPrototypeOf,m=g&&g(g(O([])));m&&m!==r&&e.call(m,a)&&(v=m);var x=y.prototype=l.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(r){s(t,r,(function(t){return this._invoke(r,t)}))}))}function T(t,r){var n;o(this,"_invoke",{value:function(o,i){function a(){return new r((function(n,a){!function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,p=s.value;return p&&"object"==typeof p&&e.call(p,"__await")?r.resolve(p.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):r.resolve(p).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}(o,i,n,a)}))}return n=n?n.then(a,a):a()}})}function b(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=E(a,e);if(c){if(c===h)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=f(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}function E(t,r){var e=r.method,n=t.iterator[e];if(void 0===n)return r.delegate=null,"throw"===e&&t.iterator.return&&(r.method="return",r.arg=void 0,E(t,r),"throw"===r.method)||"return"!==e&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+e+"' method")),h;var o=f(n,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function S(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function L(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(S,this),this.reset(!0)}function O(t){if(t){var r=t[a];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function r(){for(;++n<t.length;)if(e.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:I}}function I(){return{value:void 0,done:!0}}return d.prototype=y,o(x,"constructor",{value:y,configurable:!0}),o(y,"constructor",{value:d,configurable:!0}),d.displayName=s(y,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===d||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,s(t,u,"GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},w(T.prototype),s(T.prototype,c,(function(){return this})),t.AsyncIterator=T,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new T(p(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(x),s(x,u,"Generator"),s(x,a,(function(){return this})),s(x,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=O,k.prototype={constructor:k,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&e.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=e.call(i,"catchLoc"),u=e.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,r){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&e.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),h},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),L(e),h}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;L(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:O(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),h}},t}function o(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var r=this,e=arguments;return new Promise((function(n,i){var a=t.apply(r,e);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}var a=new Uint8Array(16);function c(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(a)}for(var u=[],s=0;s<256;++s)u.push((s+256).toString(16).slice(1));var p={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function f(t,r,e){if(p.randomUUID&&!r&&!t)return p.randomUUID();var n=(t=t||{}).random||(t.rng||c)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,r){e=e||0;for(var o=0;o<16;++o)r[e+o]=n[o];return r}return function(t,r){return void 0===r&&(r=0),(u[t[r+0]]+u[t[r+1]]+u[t[r+2]]+u[t[r+3]]+"-"+u[t[r+4]]+u[t[r+5]]+"-"+u[t[r+6]]+u[t[r+7]]+"-"+u[t[r+8]]+u[t[r+9]]+"-"+u[t[r+10]]+u[t[r+11]]+u[t[r+12]]+u[t[r+13]]+u[t[r+14]]+u[t[r+15]]).toLowerCase()}(n)}var h,l,d=e.create({baseURL:"https://api.rango.exchange"}),y=function(){function t(t){this.apiKey=t;try{if("undefined"!=typeof window){var r=localStorage.getItem("deviceId");if(r)this.deviceId=r;else{var e=f();localStorage.setItem("deviceId",e),this.deviceId=e}}else this.deviceId=f()}catch(t){this.deviceId=f()}}var r=t.prototype;return r.getAllMetadata=function(){var t=i(n().mark((function t(){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.get("/meta?apiKey="+this.apiKey);case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(){return t.apply(this,arguments)}}(),r.getBestRoute=function(){var t=i(n().mark((function t(r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.post("/routing/best?apiKey="+this.apiKey,r,{headers:{"X-Rango-Id":this.deviceId}});case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),r.checkApproval=function(){var t=i(n().mark((function t(r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.get("/tx/"+r+"/check-approval?apiKey="+this.apiKey);case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),r.checkStatus=function(){var t=i(n().mark((function t(r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.post("/tx/check-status?apiKey="+this.apiKey,r);case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),r.createTransaction=function(){var t=i(n().mark((function t(r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.post("/tx/create?apiKey="+this.apiKey,r);case 2:return t.abrupt("return",t.sent.data);case 4:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),r.reportFailure=function(){var t=i(n().mark((function t(r){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.post("/tx/report-tx?apiKey="+this.apiKey,r);case 2:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),r.getWalletsDetails=function(){var t=i(n().mark((function t(r){var e,o,i;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e="",o=0;o<r.length;o++)e+="&address="+(i=r[o]).blockchain+"."+i.address;return t.next=4,d.get("/wallets/details?apiKey="+this.apiKey+e);case 4:return t.abrupt("return",t.sent.data);case 6:case"end":return t.stop()}}),t,this)})));return function(r){return t.apply(this,arguments)}}(),t}(),v=function(t){return"EVM"===t.type},g=function(t){return"COSMOS"===t.type},m=function(t){return"SOLANA"===t.type},x=function(t){return"TRON"===t.type},w=function(t){return"TRANSFER"===t.type},T=function(t){return"STARKNET"===t.type};(h=exports.RoutingResultType||(exports.RoutingResultType={})).OK="OK",h.HIGH_IMPACT="HIGH_IMPACT",h.NO_ROUTE="NO_ROUTE",h.INPUT_LIMIT_ISSUE="INPUT_LIMIT_ISSUE",(l=exports.TransactionType||(exports.TransactionType={})).EVM="EVM",l.TRANSFER="TRANSFER",l.COSMOS="COSMOS",l.SOLANA="SOLANA",l.TRON="TRON",l.STARKNET="STARKNET";var b,E=exports.TransactionType;(b=exports.TransactionStatus||(exports.TransactionStatus={})).FAILED="failed",b.RUNNING="running",b.SUCCESS="success",exports.GenericTransactionType=E,exports.RangoClient=y,exports.cosmosBlockchains=function(t){return t.filter(g)},exports.evmBlockchains=function(t){return t.filter(v)},exports.isCosmosBlockchain=g,exports.isEvmBlockchain=v,exports.isSolanaBlockchain=m,exports.isStarknetBlockchain=T,exports.isTransferBlockchain=w,exports.isTronBlockchain=x,exports.solanaBlockchain=function(t){return t.filter(m)},exports.starknetBlockchain=function(t){return t.filter(T)},exports.transferBlockchains=function(t){return t.filter(w)},exports.tronBlockchain=function(t){return t.filter(x)};
2
2
  //# sourceMappingURL=rango-sdk.cjs.production.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rango-sdk.cjs.production.min.js","sources":["../../../node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../node_modules/uuid/dist/esm-browser/native.js","../../../node_modules/uuid/dist/esm-browser/v4.js","../src/services/httpService.ts","../src/services/client.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import axios from 'axios'\n\nexport const httpService = axios.create({\n baseURL: 'https://api.rango.exchange',\n})\n","import { v4 } from 'uuid'\n\nimport { httpService } from './httpService'\nimport {\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n} from '../types'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n\n private readonly apiKey: string\n\n constructor(apiKey: string) {\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = v4()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = v4()\n }\n } catch (e) {\n this.deviceId = v4()\n }\n }\n\n public async getAllMetadata(): Promise<MetaResponse> {\n const axiosResponse = await httpService.get<MetaResponse>(\n `/meta?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest\n ): Promise<BestRouteResponse> {\n const axiosResponse = await httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId } }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest\n ): Promise<TransactionStatusResponse> {\n const axiosResponse = await httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest\n ): Promise<CreateTransactionResponse> {\n const axiosResponse = await httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest\n ): Promise<void> {\n await httpService.post(`/tx/report-tx?apiKey=${this.apiKey}`, requestBody)\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`\n )\n return axiosResponse.data\n }\n}\n"],"names":["getRandomValues","rnds8","Uint8Array","rng","crypto","bind","Error","byteToHex","i","push","toString","slice","randomUUID","v4","options","buf","offset","native","rnds","random","arr","toLowerCase","unsafeStringify","httpService","axios","create","baseURL","RangoClient","apiKey","this","window","deviceId","localStorage","getItem","generatedId","setItem","e","_proto","getAllMetadata","_context","get","data","getBestRoute","requestBody","_context2","post","headers","X-Rango-Id","checkApproval","requestId","_context3","checkStatus","_context4","createTransaction","_context5","reportFailure","_context6","getWalletsDetails","walletAddresses","walletAddressesQueryParams","length","walletAddress","blockchain","address","_context7"],"mappings":"0EAGIA,20NACJ,IAAMC,EAAQ,IAAIC,WAAW,IACd,SAASC,IAEtB,IAAKH,KAEHA,EAAoC,oBAAXI,QAA0BA,OAAOJ,iBAAmBI,OAAOJ,gBAAgBK,KAAKD,SAGvG,MAAM,IAAIE,MAAM,4GAIpB,OAAON,EAAgBC,GCRz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B,KAAKD,OAAUe,GAAY,OAAA,UAAA,+BAC3E,OAAA,YAAA,mCAAAN,EAEYoB,6BAAiB,kBAAvB,WACLC,GAAgC,UAAA,6BAAA,6BAAA,OAGhC,IADIC,EAA6B,GACxBnD,EAAI,EAAGA,EAAIkD,EAAgBE,OAAQpD,IAE1CmD,gBADME,EAAgBH,EAAgBlD,IACkBsD,eAAcD,EAAcE,QACrF,OAAAC,SAC2BzC,EAAYiB,+BACXX,KAAKD,OAAS+B,GAC1C,OAFkB,gCAGElB,MAAI,OAAA,UAAA,+BAC1B,OAAA,YAAA"}
1
+ {"version":3,"file":"rango-sdk.cjs.production.min.js","sources":["../../../node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../node_modules/uuid/dist/esm-browser/native.js","../../../node_modules/uuid/dist/esm-browser/v4.js","../src/services/httpService.ts","../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import axios from 'axios'\n\nexport const httpService = axios.create({\n baseURL: 'https://api.rango.exchange',\n})\n","import { v4 } from 'uuid'\n\nimport { httpService } from './httpService'\nimport {\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n} from '../types'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n\n private readonly apiKey: string\n\n constructor(apiKey: string) {\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = v4()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = v4()\n }\n } catch (e) {\n this.deviceId = v4()\n }\n }\n\n public async getAllMetadata(): Promise<MetaResponse> {\n const axiosResponse = await httpService.get<MetaResponse>(\n `/meta?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest\n ): Promise<BestRouteResponse> {\n const axiosResponse = await httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId } }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest\n ): Promise<TransactionStatusResponse> {\n const axiosResponse = await httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest\n ): Promise<CreateTransactionResponse> {\n const axiosResponse = await httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest\n ): Promise<void> {\n await httpService.post(`/tx/report-tx?apiKey=${this.apiKey}`, requestBody)\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`\n )\n return axiosResponse.data\n }\n}\n",null,null],"names":["getRandomValues","rnds8","Uint8Array","rng","crypto","bind","Error","byteToHex","i","push","toString","slice","randomUUID","v4","options","buf","offset","native","rnds","random","arr","toLowerCase","unsafeStringify","httpService","axios","create","baseURL","RangoClient","apiKey","this","window","deviceId","localStorage","getItem","generatedId","setItem","e","_proto","getAllMetadata","_context","get","data","getBestRoute","requestBody","_context2","post","headers","X-Rango-Id","checkApproval","requestId","_context3","checkStatus","_context4","createTransaction","_context5","reportFailure","_context6","getWalletsDetails","walletAddresses","walletAddressesQueryParams","length","walletAddress","blockchain","address","_context7","blockchainMeta"],"mappings":"0EAGIA,20NACJ,IAAMC,EAAQ,IAAIC,WAAW,IACd,SAASC,IAEtB,IAAKH,KAEHA,EAAoC,oBAAXI,QAA0BA,OAAOJ,iBAAmBI,OAAOJ,gBAAgBK,KAAKD,SAGvG,MAAM,IAAIE,MAAM,4GAIpB,OAAON,EAAgBC,GCRzB,IAFA,IAAMM,EAAY,GAETC,EAAI,EAAGA,EAAI,MAAOA,EACzBD,EAAUE,MAAMD,EAAI,KAAOE,SAAS,IAAIC,MAAM,ICThD,MACe,CACbC,WAFmC,oBAAXR,QAA0BA,OAAOQ,YAAcR,OAAOQ,WAAWP,KAAKD,kBCIvFS,EAAGC,EAASC,EAAKC,GACxB,GAAIC,EAAOL,aAAeG,IAAQD,EAChC,OAAO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2BzC,EAAYiB,+BACXX,KAAKD,OAAS+B,GAC1C,OAFkB,gCAGElB,MAAI,OAAA,UAAA,+BAC1B,OAAA,YAAA,uFCpEqCwB,mHAYEA,yYCpC1C"}
@@ -579,11 +579,54 @@ var RangoClient = /*#__PURE__*/function () {
579
579
  return RangoClient;
580
580
  }();
581
581
 
582
- var MetaInfoType;
583
- (function (MetaInfoType) {
584
- MetaInfoType["CosmosMetaInfo"] = "CosmosMetaInfo";
585
- MetaInfoType["EvmMetaInfo"] = "EvmMetaInfo";
586
- })(MetaInfoType || (MetaInfoType = {}));
582
+ var isEvmBlockchain = function isEvmBlockchain(blockchainMeta) {
583
+ return blockchainMeta.type === 'EVM';
584
+ };
585
+ var isCosmosBlockchain = function isCosmosBlockchain(blockchainMeta) {
586
+ return blockchainMeta.type === 'COSMOS';
587
+ };
588
+ var isSolanaBlockchain = function isSolanaBlockchain(blockchainMeta) {
589
+ return blockchainMeta.type === 'SOLANA';
590
+ };
591
+ var isTronBlockchain = function isTronBlockchain(blockchainMeta) {
592
+ return blockchainMeta.type === 'TRON';
593
+ };
594
+ var isTransferBlockchain = function isTransferBlockchain(blockchainMeta) {
595
+ return blockchainMeta.type === 'TRANSFER';
596
+ };
597
+ var isStarknetBlockchain = function isStarknetBlockchain(blockchainMeta) {
598
+ return blockchainMeta.type === 'STARKNET';
599
+ };
600
+ var evmBlockchains = function evmBlockchains(blockchains) {
601
+ return blockchains.filter(isEvmBlockchain);
602
+ };
603
+ var solanaBlockchain = function solanaBlockchain(blockchains) {
604
+ return blockchains.filter(isSolanaBlockchain);
605
+ };
606
+ var starknetBlockchain = function starknetBlockchain(blockchains) {
607
+ return blockchains.filter(isStarknetBlockchain);
608
+ };
609
+ var tronBlockchain = function tronBlockchain(blockchains) {
610
+ return blockchains.filter(isTronBlockchain);
611
+ };
612
+ var cosmosBlockchains = function cosmosBlockchains(blockchains) {
613
+ return blockchains.filter(isCosmosBlockchain);
614
+ };
615
+ var transferBlockchains = function transferBlockchains(blockchains) {
616
+ return blockchains.filter(isTransferBlockchain);
617
+ };
618
+
619
+ /**
620
+ * Routing Result Type
621
+ *
622
+ */
623
+ var RoutingResultType;
624
+ (function (RoutingResultType) {
625
+ RoutingResultType["OK"] = "OK";
626
+ RoutingResultType["HIGH_IMPACT"] = "HIGH_IMPACT";
627
+ RoutingResultType["NO_ROUTE"] = "NO_ROUTE";
628
+ RoutingResultType["INPUT_LIMIT_ISSUE"] = "INPUT_LIMIT_ISSUE";
629
+ })(RoutingResultType || (RoutingResultType = {}));
587
630
 
588
631
  /**
589
632
  * The type of transaction
@@ -597,6 +640,11 @@ var TransactionType;
597
640
  TransactionType["TRON"] = "TRON";
598
641
  TransactionType["STARKNET"] = "STARKNET";
599
642
  })(TransactionType || (TransactionType = {}));
643
+ /**
644
+ * The type of transaction
645
+ * @deprecated use TransactionType instead
646
+ */
647
+ var GenericTransactionType = TransactionType;
600
648
  /**
601
649
  * The status of transaction in tracking
602
650
  */
@@ -607,5 +655,5 @@ var TransactionStatus;
607
655
  TransactionStatus["SUCCESS"] = "success";
608
656
  })(TransactionStatus || (TransactionStatus = {}));
609
657
 
610
- export { RangoClient, TransactionStatus, TransactionType };
658
+ export { GenericTransactionType, RangoClient, RoutingResultType, TransactionStatus, TransactionType, cosmosBlockchains, evmBlockchains, isCosmosBlockchain, isEvmBlockchain, isSolanaBlockchain, isStarknetBlockchain, isTransferBlockchain, isTronBlockchain, solanaBlockchain, starknetBlockchain, transferBlockchains, tronBlockchain };
611
659
  //# sourceMappingURL=rango-sdk.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rango-sdk.esm.js","sources":["../../../node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../node_modules/uuid/dist/esm-browser/native.js","../../../node_modules/uuid/dist/esm-browser/v4.js","../src/services/httpService.ts","../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import axios from 'axios'\n\nexport const httpService = axios.create({\n baseURL: 'https://api.rango.exchange',\n})\n","import { v4 } from 'uuid'\n\nimport { httpService } from './httpService'\nimport {\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n} from '../types'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n\n private readonly apiKey: string\n\n constructor(apiKey: string) {\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = v4()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = v4()\n }\n } catch (e) {\n this.deviceId = v4()\n }\n }\n\n public async getAllMetadata(): Promise<MetaResponse> {\n const axiosResponse = await httpService.get<MetaResponse>(\n `/meta?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest\n ): Promise<BestRouteResponse> {\n const axiosResponse = await httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId } }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest\n ): Promise<TransactionStatusResponse> {\n const axiosResponse = await httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest\n ): Promise<CreateTransactionResponse> {\n const axiosResponse = await httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest\n ): Promise<void> {\n await httpService.post(`/tx/report-tx?apiKey=${this.apiKey}`, requestBody)\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`\n )\n return axiosResponse.data\n }\n}\n",null],"names":["getRandomValues","rnds8","Uint8Array","rng","crypto","bind","Error","byteToHex","i","push","toString","slice","unsafeStringify","arr","offset","toLowerCase","randomUUID","v4","options","buf","native","rnds","random","httpService","axios","create","baseURL","RangoClient","apiKey","window","deviceId","localStorage","getItem","generatedId","setItem","e","getAllMetadata","get","axiosResponse","data","getBestRoute","requestBody","post","headers","checkApproval","requestId","checkStatus","createTransaction","reportFailure","getWalletsDetails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;UAAA;YAAA;;;KAC1B;IAAA;MAAA;;IAAA;;EAAA,OAEYQ,iBAAiB;IAAA,iGAAvB,kBACLN,WAAqC;MAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OAETlB,WAAW,CAACmB,IAAI,wBACrB,IAAI,CAACd,MAAM,EAChCa,WAAW,CACZ;UAAA;YAHKH,aAAa;YAAA,kCAIZA,aAAa,CAACC,IAAI;UAAA;UAAA;YAAA;;;KAC1B;IAAA;MAAA;;IAAA;;EAAA,OAEYS,aAAa;IAAA,6FAAnB,kBACLP,WAAqC;MAAA;QAAA;UAAA;YAAA;YAAA,OAE/BlB,WAAW,CAACmB,IAAI,2BAAyB,IAAI,CAACd,MAAM,EAAIa,WAAW,CAAC;UAAA;UAAA;YAAA;;;KAC3E;IAAA;MAAA;;IAAA;;EAAA,OAEYQ,iBAAiB;IAAA,iGAAvB,kBACLC,eAAgC;MAAA;MAAA;QAAA;UAAA;YAE5BC,0BAA0B,GAAG,EAAE;YACnC,KAAS3C,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG0C,eAAe,CAACE,MAAM,EAAE5C,CAAC,EAAE,EAAE;cACzC6C,aAAa,GAAGH,eAAe,CAAC1C,CAAC,CAAC;cACxC2C,0BAA0B,kBAAgBE,aAAa,CAACC,UAAU,SAAID,aAAa,CAACE,OAAS;;YAC9F;YAAA,OAC2BhC,WAAW,CAACc,GAAG,8BACd,IAAI,CAACT,MAAM,GAAGuB,0BAA0B,CACpE;UAAA;YAFKb,aAAa;YAAA,kCAGZA,aAAa,CAACC,IAAI;UAAA;UAAA;YAAA;;;KAC1B;IAAA;MAAA;;IAAA;;EAAA;AAAA;;;;;;;;AC5GH;;;AAGA;AAAA;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"rango-sdk.esm.js","sources":["../../../node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../node_modules/uuid/dist/esm-browser/native.js","../../../node_modules/uuid/dist/esm-browser/v4.js","../src/services/httpService.ts","../src/services/client.ts","../../../node_modules/rango-types/src/api/shared/type-gaurds.ts","../../../node_modules/rango-types/src/api/shared/routing.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts"],"sourcesContent":["// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\nexport default function rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import validate from './validate.js';\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\n\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).slice(1));\n}\n\nexport function unsafeStringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();\n}\n\nfunction stringify(arr, offset = 0) {\n const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!validate(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nexport default stringify;","const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);\nexport default {\n randomUUID\n};","import native from './native.js';\nimport rng from './rng.js';\nimport { unsafeStringify } from './stringify.js';\n\nfunction v4(options, buf, offset) {\n if (native.randomUUID && !buf && !options) {\n return native.randomUUID();\n }\n\n options = options || {};\n const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return unsafeStringify(rnds);\n}\n\nexport default v4;","import axios from 'axios'\n\nexport const httpService = axios.create({\n baseURL: 'https://api.rango.exchange',\n})\n","import { v4 } from 'uuid'\n\nimport { httpService } from './httpService'\nimport {\n MetaResponse,\n BestRouteRequest,\n BestRouteResponse,\n CheckApprovalResponse,\n CheckTxStatusRequest,\n TransactionStatusResponse,\n CreateTransactionRequest,\n CreateTransactionResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n} from '../types'\n\ntype WalletAddresses = { blockchain: string; address: string }[]\n\nexport class RangoClient {\n private readonly deviceId: string\n\n private readonly apiKey: string\n\n constructor(apiKey: string) {\n this.apiKey = apiKey\n try {\n if (typeof window !== 'undefined') {\n const deviceId = localStorage.getItem('deviceId')\n if (deviceId) {\n this.deviceId = deviceId\n } else {\n const generatedId = v4()\n localStorage.setItem('deviceId', generatedId)\n this.deviceId = generatedId\n }\n } else {\n this.deviceId = v4()\n }\n } catch (e) {\n this.deviceId = v4()\n }\n }\n\n public async getAllMetadata(): Promise<MetaResponse> {\n const axiosResponse = await httpService.get<MetaResponse>(\n `/meta?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async getBestRoute(\n requestBody: BestRouteRequest\n ): Promise<BestRouteResponse> {\n const axiosResponse = await httpService.post<BestRouteResponse>(\n `/routing/best?apiKey=${this.apiKey}`,\n requestBody,\n { headers: { 'X-Rango-Id': this.deviceId } }\n )\n return axiosResponse.data\n }\n\n public async checkApproval(\n requestId: string\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await httpService.get<CheckApprovalResponse>(\n `/tx/${requestId}/check-approval?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async checkStatus(\n requestBody: CheckTxStatusRequest\n ): Promise<TransactionStatusResponse> {\n const axiosResponse = await httpService.post<TransactionStatusResponse>(\n `/tx/check-status?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async createTransaction(\n requestBody: CreateTransactionRequest\n ): Promise<CreateTransactionResponse> {\n const axiosResponse = await httpService.post<CreateTransactionResponse>(\n `/tx/create?apiKey=${this.apiKey}`,\n requestBody\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest\n ): Promise<void> {\n await httpService.post(`/tx/report-tx?apiKey=${this.apiKey}`, requestBody)\n }\n\n public async getWalletsDetails(\n walletAddresses: WalletAddresses\n ): Promise<WalletDetailsResponse> {\n let walletAddressesQueryParams = ''\n for (let i = 0; i < walletAddresses.length; i++) {\n const walletAddress = walletAddresses[i]\n walletAddressesQueryParams += `&address=${walletAddress.blockchain}.${walletAddress.address}`\n }\n const axiosResponse = await httpService.get<WalletDetailsResponse>(\n `/wallets/details?apiKey=${this.apiKey}${walletAddressesQueryParams}`\n )\n return axiosResponse.data\n }\n}\n",null,null,null],"names":["getRandomValues","rnds8","Uint8Array","rng","crypto","bind","Error","byteToHex","i","push","toString","slice","unsafeStringify","arr","offset","toLowerCase","randomUUID","v4","options","buf","native","rnds","random","httpService","axios","create","baseURL","RangoClient","apiKey","window","deviceId","localStorage","getItem","generatedId","setItem","e","getAllMetadata","get","axiosResponse","data","getBestRoute","requestBody","post","headers","checkApproval","requestId","checkStatus","createTransaction","reportFailure","getWalletsDetails","walletAddresses","walletAddressesQueryParams","length","walletAddress","blockchain","address","blockchainMeta"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA,IAAIA,eAAe;AACnB,IAAMC,KAAK,gBAAG,IAAIC,UAAU,CAAC,EAAE,CAAC;AACjB,SAASC,GAAG,GAAG;;EAE5B,IAAI,CAACH,eAAe,EAAE;;IAEpBA,eAAe,GAAG,OAAOI,MAAM,KAAK,WAAW,IAAIA,MAAM,CAACJ,eAAe,IAAII,MAAM,CAACJ,eAAe,CAACK,IAAI,CAACD,MAAM,CAAC;IAEhH,IAAI,CAACJ,eAAe,EAAE;MACpB,MAAM,IAAIM,KAAK,CAAC,0GAA0G,CAAC;;;EAI/H,OAAON,eAAe,CAACC,KAAK,CAAC;AAC/B;;AChBA;AACA;AACA;AACA;;AAEA,IAAMM,SAAS,GAAG,EAAE;AAEpB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,GAAG,EAAE,EAAEA,CAAC,EAAE;EAC5BD,SAAS,CAACE,IAAI,CAAC,CAACD,CAAC,G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;;qDAIUiB;;;AAGtC;;;AAKF;;;yDAI0CA;;;;;;;;;;;;;;;;;;;;;;;;;ACpD1C;;;;AAIA;AAAA;gCAAY;;;;;;ACJZ;;;AAGA;AAAA;;;;;;;;AASA;;;;AAIA;;;;;;;;;;;;;"}
@@ -1,2 +1,3 @@
1
1
  export * from 'rango-types/lib/api/main/meta';
2
+ export * from 'rango-types/lib/api/shared/type-gaurds';
2
3
  //# sourceMappingURL=meta.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/types/api/meta.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA"}
1
+ {"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/types/api/meta.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wCAAwC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rango-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Rango Exchange SDK for dApps",
5
5
  "module": "lib/rango-sdk.esm.js",
6
6
  "main": "lib/index.js",
@@ -14,9 +14,9 @@
14
14
  "url": "https://github.com/rango-exchange/rango-sdk/issues"
15
15
  },
16
16
  "scripts": {
17
- "clean": "rm -rf ./lib",
17
+ "clean": "rm -rf ./lib && rm -rf ./dist",
18
18
  "build": "tsdx build --tsconfig ./tsconfig.json && yarn post:build",
19
- "post:build": "yarn mv:file lib && node ../../scripts/frank-build.js",
19
+ "post:build": "yarn mv:file lib",
20
20
  "watch": "tsdx watch",
21
21
  "lint": "eslint src -c ../../.eslintrc.json --fix --ignore-path ../../.prettierignore",
22
22
  "format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ../../.prettierrc.json --ignore-path ../../.prettierignore",
@@ -26,7 +26,13 @@
26
26
  "Rango Exchange",
27
27
  "SDK",
28
28
  "Cross-Chain",
29
- "Multi-Chain"
29
+ "Multi-Chain",
30
+ "Ethereum",
31
+ "Cosmos",
32
+ "Solana",
33
+ "Tron",
34
+ "Starknet",
35
+ "Aggregator"
30
36
  ],
31
37
  "files": [
32
38
  "lib/**/*"
@@ -36,7 +42,7 @@
36
42
  "dependencies": {
37
43
  "axios": "^1.2.6",
38
44
  "bignumber.js": "^9.1.1",
39
- "rango-types": "^0.1.2",
45
+ "rango-types": "^0.1.5",
40
46
  "uuid": "^9.0.0"
41
47
  },
42
48
  "publishConfig": {
package/lib/package.json DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "name": "rango-sdk",
3
- "version": "0.1.0",
4
- "description": "Rango Exchange SDK for dApps",
5
- "module": "./index.js",
6
- "main": "./cjs/index.js",
7
- "types": "./index.d.ts",
8
- "repository": {
9
- "type": "git",
10
- "url": "git+https://github.com/rango-exchange/rango-sdk.git"
11
- },
12
- "homepage": "https://github.com/rango-exchange/rango-sdk",
13
- "bugs": {
14
- "url": "https://github.com/rango-exchange/rango-sdk/issues"
15
- },
16
- "keywords": [
17
- "Rango Exchange",
18
- "SDK",
19
- "Cross-Chain",
20
- "Multi-Chain"
21
- ],
22
- "author": "rango.exchange",
23
- "license": "GPL-3.0",
24
- "dependencies": {
25
- "axios": "^1.2.6",
26
- "bignumber.js": "^9.1.1",
27
- "rango-types": "^0.1.2",
28
- "uuid": "^9.0.0"
29
- },
30
- "publishConfig": {
31
- "access": "public",
32
- "branches": [
33
- "master"
34
- ]
35
- },
36
- "private": false
37
- }