|
|
@@ -235,8 +235,7 @@ class BankClient {
|
|
|
}
|
|
|
getOrCreateContact(peerId, contactAddr) {
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
- const contactList = yield this.retrievePrivate(peerId, '📇');
|
|
|
- const itemList = yield this.getItemsForCommaList(contactList);
|
|
|
+ const itemList = yield this.getAllContacts(peerId);
|
|
|
// console.log('contact hash for', contact, type, 'is', contactHash);
|
|
|
const existing = itemList.filter(item => item.addrs && item.addrs.includes(contactAddr))[0];
|
|
|
if (existing != null) {
|
|
|
@@ -253,10 +252,15 @@ class BankClient {
|
|
|
return newItem;
|
|
|
});
|
|
|
}
|
|
|
- getContactById(peerId, contactId) {
|
|
|
+ getAllContacts(peerId) {
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
const contactList = yield this.retrievePrivate(peerId, '📇');
|
|
|
- const itemList = yield this.getItemsForCommaList(contactList);
|
|
|
+ return yield this.getItemsForCommaList(contactList);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ getContactById(peerId, contactId) {
|
|
|
+ return __awaiter(this, void 0, void 0, function* () {
|
|
|
+ const itemList = yield this.getAllContacts(peerId);
|
|
|
const existing = itemList.filter(item => item.id === contactId)[0];
|
|
|
if (!existing) {
|
|
|
throw new Error('Cannot find contact with id ' + contactId);
|