Skip to content

Commit

Permalink
Merge pull request #139 from getAlby/chore/rename-send-to-alby-account
Browse files Browse the repository at this point in the history
chore: rename sendToAlbyAccount to sendBoostagramToAlbyAccount
  • Loading branch information
rolznz authored Nov 17, 2023
2 parents 9f4b7da + 71caa1a commit ddd7df4
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ Please have a look a the Alby OAuth2 Wallet API:
- keysend
- sendPayment
- sendBoostagram
- sendToAlbyAccount
- sendBoostagramToAlbyAccount
- createWebhookEndpoint
- deleteWebhookEndpoint
Expand Down
28 changes: 24 additions & 4 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
SendBoostagramRequestParams,
SendPaymentRequestParams,
SendPaymentResponse,
SendToAlbyRequestParams,
SendBoostagramToAlbyRequestParams,
SwapInfoResponse,
} from "./types";

Expand All @@ -37,6 +37,7 @@ export class Client {
}

accountBalance(
// eslint-disable-next-line @typescript-eslint/ban-types
params: {},
request_options?: Partial<RequestOptions>,
): Promise<GetAccountBalanceResponse> {
Expand All @@ -50,7 +51,11 @@ export class Client {
});
}

accountSummary(params: {}, request_options?: Partial<RequestOptions>) {
accountSummary(
// eslint-disable-next-line @typescript-eslint/ban-types
params: {},
request_options?: Partial<RequestOptions>,
) {
return rest({
auth: this.auth,
...this.defaultRequestOptions,
Expand All @@ -62,6 +67,7 @@ export class Client {
}

accountInformation(
// eslint-disable-next-line @typescript-eslint/ban-types
params: {},
request_options?: Partial<RequestOptions>,
): Promise<GetAccountInformationResponse> {
Expand All @@ -75,7 +81,11 @@ export class Client {
});
}

accountValue4Value(params: {}, request_options?: Partial<RequestOptions>) {
accountValue4Value(
// eslint-disable-next-line @typescript-eslint/ban-types
params: {},
request_options?: Partial<RequestOptions>,
) {
return rest({
auth: this.auth,
...this.defaultRequestOptions,
Expand Down Expand Up @@ -215,8 +225,18 @@ export class Client {
});
}

/**
* @deprecated please use sendBoostagramToAlbyAccount
*/
sendToAlbyAccount(
args: SendToAlbyRequestParams,
args: SendBoostagramToAlbyRequestParams,
request_options?: Partial<RequestOptions>,
) {
return this.sendBoostagramToAlbyAccount(args, request_options);
}

sendBoostagramToAlbyAccount(
args: SendBoostagramToAlbyRequestParams,
request_options?: Partial<RequestOptions>,
) {
const params = {
Expand Down
22 changes: 15 additions & 7 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ export abstract class AuthClient {
}

// https://stackoverflow.com/a/50375286
export type UnionToIntersection<U> = (
U extends any ? (k: U) => void : never
) extends (k: infer I) => void
? I
: never;
export type UnionToIntersection<U> =
// 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<T> = {
[K in SuccessStatus & keyof T]: GetContent<T[K]>;
Expand All @@ -85,7 +85,7 @@ export type ExtractAlbyResponse<T> = "responses" extends keyof T
? GetSuccess<T["responses"]>
: never;

export type GetInvoicesRequestParams = {
export type GetInvoicesRequestParams = {
q?: {
since?: string;
created_at_lt?: string;
Expand Down Expand Up @@ -123,12 +123,20 @@ 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;
};

/**
* @deprecated please use SendBoostagramToAlbyRequestParams
*/
export type SendToAlbyRequestParams = SendBoostagramToAlbyRequestParams;

export type CreateWebhookEndpointParams = {
url: string;
description?: string;
Expand Down

0 comments on commit ddd7df4

Please sign in to comment.