order getters
This commit is contained in:
parent
f638003543
commit
3b7b5d345c
1 changed files with 15 additions and 0 deletions
15
services/gunDB/contact-api/getters.js
Normal file
15
services/gunDB/contact-api/getters.js
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue