forked from coracle/flotilla
Replace lightning toolkit with wallet adapter
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import {isNWCWallet, isWebLNWallet, type Wallet} from "@welshman/util"
|
||||
import {NWCWallet} from "./NWCWallet"
|
||||
import {WebLNWallet, getWebLn} from "./WebLNWallet"
|
||||
import type {IWallet} from "./IWallet"
|
||||
|
||||
export const createWalletAdapter = (wallet: Wallet): IWallet => {
|
||||
if (isNWCWallet(wallet)) {
|
||||
return new NWCWallet(wallet.info)
|
||||
}
|
||||
|
||||
if (isWebLNWallet(wallet)) {
|
||||
return new WebLNWallet(getWebLn())
|
||||
}
|
||||
|
||||
throw new Error("Unsupported wallet type")
|
||||
}
|
||||
Reference in New Issue
Block a user