Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrokonrad committed Jan 22, 2025
1 parent ef3d0e9 commit 5e13430
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 260 deletions.
2 changes: 0 additions & 2 deletions docs/docs/_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ docs_menu:
id: basics
- title: Getting started
id: getting-started
- title: Advanced
id: advanced

docs_items:
- title: Resources
Expand Down
1 change: 0 additions & 1 deletion docs/docs/advanced/_data.yml

This file was deleted.

21 changes: 0 additions & 21 deletions docs/docs/advanced/cml.md

This file was deleted.

17 changes: 0 additions & 17 deletions docs/docs/advanced/plutus-core.md

This file was deleted.

46 changes: 0 additions & 46 deletions docs/docs/advanced/type-casting.md

This file was deleted.

4 changes: 3 additions & 1 deletion docs/docs/basics/create-wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ section we are using the private key method.
In case you do not have private key yet, you can generate one with Lucid:

```js
const privateKey = lucid.utils.generatePrivateKey(); // Bech32 encoded private key
import { Addresses } from "https://deno.land/x/lucid/mod.ts";

const privateKey = Addresses.generatePrivateKey(); // Extended bech32 encoded private key
console.log(privateKey);
```

Expand Down
10 changes: 6 additions & 4 deletions docs/docs/basics/instantiate-lucid.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ network.
```js
import { Blockfrost, Lucid } from "https://deno.land/x/lucid/mod.ts";

const lucid = await Lucid.new(
new Blockfrost("https://cardano-preprod.blockfrost.io/api/v0", "<projectId>"),
"Preprod",
);
const lucid = new Lucid({
provider: new Blockfrost(
"https://cardano-preprod.blockfrost.io/api/v0",
"<projectId>",
),
});
```

Lucid allows you to choose different providers. You also have the option to
Expand Down
30 changes: 16 additions & 14 deletions docs/docs/basics/your-first-tx.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ Let's create a simple transaction where we send `5 ADA` to two recipients each:

```js
const tx = await lucid.newTx()
.payToAddress("addr_testa...", { lovelace: 5000000n })
.payToAddress("addr_testb...", { lovelace: 5000000n })
.complete();
.payTo("addr_testa...", { lovelace: 5000000n })
.payTo("addr_testb...", { lovelace: 5000000n })
.commit();
```

Transactions always need to end with `.complete()` in order to balance the
Transactions always need to end with `.commit()` in order to balance the
transaction and do coin selection.

Next we sign the transaction:

```js
const signedTx = await tx.sign().complete();
const signedTx = await tx.sign().commit();
```

Here we also need to call `.complete()` when we are ready with signing.
Here we also need to call `.commit()` when we are ready with signing.

Lastly we submit the transaction:

Expand All @@ -37,19 +37,21 @@ The full example:
```js
import { Blockfrost, Lucid } from "https://deno.land/x/lucid/mod.ts";

const lucid = await Lucid.new(
new Blockfrost("https://cardano-preprod.blockfrost.io/api/v0", "<projectId>"),
"Preprod",
);
const lucid = new Lucid({
provider: new Blockfrost(
"https://cardano-preprod.blockfrost.io/api/v0",
"<projectId>",
),
});

lucid.selectWalletFromPrivateKey(privateKey);

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

const signedTx = await tx.sign().complete();
const signedTx = await tx.sign().commit();
const txHash = await signedTx.submit();

console.log(txHash);
Expand Down
Binary file modified src/core/libs/lucid_core/pkg/lucid_core_bg.wasm
Binary file not shown.
Loading

0 comments on commit 5e13430

Please sign in to comment.