diff --git a/packages/extension-koni-ui/src/connector/booka/sdk.ts b/packages/extension-koni-ui/src/connector/booka/sdk.ts index ed31eb56a6..1ecafd45db 100644 --- a/packages/extension-koni-ui/src/connector/booka/sdk.ts +++ b/packages/extension-koni-ui/src/connector/booka/sdk.ts @@ -434,6 +434,19 @@ export class BookaSdk { return this.nflRivalCardListSubject.value; } + async fetchMythicalBalance (token?: string) { + try { + const rs = await this.postRequest(`${GAME_API_HOST}/api/mythical-account/fetch`, { token: token }); + + if (rs) { + this.mythicalWalletSubject.next(rs); + } + } catch (error) { + console.error('Error in fetchMythicalBalance:', error); + throw error; + } + } + getDailyRewardAchievements () { return this.dailyRewardAchievementsSubject.value; } @@ -1049,26 +1062,6 @@ export class BookaSdk { return this.airdropCampaignSubject; } - async fetchMythicalBalance (token: string) { - const request = await fetch(`${MYTHICAL_API_HOST}/player/wallet-balance`, { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - Authorization: `Bearer ${token}` - } - }); - - if (request.status === 200 || request.status === 304) { - const balance = (await request.json()) as unknown as MythicalWallet; - - this.mythicalWalletSubject.next(balance); - - return balance; - } else { - return undefined; - } - } - getMythicalWallet () { return this.mythicalWalletSubject.value; }