From ade6c77a5fa7a5dcf3997367473a790788c46b63 Mon Sep 17 00:00:00 2001 From: Mahmoud Aboelenein Date: Thu, 14 Mar 2024 12:56:30 +0200 Subject: [PATCH] replace webbtcProviders with btc_providers --- src/provider/index.ts | 14 +++++++------- src/provider/types.ts | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/provider/index.ts b/src/provider/index.ts index e26bd41..34b8e93 100644 --- a/src/provider/index.ts +++ b/src/provider/index.ts @@ -1,4 +1,4 @@ -import { type BitcoinProvider, type WebbtcProvider } from './types'; +import { type BitcoinProvider, type Provider } from './types'; export async function getProviderOrThrow( getProvider?: () => Promise @@ -13,17 +13,17 @@ export async function getProviderOrThrow( return provider; } -export function getProviders(): WebbtcProvider[] { - if (!window.webbtc_providers) window.webbtc_providers = []; - return window.webbtc_providers; +export function getProviders(): Provider[] { + if (!window.btc_providers) window.btc_providers = []; + return window.btc_providers; } export function getProviderById(providerId: string) { - if (Array.isArray(window.webbtc_providers)) { - const provider = window.webbtc_providers.find((provider) => provider.id === providerId); + if (Array.isArray(window.btc_providers)) { + const provider = window.btc_providers.find((provider) => provider.id === providerId); return provider?.id?.split('.').reduce((acc: any, part) => acc?.[part], window); } else { - console.log('window.webbtc_providers is not defined or not an array'); + console.log('window.btc_providers is not defined or not an array'); return undefined; } } diff --git a/src/provider/types.ts b/src/provider/types.ts index 14d0790..7f4ca9a 100644 --- a/src/provider/types.ts +++ b/src/provider/types.ts @@ -31,7 +31,7 @@ export interface BitcoinProvider extends BaseBitcoinProvider { getCapabilities?: (request: string) => Promise; } -export interface WebbtcProvider { +export interface Provider { id: string; name: string; icon: string; @@ -50,6 +50,6 @@ declare global { interface Window { BitcoinProvider?: BitcoinProvider; XverseProviders?: XverseProviders; - webbtc_providers?: WebbtcProvider[]; + btc_providers?: Provider[]; } }