From 7dcff867271d0b8da675b29d7a70b72cefd1418f Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Fri, 17 Nov 2023 15:03:21 +0700 Subject: [PATCH 1/2] chore: rename sendToAlbyAccount to sendBoostagramToAlbyAccount --- README.md | 2 +- src/client.ts | 20 +++++++++++++++----- src/types.ts | 17 ++++++++++------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index f2b5378..734019d 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ Please have a look a the Alby OAuth2 Wallet API: - keysend - sendPayment - sendBoostagram -- sendToAlbyAccount +- sendBoostagramToAlbyAccount - createWebhookEndpoint - deleteWebhookEndpoint diff --git a/src/client.ts b/src/client.ts index a34fd62..6b3fc17 100644 --- a/src/client.ts +++ b/src/client.ts @@ -17,7 +17,7 @@ import { SendBoostagramRequestParams, SendPaymentRequestParams, SendPaymentResponse, - SendToAlbyRequestParams, + SendBoostagramToAlbyRequestParams, SwapInfoResponse, } from "./types"; @@ -37,6 +37,7 @@ export class Client { } accountBalance( + // eslint-disable-next-line @typescript-eslint/ban-types params: {}, request_options?: Partial, ): Promise { @@ -50,7 +51,11 @@ export class Client { }); } - accountSummary(params: {}, request_options?: Partial) { + accountSummary( + // eslint-disable-next-line @typescript-eslint/ban-types + params: {}, + request_options?: Partial, + ) { return rest({ auth: this.auth, ...this.defaultRequestOptions, @@ -62,6 +67,7 @@ export class Client { } accountInformation( + // eslint-disable-next-line @typescript-eslint/ban-types params: {}, request_options?: Partial, ): Promise { @@ -75,7 +81,11 @@ export class Client { }); } - accountValue4Value(params: {}, request_options?: Partial) { + accountValue4Value( + // eslint-disable-next-line @typescript-eslint/ban-types + params: {}, + request_options?: Partial, + ) { return rest({ auth: this.auth, ...this.defaultRequestOptions, @@ -215,8 +225,8 @@ export class Client { }); } - sendToAlbyAccount( - args: SendToAlbyRequestParams, + sendBoostagramToAlbyAccount( + args: SendBoostagramToAlbyRequestParams, request_options?: Partial, ) { const params = { diff --git a/src/types.ts b/src/types.ts index edc2fe4..8010656 100644 --- a/src/types.ts +++ b/src/types.ts @@ -63,11 +63,11 @@ export abstract class AuthClient { } // https://stackoverflow.com/a/50375286 -export type UnionToIntersection = ( - U extends any ? (k: U) => void : never -) extends (k: infer I) => void - ? I - : never; +export type UnionToIntersection = + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (U extends any ? (k: U) => void : never) extends (k: infer I) => void + ? I + : never; export type GetSuccess = { [K in SuccessStatus & keyof T]: GetContent; @@ -85,7 +85,7 @@ export type ExtractAlbyResponse = "responses" extends keyof T ? GetSuccess : never; -export type GetInvoicesRequestParams = { +export type GetInvoicesRequestParams = { q?: { since?: string; created_at_lt?: string; @@ -123,7 +123,10 @@ export type SendBoostagramRequestParams = { amount: number; }; -export type SendToAlbyRequestParams = { +export type SendBoostagramToAlbyRequestParams = { + /** + * the keysend custom value found at https://getalby.com/node + */ account: string; amount: number; memo?: string; From 71caa1a592661fc8e27a17d548d8341cfea8e198 Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Fri, 17 Nov 2023 16:03:15 +0700 Subject: [PATCH 2/2] fix: deprecate sendToAlbyAccount instead of removing --- src/client.ts | 10 ++++++++++ src/types.ts | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/client.ts b/src/client.ts index 6b3fc17..b549e30 100644 --- a/src/client.ts +++ b/src/client.ts @@ -225,6 +225,16 @@ export class Client { }); } + /** + * @deprecated please use sendBoostagramToAlbyAccount + */ + sendToAlbyAccount( + args: SendBoostagramToAlbyRequestParams, + request_options?: Partial, + ) { + return this.sendBoostagramToAlbyAccount(args, request_options); + } + sendBoostagramToAlbyAccount( args: SendBoostagramToAlbyRequestParams, request_options?: Partial, diff --git a/src/types.ts b/src/types.ts index 8010656..7c36b85 100644 --- a/src/types.ts +++ b/src/types.ts @@ -132,6 +132,11 @@ export type SendBoostagramToAlbyRequestParams = { memo?: string; }; +/** + * @deprecated please use SendBoostagramToAlbyRequestParams + */ +export type SendToAlbyRequestParams = SendBoostagramToAlbyRequestParams; + export type CreateWebhookEndpointParams = { url: string; description?: string;