Use keyword arguments for User#create_event
This allows for code completion and fixes another RBS issue
This commit is contained in:
parent
2c44ae4ee8
commit
3fffcd1a4e
@ -47,17 +47,26 @@ module Nostr
|
|||||||
# content: 'Your feedback is appreciated, now pay $8'
|
# content: 'Your feedback is appreciated, now pay $8'
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
# @param event_attributes [Hash]
|
# @param created_at [Integer] Date of the creation of the vent. A UNIX timestamp, in seconds.
|
||||||
# @option event_attributes [String] :pubkey 32-bytes hex-encoded public key of the event creator.
|
# @param kind [Integer] The kind of the event. An integer from 0 to 3.
|
||||||
# @option event_attributes [Integer] :created_at Date of the creation of the vent. A UNIX timestamp, in seconds.
|
# @param tags [Array<Array>] An array of tags. Each tag is an array of strings.
|
||||||
# @option event_attributes [Integer] :kind The kind of the event. An integer from 0 to 3.
|
# @param content [String] Arbitrary string.
|
||||||
# @option event_attributes [Array<Array>] :tags An array of tags. Each tag is an array of strings.
|
|
||||||
# @option event_attributes [String] :content Arbitrary string.
|
|
||||||
#
|
#
|
||||||
# @return [Event]
|
# @return [Event]
|
||||||
#
|
#
|
||||||
def create_event(event_attributes)
|
def create_event(
|
||||||
event = Event.new(**event_attributes.merge(pubkey: keypair.public_key))
|
kind:,
|
||||||
|
content:,
|
||||||
|
created_at: Time.now.to_i,
|
||||||
|
tags: []
|
||||||
|
)
|
||||||
|
event = Event.new(
|
||||||
|
pubkey: keypair.public_key,
|
||||||
|
kind:,
|
||||||
|
content:,
|
||||||
|
created_at:,
|
||||||
|
tags:
|
||||||
|
)
|
||||||
event.sign(keypair.private_key)
|
event.sign(keypair.private_key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,14 +5,10 @@ module Nostr
|
|||||||
|
|
||||||
def initialize: (?keypair: KeyPair | nil, ?keygen: Keygen) -> void
|
def initialize: (?keypair: KeyPair | nil, ?keygen: Keygen) -> void
|
||||||
def create_event: (
|
def create_event: (
|
||||||
{
|
|
||||||
pubkey: String,
|
|
||||||
created_at: Integer,
|
|
||||||
kind: Integer,
|
kind: Integer,
|
||||||
tags: Array[String],
|
|
||||||
content: String,
|
content: String,
|
||||||
created_at: Integer,
|
?created_at: Integer,
|
||||||
}
|
?tags: Array[Array[String]],
|
||||||
) -> Event
|
) -> Event
|
||||||
|
|
||||||
private
|
private
|
||||||
|
Loading…
x
Reference in New Issue
Block a user