@soundsright/chain
Version:
soundsright contracts
61 lines (60 loc) • 2.15 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LocalChain = void 0;
const base_1 = require("./base");
const token_1 = __importDefault(require("./token"));
const nft_1 = __importDefault(require("./nft"));
__exportStar(require("./types"), exports);
__exportStar(require("./base"), exports);
class LocalChain extends base_1.ProviderChain {
constructor(chainId) {
super(chainId);
this.token = new token_1.default(this);
this.nft = new nft_1.default(this);
}
}
exports.LocalChain = LocalChain;
class Chain extends base_1.ConnectorChain {
constructor(supportedChainId) {
super(supportedChainId);
this.token = new token_1.default(this);
this.nft = new nft_1.default(this);
this.setLocalChain();
}
get local() {
return this._local;
}
getLocalChain(chainId) {
return new LocalChain(chainId);
}
setLocalChain() {
if (this.supportedChainId) {
this._local = this.getLocalChain(this.supportedChainId);
}
else {
this._local = undefined;
}
}
setSupportedChainId(chainId) {
super.setSupportedChainId(chainId);
this.setLocalChain();
}
}
exports.default = Chain;