@celo/contractkit
Version:
Celo's ContractKit to interact with Celo network
23 lines • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.newContractVersion = exports.ContractVersion = void 0;
const semverGte = require('semver/functions/gte');
/** @internal */
class ContractVersion {
constructor(storage, major, minor, patch) {
this.storage = storage;
this.major = major;
this.minor = minor;
this.patch = patch;
this.toSemver = () => `${this.storage}.${this.major}.${this.minor}`;
this.isAtLeast = (other) => semverGte(this.toSemver(), other.toSemver());
this.toString = () => this.toSemver().concat(`.${this.patch}`);
this.toRaw = () => [this.storage, this.major, this.minor, this.patch];
}
}
exports.ContractVersion = ContractVersion;
ContractVersion.fromRaw = (raw) => new ContractVersion(raw[0], raw[1], raw[2], raw[3]);
/** @internal */
const newContractVersion = (storage, major, minor, patch) => new ContractVersion(storage, major, minor, patch);
exports.newContractVersion = newContractVersion;
//# sourceMappingURL=versions.js.map