From 655a1a9e441e6713b3a886c2f39f450c9f03066b Mon Sep 17 00:00:00 2001 From: Felicio Mununga Date: Thu, 30 Jun 2022 16:34:50 +0200 Subject: [PATCH] send request on creating account --- packages/status-js/src/client/client.ts | 5 ++--- packages/status-react/src/protocol/use-account.tsx | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/status-js/src/client/client.ts b/packages/status-js/src/client/client.ts index 4fac086..8abd690 100644 --- a/packages/status-js/src/client/client.ts +++ b/packages/status-js/src/client/client.ts @@ -91,11 +91,10 @@ class Client { await this.waku.stop() } - public createAccount = (): Account => { + public createAccount = async (): Promise => { this.account = new Account() - // TODO: joining part of creation of an account - // await this.community.requestToJoin() + await this.community.requestToJoin() return this.account } diff --git a/packages/status-react/src/protocol/use-account.tsx b/packages/status-react/src/protocol/use-account.tsx index 6c81050..d6ce915 100644 --- a/packages/status-react/src/protocol/use-account.tsx +++ b/packages/status-react/src/protocol/use-account.tsx @@ -5,8 +5,8 @@ import type { Account } from '@status-im/js' export const useAccount = () => { const { client, account, dispatch } = useProtocol() - const createAccount = () => { - const account = client.createAccount() + const createAccount = async () => { + const account = await client.createAccount() dispatch({ type: 'SET_ACCOUNT', account }) // TODO: save account