Skip to content

Commit

Permalink
fix: add sapphire-hardhat explaination
Browse files Browse the repository at this point in the history
  • Loading branch information
rube-de committed Jan 6, 2025
1 parent 5439be7 commit e0be54f
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions docs/build/hardhat.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ description: Use Sapphire with hardhat

# Hardhat

:::caution Under Construction

This page is **under construction**. Content may be incomplete or subject to
change.

:::

Hardhat is a versatile development environment for Ethereum, designed to
streamline tasks like compiling, testing, and deploying smart contracts. It
offers a modular toolkit and an intuitive workflow that helps developers focus
Expand Down Expand Up @@ -80,5 +73,36 @@ You can use now the standard test accounts to run your hardhat tests:
npx hardhat test --network sapphire-localnet
```

## Hardhat Provider

The `@oasisprotocol/sapphire-hardhat` package provides a custom Hardhat provider
that enables encrypted transactions when working with Oasis Sapphire. This
makes it easy to test and run tasks involving confidential smart contracts
directly within your Hardhat setup.

### Installation

To add the provider to your project, run:

```shell npm2yarn
npm install -D @oasisprotocol/sapphire-hardhat
```

Next, import it in your `hardhat.config.ts` above the rest of your plugins so
that the provider gets wrapped before anything else starts to use it.

```js
// ESM
import '@oasisprotocol/sapphire-hardhat';

// CommonJS
require('@oasisprotocol/sapphire-hardhat');

/** All other plugins must go below this one! **/
```

The Hardhat Ethers provider is now wrapped for Sapphire and will encrypt your
transactions on use.

[Quickstart]: ../quickstart.mdx
[Localnet]: https://github.com/oasisprotocol/docs/blob/main/docs/build/tools/localnet.mdx

0 comments on commit e0be54f

Please sign in to comment.