fortress-js
Version:
A JavaScript SDK for Binance Smart Chain and the Fortress Protocol.
61 lines (60 loc) • 1.85 kB
TypeScript
/**
* @file Utility
* @desc These methods are helpers for the Fortress class.
*/
import { AbiType } from './types';
/**
* A generic HTTP request method that works in Node.js and the Web Browser.
*
* @param {object} options HTTP request options. See Node.js http.request
* documentation for details.
*
* @hidden
*
* @returns {Promise<object>} Returns a promise and eventually an HTTP response
* (JavaScript object).
*/
export declare function request(options: any): Promise<any>;
/**
* Gets the contract address of the named contract. This method supports
* contracts used by the Fortress Protocol.
*
* @param {string} contract The name of the contract.
* @param {string} [network] Optional name of the Ethereum network. Main net and
* all the popular public test nets are supported.
*
* @returns {string} Returns the address of the contract.
*
* @example
* ```
* console.log('fBNB Address: ', Fortress.util.getAddress(Fortress.fBNB));
* ```
*/
export declare function getAddress(contract: string, network?: string): string;
/**
* Gets a contract ABI as a JavaScript array. This method supports
* contracts used by the Fortress Protocol.
*
* @param {string} contract The name of the contract.
*
* @returns {Array} Returns the ABI of the contract as a JavaScript array.
*
* @example
* ```
* console.log('fBNB ABI: ', Fortress.util.getAbi(Fortress.fBNB));
* ```
*/
export declare function getAbi(contract: string): AbiType[];
/**
* Gets the name of an Ethereum network based on its chain ID.
*
* @param {string} chainId The chain ID of the network.
*
* @returns {string} Returns the name of the Ethereum network.
*
* @example
* ```
* console.log('testnet : ', Fortress.util.getNetNameWithChainId(97));
* ```
*/
export declare function getNetNameWithChainId(chainId: number): string;