Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with amino signing FeeGrant and SendAuthorization #1599

Open
wojciechowskip opened this issue Jul 10, 2024 · 2 comments
Open

Problem with amino signing FeeGrant and SendAuthorization #1599

wojciechowskip opened this issue Jul 10, 2024 · 2 comments

Comments

@wojciechowskip
Copy link

Hi guys, I have a huge problem broadcasting transactions on Cosmos using cosmjs and Ledger connected via Keplr wallet.

My code is working as expected for direct Keplr signing but when it comes to Ledger - some messages works and some not. Usually authz ones are the ones that are not working and return enigmatic cosmos error:

BroadcastTxError: Broadcasting transaction failed with code 4 (codespace: sdk).
Log: signature verification failed; please verify account number (1525623),
sequence (0) and chain-id (cosmoshub-4): unauthorized

I've realized that this error is returned when I am trying to brodcast:

  • FeeGrant
  • SendAuthorization

Isnt that cosmjs & ledger issue?

EDIT #1

Looks like for both I may have wrong amino converters OR this is not supported by sdk, anyone can point me to how such amino converters should look like or examples for SendAuthorization and MsgGrantAllowance with BasicAllowance (Fee grant)?|

These are messages I want to convert using amino (they are working with direct signing):

#1 Fee grant

{
    typeUrl: COSMOS_MESSAGE_TYPE_URL.GRANT_ALLOWANCE,
    value: MsgGrantAllowance.fromPartial({
      granter: granterAddress,
      grantee: granteeAddress,
      allowance: {
        typeUrl: COSMOS_MESSAGE_TYPE_URL.BASIC_ALLOWANCE,
        value: BasicAllowance.encode(
          BasicAllowance.fromPartial({
            spendLimit: [givenGrantsAmount],
            expiration: {
              seconds: expiredDateInS,
            },
          })
        ).finish(),
      },
    }),
  };

#2 Send Grant

{
    typeUrl: COSMOS_MESSAGE_TYPE_URL.GRANT,
    value: MsgGrant.fromPartial({
      granter: granterAddress,
      grantee: granteeAddress,
      grant: Grant.fromPartial({
        expiration: {
          seconds: expiredDateInS,
        },
        authorization: {
          typeUrl: COSMOS_MESSAGE_TYPE_URL.SEND_AUTHORIZATION,
          value: SendAuthorization.encode(
            SendAuthorization.fromPartial({
              allowList: [granteeAddress],
              spendLimit: [
                formatCompoundSpendLimit(
                  calculateTransferGrantLimit(delegationAmount)
                ),
              ],
            })
          ).finish(),
        },
      }),
    }),
  }

PS: MsgGrant converter I was able to create based on restake-ui but with the rest - no luck, any tips and tricks appreciated

@Wgil
Copy link

Wgil commented Jul 25, 2024

Hi @wojciechowskip did you find a solution?

@avkr003
Copy link

avkr003 commented Jul 29, 2024

@Wgil @wojciechowskip This might be related to issue 1092

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants