@xchainjs/xchain-thorchain
Version:
Custom Thorchain client and utilities used by XChainJS clients
85 lines (84 loc) • 2.78 kB
TypeScript
import { Network, RootDerivationPaths, TxHash } from '@xchainjs/xchain-client';
import { Address } from '@xchainjs/xchain-util';
import { CompatibleAsset } from './types';
/**
* Function to retrieve default client URLs based on network configuration.
*/
export declare const getDefaultClientUrls: () => Record<Network, string[]>;
/**
* Function to retrieve default root derivation paths based on network configuration.
*/
export declare const getDefaultRootDerivationPaths: () => RootDerivationPaths;
/**
* Function to retrieve default explorers URLs based on network configuration.
*/
export declare const getDefaultExplorers: () => Record<Network, string>;
/**
* Function to generate explorer URLs for addresses based on the network.
*/
export declare const getExplorerAddressUrl: (address: Address) => Record<Network, string>;
/**
* Function to generate explorer URLs for transactions based on the network.
*/
export declare const getExplorerTxUrl: (tx: TxHash) => Record<Network, string>;
/**
* Checks whether an asset is the native RUNE asset
*
* @param {CompatibleAsset} asset
* @returns {boolean} `true` or `false`
*/
export declare const isAssetRuneNative: (asset: CompatibleAsset) => boolean;
/**
* Checks whether an asset is the native TCY asset
*
* @param {CompatibleAsset} asset
* @returns {boolean} `true` or `false`
*/
export declare const isTCYAsset: (asset: CompatibleAsset) => boolean;
/**
* Get denomination from Asset
*
* @param {CompatibleAsset} asset
* @returns {string} The denomination of the given asset
*/
export declare const getDenom: (asset: CompatibleAsset) => string;
/**
* Get chain id from node url
*
* @param {string} nodeUrl
* @returns {Promise<string>} the chainId
*/
export declare const getChainId: (nodeUrl: string) => Promise<string>;
/**
* Get address prefix by network
* @param {Network} network The network of which return the prefix
* @returns The address prefix
*/
export declare const getPrefix: (network: Network) => string;
/**
* Parse the derivation path from a string to an Array of numbers
* @param {string} path - Path to parse
* @returns {number[]} - The derivation path as Array of numbers
*/
export declare const parseDerivationPath: (path: string) => number[];
/**
* Sort JSON object
* @param {any} obj - JSON object
* @returns {any} JSON object sorted
*/
export declare function sortedObject(obj: any): any;
/**
* Returns a JSON string with objects sorted by key
* */
export declare function sortAndStringifyJson(obj: any): string;
/**
* Parse XChainJS asset to Thornode asset
*/
export declare const parseAssetToTHORNodeAsset: (asset: CompatibleAsset) => {
chain: string;
symbol: string;
ticker: string;
synth: boolean;
trade: boolean;
secured: boolean;
};