Nip01Event class
basic nostr nip01 event data structure
- Implementers
Constructors
-
Nip01Event({required String pubKey, required int kind, required List<
List< tags, required String content, int createdAt = 0})String> > - Creates a new Nostr event.
- Nip01Event.fromJson(Map data)
-
factory
Properties
- content ↔ String
-
Event content.
getter/setter pair
- createdAt ↔ int
-
Event creation timestamp in Unix time.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setteroverride
- id ↔ String
-
The event ID is a 32-byte SHA256 hash of the serialised event data.
getter/setter pair
- isIdValid → bool
-
is Id valid?
no setter
- kind → int
-
Event kind identifier (e.g. text_note, set_metadata, etc).
final
- powCommitment → int
-
Calculate the commitment (work done) for this event
no setter
- powDifficulty → int
-
Get the proof of work difficulty of this event
no setter
-
pTags
→ List<
String> -
return all
ptags in eventno setter - pubKey → String
-
The event author's public key.
final
-
replyETags
→ List<
String> -
return all e tags in event that have a
replymarkerno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sig ↔ String
-
64-byte Schnorr signature of Nip01Event.id.
getter/setter pair
-
sources
↔ List<
String> -
Relay that an event was received from
getter/setter pair
-
A JSON array of event tags.
getter/setter pair
- targetPoWDifficulty → int?
-
Get the target difficulty from nonce tag if present
no setter
-
tTags
→ List<
String> -
return all
ttags in eventno setter - validSig ↔ bool?
-
has signature been validated?
getter/setter pair
Methods
-
checkPoWDifficulty(
int targetDifficulty) → bool - Check if this event meets a specific difficulty target
-
copyWith(
{String? pubKey, int? createdAt, int? kind, List< List< ? tags, String? content, String? sig, List<String> >String> ? sources}) → Nip01Event -
getDtag(
) → String? -
return first found
dtag -
getEId(
) → String? -
return first
etag found -
getFirstTag(
String name) → String? - Get first tag matching given name
-
getTags(
String tag) → List< String> -
return all tags that match given
tage.g. 'p' -
minePoW(
int targetDifficulty, {int? maxIterations}) → Nip01Event - Mine this event with proof of work
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sign(
String privateKey) → void -
sign the event with given privateKey
WARNonly for testing! Use EventSigner to sign events in production -
toBase64(
) → String - Returns the Event object as a base64-encoded JSON string
-
toJson(
) → Map< String, dynamic> - Returns the Event object as a JSON object
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
secondsSinceEpoch(
) → int - seconds since epoch
Constants
- kTextNodeKind → const int