Unable to perform `MsgExec` authz transaction in CosmJS
See original GitHub issueWe are building a frontend where the facility of paying gas fee for someone else is being implemented. To do this, we are using the x/authz
and x/feegrant
module to do the job.
While we could run the /cosmos.authz.v1beta1.MsgGrant
and /cosmos.feegrant.v1beta1.MsgGrantAllowance
in CosmJS, we were not able to do cosmos.authz.v1beta1.MsgExec
transaction, as it gave the error 0uhid is smaller than 100uhid: insufficient funds: insufficient funds
.
This is the overall setup of the code for executing MsgExec
Tx:
async function execTx() {
const grantee_mnemonic = " ----- grantee's mnemonic ------"
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(grantee_mnemonic, options = { prefix: "hid" })
const client = SigningStargateClient.connectWithSigner(
"http://localhost:26657",
wallet,
{
registry: // Custom Module TypeURLs are added ,
gasPrice: GasPrice.fromString("0.0001uhid"),
},
)
let grantee = "hid1k77resf8gktl5wh8fhwlqt7pccandeyj9z5702" // account with no money
let customTypeUrl = "/hypersignprotocol.hidnode.ssi.MsgCreateDID"
// The Custom Module Message that the grantee needs to execute
const txCreateDIDMessage = {
typeUrl: customTypeUrl,
value: MsgCreateDID.encode(
MsgCreateDID.fromPartial({
didDocString: "---",
signatures: "---",
creator: "---",
})).finish(),
};
// MsgExec Tx Object
const txAuthMessage = {
typeUrl: "/cosmos.authz.v1beta1.MsgExec",
value: {
grantee: grantee,
msgs: [
txCreateDIDMessage
]
},
};
const txResult = await client.signAndBroadcast(grantee, [txAuthMessage], "auto");
return txResult
}
CLI execution (hid-noded tx authz exec tx.json --from <grantee-address> --fee-account <granter's-address> --fees 90uhid
) worked fine, but we are struggling with CosmJs execution.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
x/authz - Cosmos SDK Documentation
The x/authz module defines interfaces and messages grant authorizations to perform actions on behalf of one account to other accounts.
Read more >Authz and Ledger signing — an executive summary - Medium
During Confio's work on CosmJS, I was made aware that it is currently not possible to sign authz message types with the Cosmos...
Read more >scrtlabs/secret.js: The JavaScript SDK for Secret Network
Supports every possible message and transaction type. ... MsgExec attempts to execute the provided messages using authorizations granted to the grantee.
Read more >Secret.js Docs - Secret Network
If at lease one message fails, the entire transaction is reverted and TxResponse code field will not be 0 . List of possible...
Read more >Authz - Go Packages
Authz - Authorization for accounts to perform actions on behalf of other accounts. ... AccAddress; func (m *MsgExec) Marshal() (dAtA []byte, err error) ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, this can happen when VSCode’s TypeScript server does not find the type definitions of other packages in the same repo because they are not built yet. Running
yarn build
in the repo root and restarting the IDE should help.What about this: only allow setting the fee payer when the fee is set explicitly (via StdFee)? Once this is available we can think about making “auto” fee and fee payer work together.