barterjs-sdk
Version:
Barter Network SDK
29 lines (28 loc) • 1.09 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EVMNativeCoin = void 0;
const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
const NativeCurrency_1 = require("../NativeCurrency");
const weth9_1 = require("../weth9");
const constants_1 = require("../../constants");
/**
* EVMNativCoin is the main usage of a 'native' currency, i.e. for Ethereum mainnet and all testnets
*/
class EVMNativeCoin extends NativeCurrency_1.NativeCurrency {
constructor(chainId, decimal, symbol, name, logo) {
super(chainId, decimal, constants_1.ZERO_ADDRESS, symbol, name, logo);
}
get wrapped() {
const weth9 = weth9_1.WETH9[this.chainId];
(0, tiny_invariant_1.default)(!!weth9, 'WRAPPED');
return weth9;
}
equals(other) {
return other.isNative && other.chainId === this.chainId;
}
}
exports.EVMNativeCoin = EVMNativeCoin;
EVMNativeCoin._etherCache = {};