From ac1bb7ba890a6ff47bf28aedbd487351f6aeffe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?NB=F0=9F=98=88?= Date: Wed, 21 Feb 2024 16:07:26 +0100 Subject: [PATCH] add fetchWalletList --- sdk/packages/selector-polkadot/src/adapter.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sdk/packages/selector-polkadot/src/adapter.ts b/sdk/packages/selector-polkadot/src/adapter.ts index 6f84fa96..99b5a253 100644 --- a/sdk/packages/selector-polkadot/src/adapter.ts +++ b/sdk/packages/selector-polkadot/src/adapter.ts @@ -571,10 +571,20 @@ export class NightlyConnectAdapter implements Injected { innerConnect() }) fetchWalletsFromRegistry = async () => { - return AppPolkadot.getWalletsMetadata( + this._metadataWallets = await AppPolkadot.getWalletsMetadata( `${this._appInitData.url ?? 'https://nc2.nightly.app'}/get_wallets_metadata` ) + return this._metadataWallets } + fetchWalletList = async () => { + const metadataWallets = await this.fetchWalletsFromRegistry() + this.walletsList = getPolkadotWalletsList( + metadataWallets, + getRecentWalletForNetwork(this.network)?.walletName ?? undefined + ) + return this.walletsList + } + disconnect = async () => { try { // Some apps might use disconnect to reset state / recreate session