rango-sdk-basic 0.0.14 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{LICENSE → lib/LICENSE} +0 -0
- package/{README.md → lib/README.md} +18 -7
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -21
- package/lib/package.json +39 -0
- package/lib/rango-sdk-basic.cjs.development.js +1008 -0
- package/lib/rango-sdk-basic.cjs.development.js.map +1 -0
- package/lib/rango-sdk-basic.cjs.production.min.js +2 -0
- package/lib/rango-sdk-basic.cjs.production.min.js.map +1 -0
- package/lib/rango-sdk-basic.esm.js +1005 -0
- package/lib/rango-sdk-basic.esm.js.map +1 -0
- package/lib/services/client.d.ts +21 -21
- package/lib/services/client.d.ts.map +1 -1
- package/lib/services/executor.d.ts +7 -7
- package/lib/services/executor.d.ts.map +1 -1
- package/lib/services/httpService.d.ts +1 -1
- package/lib/services/httpService.d.ts.map +1 -1
- package/lib/services/index.d.ts +1 -1
- package/lib/services/index.d.ts.map +1 -1
- package/lib/types/api/balance.d.ts +1 -38
- package/lib/types/api/balance.d.ts.map +1 -1
- package/lib/types/api/common.d.ts +3 -128
- package/lib/types/api/common.d.ts.map +1 -1
- package/lib/types/api/meta.d.ts +1 -183
- package/lib/types/api/meta.d.ts.map +1 -1
- package/lib/types/api/routing.d.ts +1 -43
- package/lib/types/api/routing.d.ts.map +1 -1
- package/lib/types/api/transactions.d.ts +1 -188
- package/lib/types/api/transactions.d.ts.map +1 -1
- package/lib/types/api/txs/cosmos.d.ts +1 -68
- package/lib/types/api/txs/cosmos.d.ts.map +1 -1
- package/lib/types/api/txs/evm.d.ts +1 -29
- package/lib/types/api/txs/evm.d.ts.map +1 -1
- package/lib/types/api/txs/index.d.ts +3 -3
- package/lib/types/api/txs/index.d.ts.map +1 -1
- package/lib/types/api/txs/transfer.d.ts +1 -28
- package/lib/types/api/txs/transfer.d.ts.map +1 -1
- package/lib/types/index.d.ts +7 -7
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/utils/errors.d.ts +22 -22
- package/lib/types/utils/errors.d.ts.map +1 -1
- package/lib/utils/errors.d.ts +1 -1
- package/lib/utils/errors.d.ts.map +1 -1
- package/lib/utils/promise.d.ts +1 -1
- package/lib/utils/promise.d.ts.map +1 -1
- package/package.json +15 -26
- package/lib/index.js.map +0 -1
- package/lib/services/client.js +0 -257
- package/lib/services/client.js.map +0 -1
- package/lib/services/executor.js +0 -196
- package/lib/services/executor.js.map +0 -1
- package/lib/services/httpService.js +0 -14
- package/lib/services/httpService.js.map +0 -1
- package/lib/services/index.js +0 -6
- package/lib/services/index.js.map +0 -1
- package/lib/types/api/balance.js +0 -3
- package/lib/types/api/balance.js.map +0 -1
- package/lib/types/api/common.js +0 -11
- package/lib/types/api/common.js.map +0 -1
- package/lib/types/api/meta.js +0 -3
- package/lib/types/api/meta.js.map +0 -1
- package/lib/types/api/routing.js +0 -3
- package/lib/types/api/routing.js.map +0 -1
- package/lib/types/api/transactions.js +0 -22
- package/lib/types/api/transactions.js.map +0 -1
- package/lib/types/api/txs/cosmos.js +0 -3
- package/lib/types/api/txs/cosmos.js.map +0 -1
- package/lib/types/api/txs/evm.js +0 -3
- package/lib/types/api/txs/evm.js.map +0 -1
- package/lib/types/api/txs/index.js +0 -20
- package/lib/types/api/txs/index.js.map +0 -1
- package/lib/types/api/txs/transfer.js +0 -3
- package/lib/types/api/txs/transfer.js.map +0 -1
- package/lib/types/index.js +0 -24
- package/lib/types/index.js.map +0 -1
- package/lib/types/utils/errors.js +0 -26
- package/lib/types/utils/errors.js.map +0 -1
- package/lib/utils/errors.js +0 -31
- package/lib/utils/errors.js.map +0 -1
- package/lib/utils/promise.js +0 -8
- package/lib/utils/promise.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rango-sdk-basic.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/types/api/common.ts","../../../node_modules/rango-types/src/api/shared/transactions.ts","../src/types/utils/errors.ts","../src/utils/promise.ts","../src/services/executor.ts","../src/utils/errors.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\nconst baseURL =\n typeof process !== 'undefined' && process.env.REACT_APP_RANGO_BASE_URL\n ? process.env.REACT_APP_RANGO_BASE_URL\n : 'https://api.rango.exchange'\n\nexport const httpService = axios.create({\n baseURL,\n})\n","import { Asset } from 'rango-types/lib/api/basic'\nexport * from 'rango-types/lib/api/basic/common'\n\nexport function assetToString(asset: Asset): string {\n if (!!asset.address)\n return `${asset.blockchain}.${asset.symbol}--${asset.address}`\n else return `${asset.blockchain}.${asset.symbol}`\n}\n",null,"export const MetamaskErrorCodes = {\n rpc: {\n invalidInput: -32000,\n resourceNotFound: -32001,\n resourceUnavailable: -32002,\n transactionRejected: -32003,\n methodNotSupported: -32004,\n limitExceeded: -32005,\n parse: -32700,\n invalidRequest: -32600,\n methodNotFound: -32601,\n invalidParams: -32602,\n internal: -32603,\n },\n provider: {\n userRejectedRequest: 4001,\n unauthorized: 4100,\n unsupportedMethod: 4200,\n disconnected: 4900,\n chainDisconnected: 4901,\n },\n}\n","export function sleep(ms: number) {\n return new Promise((resolve) => setTimeout(resolve, ms))\n}\n","import { Signer } from 'ethers'\nimport { RangoClient } from './client'\nimport { EvmTransaction } from '../types/api/txs'\nimport {\n StatusResponse,\n SwapResponse,\n TransactionStatus,\n TransactionType,\n} from '../types/api/transactions'\nimport { sleep } from '../utils/promise'\n\nexport function prepareEvmTransaction(\n evmTx: EvmTransaction,\n isApprove: boolean\n) {\n const gasPrice =\n !!evmTx.gasPrice && !evmTx.gasPrice.startsWith('0x')\n ? '0x' + parseInt(evmTx.gasPrice).toString(16)\n : null\n const manipulatedTx = {\n ...evmTx,\n gasPrice,\n }\n let tx = {}\n if (!!manipulatedTx.from) tx = { ...tx, from: manipulatedTx.from }\n if (isApprove) {\n if (!!manipulatedTx.approveTo) tx = { ...tx, to: manipulatedTx.approveTo }\n if (!!manipulatedTx.approveData)\n tx = { ...tx, data: manipulatedTx.approveData }\n } else {\n if (!!manipulatedTx.txTo) tx = { ...tx, to: manipulatedTx.txTo }\n if (!!manipulatedTx.txData) tx = { ...tx, data: manipulatedTx.txData }\n if (!!manipulatedTx.value) tx = { ...tx, value: manipulatedTx.value }\n if (!!manipulatedTx.gasLimit)\n tx = { ...tx, gasLimit: manipulatedTx.gasLimit }\n if (!!manipulatedTx.gasPrice)\n tx = { ...tx, gasPrice: manipulatedTx.gasPrice }\n }\n return tx\n}\n\nasync function checkApprovalSync(\n requestId: string,\n txId: string,\n rangoClient: RangoClient\n) {\n while (true) {\n try {\n const approvalResponse = await rangoClient.isApproved(requestId, txId)\n if (approvalResponse.isApproved) return true\n } catch (err) {\n console.log('ignorinig error', { err })\n }\n await sleep(3_000)\n }\n}\n\nexport const checkTransactionStatusSync = async (\n requestId: string,\n txId: string,\n rangoClient: RangoClient\n) => {\n let txStatus: StatusResponse | undefined\n while (true) {\n try {\n txStatus = await rangoClient.status({\n requestId,\n txId,\n })\n } catch (err) {\n console.log('ignorinig error', { err })\n }\n if (!!txStatus) {\n if (\n !!txStatus.status &&\n [TransactionStatus.FAILED, TransactionStatus.SUCCESS].includes(\n txStatus.status\n )\n ) {\n return txStatus\n }\n }\n await sleep(3_000)\n }\n}\n\nexport const executeEvmRoute = async (\n client: RangoClient,\n signer: Signer,\n route: SwapResponse\n): Promise<StatusResponse> => {\n const { tx, requestId, error, resultType } = route\n if (resultType != 'OK') throw new Error(resultType)\n if (!!error || !tx)\n throw new Error(error || 'Error creating the transaction.')\n if (tx?.type !== TransactionType.EVM)\n throw new Error('Non Evm transactions are not supported yet.')\n const evmTransaction = tx as EvmTransaction\n const txChainId = parseInt(evmTransaction.blockChain.chainId || '-1')\n let signerChainId = await signer.getChainId()\n if (signerChainId !== txChainId) {\n throw new Error(\n `Signer chainId ${signerChainId} doesn't match required chainId ${txChainId}.`\n )\n }\n if (!!evmTransaction.approveTo && !!evmTransaction.approveData) {\n const approveTxData = prepareEvmTransaction(evmTransaction, true)\n const approveTx = await signer.sendTransaction(approveTxData)\n approveTx.wait()\n await checkApprovalSync(requestId, approveTx.hash, client)\n }\n signerChainId = await signer.getChainId()\n if (signerChainId !== txChainId) {\n throw new Error(\n `Signer chainId ${signerChainId} doesn't match required chainId ${txChainId}.`\n )\n }\n const mainTxData = prepareEvmTransaction(evmTransaction, false)\n const mainTx = await signer.sendTransaction(mainTxData)\n mainTx.wait()\n const status = await checkTransactionStatusSync(\n requestId,\n mainTx.hash,\n client\n )\n return status\n}\n","import { getMessageFromCode } from 'eth-rpc-errors'\nimport { MetamaskErrorCodes } from '../types/utils/errors'\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const prettifyError = (error: any) => {\n if (!error) return error\n if (error.code && (error.code === 'ACTION_REJECTED' || error.code === 4001))\n return new Error('Transaction Rejected')\n if (error && typeof error.code === 'number') {\n if (Object.values(MetamaskErrorCodes.provider).includes(error.code)) {\n return new Error(getMessageFromCode(error.code))\n }\n if (Object.values(MetamaskErrorCodes.rpc).includes(error.code)) {\n if (\n error.code === MetamaskErrorCodes.rpc.internal &&\n error.message?.includes('underpriced')\n )\n return new Error('Transaction underpriced')\n if (\n error.message?.includes('intrinsic gas too low') ||\n error.message?.includes('out of gas')\n )\n return new Error('This Gas limit is low.')\n return new Error(getMessageFromCode(error.code))\n }\n }\n if (error.message) return new Error(error.message)\n return error\n}\n","import { v4 } from 'uuid'\n\nimport { httpService } from './httpService'\nimport {\n MetaResponse,\n QuoteRequest,\n QuoteResponse,\n CheckApprovalResponse,\n StatusRequest,\n StatusResponse,\n SwapRequest,\n SwapResponse,\n ReportTransactionRequest,\n WalletDetailsResponse,\n assetToString,\n BlockchainMeta,\n SwapperMetaDto,\n} from '../types'\nimport { Signer } from 'ethers'\nimport { executeEvmRoute as executeEvmRoute } from './executor'\nimport { prettifyError } from '../utils/errors'\n\ntype WalletAddress = { blockchain: string; address: string }\n\nexport class RangoClient {\n private readonly deviceId: string\n\n private readonly apiKey: string\n\n constructor(apiKey: string, debug = false) {\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 if (debug) {\n httpService.interceptors.request.use((request) => {\n console.log('Starting Request', JSON.stringify(request, null, 2))\n return request\n })\n httpService.interceptors.response.use((response) => {\n console.log('Response:', JSON.stringify(response, null, 2))\n return response\n })\n }\n }\n\n public async meta(): Promise<MetaResponse> {\n const axiosResponse = await httpService.get<MetaResponse>(\n `/basic/meta?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async chains(): Promise<BlockchainMeta[]> {\n const axiosResponse = await httpService.get<BlockchainMeta[]>(\n `/basic/meta/blockchains?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async swappers(): Promise<SwapperMetaDto[]> {\n const axiosResponse = await httpService.get<SwapperMetaDto[]>(\n `/basic/meta/swappers?apiKey=${this.apiKey}`\n )\n return axiosResponse.data\n }\n\n public async quote(quoteRequest: QuoteRequest): Promise<QuoteResponse> {\n const body = {\n ...quoteRequest,\n from: assetToString(quoteRequest.from),\n to: assetToString(quoteRequest.to),\n swappers:\n !!quoteRequest.swappers && quoteRequest.swappers.length > 0\n ? quoteRequest.swappers.join(',')\n : undefined,\n messagingProtocols:\n !!quoteRequest.messagingProtocols &&\n quoteRequest.messagingProtocols.length > 0\n ? quoteRequest.messagingProtocols.join(',')\n : undefined,\n }\n const axiosResponse = await httpService.get<QuoteResponse>(\n `/basic/quote?apiKey=${this.apiKey}`,\n {\n params: body,\n headers: { 'X-Rango-Id': this.deviceId },\n }\n )\n return axiosResponse.data\n }\n\n public async isApproved(\n requestId: string,\n txId: string\n ): Promise<CheckApprovalResponse> {\n const axiosResponse = await httpService.get<CheckApprovalResponse>(\n `/basic/is-approved?apiKey=${this.apiKey}`,\n {\n params: { requestId, txId },\n headers: { 'X-Rango-Id': this.deviceId },\n }\n )\n return axiosResponse.data\n }\n\n public async status(statusRequest: StatusRequest): Promise<StatusResponse> {\n const axiosResponse = await httpService.get<StatusResponse>(\n `/basic/status?apiKey=${this.apiKey}`,\n {\n params: statusRequest,\n headers: { 'X-Rango-Id': this.deviceId },\n }\n )\n return axiosResponse.data\n }\n\n public async swap(swapRequest: SwapRequest): Promise<SwapResponse> {\n const body = {\n ...swapRequest,\n from: assetToString(swapRequest.from),\n to: assetToString(swapRequest.to),\n swappers:\n !!swapRequest.swappers && swapRequest.swappers.length > 0\n ? swapRequest.swappers.join(',')\n : undefined,\n messagingProtocols:\n !!swapRequest.messagingProtocols &&\n swapRequest.messagingProtocols.length > 0\n ? swapRequest.messagingProtocols.join(',')\n : undefined,\n }\n const axiosResponse = await httpService.get<SwapResponse>(\n `/basic/swap?apiKey=${this.apiKey}`,\n {\n params: body,\n headers: { 'X-Rango-Id': this.deviceId },\n }\n )\n return axiosResponse.data\n }\n\n public async reportFailure(\n requestBody: ReportTransactionRequest\n ): Promise<void> {\n await httpService.post(\n `/basic/report-tx?apiKey=${this.apiKey}`,\n requestBody,\n {\n headers: { 'X-Rango-Id': this.deviceId },\n }\n )\n }\n\n public async balance(\n walletAddress: WalletAddress\n ): Promise<WalletDetailsResponse> {\n const axiosResponse = await httpService.get<WalletDetailsResponse>(\n `/basic/balance?apiKey=${this.apiKey}`,\n {\n params: walletAddress,\n headers: { 'X-Rango-Id': this.deviceId },\n }\n )\n return axiosResponse.data\n }\n\n public async executeEvmRoute(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n signer: any,\n route: SwapResponse\n ): Promise<StatusResponse> {\n try {\n return await executeEvmRoute(this, signer as Signer, route)\n } catch (error) {\n throw prettifyError(error)\n }\n }\n}\n"],"names":["getRandomValues","rnds8","Uint8Array","rng","crypto","bind","Error","byteToHex","i","push","toString","slice","unsafeStringify","arr","offset","toLowerCase","randomUUID","v4","options","buf","native","rnds","random","baseURL","process","env","REACT_APP_RANGO_BASE_URL","httpService","axios","create","assetToString","asset","address","blockchain","symbol","MetamaskErrorCodes","rpc","invalidInput","resourceNotFound","resourceUnavailable","transactionRejected","methodNotSupported","limitExceeded","parse","invalidRequest","methodNotFound","invalidParams","internal","provider","userRejectedRequest","unauthorized","unsupportedMethod","disconnected","chainDisconnected","sleep","ms","Promise","resolve","setTimeout","prepareEvmTransaction","evmTx","isApprove","gasPrice","startsWith","parseInt","manipulatedTx","tx","from","approveTo","to","approveData","data","txTo","txData","value","gasLimit","checkApprovalSync","requestId","txId","rangoClient","isApproved","approvalResponse","console","log","err","checkTransactionStatusSync","status","txStatus","TransactionStatus","FAILED","SUCCESS","includes","executeEvmRoute","client","signer","route","error","resultType","type","TransactionType","EVM","evmTransaction","txChainId","blockChain","chainId","getChainId","signerChainId","approveTxData","sendTransaction","approveTx","wait","hash","mainTxData","mainTx","prettifyError","code","Object","values","getMessageFromCode","message","RangoClient","apiKey","debug","window","deviceId","localStorage","getItem","generatedId","setItem","e","interceptors","request","use","JSON","stringify","response","meta","get","axiosResponse","chains","swappers","quote","quoteRequest","body","length","join","undefined","messagingProtocols","params","headers","statusRequest","swap","swapRequest","reportFailure","requestBody","post","balance","walletAddress"],"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,C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IAAA,uFAAb,kBACLC,aAA4B;MAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OAEAlI,WAAW,CAAC8G,GAAG,4BAChB,IAAI,CAAChB,MAAM,EACpC;cACE2B,MAAM,EAAES,aAAa;cACrBR,OAAO,EAAE;gBAAE,YAAY,EAAE,IAAI,CAACzB;;aAC/B,CACF;UAAA;YANKc,aAAa;YAAA,kCAOZA,aAAa,CAACnE,IAAI;UAAA;UAAA;YAAA;;;KAC1B;IAAA;MAAA;;IAAA;;EAAA,OAEYqB,eAAe;IAAA,gGAArB;;IAELE,MAAW,EACXC,KAAmB;MAAA;QAAA;UAAA;YAAA;YAAA;YAAA,OAGJH,eAAe,CAAC,IAAI,EAAEE,MAAgB,EAAEC,KAAK,CAAC;UAAA;YAAA;UAAA;YAAA;YAAA;YAAA,MAErDmB,aAAa,eAAO;UAAA;UAAA;YAAA;;;KAE7B;IAAA;MAAA;;IAAA;;EAAA;AAAA;;;;"}
|
package/lib/services/client.d.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { MetaResponse, QuoteRequest, QuoteResponse, CheckApprovalResponse, StatusRequest, StatusResponse, SwapRequest, SwapResponse, ReportTransactionRequest, WalletDetailsResponse, BlockchainMeta, SwapperMetaDto } from '../types';
|
|
2
|
-
type WalletAddress = {
|
|
3
|
-
blockchain: string;
|
|
4
|
-
address: string;
|
|
5
|
-
};
|
|
6
|
-
export declare class RangoClient {
|
|
7
|
-
private readonly deviceId;
|
|
8
|
-
private readonly apiKey;
|
|
9
|
-
constructor(apiKey: string, debug?: boolean);
|
|
10
|
-
meta(): Promise<MetaResponse>;
|
|
11
|
-
chains(): Promise<BlockchainMeta[]>;
|
|
12
|
-
swappers(): Promise<SwapperMetaDto[]>;
|
|
13
|
-
quote(quoteRequest: QuoteRequest): Promise<QuoteResponse>;
|
|
14
|
-
isApproved(requestId: string, txId: string): Promise<CheckApprovalResponse>;
|
|
15
|
-
status(statusRequest: StatusRequest): Promise<StatusResponse>;
|
|
16
|
-
swap(swapRequest: SwapRequest): Promise<SwapResponse>;
|
|
17
|
-
reportFailure(requestBody: ReportTransactionRequest): Promise<void>;
|
|
18
|
-
balance(walletAddress: WalletAddress): Promise<WalletDetailsResponse>;
|
|
19
|
-
executeEvmRoute(signer: any, route: SwapResponse): Promise<StatusResponse>;
|
|
20
|
-
}
|
|
21
|
-
export {};
|
|
1
|
+
import { MetaResponse, QuoteRequest, QuoteResponse, CheckApprovalResponse, StatusRequest, StatusResponse, SwapRequest, SwapResponse, ReportTransactionRequest, WalletDetailsResponse, BlockchainMeta, SwapperMetaDto } from '../types';
|
|
2
|
+
declare type WalletAddress = {
|
|
3
|
+
blockchain: string;
|
|
4
|
+
address: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class RangoClient {
|
|
7
|
+
private readonly deviceId;
|
|
8
|
+
private readonly apiKey;
|
|
9
|
+
constructor(apiKey: string, debug?: boolean);
|
|
10
|
+
meta(): Promise<MetaResponse>;
|
|
11
|
+
chains(): Promise<BlockchainMeta[]>;
|
|
12
|
+
swappers(): Promise<SwapperMetaDto[]>;
|
|
13
|
+
quote(quoteRequest: QuoteRequest): Promise<QuoteResponse>;
|
|
14
|
+
isApproved(requestId: string, txId: string): Promise<CheckApprovalResponse>;
|
|
15
|
+
status(statusRequest: StatusRequest): Promise<StatusResponse>;
|
|
16
|
+
swap(swapRequest: SwapRequest): Promise<SwapResponse>;
|
|
17
|
+
reportFailure(requestBody: ReportTransactionRequest): Promise<void>;
|
|
18
|
+
balance(walletAddress: WalletAddress): Promise<WalletDetailsResponse>;
|
|
19
|
+
executeEvmRoute(signer: any, route: SwapResponse): Promise<StatusResponse>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
22
|
//# sourceMappingURL=client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/services/client.ts"],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ransaction } from '../types/api/txs';
|
|
4
|
-
import { StatusResponse, SwapResponse } from '../types/api/transactions';
|
|
5
|
-
export declare function prepareEvmTransaction(evmTx: EvmTransaction, isApprove: boolean): {};
|
|
6
|
-
export declare const checkTransactionStatusSync: (requestId: string, txId: string, rangoClient: RangoClient) => Promise<StatusResponse>;
|
|
7
|
-
export declare const executeEvmRoute: (client: RangoClient, signer: Signer, route: SwapResponse) => Promise<StatusResponse>;
|
|
1
|
+
import { Signer } from 'ethers';
|
|
2
|
+
import { RangoClient } from './client';
|
|
3
|
+
import { EvmTransaction } from '../types/api/txs';
|
|
4
|
+
import { StatusResponse, SwapResponse } from '../types/api/transactions';
|
|
5
|
+
export declare function prepareEvmTransaction(evmTx: EvmTransaction, isApprove: boolean): {};
|
|
6
|
+
export declare const checkTransactionStatusSync: (requestId: string, txId: string, rangoClient: RangoClient) => Promise<StatusResponse>;
|
|
7
|
+
export declare const executeEvmRoute: (client: RangoClient, signer: Signer, route: SwapResponse) => Promise<StatusResponse>;
|
|
8
8
|
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../src/services/executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EACL,cAAc,EACd,YAAY,EAGb,MAAM,2BAA2B,CAAA;AAGlC,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,EACrB,SAAS,EAAE,OAAO,MA0BnB;AAkBD,eAAO,MAAM,0BAA0B,cAC1B,MAAM,QACX,MAAM,eACC,WAAW,4BAwBzB,CAAA;AAED,eAAO,MAAM,eAAe,WAClB,WAAW,UACX,MAAM,SACP,YAAY,KAClB,OAAO,CAAC,cAAc,CAoCxB,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const httpService: import("axios").AxiosInstance;
|
|
1
|
+
export declare const httpService: import("axios").AxiosInstance;
|
|
2
2
|
//# sourceMappingURL=httpService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpService.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"httpService.d.ts","sourceRoot":"","sources":["../src/services/httpService.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,WAAW,+BAEtB,CAAA"}
|
package/lib/services/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { RangoClient } from './client';
|
|
1
|
+
export { RangoClient } from './client';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -1,39 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Pair of the asset and its amount in wallet balance
|
|
4
|
-
*
|
|
5
|
-
* @property {Amount} amount
|
|
6
|
-
* @property {Asset} asset
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
export type AssetAndAmount = {
|
|
10
|
-
amount: Amount;
|
|
11
|
-
asset: Asset;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Balance of a specific address inside a specific blockchain
|
|
15
|
-
*
|
|
16
|
-
* @property {boolean} failed - If true, Rango was not able to fetch balance of this wallet, maybe try again later
|
|
17
|
-
* @property {string} blockChain - Wallet blockchain
|
|
18
|
-
* @property {string} address - Wallet address
|
|
19
|
-
* @property {AssetAndAmount[] | null} balances - Examples: BSC, TERRA, OSMOSIS, ...
|
|
20
|
-
* @property {string} explorerUrl - The explorer url of the wallet, example: https://bscscan.com/address/0x7a3....fdsza
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
export type WalletDetail = {
|
|
24
|
-
failed: boolean;
|
|
25
|
-
blockChain: string;
|
|
26
|
-
address: string;
|
|
27
|
-
balances: AssetAndAmount[] | null;
|
|
28
|
-
explorerUrl: string;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Response of checking wallet balance
|
|
32
|
-
*
|
|
33
|
-
* @property {WalletDetail[]} wallets - list of wallet assets
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
export type WalletDetailsResponse = {
|
|
37
|
-
wallets: WalletDetail[];
|
|
38
|
-
};
|
|
1
|
+
export * from 'rango-types/lib/api/basic/balance';
|
|
39
2
|
//# sourceMappingURL=balance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../src/types/api/balance.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA"}
|
|
@@ -1,129 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* @property {string} blockchain - The blockchain which this token belongs to
|
|
6
|
-
* @property {string | null} address - Smart contract address of token, null for native tokens
|
|
7
|
-
* @property {string} symbol - The display token symbol, e.g. USDT, BTC, ...
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
export type Asset = {
|
|
11
|
-
blockchain: string;
|
|
12
|
-
address: string | null;
|
|
13
|
-
symbol: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function assetToString(asset: Asset): string;
|
|
16
|
-
/**
|
|
17
|
-
* The amount of an asset, including value & decimals.
|
|
18
|
-
* The value is machine-readable, to make it human-readable it should be shifted by decimals.
|
|
19
|
-
*
|
|
20
|
-
* @property {string} amount - The machine-readable amount shifted by decimals, example: 1000000000000000000
|
|
21
|
-
* @property {number} decimals - The decimals of the token in blockchain, example: 18
|
|
22
|
-
*
|
|
23
|
-
*/
|
|
24
|
-
export type Amount = {
|
|
25
|
-
amount: string;
|
|
26
|
-
decimals: number;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* A fee unit, including the type of asset and the amount of fee
|
|
30
|
-
*
|
|
31
|
-
* @property {string} name - A display name for this fee, example: Network Fee
|
|
32
|
-
* @property {Token} token - Underlying token for paying fee, example: BNB for BSC blockchain
|
|
33
|
-
* @property {string} expenseType - Type of the fee, example: FROM_SOURCE_WALLET
|
|
34
|
-
* @property {string} amount - The human readable amount of fee, example: 0.004
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
export type SwapFee = {
|
|
38
|
-
name: string;
|
|
39
|
-
token: Token;
|
|
40
|
-
expenseType: 'FROM_SOURCE_WALLET' | 'DECREASE_FROM_OUTPUT' | 'FROM_DESTINATION_WALLET';
|
|
41
|
-
amount: string;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Type of the swapper
|
|
45
|
-
*
|
|
46
|
-
*/
|
|
47
|
-
export type SwapperType = 'BRIDGE' | 'DEX' | 'AGGREGATOR';
|
|
48
|
-
/**
|
|
49
|
-
* A quote path from asset x (from) to asset y (to)
|
|
50
|
-
*
|
|
51
|
-
* @property {Token} from - The source asset
|
|
52
|
-
* @property {Token} to - The destination asset
|
|
53
|
-
* @property {SwapperMetaDto} swapper - Swapper for this path
|
|
54
|
-
* @property {SwapperType} swapperType - Type of swapper
|
|
55
|
-
* @property {string} expectedOutput - Expected output
|
|
56
|
-
* @property {number} estimatedTimeInSeconds - Expected duration
|
|
57
|
-
*
|
|
58
|
-
*/
|
|
59
|
-
export type QuotePath = {
|
|
60
|
-
from: Token;
|
|
61
|
-
to: Token;
|
|
62
|
-
swapper: SwapperMetaDto;
|
|
63
|
-
swapperType: SwapperType;
|
|
64
|
-
expectedOutput: string;
|
|
65
|
-
estimatedTimeInSeconds: number;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Limitations on input amount for requested route
|
|
69
|
-
*
|
|
70
|
-
* @property {string | null} min - Limitation on minimum input amount for this route
|
|
71
|
-
* @property {string | null} max - Limitation on maximum input amount for this route
|
|
72
|
-
* @property {'INCLUSIVE' | 'EXCLUSIVE'} type - type of limitation
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
export type AmountRestriction = {
|
|
76
|
-
min: string | null;
|
|
77
|
-
max: string | null;
|
|
78
|
-
type: 'INCLUSIVE' | 'EXCLUSIVE';
|
|
79
|
-
};
|
|
80
|
-
/**
|
|
81
|
-
* A step of a multi-step swap route
|
|
82
|
-
*
|
|
83
|
-
* @property {Token} from - Source token
|
|
84
|
-
* @property {Token} to - Destination token
|
|
85
|
-
* @property {string} outputAmount - The estimation of Rango from output amount for Y
|
|
86
|
-
* @property {string} outputAmountMin - The estimation of Rango from output amount for Y
|
|
87
|
-
* @property {number | null} outputAmountUsd - The estimation of Rango from output usd value for Y
|
|
88
|
-
* @property {SwapperMetaDto} swapper - Swapper suggested for this path
|
|
89
|
-
* @property {QuotePath[] | null} path - The internal routing of this step showing how the initial swap request will
|
|
90
|
-
* be split and executed. This can be used for previewing purpose to give the user a sense of what's going to happen.
|
|
91
|
-
* Null indicates that there is no internal mechanism and swapping is simple and straight-forward.
|
|
92
|
-
* @property {SwapFee[]} fee - List of fees that are taken from user in this step
|
|
93
|
-
* @property {number | null} feeUsd - Amount of fee in usd
|
|
94
|
-
* @property {AmountRestriction | null} amountRestriction - restrictions on input amount. This field is informational
|
|
95
|
-
* and there is no need to apply it in client-side
|
|
96
|
-
* @property {number} estimatedTimeInSeconds - The estimated time (in seconds) that this step might take, beware that
|
|
97
|
-
* this number is just an estimation and should be used only for user preview, example: 15
|
|
98
|
-
*
|
|
99
|
-
*/
|
|
100
|
-
export type QuoteSimulationResult = {
|
|
101
|
-
from: Token;
|
|
102
|
-
to: Token;
|
|
103
|
-
outputAmount: string;
|
|
104
|
-
outputAmountMin: string;
|
|
105
|
-
outputAmountUsd: number | null;
|
|
106
|
-
swapper: SwapperMetaDto;
|
|
107
|
-
path: QuotePath[] | null;
|
|
108
|
-
fee: SwapFee[];
|
|
109
|
-
feeUsd: number | null;
|
|
110
|
-
amountRestriction: AmountRestriction | null;
|
|
111
|
-
estimatedTimeInSeconds: number;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* An asset with its ticker
|
|
115
|
-
*
|
|
116
|
-
* @property {string} blockchain - Blockchain of asset
|
|
117
|
-
* @property {string | null} address - Contract address of the asset, null for native tokens
|
|
118
|
-
* @property {string} symbol - Symbol of an asset, example: BUSD
|
|
119
|
-
* @property {string} ticker - The ticker of the asset which normally is a combination of symbol and address,
|
|
120
|
-
* required by some javascript wallets
|
|
121
|
-
*
|
|
122
|
-
*/
|
|
123
|
-
export type AssetWithTicker = {
|
|
124
|
-
blockchain: string;
|
|
125
|
-
address: string | null;
|
|
126
|
-
symbol: string;
|
|
127
|
-
ticker: string;
|
|
128
|
-
};
|
|
1
|
+
import { Asset } from 'rango-types/lib/api/basic';
|
|
2
|
+
export * from 'rango-types/lib/api/basic/common';
|
|
3
|
+
export declare function assetToString(asset: Asset): string;
|
|
129
4
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/types/api/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACjD,cAAc,kCAAkC,CAAA;AAEhD,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAIlD"}
|
package/lib/types/api/meta.d.ts
CHANGED
|
@@ -1,184 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { TransactionType } from './transactions';
|
|
3
|
-
/**
|
|
4
|
-
* EVM Chain Info
|
|
5
|
-
*
|
|
6
|
-
* @property {string} chainName - Chain name, e.g. Polygon Mainnet
|
|
7
|
-
* @property {name: string, symbol: string, decimals: null} nativeCurrency
|
|
8
|
-
* @property {string[]} rpcUrls - e.g. "https://polygon-rpc.com"
|
|
9
|
-
* @property {string[]} blockExplorerUrls - e.g. "https://polygonscan.com"
|
|
10
|
-
* @property {string} addressUrl - Explorer address base url for this blockchain,
|
|
11
|
-
* e.g. "https://bscscan.com/address/{wallet}"
|
|
12
|
-
* @property {string} transactionUrl - Explorer transaction base url for this blockchain,
|
|
13
|
-
* e.g. "https://bscscan.com/tx/{txHash}"
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
export type EVMChainInfo = {
|
|
17
|
-
chainName: string;
|
|
18
|
-
nativeCurrency: {
|
|
19
|
-
name: string;
|
|
20
|
-
symbol: string;
|
|
21
|
-
decimals: number;
|
|
22
|
-
};
|
|
23
|
-
rpcUrls: string[];
|
|
24
|
-
blockExplorerUrls: string[];
|
|
25
|
-
addressUrl: string;
|
|
26
|
-
transactionUrl: string;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Cosmos Chain Info - Used for adding experimental chains to keplr if needed
|
|
30
|
-
*
|
|
31
|
-
* @see https://github.com/osmosis-labs/osmosis-frontend/blob/0b88e39740cb087be576f464bfcd6cc2971ed2fd/packages/web/config/chain-infos.ts
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
export type CosmosChainInfo = {
|
|
35
|
-
experimental: boolean;
|
|
36
|
-
rpc: string;
|
|
37
|
-
rest: string;
|
|
38
|
-
cosmostationLcdUrl: string | null;
|
|
39
|
-
cosmostationApiUrl: string | null;
|
|
40
|
-
cosmostationDenomTracePath: string;
|
|
41
|
-
mintScanName: string | null;
|
|
42
|
-
chainName: string;
|
|
43
|
-
stakeCurrency: {
|
|
44
|
-
coinDenom: string;
|
|
45
|
-
coinMinimalDenom: string;
|
|
46
|
-
coinDecimals: number;
|
|
47
|
-
coinGeckoId: string;
|
|
48
|
-
coinImageUrl: string;
|
|
49
|
-
};
|
|
50
|
-
bip44: {
|
|
51
|
-
coinType: number;
|
|
52
|
-
};
|
|
53
|
-
bech32Config: {
|
|
54
|
-
bech32PrefixAccAddr: string;
|
|
55
|
-
bech32PrefixAccPub: string;
|
|
56
|
-
bech32PrefixValAddr: string;
|
|
57
|
-
bech32PrefixValPub: string;
|
|
58
|
-
bech32PrefixConsAddr: string;
|
|
59
|
-
bech32PrefixConsPub: string;
|
|
60
|
-
};
|
|
61
|
-
currencies: {
|
|
62
|
-
coinDenom: string;
|
|
63
|
-
coinMinimalDenom: string;
|
|
64
|
-
coinDecimals: number;
|
|
65
|
-
coinGeckoId: string;
|
|
66
|
-
coinImageUrl: string;
|
|
67
|
-
}[];
|
|
68
|
-
feeCurrencies: {
|
|
69
|
-
coinDenom: string;
|
|
70
|
-
coinMinimalDenom: string;
|
|
71
|
-
coinDecimals: number;
|
|
72
|
-
coinGeckoId: string;
|
|
73
|
-
coinImageUrl: string;
|
|
74
|
-
}[];
|
|
75
|
-
features: string[];
|
|
76
|
-
explorerUrlToTx: string;
|
|
77
|
-
gasPriceStep: {
|
|
78
|
-
low: number;
|
|
79
|
-
average: number;
|
|
80
|
-
high: number;
|
|
81
|
-
} | null;
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Blockchain Meta Information
|
|
85
|
-
*
|
|
86
|
-
* @property {string} name - Unique name of blockchain, this field is used in all endpoints as the identifier
|
|
87
|
-
* @property {number} defaultDecimals - The default decimals of blockchain, do not use it in computations, use Token.decimals instead
|
|
88
|
-
* @property {Asset[]} feeAssets - List of assets that can be used as fee in this blockchain
|
|
89
|
-
* @property {string[]} addressPatterns - List of all regex patterns for wallet addresses of this blockchain, can be
|
|
90
|
-
* used for input validation, example: [ "^(0x)[0-9A-Fa-f]{40}$" ]
|
|
91
|
-
* @property {string} logo - Logo of the blockchain
|
|
92
|
-
* @property {string} displayName - Display name for the blockchain
|
|
93
|
-
* @property {string} shortName - Short name for the blockchain
|
|
94
|
-
* @property {string} color - Suggested color for the blockchain
|
|
95
|
-
* @property {boolean} enabled - Is blockchain enabled or not in Rango
|
|
96
|
-
* @property {TransactionType} type - Type of the blockchain
|
|
97
|
-
* @property {string | null} chainId - e.g. "0xa86a" for Avax, "osmosis-1" for Osmosis, etc.
|
|
98
|
-
* @property {EVMChainInfo | CosmosChainInfo | null} info - Chain specific information
|
|
99
|
-
*
|
|
100
|
-
*/
|
|
101
|
-
export type BlockchainMetaBase = {
|
|
102
|
-
name: string;
|
|
103
|
-
shortName: string;
|
|
104
|
-
displayName: string;
|
|
105
|
-
defaultDecimals: number;
|
|
106
|
-
feeAssets: Asset[];
|
|
107
|
-
addressPatterns: string[];
|
|
108
|
-
logo: string;
|
|
109
|
-
color: string;
|
|
110
|
-
enabled: boolean;
|
|
111
|
-
type: TransactionType;
|
|
112
|
-
chainId: string | null;
|
|
113
|
-
info: EVMChainInfo | CosmosChainInfo | null;
|
|
114
|
-
};
|
|
115
|
-
export interface EvmBlockchainMeta extends BlockchainMetaBase {
|
|
116
|
-
type: TransactionType.EVM;
|
|
117
|
-
chainId: string;
|
|
118
|
-
info: EVMChainInfo;
|
|
119
|
-
}
|
|
120
|
-
export interface CosmosBlockchainMeta extends BlockchainMetaBase {
|
|
121
|
-
type: TransactionType.COSMOS;
|
|
122
|
-
chainId: string;
|
|
123
|
-
info: CosmosChainInfo;
|
|
124
|
-
}
|
|
125
|
-
export interface TransferBlockchainMeta extends BlockchainMetaBase {
|
|
126
|
-
type: TransactionType.TRANSFER;
|
|
127
|
-
chainId: null;
|
|
128
|
-
info: null;
|
|
129
|
-
}
|
|
130
|
-
export type BlockchainMeta = EvmBlockchainMeta | CosmosBlockchainMeta | TransferBlockchainMeta;
|
|
131
|
-
/**
|
|
132
|
-
* Metadata of Swapper
|
|
133
|
-
*
|
|
134
|
-
* @property {string} id - Unique identifier for the swapper
|
|
135
|
-
* @property {string} title - Display name for the swapper
|
|
136
|
-
* @property {string} logo - Icon logo for the swapper
|
|
137
|
-
* @property {string} swapperGroup - Group name for swapper
|
|
138
|
-
* @property {SwapperType[]} types - Type of the transaction supported by the swapper
|
|
139
|
-
*
|
|
140
|
-
*/
|
|
141
|
-
export type SwapperMetaDto = {
|
|
142
|
-
id: string;
|
|
143
|
-
title: string;
|
|
144
|
-
logo: string;
|
|
145
|
-
swapperGroup: string;
|
|
146
|
-
types: SwapperType[];
|
|
147
|
-
};
|
|
148
|
-
/**
|
|
149
|
-
* All metadata info for a token, unique by (blockchain, symbol, address) tuple
|
|
150
|
-
*
|
|
151
|
-
* @property {string} blockchain - The blockchain which this token belongs to
|
|
152
|
-
* @property {string | null} chainId - The chainId which this token belongs to, e.g. 1 for ETH, 56 for BSC and ...
|
|
153
|
-
* @property {string | null} address - Smart contract address of token, null for native tokens
|
|
154
|
-
* @property {string} symbol - The token symbol, e.g: ADA
|
|
155
|
-
* @property {string} name - The token name, e.g: Binance Pegged ETH
|
|
156
|
-
* @property {number} decimals - Decimals of token in blockchain, example: 18
|
|
157
|
-
* @property {string} image - Url of its image, example: https://api.rango.exchange/tokens/ETH/ETH.png
|
|
158
|
-
* @property {string | decimals} usdPrice - The token unit price
|
|
159
|
-
*
|
|
160
|
-
*/
|
|
161
|
-
export type Token = {
|
|
162
|
-
blockchain: string;
|
|
163
|
-
chainId: string | null;
|
|
164
|
-
address: string | null;
|
|
165
|
-
symbol: string;
|
|
166
|
-
name: string;
|
|
167
|
-
decimals: number;
|
|
168
|
-
image: string;
|
|
169
|
-
usdPrice: string | null;
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* Metadata info for all blockchains and tokens supported
|
|
173
|
-
*
|
|
174
|
-
* @property {BlockchainMeta[]} blockchains - List of all supported blockchains
|
|
175
|
-
* @property {Token[]} tokens - List of all tokens
|
|
176
|
-
* @property {SwapperMetaDto[]} swappers - List of all DEXes & Bridges
|
|
177
|
-
*
|
|
178
|
-
*/
|
|
179
|
-
export type MetaResponse = {
|
|
180
|
-
blockchains: BlockchainMeta[];
|
|
181
|
-
tokens: Token[];
|
|
182
|
-
swappers: SwapperMetaDto[];
|
|
183
|
-
};
|
|
1
|
+
export * from 'rango-types/lib/api/basic/meta';
|
|
184
2
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../src/types/api/meta.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAA"}
|
|
@@ -1,44 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Body of quote request
|
|
4
|
-
*
|
|
5
|
-
* @property {Asset} from - The source asset
|
|
6
|
-
* @property {Asset} to - The destination asset
|
|
7
|
-
* @property {string} amount - The human-readable amount of asset X that is going to be swapped, example: 0.28
|
|
8
|
-
* @property {string[]} [swappers] - List of all accepted swappers, an empty list means no filter is required
|
|
9
|
-
* @property {string[]} [messagingProtocols] - List of all messaging protocols, an empty list means no filter is required
|
|
10
|
-
* @property {string} [sourceContract] - Address of your contract on source chain (will be called in case of refund in the source chain)
|
|
11
|
-
* @property {string} [destinationContract] - Address of your contract on destination chain (will be called in case of success/refund in the destination chain)
|
|
12
|
-
* @property {string} [imMessage] - The message that you want to pass to your contract on the destination chain
|
|
13
|
-
* @property {boolean} contractCall - Mark it true if you are going to call this quote via your own contract, so we
|
|
14
|
-
* will filter routes that are not possible to be called from a contract
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
export type QuoteRequest = {
|
|
18
|
-
from: Asset;
|
|
19
|
-
to: Asset;
|
|
20
|
-
amount: string;
|
|
21
|
-
swappers?: string[];
|
|
22
|
-
messagingProtocols?: string[];
|
|
23
|
-
sourceContract?: string;
|
|
24
|
-
destinationContract?: string;
|
|
25
|
-
imMessage?: string;
|
|
26
|
-
contractCall?: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* The response of quote API, if the route field is null, it means that no route is found
|
|
30
|
-
*
|
|
31
|
-
* @property {string} requestId - The unique requestId which is generated for this request by the server. It should be
|
|
32
|
-
* passed down to all other endpoints if this swap continues on. e.g. d10657ce-b13a-405c-825b-b47f8a5016ad
|
|
33
|
-
* @property {string} resultType - Type of result for route (OK or error type)
|
|
34
|
-
* @property {QuoteSimulationResult | null} route - Suggested route
|
|
35
|
-
* @property {string | null} error - Error message
|
|
36
|
-
*
|
|
37
|
-
*/
|
|
38
|
-
export type QuoteResponse = {
|
|
39
|
-
requestId: string;
|
|
40
|
-
resultType: 'OK' | 'HIGH_IMPACT' | 'INPUT_LIMIT_ISSUE' | 'NO_ROUTE';
|
|
41
|
-
route: QuoteSimulationResult | null;
|
|
42
|
-
error: string | null;
|
|
43
|
-
};
|
|
1
|
+
export * from 'rango-types/lib/api/basic/routing';
|
|
44
2
|
//# sourceMappingURL=routing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"routing.d.ts","sourceRoot":"","sources":["../../src/types/api/routing.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA"}
|