diff --git a/src/core/wallets/bbn/BBNProvider.ts b/src/core/wallets/bbn/BBNProvider.ts deleted file mode 100644 index 1250792..0000000 --- a/src/core/wallets/bbn/BBNProvider.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { OfflineAminoSigner, OfflineDirectSigner } from "@keplr-wallet/types"; - -import { IBBNProvider } from "@/core/types"; - -export abstract class BBNProvider implements IBBNProvider { - /** - * Connects to the wallet and returns the instance of the wallet provider. - * @returns A promise that resolves to an instance of the wrapper wallet provider. - * @throws An error if the wallet is not installed or if connection fails. - */ - abstract connectWallet(): Promise; - - /** - * Gets the address of the connected wallet. - * @returns A promise that resolves to the address of the connected wallet. - */ - abstract getAddress(): Promise; - - /** - * Gets the public key of the connected wallet. - * @returns A promise that resolves to the public key of the connected wallet. - */ - abstract getPublicKeyHex(): Promise; - - /** - * Gets the name of the wallet provider. - * @returns A promise that resolves to the name of the wallet provider. - */ - abstract getWalletProviderName(): Promise; - - /** - * Gets the icon of the wallet provider. - * @returns A promise that resolves to the icon of the wallet provider. - */ - abstract getWalletProviderIcon(): Promise; - - /** - * Retrieves an offline signer that supports both Amino and Direct signing methods. - * This signer is used for signing transactions offline before broadcasting them to the network. - * - * @returns {Promise} A promise that resolves to a signer supporting both Amino and Direct signing - * @throws {Error} If wallet connection is not established or signer cannot be retrieved - */ - abstract getOfflineSigner(): Promise; -} diff --git a/src/core/wallets/bbn/index.ts b/src/core/wallets/bbn/index.ts index 8ca9096..747a0c9 100644 --- a/src/core/wallets/bbn/index.ts +++ b/src/core/wallets/bbn/index.ts @@ -1,11 +1,10 @@ -import { BBNConfig, ChainMetadata } from "@/core/types"; +import { BBNConfig, ChainMetadata, IBBNProvider } from "@/core/types"; -import { BBNProvider } from "./BBNProvider"; import icon from "./babylon.jpeg"; import injectable from "./injectable"; import keplr from "./keplr"; -const metadata: ChainMetadata<"BBN", BBNProvider, BBNConfig> = { +const metadata: ChainMetadata<"BBN", IBBNProvider, BBNConfig> = { chain: "BBN", name: "Babylon Chain", icon, diff --git a/src/core/wallets/bbn/injectable/index.ts b/src/core/wallets/bbn/injectable/index.ts index 13b63ea..d36020f 100644 --- a/src/core/wallets/bbn/injectable/index.ts +++ b/src/core/wallets/bbn/injectable/index.ts @@ -1,8 +1,6 @@ -import { Network, type BBNConfig, type WalletMetadata } from "@/core/types"; +import { IBBNProvider, Network, type BBNConfig, type WalletMetadata } from "@/core/types"; -import { BBNProvider } from "../BBNProvider"; - -const metadata: WalletMetadata = { +const metadata: WalletMetadata = { id: "injectable", name: (wallet) => wallet.getWalletProviderName?.(), icon: (wallet) => wallet.getWalletProviderIcon?.(), diff --git a/src/core/wallets/bbn/keplr/index.ts b/src/core/wallets/bbn/keplr/index.ts index 187770d..c271bea 100644 --- a/src/core/wallets/bbn/keplr/index.ts +++ b/src/core/wallets/bbn/keplr/index.ts @@ -1,11 +1,9 @@ -import { Network, type BBNConfig, type WalletMetadata } from "@/core/types"; - -import type { BBNProvider } from "../BBNProvider"; +import { IBBNProvider, Network, type BBNConfig, type WalletMetadata } from "@/core/types"; import logo from "./logo.svg"; import { KeplrProvider } from "./provider"; -const metadata: WalletMetadata = { +const metadata: WalletMetadata = { id: "keplr", name: "Keplr", icon: logo, diff --git a/src/core/wallets/bbn/keplr/provider.ts b/src/core/wallets/bbn/keplr/provider.ts index cd30897..f9d6e55 100644 --- a/src/core/wallets/bbn/keplr/provider.ts +++ b/src/core/wallets/bbn/keplr/provider.ts @@ -2,8 +2,7 @@ import { Window as KeplrWindow } from "@keplr-wallet/types"; import { OfflineAminoSigner, OfflineDirectSigner } from "@keplr-wallet/types/src/cosmjs"; import { Buffer } from "buffer"; -import { BBNConfig, WalletInfo } from "@/core/types"; -import { BBNProvider } from "@/core/wallets/bbn/BBNProvider"; +import { BBNConfig, IBBNProvider, WalletInfo } from "@/core/types"; import logo from "./logo.svg"; @@ -12,7 +11,7 @@ declare global { interface Window extends KeplrWindow {} } -export class KeplrProvider extends BBNProvider { +export class KeplrProvider implements IBBNProvider { private walletInfo: WalletInfo | undefined; private chainId: string | undefined; private rpc: string | undefined; @@ -22,7 +21,6 @@ export class KeplrProvider extends BBNProvider { private keplr: Window["keplr"], config: BBNConfig, ) { - super(); if (!keplr) { throw new Error("Keplr extension not found"); } diff --git a/src/index.tsx b/src/index.tsx index 30ac4c1..87da8b6 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -13,4 +13,3 @@ export * from "@/context/State.context"; export { createExternalWallet } from "@/core"; export * from "@/core/types"; -export * from "@/core/wallets/bbn/BBNProvider";