Skip to content

Commit

Permalink
Squashed commit of the following: (#1476)
Browse files Browse the repository at this point in the history
commit fcebfea
Author: Nikita-Polyakov <polyakov@soramitsu.co.jp>
Date:   Tue Jul 23 09:38:39 2024 +0300

    update SelectProvider

commit 44c3d42
Merge: d1043f8 1ed4735
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Tue Jul 23 09:14:17 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit d1043f8
Merge: 2598efc 89b21a3
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Wed Jul 10 15:53:21 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit 2598efc
Merge: 0394471 3daa74c
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Wed Jun 19 08:37:57 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit 0394471
Merge: 61aa10b 4ae390c
Author: Stefan Popov <stefanpopov@list.ru>
Date:   Wed Jun 5 12:31:28 2024 +0200

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit 61aa10b
Merge: 6b3e5f6 dcf97e3
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Mon May 20 13:42:55 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit 6b3e5f6
Merge: c85faf7 4597330
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Thu May 16 16:55:12 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit c85faf7
Merge: fd40b06 3bfb128
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Mon May 13 09:00:39 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit fd40b06
Merge: 758746b 0f99640
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Fri Apr 26 12:12:53 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit 758746b
Merge: 479f4d6 8c697f4
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Thu Apr 25 12:54:24 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit 479f4d6
Merge: faae7a3 11c1dd2
Author: Nikita Polyakov <53777036+Nikita-Polyakov@users.noreply.github.com>
Date:   Wed Apr 24 12:11:43 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit faae7a3
Merge: 2ed6131 32646a4
Author: NaghmeMohammadifar <45916098+Naghme98@users.noreply.github.com>
Date:   Mon Mar 25 11:29:17 2024 +0300

    Merge branch 'develop' into feature/add-fearless-to-bridge

commit 2ed6131
Author: Nikita-Polyakov <polyakov@soramitsu.co.jp>
Date:   Fri Mar 1 12:48:26 2024 +0300

    refactoring useExtensionProvider

commit 15130fc
Author: Nikita-Polyakov <polyakov@soramitsu.co.jp>
Date:   Fri Mar 1 12:37:25 2024 +0300

    add Fearless provider
  • Loading branch information
Nikita-Polyakov authored Jul 23, 2024
1 parent 1ed4735 commit 3e76408
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
3 changes: 3 additions & 0 deletions public/wallet/Fearless.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 13 additions & 17 deletions src/components/shared/Dialog/SelectProvider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,26 +43,22 @@ export default class SelectProviderDialog extends Mixins(WalletConnectMixin) {
return [Provider.WalletConnect];
}
return [Provider.Metamask, Provider.SubWallet, Provider.TrustWallet, Provider.WalletConnect];
return Object.keys(Provider).map((key) => Provider[key]);
}
get wallets(): WalletInfo[] {
return Object.keys(Provider)
.filter((key) => this.allowedProviders.includes(key as Provider))
.map((key) => {
const provider = Provider[key];
return {
extensionName: provider,
title: provider,
chromeUrl: '',
mozillaUrl: '',
logo: {
src: this.getEvmProviderIcon(provider),
alt: provider,
},
};
});
return this.allowedProviders.map((provider) => {
return {
extensionName: provider,
title: provider,
chromeUrl: '',
mozillaUrl: '',
logo: {
src: this.getEvmProviderIcon(provider),
alt: provider,
},
};
});
}
get selectedProvider(): Nullable<Provider> {
Expand Down
10 changes: 8 additions & 2 deletions src/utils/ethers-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ let ethereumProvider!: any;
let ethersInstance: ethersProvider | null = null;

export enum Provider {
Fearless = 'Fearless',
Metamask = 'Metamask',
SubWallet = 'SubWallet',
TrustWallet = 'TrustWallet',
Expand Down Expand Up @@ -103,17 +104,22 @@ function createWeb3Instance(provider: any) {
}

async function useExtensionProvider(provider: Provider): Promise<string> {
const injectedWindow = window as any;

let ethereumProvider!: any;

switch (provider) {
case Provider.Metamask:
ethereumProvider = await detectEthereumProvider({ mustBeMetaMask: true, timeout: 0 });
break;
case Provider.SubWallet:
ethereumProvider = (window as any).SubWallet;
ethereumProvider = injectedWindow.SubWallet;
break;
case Provider.TrustWallet:
ethereumProvider = (window as any).trustwallet;
ethereumProvider = injectedWindow.trustwallet;
break;
case Provider.Fearless:
ethereumProvider = injectedWindow.fearlessWallet;
break;
default:
throw new Error('Unknown provider');
Expand Down

0 comments on commit 3e76408

Please sign in to comment.