Skip to content

Commit

Permalink
chore: move namespaces info to provider and remove the hardcoded mapp…
Browse files Browse the repository at this point in the history
…ing in wallets-shared
  • Loading branch information
yeager-eren committed Dec 15, 2024
1 parent 52953ea commit 692a5c3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
4 changes: 2 additions & 2 deletions wallets/core/src/hub/store/providers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Namespace } from '../../namespaces/common/types.js';
import type { State as InternalProviderState } from '../provider/mod.js';
import type { CommonNamespaceKeys } from '../provider/types.js';
import type { StateCreator } from 'zustand';

import { produce } from 'immer';
Expand All @@ -8,7 +8,7 @@ import { guessProviderStateSelector, type State } from './mod.js';

type Browsers = 'firefox' | 'chrome' | 'edge' | 'brave' | 'homepage';
type Property<N extends string, V> = { name: N; value: V };
type DetachedInstances = Property<'detached', CommonNamespaceKeys[]>;
type DetachedInstances = Property<'detached', Namespace[]>;

export type ProviderInfo = {
name: string;
Expand Down
24 changes: 21 additions & 3 deletions wallets/core/src/legacy/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,24 @@ export type InstallObjects = {
DEFAULT: string;
};

interface NeedsNamespace {
selection: 'single' | 'multiple';
data: {
label: string;
id: string;
value: Namespace;
}[];
}

interface NeedsDerivationPath {
data: {
id: string;
label: string;
namespace: Namespace;
generateDerivationPath: (index: string) => string;
}[];
}

export type WalletInfo = {
name: string;
img: string;
Expand All @@ -93,9 +111,9 @@ export type WalletInfo = {
showOnMobile?: boolean;
isContractWallet?: boolean;
mobileWallet?: boolean;
namespaces?: Namespace[];
singleNamespace?: boolean;
needsDerivationPath?: boolean;

needsDerivationPath?: NeedsDerivationPath;
needsNamespace?: NeedsNamespace;
};

export type State = {
Expand Down

0 comments on commit 692a5c3

Please sign in to comment.