Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,20 @@ export class PaliWalletConnector implements Connector {


await this.provider!.send(
"eth_changeUTXOEVM",
"sys_changeUTXOEVM",
[{ chainId: 57 }],
);

const chainId: string = await this.provider!.send('eth_chainId', [])
const accounts: string[] = await this.provider!.send('eth_requestAccounts', [])

let accounts: string[] = []

try {
accounts = await this.provider!.send('eth_requestAccounts', [])

} catch (e: any) {
console.log(e);
}

if (!accounts) {
throw new Error('Could not activate connector: no accounts');;
Expand All @@ -188,6 +196,8 @@ export class PaliWalletConnector implements Connector {
}

async activate(): Promise<void> {

console.log(`ACTIVATE`);
await this.init()

if (!this.provider) {
Expand All @@ -198,6 +208,14 @@ export class PaliWalletConnector implements Connector {
const chainId: string = await this.provider!.send('eth_chainId', [])
const accounts: string[] = await this.provider!.send('eth_requestAccounts', [])

console.log(accounts);

if (typeof accounts[0] === 'string' && accounts[0].startsWith('sys')) {
await this.provider!.send(
"eth_changeUTXOEVM",
[{ chainId: 57 }],
);
}

// @ts-ignore
if (accounts[0].success === false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
ModalBody,
Button,
VStack,
Box,
Icon,

} from "@chakra-ui/react"

Expand Down Expand Up @@ -42,6 +44,24 @@ export const ConnectWalletBlock: FC<ConnectWalletBlockProps> = ({ setScreen, onC
<Divider />
<ModalBody>
<VStack spacing={1} justifyContent={'left'}>
<Box w={'100'} textAlign={'center'}
sx={
{
backgroundColor: 'gray.100',
borderRadius: '8px',
border: '1px solid #E2E8F0',
padding: '8px',
}
}
>
<HStack>
<Icon as={QuestionIcon} />
<Text textAlign={'center'} size='sm' fontSize={'12px'}>
{'Before use Pali wallet connector please switch your network mode to EVM chain to prevent app crash.'}
</Text>
</HStack>

</Box>
<ConnectWalletButton
label={'Pali Wallet'}
logoPath={'/wallets/Pali.svg'}
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@
"web3-core": "^4.0.2"
},
"devDependencies": {
"@types/lodash": "latest",
"@types/lodash.mergewith": "latest",
"@types/node": "17.0.32",
"@types/react": "18.0.9",
"@types/react-dom": "18.0.3",
"eslint": "8.15.0",
"eslint-config-next": "12.1.6",
"firebase-tools": "^11.0.1",
"typescript": "4.6.4"
"typescript": "latest"
}
}
Loading