From 0daa1e997e401226bf678b4114e66dfdbda9bb28 Mon Sep 17 00:00:00 2001 From: boo-0x Date: Mon, 19 Feb 2024 08:44:23 +0100 Subject: [PATCH] AccountSelector: Add Snap management --- package.json | 2 +- .../AccountSelector/AccountSelector.tsx | 35 ++++++++++++++++++- yarn.lock | 28 ++++++--------- 3 files changed, 45 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 027fb0f..93e4f13 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@polkadot/extension-dapp": "^0.40.4", "@polkadot/react-identicon": "^0.86.4", "@reef-chain/evm-provider": "^2.0.1", - "@reef-chain/ui-kit": "^1.1.6", + "@reef-chain/ui-kit": "^2.0.0", "@reef-chain/util-lib": "^2.1.13", "@reef-defi/extension-base": "^1.0.14", "@reef-defi/extension-dapp": "^1.0.14", diff --git a/src/components/AccountSelector/AccountSelector.tsx b/src/components/AccountSelector/AccountSelector.tsx index 3204f7e..f1e70aa 100644 --- a/src/components/AccountSelector/AccountSelector.tsx +++ b/src/components/AccountSelector/AccountSelector.tsx @@ -3,7 +3,10 @@ import Uik from "@reef-chain/ui-kit"; import "./AccountSelector.css"; import { faGear } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { Account } from "@reef-chain/ui-kit/dist/ui-kit/components/organisms/AccountSelector/AccountSelector"; +import { + Account, + AccountCreationData, +} from "@reef-chain/ui-kit/dist/ui-kit/components/organisms/AccountSelector/AccountSelector"; import { ReefSigner } from "../../state"; import { toReefBalanceDisplay, trim } from "../../utils"; @@ -20,6 +23,16 @@ interface AccountSelector { isBalanceHidden?: boolean; showBalance?: (...args: any[]) => any; availableNetworks: Network[]; + showSnapOptions?: boolean; + isDefaultWallet?: boolean; + onRename?: (address: string, newName: string) => any; + onExport?: (address: string) => any; + onImport?: (...args: any[]) => any; + onForget?: (address: string) => any; + onDefaultWalletSelect?: (isDefault: boolean) => any; + onUpdateMetadata?: (network: Network) => any; + onStartAccountCreation?: () => Promise; + onConfirmAccountCreation?: (seed: string, name: string) => any; } export const AccountSelector = ({ @@ -32,6 +45,16 @@ export const AccountSelector = ({ isBalanceHidden, showBalance, availableNetworks, + showSnapOptions, + isDefaultWallet, + onRename, + onExport, + onImport, + onForget, + onDefaultWalletSelect, + onUpdateMetadata, + onStartAccountCreation, + onConfirmAccountCreation, }: AccountSelector): JSX.Element => { const name = selectedSigner ? selectedSigner.name : ""; const balance = toReefBalanceDisplay(selectedSigner?.balance); @@ -123,6 +146,16 @@ export const AccountSelector = ({ onNetworkSelect={onNetworkSelect} onLanguageSelect={onLanguageSelect} availableNetworks={availableNetworks} + showSnapOptions={showSnapOptions} + isDefaultWallet={isDefaultWallet} + onRename={onRename} + onExport={onExport} + onImport={onImport} + onForget={onForget} + onDefaultWalletSelect={onDefaultWalletSelect} + onUpdateMetadata={onUpdateMetadata} + onStartAccountCreation={onStartAccountCreation} + onConfirmAccountCreation={onConfirmAccountCreation} />