Skip to content

Commit

Permalink
chore: pr review last comments
Browse files Browse the repository at this point in the history
  • Loading branch information
wainola committed Nov 28, 2023
1 parent 7b90cae commit 3fdf418
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/wallet-manager/src/WalletManagerContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from './WalletManagerController';
import { ethers } from 'ethers';
import { ApiPromise } from '@polkadot/api';
import { Networks } from './types';
import { Network } from './types';

export const WalletManagerContext = createContext<
TWalletManagerController | undefined
Expand Down Expand Up @@ -56,11 +56,11 @@ export class WalletManagerContextProvider extends LitElement {
wssConnectionUrl?: string;

@property({ type: String })
networks: Networks;
networks: Network;

constructor() {
super();
this.networks = Networks.EVM;
this.networks = Network.EVM;
}

connectedCallback(): void {
Expand Down
10 changes: 5 additions & 5 deletions packages/wallet-manager/src/WalletManagerController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactiveControllerHost } from 'lit';
import { EvmWallet, SubstrateWallet } from '.';
import { Web3Provider } from '@ethersproject/providers';
import { ApiPromise } from '@polkadot/api';
import { AddChain, Networks } from './types';
import { AddChain, Network } from './types';
import { customEVMEvents, IWalletManagerController } from './interfaces';
import { Signer } from '@ethersproject/abstract-signer';

Expand All @@ -15,7 +15,7 @@ export class WalletManagerController implements IWalletManagerController {

constructor(
host: ReactiveControllerHost,
networks: Networks,
networks: Network,
initArgument: {
web3Provider?: Web3Provider;
apiPromise?: ApiPromise;
Expand All @@ -24,12 +24,12 @@ export class WalletManagerController implements IWalletManagerController {
) {
(this.host = host).addController(this);

if (networks === Networks.EVM) {
if (networks === Network.EVM) {
this.initWeb3Provider(initArgument.web3Provider);
} else if (networks === Networks.Substrate) {
} else if (networks === Network.Substrate) {
this.initFromApiPromise(initArgument as ApiPromise);
} else if (
networks === Networks.Substrate &&
networks === Network.Substrate &&
initArgument.wssConnectionUrl
) {
this.initFromWssProvider(initArgument as string);
Expand Down
11 changes: 1 addition & 10 deletions packages/wallet-manager/src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,7 @@ export interface IEvmWallet {
chainId,
rpcUrl,
chainName
}: {
chainId: number;
rpcUrl: string;
chainName: string;
nativeCurrency: {
name: string;
symbol: string;
decimals: number;
};
}): Promise<void>;
}: Pick<AddChain, 'chainId' | 'rpcUrl' | 'chainName'>): Promise<void>;
}

export interface ISubstrateWallet {
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-manager/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type SyntheticEventCreator = (
dataToPass: Record<string, unknown> | number | string | Array<unknown>
) => void;

export enum Networks {
export enum Network {
EVM = 'EVM',
Substrate = 'Substrate'
}

0 comments on commit 3fdf418

Please sign in to comment.