diff --git a/apps/api/src/billing/services/managed-user-wallet/managed-user-wallet.service.ts b/apps/api/src/billing/services/managed-user-wallet/managed-user-wallet.service.ts index e8014ab62..76e10bffa 100644 --- a/apps/api/src/billing/services/managed-user-wallet/managed-user-wallet.service.ts +++ b/apps/api/src/billing/services/managed-user-wallet/managed-user-wallet.service.ts @@ -94,7 +94,7 @@ export class ManagedUserWalletService { private async authorizeFeeSpending(options: Omit) { const messages: EncodeObject[] = []; - const hasValidFeeAllowance = await this.authzHttpService.hasValidFeeAllowance(options.granter, options.grantee); + const hasValidFeeAllowance = await this.authzHttpService.hasFeeAllowance(options.granter, options.grantee); if (hasValidFeeAllowance) { messages.push(this.rpcMessageService.getRevokeAllowanceMsg(options)); @@ -119,7 +119,7 @@ export class ManagedUserWalletService { deploymentGrant: false }; - if (await this.authzHttpService.hasValidFeeAllowance(params.granter, params.grantee)) { + if (await this.authzHttpService.hasFeeAllowance(params.granter, params.grantee)) { revokeSummary.feeAllowance = true; messages.push(this.rpcMessageService.getRevokeAllowanceMsg(params)); } diff --git a/apps/api/test/functional/start-trial.spec.ts b/apps/api/test/functional/start-trial.spec.ts index 0cf73c093..71c1c1763 100644 --- a/apps/api/test/functional/start-trial.spec.ts +++ b/apps/api/test/functional/start-trial.spec.ts @@ -45,7 +45,7 @@ describe("start trial", () => { const masterWalletAddress = await resolveWallet("MANAGED").getFirstAddress(); const allowances = await Promise.all([ authzHttpService.getDepositDeploymentGrantsForGranterAndGrantee(masterWalletAddress, userWallet.address), - authzHttpService.getFeeAllowancesForGrantee(userWallet.address) + authzHttpService.getValidFeeAllowancesForGrantee(userWallet.address) ]); expect(createWalletResponse.status).toBe(200); diff --git a/apps/deploy-web/src/hooks/useWalletBalance.ts b/apps/deploy-web/src/hooks/useWalletBalance.ts index 68689e3cb..a7baece2b 100644 --- a/apps/deploy-web/src/hooks/useWalletBalance.ts +++ b/apps/deploy-web/src/hooks/useWalletBalance.ts @@ -144,7 +144,7 @@ export const useDenomData = (denom: string) => { setDepositData(depositData); } - }, [denom, isLoaded, price, walletBalance, usdcIbcDenom, minDeposit]); + }, [denom, isLoaded, price, walletBalance, usdcIbcDenom, minDeposit, isManaged, txFeeBuffer, aktToUSD]); return depositData; }; diff --git a/packages/http-sdk/src/authz/authz-http.service.ts b/packages/http-sdk/src/authz/authz-http.service.ts index 8a5c664cc..251fff512 100644 --- a/packages/http-sdk/src/authz/authz-http.service.ts +++ b/packages/http-sdk/src/authz/authz-http.service.ts @@ -58,7 +58,12 @@ export class AuthzHttpService extends HttpService { async getFeeAllowancesForGrantee(address: string) { const allowances = this.extractData(await this.get(`cosmos/feegrant/v1beta1/allowances/${address}`)); - return allowances.allowances.filter(allowance => this.isValidFeeAllowance(allowance)); + return allowances.allowances; + } + + async getValidFeeAllowancesForGrantee(address: string) { + const allowances = await this.getFeeAllowancesForGrantee(address); + return allowances.filter(allowance => this.isValidFeeAllowance(allowance)); } async getFeeAllowanceForGranterAndGrantee(granter: string, grantee: string): Promise { @@ -86,11 +91,16 @@ export class AuthzHttpService extends HttpService { return response.grants.find(grant => this.isValidDepositDeploymentGrant(grant)); } - async hasValidFeeAllowance(granter: string, grantee: string) { + async hasFeeAllowance(granter: string, grantee: string) { const feeAllowances = await this.getFeeAllowancesForGrantee(grantee); return feeAllowances.some(allowance => allowance.granter === granter); } + async hasValidFeeAllowance(granter: string, grantee: string) { + const feeAllowances = await this.getValidFeeAllowancesForGrantee(grantee); + return feeAllowances.some(allowance => allowance.granter === granter); + } + async hasValidDepositDeploymentGrant(granter: string, grantee: string) { return !!(await this.getDepositDeploymentGrantsForGranterAndGrantee(granter, grantee)) }