-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
docs: add docs on how to construct and broadcast transactions #11625
Comments
Get
Does that mean the
encoded to base64? |
I see now that tx_bytes is actually the base64 encoding of a protobuf: https://docs.cosmos.network/v0.45/run-node/txs.html#broadcasting-a-transaction-3. Is there no way to post a transaction using just json anymore? If not, is there an example of how to correctly build the protobuf for posting as a tx_bytes equivalent to the |
@marbar3778 can you please reply to this thread? I'm having the same issue |
@devkhalil1337 I don't really have time to write up how rn. But, I figured it out here: https://github.com/eqoty-labs/secretk/blob/7b0e3f222a82afa09db9b922c334badf9978801c/src/commonMain/kotlin/io/eqoty/client/SigningCosmWasmClient.kt#L126 if you step through my code you can see how I'm building it. Or if js is easier. I figured it out based on the secret.js code: https://github.com/scrtlabs/secret.js/blob/164eed6f93c419ca7522a3605dc617a7f745b44f/src/secret_network_client.ts#L1049 But, I agree some documentation would be really helpful. |
thanks for the reply @luca992 I tried but unable to understand I'd appreciate if you can share the exact payload here for the new endpoint this is the payload I am using
then encoding to base64 like this Final Payload: { response:
|
first your actual payload should look like:
|
to build So, bodyBytes and authInfoBytes are protobuffer objects which were previously encoded to byte arrays here for example The the TxRaw probuf is defined here:
Sorry, probably not the best explanation. But maybe will get you headed in the right direction. You are probably going to have to read up on how protobufs work if you haven't used them before. I definitely had to haha |
@luca992 thanks for the explanation I get the final payload just one more thing, I am working in javascript and is this JSON object is fine before converting it to the byteArray and base64
or does it need to be update as below:
|
The second. It'd be But, the structure looks approximately right to me. You are going to have to encode all of those sub-objects with |
Thanks again for your time @luca992 broadcast Object :
then converting it to base64 Final Payload:
Response:
|
That won't work. You are encoding json to a byte array. You need to build a protobuffer object that contains that data. Then encode the protobuffer to a byte array |
Any solutions here? |
Sorry @elite0226, but what are you trying to do again? |
are you manually constructing the body or using a library. the client package in the sdk and cosmjs give you ways to handle this out of the box. also with 0.47 there are endpoints that will handle the encoding needed for signing and broadcasting this would fix the need to write your own implementations |
Any update on this, facing same issue ? |
+1 on the docs being complete ass. The example on calling modules programmatically with Go doesn't even resolve. @tac0turtle you guys should hire a technical writer |
someone has updates on this? i have the same problem |
I'm converting from the
/txs
end point to/cosmos/tx/v1beta1/txs
The documentation shows an example of a /txs post body as:
but,
/cosmos/tx/v1beta1/txs
only shows it's example body as:where
tx_bytes
is a base64 encoded string.But, where can I find an example of the
tx_bytes
json structure before encoding to base64?Right now I am encoding the tx value from
/txs
which looks like:As base64 but I am getting the error:
Code: 2; Raw log: expected 2 wire type, got 3: tx parse error
The text was updated successfully, but these errors were encountered: