AppleSauce
    Preparing search index...

    Class WalletConnect<Methods>

    Type Parameters

    Index

    Constructors

    Properties

    acceptRelayHint: boolean

    Whether to accept the relay hint from the wallet service

    defaultTimeout: number

    Default timeout for requests

    The preferred encryption method for the wallet

    events$: Observable<Event>

    Shared observable for all wallet response events and notifications

    Shared observable for all wallet notifications

    publishMethod: NostrPublishMethod

    A method that is called when an event needs to be published

    relays$: BehaviorSubject<string[]> = ...

    The relays to use for the connection

    secret: Uint8Array

    The local client signer

    service$: BehaviorSubject<string | undefined> = ...

    The wallet service public key ( unset if waiting for service )

    signer: EventSigner
    subscriptionMethod: NostrSubscriptionMethod

    The active nostr subscription method

    Observable for wallet info updates

    waitForService$: Observable<string>

    An internal observable for listening for the wallet service to connect

    pool: NostrPool | undefined = undefined

    A fallback pool to use if none is pass in when creating the signer

    publishMethod: NostrPublishMethod | undefined = undefined

    A fallback method to use for publishMethod if none is passed in when creating the client

    subscriptionMethod: NostrSubscriptionMethod | undefined = undefined

    A fallback method to use for subscriptionMethod if none is passed in when creating the client

    Accessors

    Methods

    • Call a method and return an observable of results

      Type Parameters

      • K extends string

      Parameters

      • method: K
      • params: Extract<Methods, { method: K }>["request"]["params"]
      • options: { timeout?: number } = {}

      Returns Observable<
          | Extract<Methods, { method: K }>["response"]
          | Extract<Methods, { method: K }>["error"],
      >

    • Request method with generic type

      Type Parameters

      Parameters

      • method: Method["method"]
      • params: Method["request"]["params"]
      • options: { timeout?: number } = {}

      Returns Promise<Method["response"]["result"]>

    • Get wallet balance

      Returns Promise<{ balance: number }>

    • List transactions

      Parameters

      • Optionalparams: {
            from?: number;
            limit?: number;
            offset?: number;
            type?: "incoming" | "outgoing";
            unpaid?: boolean;
            until?: number;
        }

      Returns Promise<{ transactions: Transaction[] }>

    • Look up an invoice by payment hash or invoice string

      Parameters

      • Optionalpayment_hash: string
      • Optionalinvoice: string

      Returns Promise<Transaction>

    • Create a new invoice

      Parameters

      • amount: number
      • Optionaloptions: Omit<
            {
                amount: number;
                description?: string;
                description_hash?: string;
                expiry?: number;
            },
            "amount",
        >

      Returns Promise<Transaction>

    • Listen for a type of notification

      Type Parameters

      Parameters

      • type: T["notification_type"]
      • listener: (notification: T["notification"]) => any

      Returns Subscription

      a method to unsubscribe the listener

    • Pay a lightning invoice

      Parameters

      • invoice: string
      • Optionalamount: number

      Returns Promise<{ fees_paid?: number; preimage: string }>

    • Send a keysend payment

      Parameters

      • pubkey: string
      • amount: number
      • Optionalpreimage: string
      • Optionaltlv_records: { type: number; value: string }[]

      Returns Promise<{ fees_paid?: number; preimage: string }>

    • Pay multiple lightning invoices

      Parameters

      • invoices: { amount?: number; id?: string; invoice: string }[]

      Returns Promise<{ fees_paid?: number; preimage: string }[]>

    • Send multiple keysend payments

      Parameters

      • keysends: {
            amount: number;
            id?: string;
            preimage?: string;
            pubkey: string;
            tlv_records?: { type: number; value: string }[];
        }[]

      Returns Promise<{ fees_paid?: number; preimage: string }[]>

    • Typed request method, returns the result or throws and error

      Type Parameters

      • K extends string

      Parameters

      • method: K
      • params: Extract<Methods, { method: K }>["request"]["params"]
      • options: { timeout?: number } = {}

      Returns Promise<Extract<Methods, { method: K }>["response"]["result"]>

    • Check if the wallet supports a method

      Parameters

      • method: string

      Returns Promise<boolean>

    • Check if the wallet supports notifications

      Returns Promise<boolean>

    • Wait for the wallet service to connect

      Parameters

      • OptionalabortSignal: AbortSignal

      Returns Promise<string>