# juice-sdk

> 🧃 A JavaScript SDK for the [Juicebox V2 protocol](https://github.com/jbx-protocol/juice-contracts-v2).

Latest version **2.1.0-alpha** (published 2022-08-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install juice-sdk
pnpm add juice-sdk
yarn add juice-sdk
bun add juice-sdk
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0-alpha |
| Published | 2022-08-18 |
| First published | 2022-05-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | aeolian.eth |

## Links

- npm: https://www.npmjs.com/package/juice-sdk
- Repository: https://github.com/aeolianeth/juice-sdk
- Homepage: https://github.com/aeolianeth/juice-sdk#readme
- Issues: https://github.com/aeolianeth/juice-sdk/issues
- Funding: https://juicebox.money/#/p/juicebox
- npm.io page: https://npm.io/package/juice-sdk

## Recent versions

- 2.1.0-alpha (latest) — 2022-08-18
- 2.0.4-alpha — 2022-08-18
- 2.0.3-alpha — 2022-08-16
- 2.0.2-alpha — 2022-07-06
- 2.0.1-alpha — 2022-06-13
- 2.0.0-alpha — 2022-06-13
- 1.0.0-alpha — 2022-05-26
- 0.0.21-alpha — 2022-05-23
- 0.0.20-alpha — 2022-05-23
- 0.0.19-alpha — 2022-05-23
- 0.0.18-alpha — 2022-05-23
- 0.0.17-alpha — 2022-05-23
- 0.0.16-alpha — 2022-05-23
- 0.0.15-alpha — 2022-05-23
- 0.0.14-alpha — 2022-05-23
- … 13 more at https://npm.io/package/juice-sdk/versions

## README

# juice-sdk

🧃 A JavaScript SDK for the [Juicebox V2 protocol](https://github.com/jbx-protocol/juice-contracts-v2).

> ⚠️ This library is experimental and we provide no guarantees. Use at your own risk.

## Overview

`juice-sdk` helps you interact with the Juicebox V2 contracts using JavaScript.

Supports your favorite dev environment:

- ✅ Node.js
- ✅ Typescript
- ✅ Webpack (supports tree-shaking)
- ✅ Rollup (supports tree-shaking)
- ✅ Vite (supports tree-shaking)

Check out the [examples](#examples) to get started 🚀.

## Installation

```bash
npm install juice-sdk
```

## Usage

1. Import the factory function for a Juicebox contract.

   ```js
   import { getJBDirectory } from "juice-sdk";
   ```

1. Create a JsonRpcProvider.
   The example below uses the [ethers](https://docs.ethers.io/v5/) library.

   ```js
   import { JsonRpcProvider } from "@ethersproject/providers";
   // ...);
   const provider = new JsonRpcProvider(YOUR_GATEWAY_HOST_URL);
   ```

1. Call the factory function to get an instance of the ethers.js `Contract`.

   ```js
   const JBDirectory = getJBDirectory(provider);
   ```

1. Start interacting with the contract.

   ```js
   const const terminals = await JBDirectory.terminalsOf(projectId);
   ```

### Examples

Inspect the `examples/` directory to learn how to use `juice-sdk` for your project.

| Environment                    | Example                                                                                                          |
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| node.js                        | [./examples/node](./examples/node)                                                                               |
| node.js with Typescript        | [./examples/typescript-node](./examples/typescript-node)                                                         |
| create-react-app (webpack)     | [./examples/create-react-app](./examples/create-react-app)                                                       |
| Vue                            | [./examples/vue](./examples/vue)                                                                                 |
| Svelte                         | [./examples/svelte](./examples/svelte)                                                                           |
| Vanilla JavaScript (with Vite) | [juice-tools/embed/project/balance](https://github.com/jbx-protocol/juice-tools/tree/main/embed/project/balance) |

## Development

- [Build process](./doc/build-process.md)

---
_Source: https://npm.io/package/juice-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
