Sapphire Contracts Lib
NPM ![npm](https://img.shields.io/npm/v/@oasisprotocol/sapphire-contracts)
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 {Sapphire} from "@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!