Skip to content

Latest commit

 

History

History
135 lines (91 loc) · 4.76 KB

development.md

File metadata and controls

135 lines (91 loc) · 4.76 KB

JavaScript DLC Documentation

Table of Contents

  1. Introduction
  2. Getting Started
    1. Prerequisites
    2. Installation
  3. Usage
  4. Testing
  5. Contributing
  6. License

1. Introduction

Javascript DLC is a library for Discreet Log Contracts

2. Getting Started

Explain how to set up and get your project running.

2.1 Prerequisites

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

2.2 Installation

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

# 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

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

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

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

4. Testing

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 or Mocha.

# Run tests
npm test

4.2 Writing Tests

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

Guide contribution

5.1 Code of Conduct

Code of Conduct

5.2 How to Contribute

Guide contribution

6. License

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.