order getters

This commit is contained in:
Daniel Lugo 2020-01-13 16:01:37 -04:00
parent f638003543
commit 3b7b5d345c

View file

@ -0,0 +1,15 @@
const Key = require('./key')
/**
* @param {string} pub
* @param {import('./SimpleGUN').GUNNode} gun
* @returns {Promise<string>}
*/
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
}