39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
/**
|
|
* Synchronous getters for backward compatibility
|
|
* Returns defaults if IndexedDB is not ready
|
|
*/
|
|
|
|
import { DEFAULT_RELAYS, DEFAULT_NIP95_APIS, DEFAULT_PLATFORM_LIGHTNING_ADDRESS } from './configStorageTypes'
|
|
|
|
/**
|
|
* Synchronous getter for primary relay (for backward compatibility)
|
|
* Returns default if IndexedDB is not ready
|
|
*/
|
|
export function getPrimaryRelaySync(): string {
|
|
const defaultRelay = DEFAULT_RELAYS[0]
|
|
if (!defaultRelay) {
|
|
throw new Error('No default relay configured')
|
|
}
|
|
return defaultRelay.url
|
|
}
|
|
|
|
/**
|
|
* Synchronous getter for primary NIP-95 API (for backward compatibility)
|
|
* Returns default if IndexedDB is not ready
|
|
*/
|
|
export function getPrimaryNip95ApiSync(): string {
|
|
const defaultApi = DEFAULT_NIP95_APIS[0]
|
|
if (!defaultApi) {
|
|
throw new Error('No default NIP-95 API configured')
|
|
}
|
|
return defaultApi.url
|
|
}
|
|
|
|
/**
|
|
* Synchronous getter for platform Lightning address (for backward compatibility)
|
|
* Returns default if IndexedDB is not ready
|
|
*/
|
|
export function getPlatformLightningAddressSync(): string {
|
|
return DEFAULT_PLATFORM_LIGHTNING_ADDRESS
|
|
}
|