barterjs-sdk
Version:
Barter Network SDK
32 lines (31 loc) • 1.23 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BaseCurrency = void 0;
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
/**
* A currency is any fungible financial instrument, including EVMNativCoin, all ERC20 tokens, and other chain-native currencies
*/
class BaseCurrency {
/**
* Constructs an instance of the base class `BaseCurrency`.
* @param chainId the chain ID on which this currency resides
* @param decimals decimals of the currency
* @param address address of the currency
* @param symbol symbol of the currency
* @param name of the currency
* @param logo of the currency
*/
constructor(chainId, decimals, address, symbol, name, logo) {
(0, tiny_invariant_1.default)(decimals >= 0 && decimals < 255 && Number.isInteger(decimals), 'DECIMALS');
this.address = address;
this.chainId = chainId;
this.decimals = decimals;
this.symbol = symbol;
this.name = name;
this.logo = logo;
}
}
exports.BaseCurrency = BaseCurrency;