Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function fetchContacts(
kit: ContractKit
): Promise<{ rawContacts: ContactsById; phoneNumbersByAddress: PhoneNumberMappingEntryByAddress }> {
const contacts = await getContactsAsync({
fields: [Fields.PhoneNumbers, Fields.Image],
})
const filteredContacts = contacts.data.filter((contact) => {
return (
contact.phoneNumbers && find(contact.phoneNumbers, (p) => isValidPhoneNumber(p) !== undefined)
)
})
const rawContacts = fromPairs(filteredContacts.map((contact) => [contact.id, contact]))
// @ts-ignore
const phoneNumbersToContacts = createPhoneNumberToContactMapping(filteredContacts)
const phoneNumbersByAddress = await lookupPhoneNumbersOnAttestations(kit, phoneNumbersToContacts)
return {