Skip to content

Commit

Permalink
docs(update): vertical display refined
Browse files Browse the repository at this point in the history
  • Loading branch information
0xBora committed Dec 15, 2024
1 parent 0173585 commit f1cacac
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 167 deletions.
36 changes: 29 additions & 7 deletions docs/pages/documentation/core-concepts/instantiate-evolution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const lucid = await Lucid(
);
```

---

### Kupmios

```typescript
Expand All @@ -34,8 +36,12 @@ const lucid = await Lucid(
"Preview"
);
```

<Callout type="info">
Kupmios is a mix of [Ogmios](https://ogmios.dev/) and [Kupo](https://cardanosolutions.github.io/kupo/).
</Callout>

---

### Maestro

Expand All @@ -52,6 +58,8 @@ const lucid = await Lucid(
);
```

---

### Koios

```typescript
Expand All @@ -63,6 +71,8 @@ const lucid = await Lucid(
);
```

---

### YACI DevKit

YACI DevKit provides a local development environment with configurable block times and network parameters. For detailed setup instructions, visit the [YACI DevKit documentation](https://devkit.yaci.xyz/tutorials/lucid-evolution/overview).
Expand All @@ -83,6 +93,8 @@ const lucid = await Lucid(
);
```

---

### UTxORPC
```typescript
//TODO: https://github.com/utxorpc/lucid-evolution-provider
Expand All @@ -96,13 +108,15 @@ The `provider` in `lucid.provider` is the provider instance you passed to `Lucid

### Query UTxOs

#### Using Provider
**Using Provider**

```typescript
const utxos = await lucid.provider.getUtxos("addr_test...");
```

#### Using Convenience Method
---

**Using Convenience Method**

```typescript
const utxos = await lucid.utxosAt("addr_test...");
Expand All @@ -112,35 +126,43 @@ const utxos = await lucid.utxosAt("addr_test...");
This convenience method internally uses `lucid.provider.getUtxos()`.
</Callout>

---

### Query Datums

#### Using Provider
**Using Provider**

```typescript
const datum = await lucid.provider.getDatum("<datum_hash>");
```

#### Using Convenience Method
---

**Using Convenience Method**

```typescript
const datum = await lucid.datumOf("<datum_hash>");
```

#### Querying datum from a UTxO:
---

**Querying datum from a UTxO**

```typescript
const [scriptUtxo] = await lucid.utxosAt("addr_test...");
const datum = await lucid.datumOf(scriptUtxo);
```

<Callout type="info">
`lucid.datumOf(scriptUtxo)` is a convenience method that internally uses `lucid.provider.getDatum()` if the datum isn't already attached to the UTxO. When you query the datum for a UTxO, Lucid automatically adds the datum to the UTxO. This means that subsequent queries for the same UTxO will return the result instantly, without the need for an additional network request.
`lucid.datumOf(scriptUtxo)` is a convenience method that internally uses `lucid.provider.getDatum()` if the datum isn't already attached to the UTxO.

When you query the datum for a UTxO, Lucid automatically adds the datum to the UTxO. This means that subsequent queries for the same UTxO will return the result instantly, without the need for an additional network request.
</Callout>


### Query Protocol Parameters

Using the provider directly:
**Using the provider directly:**

```typescript
const protocolParameters = await lucid.provider.getProtocolParameters();
Expand Down
146 changes: 74 additions & 72 deletions docs/pages/documentation/deep-dives/conway-era.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,134 +5,136 @@ import Link from 'next/link';

The Conway era introduces significant on-chain governance features to the Cardano blockchain, as outlined in [CIP-1694](https://github.com/cardano-foundation/CIPs/tree/master/CIP-1694). These enhancements enable ADA holders to participate in various on-chain decisions. Lucid Evolution now supports key governance actions, allowing users to engage in the democratic process of the Cardano ecosystem.

<Callout>Governance functionality documentation is actively being updated to reflect the latest features 🛠️</Callout>

## For ADA Holders

As an ADA holder, you can participate in governance through various voting strategies and delegation options.

<Callout>
<Callout type="info">
To be able to delegate your voting power, you must first register the associated stake address and query the reward address. Learn more about stake address registration [here](/documentation/deep-dives/register-stake).
</Callout>

### Voting Delegation

#### Delegate Vote
Delegate your voting power to a specific DRep:
```typescript
await lucid.newTx()
.delegate.VoteToDRep(rewardAddress, drep)
```

#### Register and Delegate
Register a stake address and delegate voting power to a DRep in one action:
```typescript
await lucid.newTx()
.registerAndDelegate.ToDrep(rewardAddress, drep)
```

#### Delegate Vote and Stake

Delegate both your ADA stake to a pool and your voting power to a DRep in one action:
```typescript
await lucid.newTx()
.delegate.VoteToPoolAndDrep(rewardAddress, poolId, drep)
```

<Callout>
You can also register a stake address, delegate to a pool, and vote to a DRep (e.g., `AlwaysAbstain`) in one action:

```typescript
await lucid.newTx()
.registerAndDelegate.ToPoolAndDRep(rewardAddress, poolId, {
__typename: "AlwaysAbstain",
})
```
</Callout>
**Delegate your voting power to a specific DRep:**

```typescript
await lucid.newTx()
.delegate.VoteToDRep(rewardAddress, drep)
```
---
**Register a stake address and delegate voting power to a DRep in one action:**

```typescript
await lucid.newTx()
.registerAndDelegate.ToDrep(rewardAddress, drep)
```

---

**Delegate both your ADA stake to a pool and your voting power to a DRep in one action:**

```typescript
await lucid.newTx()
.delegate.VoteToPoolAndDrep(rewardAddress, poolId, drep)
```

<Callout>
You can also register a stake address, delegate to a pool, and vote to a DRep (e.g., `AlwaysAbstain`) in one action:

```typescript
await lucid.newTx()
.registerAndDelegate.ToPoolAndDRep(rewardAddress, poolId, {
__typename: "AlwaysAbstain",
})
```
</Callout>

---

### Predefined Voting Strategies

#### Always Abstain
**Always Abstain:**

```typescript
await lucid.newTx()
.delegate.VoteToDRep(rewardAddress, {
__typename: "AlwaysAbstain",
})
```

#### Always No Confidence
---

**Always No Confidence:**

```typescript
await lucid.newTx()
.delegate.VoteToDRep(rewardAddress, {
__typename: "AlwaysNoConfidence",
})
```

<Callout>
When using predefined strategies like `AlwaysAbstain` or `AlwaysNoConfidence`, ensure the DRep object has the `__typename` property set to the desired value
</Callout>

## For DReps
As a Delegated Representative (DRep), you can manage your status and information on the network.

### Managing DRep Status

#### Register DRep
Register a stake address as a DRep:
```typescript
await lucid.newTx()
.register.DRep(rewardAddress)
```
**Register a stake address as a DRep:**

```typescript
await lucid.newTx()
.register.DRep(rewardAddress)
```


<Callout>
Remember to register the associated stake address before registering as a DRep. This way you will be able to query the reward address and update the DRep information. Learn more about stake address registration [here](/documentation/deep-dives/register-stake).
</Callout>

#### Update DRep
---

**Update DRep information:**

```typescript
await lucid.newTx()
.updateDRep(rewardAddress)
```

---

Update DRep information:
```typescript
await lucid.newTx()
.updateDRep(rewardAddress)
```
**Deregister a DRep stake address:**

#### Deregister DRep
Deregister as a DRep:
```typescript
await lucid.newTx()
.deregister.DRep(rewardAddress)
```
```typescript
await lucid.newTx()
.deregister.DRep(rewardAddress)
```

<Callout>
Remember to register the associated stake address before registering as a DRep. This way you will be able to query the reward address and update the DRep information. Learn more about stake address registration [here](/documentation/deep-dives/register-stake).
</Callout>

## Script-based DReps

Lucid Evolution supports script-based DReps, enabling programmatic voting behavior for more complex governance strategies

<Steps>
<Tabs items={['Register Script DRep', 'Deregister Script DRep']}>
<Tabs.Tab>
---

**Register Script DRep:**

```typescript
await lucid
.newTx()
.register.DRep(rewardAddress)
.attach.Script(script)
```

</Tabs.Tab>
<Tabs.Tab>
---

**Deregister Script DRep:**

```typescript
await lucid
.newTx()
.deregister.DRep(rewardAddress)
```
</Tabs.Tab>
</Tabs>



</Steps>
---

## Example

Expand Down
Loading

0 comments on commit f1cacac

Please sign in to comment.