sendContactList method

Event sendContactList(
  1. ContactList contacts
)

Publishes a contact_list event.

contacts is the contact list to be published.

Note that the transmission of the event to connected relays occurs asynchronously. nostr_dart maintains a message queue for each relay so that messages will be sent one at a time only after the previous message has acknowledged by the relay or a timeout occurs. This requires relays used to support NIP-15 and NIP-20.

The Event returned is the Nostr event that was published.

An ArgumentError is thrown if the private key hasn't been set. A TimeoutException is thrown if no Command Response is received.

Example:

final contacts = ContactList();
final anne = Contact(publicKey: "91cf9..4e5ca", petname: "anne");
contacts.add(anne);
var event = nostr.sendContactList(contacts);

Implementation

Event sendContactList(ContactList contacts) {
  final tags = contacts.toJson();
  final event = Event(_publicKey, EventKind.contactList, tags, "");
  return sendEvent(event);
}