Skip to content
Michael Bumann edited this page Mar 25, 2022 · 3 revisions

Currently the connectors roughly implement the WebLN spec. This will change in the future as we will need more functionality and response data internally.

Every connector must implement the following methods. You can find the detailed TypeScript interface here.

getInfo

Parameters

none

Return

interface GetInfoResponse = {
  alias: string;
  pubkey?: string;
  color?: string;
}

getBalance

Parameters

none

Return

interface GetBalanceResponse = {
  balance: number; // in satoshi
}

Example

return {
  data: {
    balance: data.balance,
  },
};

sendPayment

Parameters

interface SendPaymentParams {
  paymentRequest: string;
}

Return

interface SendPaymentResponse {
  preimage: string;
  paymentHash: string;
  route: Route;
}

// TODO capitalize Route attributes (total_amt => totalAmt)
interface Route {
  total_amt: string;
  total_fees: number;
}

Example

return {
  data: {
    preimage: data.payment_preimage,
    paymentHash: data.payment_hash,
    route: data.payment_route,
  },
};

keysend

Parameters

interface KeysendArgs {
  pubkey: string;
  amount: number;
  customRecords: Record<string, string>;
}

Return

interface SendPaymentResponse {
  preimage: string;
  paymentHash: string;
  route: Route;
}

// TODO capitalize Route attributes (total_amt => totalAmt)
interface Route {
  total_amt: string;
  total_fees: number;
}

Example

return {
  data: {
    preimage: data.payment_preimage,
    paymentHash: data.payment_hash,
    route: data.payment_route,
  },
};

makeInvoice

Parameters

interface MakeInvoiceParams {
  amount: number;
  memo: string;
}

Return

Success

interface MakeInvoiceResponse {
  paymentRequest: string;
  rHash: string;
}
Clone this wiki locally