diff --git a/lib/index.js b/lib/index.js index 01396b4..f062a4e 100644 --- a/lib/index.js +++ b/lib/index.js @@ -405,6 +405,18 @@ function initRecord(peer, config) { return record } + /** + * @public + * @param {string} subdomain + * @returns {string} + */ + function getFeedID(subdomain) { + if (!accountID) throw new Error('Cannot getFeedID() before loading') + assertDBPlugin(peer) + const domain = fromSubdomain(subdomain) + return MsgV3.getMootID(accountID, domain) + } + /** * @public * @param {Msg} msg @@ -517,6 +529,7 @@ function initRecord(peer, config) { load, update, read, + getFeedID, isRoot, isGhostable, getFieldRoots, diff --git a/test/index.test.js b/test/index.test.js index 17b94c0..c396cdc 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -143,6 +143,8 @@ test('Record isGhostable', (t) => { const moot = MsgV3.createMoot(aliceID, 'record_v1__profile', aliceKeypair) const mootID = MsgV3.getMsgID(moot) + assert.equal(mootID, peer.record.getFeedID('profile'), 'getFeedID') + const tangle = peer.db.getTangle(mootID) const msgIDs = tangle.topoSort()