fromGiftWrap method

Future<Nip01Event> fromGiftWrap({
  1. required Nip01Event giftWrap,
})

Unwraps a gift-wrapped event to retrieve the original rumor
giftWrap the gift-wrapped event to unwrap
returns the original rumor event

Implementation

Future<Nip01Event> fromGiftWrap({
  required Nip01Event giftWrap,
}) async {
  if (giftWrap.kind != kGiftWrapEventkind) {
    throw Exception("Event is not a gift wrap (kind:1059)");
  }

  final sealEvent = await unwrapEvent(wrappedEvent: giftWrap);
  final rumor = await unsealRumor(sealedEvent: sealEvent);

  return rumor;
}