Skip to content

Commit

Permalink
added docs folder with docusaurus project (#256)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaga authored Sep 26, 2023
1 parent 7c6a0df commit 858f48c
Show file tree
Hide file tree
Showing 44 changed files with 9,866 additions and 1,156 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,9 @@ crypto/wasm/target/**
crypto/wasm/Cargo.lock
crypto/wasm/pkg/**

tools/metadata-cddl-checker/Cargo.lock
tools/metadata-cddl-checker/Cargo.lock


# Docs
docs/node_modules/
docs/.docusaurus/
2 changes: 2 additions & 0 deletions docs/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
29 changes: 29 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<p align="center">
<img width="300px" src="/static/img/milkomeda-banner.png" alt="Milkomeda logo">
</p>

<h1 align="center">Getting started with Milkomeda</h1>

You can find the Milkomeda Documentation [on the website](https://dcspark.github.io/milkomeda-documentation/)

### Installation

```
$ npm install
```

### Local Development

```
$ npm run start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ npm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.
3 changes: 3 additions & 0 deletions docs/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
6 changes: 6 additions & 0 deletions docs/crowdin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
preserve_hierarchy: true
files:
- source: /i18n/en/**/*
translation: /i18n/%two_letters_code%/**/%original_file_name%
- source: /docs/**/*
translation: /i18n/%two_letters_code%/docusaurus-plugin-content-docs/current/**/%original_file_name%
20 changes: 20 additions & 0 deletions docs/docs/crate_architecture.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
sidebar_position: 3
---


# Crate Architecture

(To Update...)

- **Core** - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

- **Chain** - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

- **Crypto** - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

- **CIP25** - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

- **CIP36** - Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

For current users, the `rust/ `crate is the main version of CML and is the only one that should be used. There is a workspace in the root directory with crates like `core`, `wasm` etc, which are a part of a big refactor and will eventually replace the rust crate at some point in the future, but are still quite WIP for now. The rust crate when used for WASM builds via the npm scripts in the root repo dir will utilize the `rust/json-gen` crate here in the build scripts to generate typescript definitions for the JSON conversion. The `json-gen-split` crate is the equivalent for the new `core`/`wasm` crates and is not called anywhere from the build scripts, but will someday replace the `rust/json-gen` crate once the refactoring is completed.
135 changes: 135 additions & 0 deletions docs/docs/enums.mdx_bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Enums

## Certificate

### CertificateEnum

```rust
pub enum CertificateEnum {
StakeRegistration(StakeRegistration),
StakeDeregistration(StakeDeregistration),
StakeDelegation(StakeDelegation),
PoolRegistration(PoolRegistration),
PoolRetirement(PoolRetirement),
GenesisKeyDelegation(GenesisKeyDelegation),
MoveInstantaneousRewardsCert(MoveInstantaneousRewardsCert),
}
```

### CertificateKind

```rust
pub enum CertificateKind {
StakeRegistration,
StakeDeregistration,
StakeDelegation,
PoolRegistration,
PoolRetirement,
GenesisKeyDelegation,
MoveInstantaneousRewardsCert,
}
```

## Datum

### DatumKind

```rust
pub enum DatumKind {
Hash,
Inline,
}
```

## MIR

### MIREnum

```rust
pub enum MIREnum {
ToOtherPot(Coin),
ToStakeCredentials(MIRToStakeCredentials),
}
```

### MIRKind

```rust
pub enum MIRKind {
ToOtherPot,
ToStakeCredentials,
}
```


### MIRPot

```rust
pub enum MIRPot {
Reserves,
Treasury,
}
```

## NativeScript

### NativeScriptEnum

```rust
pub enum NativeScriptEnum {
ScriptPubkey(ScriptPubkey),
ScriptAll(ScriptAll),
ScriptAny(ScriptAny),
ScriptNOfK(ScriptNOfK),
TimelockStart(TimelockStart),
TimelockExpiry(TimelockExpiry),
}
```


### NativeScriptKind

```rust
pub enum NativeScriptKind {
ScriptPubkey,
ScriptAll,
ScriptAny,
ScriptNOfK,
TimelockStart,
TimelockExpiry,
}
```

## NetworkId

### NetworkIdKind

```rust
pub enum NetworkIdKind {
Testnet,
Mainnet,
}
```

## Relay

### RelayEnum

```rust
pub enum RelayEnum {
SingleHostAddr(SingleHostAddr),
SingleHostName(SingleHostName),
MultiHostName(MultiHostName),
}
```


### RelayKind

```rust
pub enum RelayKind {
SingleHostAddr,
SingleHostName,
MultiHostName,
}
```
35 changes: 35 additions & 0 deletions docs/docs/getting_started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
sidebar_position: 2
---

# Installation & Getting Started


## Install


```bash

```


## Run Example




```bash
```


## Build

```bash
```


## Test

```bash
nvm i && npm i && npm run rust:test
```
57 changes: 57 additions & 0 deletions docs/docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
sidebar_label: "Introduction"
sidebar_position: 1
---


# Cardano Multiplatform Lib

This is a library, written in Rust, that can be deployed to multiple platforms (Rust crate, JS, Typescript, WASM, etc). It handles:
- Serialization & deserialization of core data structures
- Useful utility functions for dApps & wallets

##### NPM packages

- browser: [link](https://www.npmjs.com/package/@dcspark/cardano-multiplatform-lib-browser)
- nodejs: [link](https://www.npmjs.com/package/@dcspark/cardano-multiplatform-lib-nodejs)
- asm.js (strongly discouraged): [link](https://www.npmjs.com/package/@dcspark/cardano-multiplatform-lib-asmjs)

##### Rust crates

- crates: [link](https://crates.io/crates/cardano-multiplatform-lib)

##### Mobile bindings

We recommend using Ionic + Capacitor or an equivalent setup to have the WASM bindings working in mobile


## Pre-requisite knowledge

This library assumes a certain amount of knowledge about how Cardano works (want to avoid re-documenting the wheel).

You can find the specifications of Cardano's ledger [here](https://github.com/input-output-hk/cardano-ledger-specs) which we suggest consulting as you use this library. Notably, the `Shelley ledger formal specification` covers the core concepts.


## Benefits of using this library

Serialization/deserialization code is automatically generated from
Cardano’s official specification, which guarantees it can easily stay up
to date! We do this using a tool managed by EMURGO & dcSpark called `cddl-codegen`_
which can be re-used for other tasks such as automatically generate a
Rust library for Cardano metadata specifications!

It is also very easy to create scripts in Rust or WASM to share with
stake pools, or even embed inside an online tool! No more crazy
cardano-cli bash scripts!

Powerful and flexible enough to be used to power wallets and exchanges!
(Yes, it’s used in production!)

## Documentation

This library generates both `Typescript`_ and `Flow`_ type definitions,
so it’s often easiest to see what is possible by just looking at the
types! You can find the Flow types `here`_

You can also look in the `example`_ folder to see how to use this
library from Typescript or just experiment with the library.
Loading

0 comments on commit 858f48c

Please sign in to comment.