Commit ce689e4 1 parent 172ce80 commit ce689e4 Copy full SHA for ce689e4
File tree 10 files changed +41
-37
lines changed
packages/messenger-widget/src/components
10 files changed +41
-37
lines changed Original file line number Diff line number Diff line change @@ -7,10 +7,6 @@ import { GlobalContext } from '../../utils/context-utils';
7
7
import DeleteDM3Name from '../DeleteDM3Name/DeleteDM3Name' ;
8
8
import './ConfigureProfile.css' ;
9
9
import {
10
- ACTION_TYPE ,
11
- BUTTON_CLASS ,
12
- NAME_TYPE ,
13
- PROFILE_INPUT_FIELD_CLASS ,
14
10
closeConfigurationModal ,
15
11
fetchChainIdFromServiceName ,
16
12
fetchComponent ,
@@ -30,6 +26,12 @@ import { AuthContext } from '../../context/AuthContext';
30
26
import { useNetwork } from 'wagmi' ;
31
27
import { useMainnetProvider } from '../../hooks/mainnetprovider/useMainnetProvider' ;
32
28
import { switchNetwork } from '@wagmi/core' ;
29
+ import {
30
+ ACTION_TYPE ,
31
+ BUTTON_CLASS ,
32
+ NAME_TYPE ,
33
+ PROFILE_INPUT_FIELD_CLASS ,
34
+ } from './chain/common' ;
33
35
34
36
export function ConfigureDM3Profile ( ) {
35
37
// global context state
Original file line number Diff line number Diff line change @@ -19,26 +19,7 @@ import { getLastDm3Name } from '../../utils/common-utils';
19
19
import { ConfigureGenomeProfile } from './chain/genome/ConfigureGenomeProfile' ;
20
20
import { ConfigureEnsProfile } from './chain/ens/ConfigureEnsProfile' ;
21
21
import React from 'react' ;
22
-
23
- export const PROFILE_INPUT_FIELD_CLASS =
24
- 'profile-input font-weight-400 font-size-14 border-radius-6 w-100 line-height-24' ;
25
-
26
- export const BUTTON_CLASS =
27
- 'configure-btn font-weight-400 font-size-12 border-radius-4 line-height-24' ;
28
-
29
- export enum NAME_TYPE {
30
- ENS_NAME ,
31
- DM3_NAME ,
32
- }
33
-
34
- export enum ACTION_TYPE {
35
- CONFIGURE ,
36
- REMOVE ,
37
- }
38
-
39
- export interface IChain {
40
- chainToConnect : number ;
41
- }
22
+ import { NAME_TYPE } from './chain/common' ;
42
23
43
24
// method to open the profile configuration modal
44
25
export const openConfigurationModal = ( dispatch : React . Dispatch < Actions > ) => {
@@ -186,10 +167,6 @@ export const validateName = (username: string): boolean => {
186
167
) ;
187
168
} ;
188
169
189
- export const validateEnsName = ( username : string ) : boolean => {
190
- return ethers . utils . isValidName ( username ) ;
191
- } ;
192
-
193
170
export const fetchExistingDM3Name = async (
194
171
mainnetProvider : ethers . providers . StaticJsonRpcProvider ,
195
172
account : Account ,
Original file line number Diff line number Diff line change 1
1
import { useContext } from 'react' ;
2
2
import tickIcon from '../../../assets/images/white-tick.svg' ;
3
+ import { ConfigureProfileContext } from '../context/ConfigureProfileContext' ;
3
4
import {
4
5
ACTION_TYPE ,
5
- BUTTON_CLASS ,
6
6
NAME_TYPE ,
7
7
PROFILE_INPUT_FIELD_CLASS ,
8
- } from '../bl' ;
9
- import { ConfigureProfileContext } from '../context/ConfigureProfileContext ' ;
8
+ BUTTON_CLASS ,
9
+ } from './common ' ;
10
10
11
11
export const SubmitOnChainProfile = ( {
12
12
label,
Original file line number Diff line number Diff line change
1
+ import { ethers } from 'ethers' ;
2
+
3
+ export enum NAME_TYPE {
4
+ ENS_NAME ,
5
+ DM3_NAME ,
6
+ }
7
+
8
+ export enum ACTION_TYPE {
9
+ CONFIGURE ,
10
+ REMOVE ,
11
+ }
12
+
13
+ export const PROFILE_INPUT_FIELD_CLASS =
14
+ 'profile-input font-weight-400 font-size-14 border-radius-6 w-100 line-height-24' ;
15
+
16
+ export const BUTTON_CLASS =
17
+ 'configure-btn font-weight-400 font-size-12 border-radius-4 line-height-24' ;
18
+
19
+ export interface IChain {
20
+ chainToConnect : number ;
21
+ }
22
+
23
+ export const validateEnsName = ( username : string ) : boolean => {
24
+ return ethers . utils . isValidName ( username ) ;
25
+ } ;
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ import { useContext } from 'react';
3
3
import { GlobalContext } from '../../../../utils/context-utils' ;
4
4
import { ConfigureProfileContext } from '../../context/ConfigureProfileContext' ;
5
5
import { SubmitOnChainProfile } from '../SubmitOnChainProfile' ;
6
- import { IChain , NAME_TYPE , validateEnsName } from '../../bl' ;
7
6
import { AuthContext } from '../../../../context/AuthContext' ;
8
7
import { submitEnsNameTransaction } from './bl' ;
9
8
import { useMainnetProvider } from '../../../../hooks/mainnetprovider/useMainnetProvider' ;
10
9
import { useNetwork } from 'wagmi' ;
10
+ import { IChain , NAME_TYPE , validateEnsName } from '../common' ;
11
11
12
12
export const ConfigureEnsProfile = ( props : IChain ) => {
13
13
const { dispatch } = useContext ( GlobalContext ) ;
Original file line number Diff line number Diff line change 9
9
} from '../../../../utils/enum-type-utils' ;
10
10
import { setContactHeightToMaximum } from '../../../Contacts/bl' ;
11
11
import { startLoader , closeLoader } from '../../../Loader/Loader' ;
12
- import { NAME_TYPE } from '../../bl' ;
13
12
import { Account , SignedUserProfile } from '@dm3-org/dm3-lib-profile' ;
14
13
import { Connection } from '../../../../interfaces/web3' ;
14
+ import { NAME_TYPE } from '../common' ;
15
15
16
16
// method to check ENS name is valid or not
17
17
const isEnsNameValid = async (
Original file line number Diff line number Diff line change @@ -2,11 +2,11 @@ import { useContext } from 'react';
2
2
import { SubmitOnChainProfile } from '../SubmitOnChainProfile' ;
3
3
import { submitGenomeNameTransaction , validateGenomeName } from './bl' ;
4
4
import { ConfigureProfileContext } from '../../context/ConfigureProfileContext' ;
5
- import { IChain , NAME_TYPE } from '../../bl' ;
6
5
import { GlobalContext } from '../../../../utils/context-utils' ;
7
6
import { useNetwork } from 'wagmi' ;
8
7
import { AuthContext } from '../../../../context/AuthContext' ;
9
8
import { ethers } from 'ethers' ;
9
+ import { IChain , NAME_TYPE } from '../common' ;
10
10
11
11
export const ConfigureGenomeProfile = ( props : IChain ) => {
12
12
const { state, dispatch } = useContext ( GlobalContext ) ;
Original file line number Diff line number Diff line change @@ -8,13 +8,13 @@ import {
8
8
} from '../../../../utils/enum-type-utils' ;
9
9
import { setContactHeightToMaximum } from '../../../Contacts/bl' ;
10
10
import { startLoader , closeLoader } from '../../../Loader/Loader' ;
11
- import { NAME_TYPE } from '../../bl' ;
12
11
import { ethers } from 'ethers' ;
13
12
import { getConractInstance } from '@dm3-org/dm3-lib-shared/dist/ethersHelper' ;
14
13
import { Connection } from '../../../../interfaces/web3' ;
15
14
import { Account , SignedUserProfile } from '@dm3-org/dm3-lib-profile' ;
16
15
17
16
import { Address , namehash , toHex } from 'viem' ;
17
+ import { NAME_TYPE } from '../common' ;
18
18
19
19
//Space id uses the namehash of the name + the GNO identifier to calculate the node
20
20
const GNO_IDENTIFIER = BigInt (
Original file line number Diff line number Diff line change 1
1
import React , { useState } from 'react' ;
2
- import { NAME_TYPE } from '../bl ' ;
2
+ import { NAME_TYPE } from '../chain/common ' ;
3
3
4
4
export interface ConfigureProfileContextType {
5
5
existingEnsName : string | null ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import './DeleteDM3Name.css';
2
2
import '../../styles/modal.css' ;
3
3
import closeIcon from '../../assets/images/cross.svg' ;
4
4
import { DeleteDM3NameProps } from '../../interfaces/props' ;
5
- import { ACTION_TYPE } from '../ConfigureProfile/bl ' ;
5
+ import { ACTION_TYPE } from '../ConfigureProfile/chain/common ' ;
6
6
7
7
export default function DeleteDM3Name ( props : DeleteDM3NameProps ) {
8
8
return (
You can’t perform that action at this time.
0 commit comments