Skip to content

Commit

Permalink
🚨 Auto fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
williamchong committed Jan 11, 2024
1 parent f3a2eee commit 340c310
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/components/connection-method-selection-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ const connectionMethodMap = [
isMobileOk: true,
url: '',
description: 'connect_wallet_method_description_wallet_connect_v2',
}, {
},
{
type: LikeCoinWalletConnectorMethodType.Web3Auth,
name: 'Web3Auth',
defaultTier: 2,
Expand Down
8 changes: 3 additions & 5 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ import {
listenLeapKeyStoreChange,
removeLeapKeyStoreChangeListener,
} from './utils/leap';
import {
initWeb3Auth,
disconnectWeb3Auth,
} from './utils/web3auth';
import { initWeb3Auth, disconnectWeb3Auth } from './utils/web3auth';
import { deserializePublicKey, serializePublicKey } from './utils/wallet';

import {
Expand Down Expand Up @@ -136,7 +133,8 @@ export class LikeCoinWalletConnector {

onEvent: options.onEvent || (() => {}),

blockExplorerURL: options.blockExplorerURL || 'https://mintscan.io/likecoin',
blockExplorerURL:
options.blockExplorerURL || 'https://mintscan.io/likecoin',
web3AuthClientId: options.web3AuthClientId || '',
web3AuthNetwork: options.web3AuthNetwork || 'mainnet',
};
Expand Down
20 changes: 14 additions & 6 deletions src/utils/web3auth.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DirectSecp256k1Wallet, OfflineSigner } from '@cosmjs/proto-signing';
import { Secp256k1Wallet } from '@cosmjs/amino';
import { Web3Auth, Web3AuthOptions } from "@web3auth/modal";
import { CHAIN_NAMESPACES } from "@web3auth/base";
import { Web3Auth, Web3AuthOptions } from '@web3auth/modal';
import { CHAIN_NAMESPACES } from '@web3auth/base';

import {
LikeCoinWalletConnectorInitResponse,
Expand All @@ -11,7 +11,7 @@ import {
let web3auth: Web3Auth | null = null;

export async function initWeb3Auth(
options: LikeCoinWalletConnectorOptions,
options: LikeCoinWalletConnectorOptions
): Promise<LikeCoinWalletConnectorInitResponse> {
const web3AuthOptions = {
clientId: options.web3AuthClientId,
Expand All @@ -38,10 +38,18 @@ export async function initWeb3Auth(
if (!provider) {
throw new Error('Failed to connect to wallet');
}
const privateKeyStr = await (provider as any).request({ method: 'private_key' });
const privateKeyStr = await (provider as any).request({
method: 'private_key',
});
const privateKey = Buffer.from(privateKeyStr, 'hex');
const aminoSigner = await Secp256k1Wallet.fromKey(privateKey, options.bech32PrefixAccAddr);
const directSigner = await DirectSecp256k1Wallet.fromKey(privateKey, options.bech32PrefixAccAddr);
const aminoSigner = await Secp256k1Wallet.fromKey(
privateKey,
options.bech32PrefixAccAddr
);
const directSigner = await DirectSecp256k1Wallet.fromKey(
privateKey,
options.bech32PrefixAccAddr
);
const accounts = [...(await aminoSigner.getAccounts())];
if (!accounts.length) {
throw new Error('WALLETCONNECT_ACCOUNT_NOT_FOUND');
Expand Down

0 comments on commit 340c310

Please sign in to comment.