hyperweb-io / hyperweb-io/telescope

Create msgGrant have error "tx parse error"

Open
#566 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
154
Forks
53
PR merge metrics
No merged PRs in 30d

Description

I'm following this doc (https://www.npmjs.com/package/@cosmology/telescope#grpc-gateway-client) to create a multisig msg for typeUrl: "/cosmos.authz.v1beta1.MsgGrant" and we have typeUrl: "/cosmwasm.wasm.v1.ContractExecutionAuthorization", in it. But when I boadcast my transaction, it emits this error: "tx parse error". I'm using your latest version. Where am I wrong here? Can you give me a example for this? Here is the code:
```
window.keplr.defaultOptions = {
sign: {
preferNoSetMemo: true,
preferNoSetFee: true,
disableBalanceCheck: true,
},
};
const offlineSigner = window.getOfflineSignerOnlyAmino(
chain.chain_id
);
const signAccount = await getSequence(chain.api, multisigID)
const { grant } = cosmos.authz.v1beta1.MessageComposer.withTypeUrl;
const msg = grant({
granter: 'migaloo17gayusvse9e9espd0ym66eju5jymshsz6etlx0',
grantee: 'migaloo1g77s6rh7fgdfcwgcxpwwzr5ujamf302krvua0v',
grant: {
authorization: cosmwasm.wasm.v1.ContractExecutionAuthorization.toAminoMsg({
grants: [
{
contract: 'migaloo14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s58v48z',
limit: cosmwasm.wasm.v1.CombinedLimit.toAminoMsg({
callsRemaining: BigInt("100"),
amounts: [
{
denom: "uwhale",
amount: "250",
}
]
}),
filter: cosmwasm.wasm.v1.AcceptedMessageKeysFilter.toAminoMsg({
keys: ['create_pair']
})
}
]
}),
expiration: new Date(Date.now() + 60 * 60 * 24 * 7)
}
})
console.log(msg);
// const signingClient = await getCustomClient(types, offlineSigner);
const signingClient = await getSigningCosmosClient({
rpcEndpoint: "http://localhost:26657",
signer: offlineSigner
});
const signerData = {
accountNumber: parseInt(signAccount.account_number, 10),
sequence: parseInt(signAccount.sequence, 10),
chainId: chain.chain_id,
};
const { bodyBytes, signatures } = await signingClient.sign(
account.bech32Address,
[msg],
tx.fee,
tx.memo,
signerData
);
const pubkey = JSON.parse(multisig.pubkeyJSON)
const gasLimit = 200000;
const signedTx = makeMultisignedTx(
JSON.parse(pubkey),
parseInt(signAccount.sequence, 10),
{
amount: coins(2000, "uwhale"),
gas: gasLimit.toString(),
},
bodyBytes,
new Map([
[account.bech32Address, signatures[0]]
])
);
const broadcaster = await StargateClient.connect(chain.rpc);
const result = await broadcaster.broadcastTx(
Uint8Array.from(TxRaw.encode(signedTx).finish())
);
console.log(result);
return
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.