@unruggable/gateways
Version:
Trustless Ethereum Multichain CCIP-Read Gateway
24 lines (23 loc) • 494 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Wrapped = void 0;
exports.unwrap = unwrap;
function unwrap(x) {
return x instanceof Wrapped ? x.get() : x;
}
class Wrapped {
payload;
init;
value;
constructor(payload, init) {
this.payload = payload;
this.init = init;
}
get() {
if (!this.value) {
this.value = this.init();
}
return this.value;
}
}
exports.Wrapped = Wrapped;