From 9e678e2773e399c440759fc3ef6477488c319937 Mon Sep 17 00:00:00 2001 From: lserra-iov Date: Wed, 15 Jan 2025 18:59:58 -0300 Subject: [PATCH] Check for permissions before getting addresses --- src/common/services/XverseService.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/services/XverseService.ts b/src/common/services/XverseService.ts index b2d86689..f8638548 100644 --- a/src/common/services/XverseService.ts +++ b/src/common/services/XverseService.ts @@ -23,7 +23,13 @@ export default class XverseService extends WalletService { } } - getAccountAddresses(): Promise { + async getAccountAddresses(): Promise { + // @ts-expect-error method type not provided + const permissions = await Wallet.request('wallet_getCurrentPermissions', undefined); + if (permissions.status !== 'success') { + // @ts-expect-error method type not provided + await Wallet.request('wallet_requestPermissions', undefined); + } return new Promise((resolve, reject) => { const walletAddresses: WalletAddress[] = []; const payload = {