Skip to content

Commit

Permalink
Disable fee balance check if payer is not signer
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunnini committed Jul 10, 2023
1 parent b81b18b commit 4eb33b2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/cosmos/src/stargate/wrapper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ export class SignDocWrapper {
return this.aminoSignDoc.fee.amount;
}

get payer(): string | undefined {
if (this.mode === "direct") {
return this.protoSignDoc.authInfo.fee?.payer;
}

return this.aminoSignDoc.fee.payer;
}

get granter(): string | undefined {
if (this.mode === "direct") {
return this.protoSignDoc.authInfo.fee?.granter;
Expand Down
7 changes: 7 additions & 0 deletions packages/extension/src/pages/sign/cosmos/tx/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ export const CosmosTxView: FunctionComponent<{
feeConfig.setDisableBalanceCheck(
!!data.data.signOptions.disableBalanceCheck
);
// We can't check the fee balance if the payer is not the signer.
if (
data.data.signDocWrapper.payer &&
data.data.signDocWrapper.payer !== data.data.signer
) {
feeConfig.setDisableBalanceCheck(true);
}
// We can't check the fee balance if the granter is not the signer.
if (
data.data.signDocWrapper.granter &&
Expand Down

0 comments on commit 4eb33b2

Please sign in to comment.