open-index/open-npm huggingface dataset:
npm package: @oasisprotocol/client
Description: Users of this package, see [this getting started guide](docs/getting-started.md).
Latest version: 1.3.0

# An oasis-core SDK for TypeScript

Users of this package, see [this getting started guide](docs/getting-started.md).

## Philosophy

Prioritize exposing an unopinionated binding to
[`oasis-node`](https://github.com/oasisprotocol/oasis-core/tree/master/go/oasis-node)'s gRPC
services.
Mostly leave the protocol and formats be, and don't create too much abstraction over it.
Aim to create a library that will take less work to maintain when oasis-core changes.
The target audience is developers who are already familiar with oasis-core.

## Inventory of what's here

1. A layer over [`grpc-web`](https://github.com/grpc/grpc-web) to hook up CBOR-based message
serialization.
1. Method definitions and wrappers to represent the node's gRPC methods.
1. A heuristic to convert structures from CBOR maps to JavaScript objects.
1. Type definitions for structures.
1. Helpers for operating on a few kinds of data.
1. Constants.
1. JSDoc copied from Godoc.
1. Wrappers for consensus transactions.

## Design notes

1. There is no conversion layer between deserialized messages and further object model.
1. Non-structure types, e.g. specialized byte arrays such as `Quantity` and `PublicKey` don't have
dedicated names in the type system.
1. Types are only interfaces (where possible), and helpers are standalone functions.

## Caveats

1. `oasis-node`'s gRPC interface is not desigend to be secure against untrusted clients. We suggest
using this SDK with an additional access control component.
1. Native gRPC is not accessible over the web. The `grpc-web` project suggests setting up an
[Envoy](https://www.envoyproxy.io/) proxy to allow browsers to connect.
1. Empty structures are deserialized into an empty `Map`, due to a limitation in the heuristic that
converts structures to objets.
1. Go prefers to use `nil` instead of some empty values and to serialize them as `null` or missing
structure fields. This behavior is not modeled in this library's type system.
npm package: @oasisprotocol/client-ext-utils
Description: This package contains a library for both building a browser extension and interacting with it from web content.
Latest version: 1.0.0

# Utilities related to browser extensions

This package contains a library for both building a browser extension and
interacting with it from web content.

Developers, see [this getting started guide](docs/getting-started.md).

## Philosophy

A browser extension is a convenient place to implement a wallet so that it can
be used with dApps.
Prefer to have more responsibilities in the dApp, such as connecting to a
node, estimating or configuring gas, setting nonces, and submitting
transactions.

An extension that works by altering the JavaScript environment for all sites
is a lot to trust.
Prefer to have a dApp request to interact with an extension.

## Inventory of what's here

1. A messaging protocol for web content to connect to a browser extension.
1. For use in web content, a `ContextSigner` implementation that forwards
   requests to a browser extension over the messaging protocol.
1. For use in browser extensions, a library that understands the messaging
   protocol and calls given callbacks.
npm package: @oasisprotocol/ionic-ledger-hw-transport-ble
Description: Ledger Hardware Wallet Bluetooth BLE transport for Ionic
Latest version: 8.0.0

# ionic-ledger-hw-transport-ble

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![CI test status][github-ci-tests-badge]][github-ci-tests-link]

<!-- markdownlint-disable line-length -->
[github-ci-tests-badge]: https://github.com/oasisprotocol/ionic-ledger-hw-transport-ble/workflows/ci-test/badge.svg
[github-ci-tests-link]: https://github.com/oasisprotocol/ionic-ledger-hw-transport-ble/actions?query=workflow:ci-test+branch:master
<!-- markdownlint-enable line-length -->

**Ledger Hardware Wallet Bluetooth BLE transport for Ionic.**

```shell
yarn add @oasisprotocol/ionic-ledger-hw-transport-ble
```

### Pre-requisite

-   [**Install and link library `@capacitor-community/bluetooth-le` + configure your app for Bluetooth permissions**](https://github.com/capacitor-community/bluetooth-le) (Open the link for documentation)
-   **global.Buffer** available. Typically `global.Buffer = require("buffer").Buffer;` that can be placed in a `polyfill.js` and imported with `import "./polyfill";` at first line of the main JavaScript entry file.

## Minimal getting started

`@oasisprotocol/ionic-ledger-hw-transport-ble` works like any of `@ledgerhq/hw-transport` libraries.

The difference here is that the `list()` is not implemented, only `create()`.
Create doesn't always scan for devices, it tries to reuse previously selected
device.

> Important: you will also have to deal with specifics of Bluetooth BLE, for instance, you need to request the LOCATION permission on Android!

Here is a gist of the most important parts required.

### Check for Bluetooth state

```ts
import BleTransport from "@oasisprotocol/ionic-ledger-hw-transport-ble";

// Check if @capacitor-community/bluetooth-le is setup
BleTransport.isSupported()

// Check for bluetooth status
BleTransport.isEnabled()
```

### Connect to device

```ts
const transport = await BleTransport.create()
```

**and now we can just use the transport like any other Ledger transport!**
npm package: @oasisprotocol/ledger
Description: Javascript / Node API for Oasis apps running on Ledger Nano S/X
Author: Oasis Protocol Foundation
Latest version: 1.0.0

# ledger-js

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![CI test status][github-ci-tests-badge]][github-ci-tests-link]

<!-- markdownlint-disable line-length -->
[github-ci-tests-badge]: https://github.com/oasisprotocol/ledger-js/workflows/ci-tests/badge.svg
[github-ci-tests-link]: https://github.com/oasisprotocol/ledger-js/actions?query=workflow:ci-tests+branch:master
<!-- markdownlint-enable line-length -->

This package provides a basic client library to communicate with the Oasis apps running on a Ledger Nano S/X.

We recommend using the npmjs package in order to receive updates/fixes.

![Example](docs/example.png)
npm package: @oasisprotocol/sapphire-contracts
Description: Solidity smart contract library for confidential contract development
Latest version: 0.2.15

# Sapphire Contracts Lib

[NPM](https://www.npmjs.com/package/@oasisprotocol/sapphire-contracts) ![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

```solidity
$ pnpm install @oasisprotocol/sapphire-contracts
```

#### Usage

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

```solidity
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](https://docs.oasis.io/build/sapphire/) and
[OPL](https://docs.oasis.io/build/opl/).

The generated API reference is hosted at
[api.docs.oasis.io](https://api.docs.oasis.io/sol/sapphire-contracts).

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

```shell
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](https://github.com/oasisprotocol/sapphire-paratime/blob/main/CONTRIBUTING.md)!
npm package: @oasisprotocol/sapphire-hardhat
Description: A Hardhat plugin for developing on the Sapphire ParaTime.
Latest version: 2.22.3

# @oasisprotocol/sapphire-hardhat

A plugin for Hardhat that wraps the provider connected to a Sapphire network.

## Usage

First install the plugin.

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

Next, import it in your Hardhat config 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! **/
```
npm package: @oasisprotocol/sapphire-paratime
Description: The Sapphire ParaTime Web3 integration library.
Latest version: 2.3.0

# Sapphire ParaTime Compat Lib

[@oasisprotocol/sapphire-paratime] makes it easy to port your dapp to the [Sapphire ParaTime]
by wrapping your existing EIP-1193 compatible provider (e.g. `window.ethereum`).
Once you wrap your provider, you can use Sapphire just like you would use
Ethereum, however to get full support for encrypted transactions, queries and
gas estimates it may be necessary to use a framework-specific package such as
with Ethers, Hardhat, Viem or Wagmi.

The Sapphire wrapper with automatically encrypt the `eth_call`, `eth_estimateGas`
and `eth_signTransaction` JSON-RPC calls

[@oasisprotocol/sapphire-paratime]: https://www.npmjs.com/package/@oasisprotocol/sapphire-paratime
[sapphire paratime]: https://docs.oasis.io/build/sapphire/

_If your dapp doesn't port in under 10 minutes, it's a bug!_<br />
If you have more than a little trouble, please file an issue.<br />
There should be _no_ reason _not_ to use the Sapphire ParaTime!

## Usage

After installing this library, find your Ethereum provider and wrap it using
`wrapEthereumProvider`. Below are some examples for the most kinds of providers.

### [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193)

```ts
import { wrapEthereumProvider } from '@oasisprotocol/sapphire-paratime';

const provider = wrapEthereumProvider(window.ethereum);
window.ethereum = wrapEthereumProvider(window.ethereum); // If you're feeling bold.
```

### Hardhat

Try the [@oasisprotocol/sapphire-hardhat] Hardhat plugin for extra convenience.
Place this line at the top of your `hardhat.config.ts`.

```js
import '@oasisprotocol/sapphire-hardhat';
// All other Hardhat plugins must come below.
```

[@oasisprotocol/sapphire-hardhat]: https://www.npmjs.com/package/@oasisprotocol/sapphire-hardhat

## Troubleshooting

### `Error: missing provider (operation="getChainId", code=UNSUPPORTED_OPERATION, ...)`

**Explanation:** When you first make a transaction or call using a wrapped signer or provider,
this library will automatically fetch the runtime public key from the Web3 gateway
using your connected provider. If you've wrapped just a signer (e.g., `ethers.Wallet`),
then you'll see this error.

**Fix:** The simplest thing to do is connect a provider. Alternatively, you can pass in
a pre-initialized `Cipher` object as the second argument to `wrap`; and then also generate
signed queries manually using the `overrides` parameter to `SignedCallDataPack.make`.

## See Also

- [Oasis Testnet Faucet](https://faucet.testnet.oasis.io/)
- [Creating dapps for Sapphire](https://docs.oasis.io/build/sapphire/quickstart)
- [How to Transfer ROSE into an EVM ParaTime](https://docs.oasis.io/general/manage-tokens/how-to-transfer-rose-into-paratime/)