@dorgtech/daocomponents
Version:
Componentizing [DAOstack's client library](https://github.com/daostack/client), enabling easier React application integration. The hope is to be able to turn any app into a DAO enabled dApp by adding ~2 components.
111 lines • 4.12 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var React = require("react");
var runtime_1 = require("../runtime");
exports.ComponentLogs = runtime_1.ComponentLogs;
var ContextFeed_1 = require("../runtime/ContextFeed");
var protocol_1 = require("../protocol");
var client_1 = require("@daostack/client");
exports.RewardEntity = client_1.Reward;
var ArcReward = /** @class */ (function (_super) {
__extends(ArcReward, _super);
function ArcReward() {
return _super !== null && _super.apply(this, arguments) || this;
}
ArcReward.prototype.createEntity = function () {
var _a = this.props, id = _a.id, arcConfig = _a.arcConfig;
if (!arcConfig) {
throw Error("Arc Config Missing: Please provide this field as a prop, or use the inference component.");
}
return new client_1.Reward(id, arcConfig.connection);
};
Object.defineProperty(ArcReward, "Entity", {
get: function () {
return ContextFeed_1.CreateContextFeed(this._EntityContext.Consumer, this._LogsContext.Consumer);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ArcReward, "Data", {
get: function () {
return ContextFeed_1.CreateContextFeed(this._DataContext.Consumer, this._LogsContext.Consumer);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ArcReward, "Code", {
get: function () {
return ContextFeed_1.CreateContextFeed(this._CodeContext.Consumer, this._LogsContext.Consumer);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ArcReward, "Logs", {
get: function () {
return ContextFeed_1.CreateContextFeed(this._LogsContext.Consumer, this._LogsContext.Consumer);
},
enumerable: true,
configurable: true
});
ArcReward._EntityContext = React.createContext({});
ArcReward._DataContext = React.createContext({});
ArcReward._CodeContext = React.createContext({});
ArcReward._LogsContext = React.createContext({});
return ArcReward;
}(runtime_1.Component));
exports.ArcReward = ArcReward;
var Reward = /** @class */ (function (_super) {
__extends(Reward, _super);
function Reward() {
return _super !== null && _super.apply(this, arguments) || this;
}
Reward.prototype.render = function () {
var _a = this.props, id = _a.id, children = _a.children;
return (React.createElement(protocol_1.Arc.Config, null, function (arc) { return (React.createElement(ArcReward, { id: id, arcConfig: arc }, children)); }));
};
Object.defineProperty(Reward, "Entity", {
get: function () {
return ArcReward.Entity;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Reward, "Data", {
get: function () {
return ArcReward.Data;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Reward, "Code", {
get: function () {
return ArcReward.Code;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Reward, "Logs", {
get: function () {
return ArcReward.Logs;
},
enumerable: true,
configurable: true
});
return Reward;
}(React.Component));
exports.Reward = Reward;
exports.default = Reward;
//# sourceMappingURL=Reward.js.map