UNPKG

@thorwallet/xchain-polkadot

Version:

Custom Polkadot client and utilities used by XChainJS clients

47 lines 1.38 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPrefix = exports.getDefaultFees = exports.getDecimal = exports.isSuccess = void 0; const xchain_util_1 = require("@thorwallet/xchain-util"); /** * Check Subscan API response * * @param {SubscanResponse} response The subscan response. * @returns {boolean} `true` or `false` */ const isSuccess = (response) => !response.code; exports.isSuccess = isSuccess; /** * Get the decimal based on the network * * @param {Network} network The network. * @returns {number} The decimal based on the network. */ const getDecimal = (network) => { return network === 'testnet' ? 12 : 10; }; exports.getDecimal = getDecimal; /** * Get the default fees. * * @returns {Fees} The default fees based on the network. */ const getDefaultFees = (network) => { const fee = xchain_util_1.assetToBase(xchain_util_1.assetAmount(0.015, exports.getDecimal(network))); return { type: 'byte', fast: fee, fastest: fee, average: fee, }; }; exports.getDefaultFees = getDefaultFees; /** * Get address prefix based on the network. * * @param {string} network * @returns {string} The address prefix based on the network. * **/ const getPrefix = (network) => (network === 'testnet' ? '5' : '1'); exports.getPrefix = getPrefix; //# sourceMappingURL=util.js.map