From 60a46c353edcfbda7abc6545f9ff28fc6f12664a Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Mon, 6 Nov 2023 18:26:59 +0000 Subject: [PATCH] refactor: change wallet kit options --- packages/vanilla-wallet-kit/src/client.ts | 29 ++++------------------- 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/packages/vanilla-wallet-kit/src/client.ts b/packages/vanilla-wallet-kit/src/client.ts index bf072dc8..6f1525fd 100644 --- a/packages/vanilla-wallet-kit/src/client.ts +++ b/packages/vanilla-wallet-kit/src/client.ts @@ -1,38 +1,19 @@ import type { WalletSource } from '@vechain/wallet-kit'; import { MultiWalletConnex } from '@vechain/wallet-kit'; +import type { ConnexOptions } from '@vechain/wallet-kit/src'; import type { SourceInfo } from './constants'; -export interface VechainWalletKitOptions { - connex?: MultiWalletConnex; - nodeUrl: string; - network: string; // TODO: add a type for this - walletConnectOptions: { - projectId: string; - metadata: { - name: string; - description: string; - url: string; - icons: string[]; - }; - }; - onDisconnected: () => void; -} +export type VechainWalletKitOptions = MultiWalletConnex | ConnexOptions; class VechainWalletKit { connex: MultiWalletConnex; account: string | null = null; constructor(options: VechainWalletKitOptions) { - if (options.connex) { - this.connex = options.connex; + if ('thor' in options) { + this.connex = options; } else { - this.connex = new MultiWalletConnex({ - nodeUrl: options.nodeUrl, - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - genesis: options.network as any, - walletConnectOptions: options.walletConnectOptions, - onDisconnected: options.onDisconnected, - }); + this.connex = new MultiWalletConnex(options); } }