I just don’t know how to pass it to the endpoint using Content-Type application/octet-stream. In the API doc it says:
string <binary>
Signed transaction message binary blob.
I’m using javascript for this and have tried passing the cborHex directly, using Buffer.from(txBody.cborHex).toString('base64') and the whole json Buffer.from(JSON.stringify(txBody)).toString('base64') but alway got the same result:
{
"code": "malformed_tx_payload",
"message": "I couldn't verify that the payload has the c…node. Please check the format and try again."
}
Also I’ve noticed from the swagger specification that the endpoint support a JSON payload but no idea al the structure of it. Any idea how to pass the signed tx?
cardano-wallet is not supposed to work in the way you’re trying with other modules, you can submit your tx using CLI itself against node that runs with the wallet
I know I can submit the tx using CLI, I just want to know how is it using proxy/transactions endpoint. If I cannot use an already signed tx from cardano-cli then where is the signed tx coming from (I thought no distinction should be made here)? Maybe an example will be useful in this case.
The tx is created and submitted by wallet API and does not necessarily follow same semantics. For cardano-wallet component, you cannot manually construct transaction by selecting UTXOs. It is not aimed for such usage. This component is aimed at users who dont want to worry about setting fees or electing UTXOs manually - also, it will store the keys encrypted with spending password locally on wallet instance db. Thus, it does not make sense for many use cases (like third party wallet/integrations/…) to use this component .
Similar to other posts, your requirements highly point that you should be using cardano-address/cardano-rosetta/serialisation-lib against node instead.
(Also, since you’ve already used CLI to construct transaction - you should submit it against node using CLI)
I totally got your point, but cardano-wallet is shipped with this endpoint proxy/transactions entitled “Submit External Transaction”. So we should expect it has some use cases right? Judging by the endpoint title and description: “Submits a transaction that was created and signed outside of cardano-wallet.” why is my approach wrong? More important, what is the right way to use it?
Sure, and as mentioned above - it is valid for user/custodial entity’s transactions, nowhere does it set an expectation of manually constructed transaction using cardano-cli.
If you want to use cardano-wallet component/API to submit tx , you can only create transaction as per the documentation and example in wallet API.
Maybe you are not following me, Yes I do want to use cardano-wallet to submit a tx through the endpoint proxy/transactions. So I need to figure it out how this method receive the payload, this is the original question.
I mean, how the payload for proxy/transactions looks like and where it is coming from (Maybe my approach is wrong, but should be examples that point out how to use it).
TLDR: In my case I was using a swagger code generation for the API https://editor.swagger.io and it seems the generated code for typescript/axios has some issues (or maybe is the API definition).
I ended up with this snippet code for submit external tx: