<p>I recommend using Lucid for this:</p>
<pre><code>import { Blockfrost, Lucid } from &quot;lucid-cardano&quot;; // NPM

const lucid = await Lucid.new(
  new Blockfrost(&quot;https://cardano-preview.blockfrost.io/api/v0&quot;, &quot;&lt;projectId&gt;&quot;),
  &quot;Preview&quot;,
);

// Assumes you are in a browser environment
const api = await window.cardano.nami.enable();
lucid.selectWallet(api);

const tx = await lucid.newTx()
  .payToAddress(&quot;addr...&quot;, { lovelace: 5000000n })
  .complete();

const signedTx = await tx.sign().complete();

const txHash = await signedTx.submit();

console.log(txHash);
</code></pre>
<p>This piece of code (from the <a href="https://github.com/spacebudz/lucid" rel="nofollow noreferrer">lucid</a> github page) selects a wallet injected in the browser (in this case Nami) and creates a transaction using Lucid. It is quite easy to use and well documented!</p>

CC BY-SA 4.0
2023-04-29T19:58:19.583Z
I tried using this, can you look at the code i submitted and let me know what to change/add? Thanks.
lovetoshi
CC BY-SA 4.0
2023-04-28T14:36:09.600Z
2023-04-28T14:36:09.600Z
Duco
<p>I think you may be looking for this. <a href="https://cardano.stackexchange.com/a/7657/7159">https://cardano.stackexchange.com/a/7657/7159</a></p>
<p>Here is the official documentation.
<a href="https://developers.cardano.org/docs/get-started/cardano-serialization-lib/generating-transactions/" rel="nofollow noreferrer">https://developers.cardano.org/docs/get-started/cardano-serialization-lib/generating-transactions/</a></p>

CC BY-SA 4.0
2023-04-27T15:48:00.313Z
2023-04-27T15:48:00.313Z
PREEB
<p>Using just HTML / PHP / Javascript and cardano-serialization, I have the connect wallet working. It shows the balance and stake address. So I have gotten that far.</p>
<p>My question is, how can I request the connected wallet for a chosen amount of ADA?</p>
<p>I do not want to use Mesh or any of those, just using Javascript.</p>
<p>Any and all input greatly appreciated!</p>
<p><strong>EDIT:</strong> I am getting a lot of errors, can anyone tell me what else I can do to make this work correctly?</p>
<pre><code>&lt;script type=&quot;module&quot;&gt;

import { Blockfrost, Lucid } from &quot;https://unpkg.com/lucid-cardano@0.10.2/web/mod.js&quot;; // NPM

const lucid = await Lucid.new(
  new Blockfrost(&quot;https://cardano-preview.blockfrost.io/api/v0&quot;, 
&quot;mainnet...&quot;),
&quot;Preview&quot;,
);

// Assumes you are in a browser environment
const api = await window.cardano.nami.enable();
lucid.selectWallet(api);

const tx = await lucid.newTx()    

 .payToAddress(&quot;addr...&quot;, { lovelace: 5000000n })
  .complete();

const signedTx = await tx.sign().complete();

const txHash = await signedTx.submit();

console.log(txHash);

&lt;/script&gt;
</code></pre>

<wallet><javascript>
EDIT | Is it possible to send (transfer, request) ADA using just Javascript?
# EDIT | Is it possible to send (transfer, request) ADA using just Javascript?

(Asked by: username_0 on 2023-04-27)

Using just HTML / PHP / Javascript and cardano-serialization, I have the connect wallet working. It shows the balance and stake address. So I have gotten that far.
My question is, how can I request the connected wallet for a chosen amount of ADA?
I do not want to use Mesh or any of those, just using Javascript.
Any and all input greatly appreciated!
EDIT: I am getting a lot of errors, can anyone tell me what else I can do to make this work correctly?

**Tags:** wallet, javascript

---

## 2 answers

### Answer by username_1 on 2023-04-28. Score: 2

I recommend using Lucid for this:
import { Blockfrost, Lucid } from "lucid-cardano"; // NPM

const lucid = await Lucid.new(
  new Blockfrost("https://cardano-preview.blockfrost.io/api/v0", ""),
  "Preview",
);

// Assumes you are in a browser environment
const api = await window.cardano.nami.enable();
lucid.selectWallet(api);

const tx = await lucid.newTx()
  .payToAddress("addr...", { lovelace: 5000000n })
  .complete();

const signedTx = await tx.sign().complete();

const txHash = await signedTx.submit();

console.log(txHash);

This piece of code (from the lucid github page) selects a wallet injected in the browser (in this case Nami) and creates a transaction using Lucid. It is quite easy to use and well documented!

> **Comments:**
> **username_0**: I tried using this, can you look at the code i submitted and let me know what to change/add? Thanks.  

---

### Answer by username_2 on 2023-04-27. Score: 0

I think you may be looking for this. <https://cardano.stackexchange.com/a/7657/7159>

Here is the official documentation.
<https://developers.cardano.org/docs/get-started/cardano-serialization-lib/generating-transactions/>


---

