Class NDKUser

Represents a pubkey.

Hierarchy

  • NDKUser

Constructors

Properties

follows: ((...args: [opts?: NDKSubscriptionOptions, outbox?: boolean, kind: number]) => Promise<Set<NDKUser>>) = ...

Type declaration

ndk: undefined | default
nip46Urls: string[] = []
profile?: NDKUserProfile
relayUrls: string[] = []

Accessors

  • get hexpubkey(): string
  • Get the user's hexpubkey

    Returns string

    The user's hexpubkey

    Deprecated

    Use pubkey instead

  • set hexpubkey(pubkey: string): void
  • Set the user's hexpubkey

    Parameters

    • pubkey: string

      {Hexpubkey} The user's hexpubkey

    Returns void

    Deprecated

    Use pubkey instead

  • get pubkey(): string
  • Get the user's pubkey

    Returns string

    The user's pubkey

  • set pubkey(pubkey: string): void
  • Set the user's pubkey

    Parameters

    • pubkey: string

      {string} The user's pubkey

    Returns void

Methods

  • Add a follow to this user's contact list

    Parameters

    • newFollow: NDKUser

      {NDKUser} The user to follow

    • Optional currentFollowList: Set<NDKUser>

      {Set} The current follow list

    • kind: NDKKind = NDKKind.Contacts

      {NDKKind} The kind to use for this contact list (defaults to 3)

    Returns Promise<boolean>

    True if the follow was added, false if the follow already exists

  • Get the tags that can be used to reference this user in an event

    Parameters

    • Optional marker: string

    Returns NDKTag[]

    an array of NDKTag

  • Validate a user's NIP-05 identifier (usually fetched from their kind:0 profile data)

    Parameters

    • nip05Id: string

      The NIP-05 string to validate

    Returns Promise<null | boolean>

    True if the NIP-05 is found and matches this user's pubkey, False if the NIP-05 is found but doesn't match this user's pubkey, null if the NIP-05 isn't found on the domain or we're unable to verify (because of network issues, etc.)

  • Zap a user

    Parameters

    • amount: number

      The amount to zap in millisatoshis

    • Optional comment: string

      A comment to add to the zap request

    • Optional extraTags: NDKTag[]

      Extra tags to add to the zap request

    • Optional signer: NDKSigner

      The signer to use (will default to the NDK instance's signer)

    Returns Promise<null | string>

  • Instantiate an NDKUser from a NIP-05 string

    Parameters

    • nip05Id: string

      {string} The user's NIP-05

    • Optional ndk: default

      {NDK} An NDK instance

    • skipCache: boolean = false

      {boolean} Whether to skip the cache or not

    Returns Promise<undefined | NDKUser>

    An NDKUser if one is found for the given NIP-05, undefined otherwise.

Generated using TypeDoc