Skip to content

Commit

Permalink
Merge pull request #13 from AreaLayer/Rsync25-patch-3
Browse files Browse the repository at this point in the history
Add Clean documentation
  • Loading branch information
Rsync25 authored Nov 2, 2023
2 parents fc4e514 + 732c8f5 commit 01b8a56
Showing 1 changed file with 135 additions and 0 deletions.
135 changes: 135 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -1 +1,136 @@
# JavaScript DLC Documentation

## Table of Contents
1. [Introduction](#introduction)
2. [Getting Started](#getting-started)
1. [Prerequisites](#prerequisites)
2. [Installation](#installation)
3. [Usage](#usage)
4. [Testing](#testing)
5. [Contributing](#contributing)
6. [License](#license)

## 1. Introduction <a name="introduction"></a>

Javascript DLC is a library for Discreet Log Contracts

## 2. Getting Started <a name="getting-started"></a>

Explain how to set up and get your project running.

### 2.1 Prerequisites <a name="prerequisites"></a>

List the software and tools that users need to have installed on their system before they can use your DLC. For example:

- [Node.js](https://nodejs.org/) (v14.0.0 or higher)
- [npm](https://www.npmjs.com/)
- Git

### 2.2 Installation <a name="installation"></a>

Provide step-by-step instructions for users to install and set up your DLC. This might include cloning the Git repository and installing dependencies.

```bash
# Clone the repository
git clone https://github.com/AreaLayer/javascript-dlc.git

# Change to the project directory
cd javascriptdlc

# Install dependencies
npm install
```

## 3. Usage <a name="usage"></a>

Explain how users can use your DLC in their own projects. Provide code examples, explanations, and any configuration details.

```javascript
// Example code demonstrating how to use your DLC
const dlc = require('dlc');

const result = dlc.doSomething();
console.log(result);
```

## 4. Testing <a name="testing"></a>

Detail how users can run tests to ensure the stability and correctness of your DLC.

### 4.1 Running Tests

Provide instructions on running tests. Use a testing framework like [Jest](https://jestjs.io/) or [Mocha](https://mochajs.org/).

```bash
# Run tests
npm test
```

### 4.2 Writing Tests

Explain how users can write their own tests for your DLC. Include guidelines and best practices.

```javascript
const { executeDLC, verifyDLCResult } = require('./dlc-utils'); // Replace with your DLC utility functions

test('DLC Execution Test', () => {
// Set up the DLC parameters and contract
const dlcParams = {
oracleSignature: 'mock_oracle_signature',
oraclePublicKey: 'mock_oracle_public_key',
contract: 'your_dlc_contract_details', // Replace with your contract
};

// Execute the DLC
const dlcResult = executeDLC(dlcParams);

// Verify the DLC result
const expectedOutcome = 'expected_outcome'; // Replace with your expected outcome
const isDLCSuccessful = verifyDLCResult(dlcResult, expectedOutcome);

// Assert the test
expect(isDLCSuccessful).toBe(true);
});
```

In this example, we have a test case for a DLC execution. You'll need to replace the executeDLC and verifyDLCResult functions with your actual implementation. The dlcParams object should contain the necessary parameters for your DLC, and you should set the expectedOutcome to what you expect the outcome of the DLC to be.

Make sure that you have the appropriate testing infrastructure in place and that your executeDLC function simulates the execution of a DLC using the provided parameters. The verifyDLCResult function should compare the actual outcome of the DLC to the expected outcome and return true if they match.

Before running the test, ensure you've installed Jest and configured it for your project. You may also need to set up mock objects or utilities for the DLC-specific functions, such as executeDLC and verifyDLCResult, to facilitate testing.

## 5. Contributing <a name="contributing"></a>

[Guide contribution](https://github.com/AreaLayer/javascript-dlc/blob/main/CONTRIBUTING.md)

### 5.1 Code of Conduct

[Code of Conduct](https://github.com/AreaLayer/javascript-dlc/blob/main/CODE_OF_CONDUCT.md)

### 5.2 How to Contribute

[Guide contribution](https://github.com/AreaLayer/javascript-dlc/blob/main/CONTRIBUTING.md)

## 6. License <a name="license"></a>

MIT License

Copyright (c) 2023 Area Layer⚡️

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

0 comments on commit 01b8a56

Please sign in to comment.