UNPKG

@1hive/connect-core

Version:

Access and interact with Aragon Organizations and their apps.

45 lines 1.69 kB
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); }; var _installedApps; export default class ForwardingPathDescription { constructor(describedSteps, installedApps) { _installedApps.set(this, void 0); __classPrivateFieldSet(this, _installedApps, installedApps); this.describedSteps = describedSteps; } // Return a tree that can get used to render the path. tree() { const docoratedStep = this.describedSteps.map(async (step) => { const app = __classPrivateFieldGet(this, _installedApps).find((app) => app.address === step.to); if (app) { return { ...step, app, }; } }); return []; } // Renders the forwarding path description as text toString() { return this.tree().toString(); } // TBD: a utility that makes it easy to render the tree, // e.g. as a nested list in HTML or React. reduce(callback) { } } _installedApps = new WeakMap(); export { describePath, describeTransaction } from './describe'; export { decodeForwardingPath } from './decode'; //# sourceMappingURL=index.js.map