1

I am trying to build a transaction with the libary of cardano-client-lib (java sdk). Inorder to build a transaction one needs to provide an account object which can only be created with the mnemonic phase, which is clearly a problem.

I thought of using Nami wallet API as a walkaround, but seems unable to get the specific instance of the wallet in java. is there a way to build a transaction in java with nami api?

thanks.

3 Answers 3

1

Nami is a web wallet and injects its API into your website. It is not supposed to work with desktop applications but only with web apps. I recommend you to build your app with react + typescript + emurgo/cardano-serialization-lib-browser. That is how I built this minting app

1

Another option:

Transaction can be built in Java backend and then sent to Nami for signing.

Here's a sample code for Multi-sig token mint where

(Not exactly same but similar approach can be used for your scenario)

  1. Mint Transaction is built in Java backend
  2. Sign by Nami extension in the browser
  3. Send the witness back to Java backend
  4. Assemble transaction again with other witnesses in Java backend and submit the final transaction

MultiSigTokenMint With Java + Nami

0

I don't think you can get the wallet instance from Nami as the whole point of a wallet is to hide the private key and pass transactions visually to the user so that she can approve and submit them.

I would rather try the other way and look if your java library has methods to generate an unbalanced transaction that can be passed to the Nami wallet. Such a method would only need the wallet's UTxOs and the address of the recipient.

But I also have no clue on which libraries do this. It is very difficult at the moment to find anything useful on the subject.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.