@oasisprotocol/sapphire-contracts

0.2.8 • Public • Published

Sapphire Contracts Lib

NPM npm

A library for privacy focused smart contract development.

  • Implementations of OPL smart contracts
  • Sapphire library precompiles and cryptographic primitives
  • Wrapped Rose example

Overview

Installation

$ pnpm install @oasisprotocol/sapphire-contracts

Usage

Once installed, you can import and use the Sapphire contracts as follows:

pragma solidity ^0.8.13;

import "@oasisprotocol/sapphire-contracts/contracts/Sapphire.sol";

contract RandomNumber {
  function generateNumber() public view returns (uint) {
    return uint(bytes32(Sapphire.randomBytes(32, "")));
  }
}

Documentation

See the user's guide for Sapphire and OPL.

The generated API reference is hosted at api.docs.oasis.io.

Generating API docs locally requires Foundry and mdbook-pagetoc. To install them and generate the docs execute:

curl -L https://foundry.paradigm.xyz | bash
cargo install mdbook-pagetoc
pnpm doc

The API docs index will be located in sol/sapphire-contracts/book/index.html.

Contribute

There are many ways you can participate and help build high quality software. Check out the contribution guide!

Readme

Keywords

none

Package Sidebar

Install

npm i @oasisprotocol/sapphire-contracts

Weekly Downloads

23

Version

0.2.8

License

Apache-2.0

Unpacked Size

75.9 kB

Total Files

13

Last publish

Collaborators

  • cedarmist
  • tjanez
  • luka_oasisprotocol
  • kostko
  • oasisprotocol-bot
  • pro-wh