diff --git a/services/gunDB/contact-api/getters.js b/services/gunDB/contact-api/getters.js new file mode 100644 index 00000000..7687fdbb --- /dev/null +++ b/services/gunDB/contact-api/getters.js @@ -0,0 +1,15 @@ +const Key = require('./key') +/** + * @param {string} pub + * @param {import('./SimpleGUN').GUNNode} gun + * @returns {Promise} + */ +exports.currentOrderAddress = async (pub, gun) => { + const currAddr = await gun.user(pub).get(Key.CURRENT_ORDER_ADDRESS).then() + + if (typeof currAddr !== 'string') { + throw new TypeError('Expected user.currentOrderAddress to be an string') + } + + return currAddr +} \ No newline at end of file