Skip to content

Commit

Permalink
chore: rename supportsMethod to supports
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed May 14, 2024
1 parent 933f99c commit b19cc25
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/components/bc-button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ export class Button extends withTwind()(BitcoinConnectElement) {

this._showBalance =
store.getState().bitcoinConnectConfig.showBalance &&
store.getState().supportsMethod('getBalance');
store.getState().supports('getBalance');

// TODO: handle unsubscribe
store.subscribe((store) => {
this._showBalance =
store.bitcoinConnectConfig.showBalance &&
store.supportsMethod('getBalance');
store.bitcoinConnectConfig.showBalance && store.supports('getBalance');
});
}

Expand Down
5 changes: 2 additions & 3 deletions src/components/bc-start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ export class Start extends withTwind()(BitcoinConnectElement) {

this._showBalance =
store.getState().bitcoinConnectConfig.showBalance &&
store.getState().supportsMethod('getBalance');
store.getState().supports('getBalance');

// TODO: handle unsubscribe
store.subscribe((store) => {
this._showBalance =
store.bitcoinConnectConfig.showBalance &&
store.supportsMethod('getBalance');
store.bitcoinConnectConfig.showBalance && store.supports('getBalance');
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/state/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface Store {
clearRouteHistory(): void;
setModalOpen(modalOpen: boolean): void;
setCurrency(currency: string | undefined): void;
supportsMethod(weblnMethod: WebLNMethod): boolean;
supports(weblnMethod: WebLNMethod): boolean;

// provider functions
// getBalance(): Promise<number | undefined>;
Expand Down Expand Up @@ -152,7 +152,7 @@ const store = createStore<Store>((set, get) => ({
set({currency});
},
// TODO: move this method to Alby JS SDK NWCCLient
supportsMethod: (method: WebLNMethod) => {
supports: (method: WebLNMethod) => {
const {info, provider} = get();

return (
Expand Down

0 comments on commit b19cc25

Please sign in to comment.