diff --git a/src/adapters/index.ts b/src/adapters/index.ts index dbe0b2d..6ac13ec 100644 --- a/src/adapters/index.ts +++ b/src/adapters/index.ts @@ -8,6 +8,8 @@ export const DefaultAdaptersInfo: Record = { id: 'XverseProviders.BitcoinProvider', name: 'Xverse', webUrl: 'https://www.xverse.app/', + googlePlayStoreUrl: 'https://play.google.com/store/apps/details?id=com.secretkeylabs.xverse', + iOSAppStoreUrl: 'https://apps.apple.com/app/xverse-bitcoin-web3-wallet/id1552272513', chromeWebStoreUrl: 'https://chromewebstore.google.com/detail/xverse-wallet/idnnbdplmphpflfnlkomgpfbpcgelopg', icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyIiBoZWlnaHQ9IjEwMiIgdmlld0JveD0iMCAwIDEwMiAxMDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGlkPSJJY29uX0FydCAoRWRpdCBNZSkiPgo8cmVjdCB3aWR0aD0iMTAyIiBoZWlnaHQ9IjEwMiIgZmlsbD0iIzE4MTgxOCIvPgo8ZyBpZD0iTG9nby9FbWJsZW0iIGNsaXAtcGF0aD0idXJsKCNjbGlwMF8yMF8xMjIzKSI+CjxwYXRoIGlkPSJWZWN0b3IiIGQ9Ik03NC42NTQyIDczLjg4ODNWNjUuMjMxMkM3NC42NTQyIDY0Ljg4OCA3NC41MTc3IDY0LjU2MDYgNzQuMjc0NSA2NC4zMTc0TDM3LjQzOTcgMjcuNDgyNUMzNy4xOTY1IDI3LjIzOTIgMzYuODY5MSAyNy4xMDI4IDM2LjUyNTggMjcuMTAyOEgyNy44NjlDMjcuNDQxNiAyNy4xMDI4IDI3LjA5MzggMjcuNDUwNiAyNy4wOTM4IDI3Ljg3OFYzNS45MjExQzI3LjA5MzggMzYuMjY0NCAyNy4yMzAyIDM2LjU5MTcgMjcuNDczNCAzNi44MzVMNDAuNjk1MiA1MC4wNTY3QzQwLjk5NzUgNTAuMzU5M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MjA5NiA2NC43MDE0IDI3LjM1NTFMNTQuODA1NiAzNy4yMzVDNTQuMzE0NSAzNy43MjYgNTQuNjYyMyAzOC41NjcyIDU1LjM1NTcgMzguNTY3Mkg1NS4zNThaIiBmaWxsPSIjRUU3QTMwIi8+CjwvZz4KPC9nPgo8ZGVmcz4KPGNsaXBQYXRoIGlkPSJjbGlwMF8yMF8xMjIzIj4KPHJlY3Qgd2lkdGg9IjQ3LjgxMjUiIGhlaWdodD0iNDcuODEyNSIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI3LjA5MzggMjcuMDkzOCkiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K', diff --git a/src/adapters/unisat.ts b/src/adapters/unisat.ts index dba01be..07b91cb 100644 --- a/src/adapters/unisat.ts +++ b/src/adapters/unisat.ts @@ -12,6 +12,7 @@ import { SatsConnectAdapter } from './satsConnectAdapter'; import { RpcErrorCode, RpcResult } from '../types'; import { AddressType, getAddressInfo } from 'bitcoin-address-validation'; import { Address, AddressPurpose } from '../addresses'; +import { DefaultAdaptersInfo } from '.'; type InputType = { index: number; @@ -66,7 +67,7 @@ function convertSignInputsToInputType( } class UnisatAdapter extends SatsConnectAdapter { - id = 'unisat'; + id = DefaultAdaptersInfo.unisat.id; private async getAccounts(params: GetAccountsParams): Promise> { const { purposes } = params; diff --git a/src/adapters/xverse.ts b/src/adapters/xverse.ts index ed998f0..2a2084a 100644 --- a/src/adapters/xverse.ts +++ b/src/adapters/xverse.ts @@ -2,9 +2,10 @@ import { Params, Requests } from '../request'; import { SatsConnectAdapter } from './satsConnectAdapter'; import { request } from '../request'; import { RpcResult } from '../types'; +import { DefaultAdaptersInfo } from '.'; class XverseAdapter extends SatsConnectAdapter { - id = 'XverseProviders.BitcoinProvider'; + id = DefaultAdaptersInfo.xverse.id; request = async ( method: Method, diff --git a/src/ui/index.ts b/src/ui/index.ts index 57c589b..3b66f23 100644 --- a/src/ui/index.ts +++ b/src/ui/index.ts @@ -1,32 +1,22 @@ -import { SupportedWallet } from 'src/provider'; +import { DefaultAdaptersInfo } from '../adapters'; +import { SupportedWallet } from '../provider'; export interface Config { providers: SupportedWallet[]; } -export const xverseIcon = - 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyIiBoZWlnaHQ9IjEwMiIgdmlld0JveD0iMCAwIDEwMiAxMDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGlkPSJJY29uX0FydCAoRWRpdCBNZSkiPgo8cmVjdCB3aWR0aD0iMTAyIiBoZWlnaHQ9IjEwMiIgZmlsbD0iIzE4MTgxOCIvPgo8ZyBpZD0iTG9nby9FbWJsZW0iIGNsaXAtcGF0aD0idXJsKCNjbGlwMF8yMF8xMjIzKSI+CjxwYXRoIGlkPSJWZWN0b3IiIGQ9Ik03NC42NTQyIDczLjg4ODNWNjUuMjMxMkM3NC42NTQyIDY0Ljg4OCA3NC41MTc3IDY0LjU2MDYgNzQuMjc0NSA2NC4zMTc0TDM3LjQzOTcgMjcuNDgyNUMzNy4xOTY1IDI3LjIzOTIgMzYuODY5MSAyNy4xMDI4IDM2LjUyNTggMjcuMTAyOEgyNy44NjlDMjcuNDQxNiAyNy4xMDI4IDI3LjA5MzggMjcuNDUwNiAyNy4wOTM4IDI3Ljg3OFYzNS45MjExQzI3LjA5MzggMzYuMjY0NCAyNy4yMzAyIDM2LjU5MTcgMjcuNDczNCAzNi44MzVMNDAuNjk1MiA1MC4wNTY3QzQwLjk5NzUgNTAuMzU5MSA0MC45OTc1IDUwLjg1MDEgNDAuNjk1MiA1MS4xNTI0TDI3LjMyMTEgNjQuNTI2NUMyNy4xNzU2IDY0LjY3MiAyNy4wOTM4IDY0Ljg2OTggMjcuMDkzOCA2NS4wNzQ0VjczLjg4ODNDMjcuMDkzOCA3NC4zMTUzIDI3LjQ0MTYgNzQuNjYzNSAyNy44NjkgNzQuNjYzNUg0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4KPHJlY3Qgd2lkdGg9IjQ3LjgxMjUiIGhlaWdodD0iNDcuODEyNSIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDI3LjA5MzggMjcuMDkzOCkiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K'; - export function createDefaultConfig(providers: SupportedWallet[]): Config { const config: Config = { providers: [] }; // Xverse const xverseProvider = providers.find( - (provider) => provider.id === 'XverseProviders.BitcoinProvider' + (provider) => provider.id === DefaultAdaptersInfo.xverse.id ); config.providers.push( xverseProvider ? xverseProvider : { - id: 'XverseProviders.BitcoinProvider', - name: 'Xverse', - icon: xverseIcon, + ...DefaultAdaptersInfo.xverse, isInstalled: false, - chromeWebStoreUrl: - 'https://chromewebstore.google.com/detail/xverse-wallet/idnnbdplmphpflfnlkomgpfbpcgelopg', - googlePlayStoreUrl: - 'https://play.google.com/store/apps/details?id=com.secretkeylabs.xverse', - iOSAppStoreUrl: 'https://apps.apple.com/app/xverse-bitcoin-web3-wallet/id1552272513', - webUrl: 'https://www.xverse.app/', } ); @@ -39,7 +29,7 @@ export function createDefaultConfig(providers: SupportedWallet[]): Config { // Rest config.providers.concat( providers.filter((provider) => { - return provider.id !== 'xverseProviders.bitcoinProvider' && provider.id !== 'unisat'; + return provider.id !== DefaultAdaptersInfo.xverse.id && provider.id !== 'unisat'; }) );