3.2.2-alpha ā€¢ Published 9 months ago

@jigglyjams/juice-sdk-v3 v3.2.2-alpha

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

juice-sdk

šŸ§ƒ A JavaScript SDK for the Juicebox V2 protocol.

āš ļø 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 to get started šŸš€.

Installation

npm install juice-sdk

Usage

  1. Import the factory function for a Juicebox contract.

    import { getJBDirectory } from 'juice-sdk';
  2. Create a JsonRpcProvider. The example below uses the ethers library.

    import { JsonRpcProvider } from '@ethersproject/providers';
    // ...);
    const provider = new JsonRpcProvider(YOUR_GATEWAY_HOST_URL);
  3. Call the factory function to get an instance of the ethers.js Contract.

    const JBDirectory = getJBDirectory(provider);
  4. Start interacting with the contract.

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

Usage on Rinkeby

Juicebox is deployed on Ethererum mainnet and the Rinkeby testnet. To use the Rinkeby contract addresses, set the network argument to rinkeby when loading the given contract:

const JBDirectory = getJBDirectory(provider, { network: 'rinkeby' });

Examples

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

EnvironmentExample
node.js./examples/node
node.js with Typescript./examples/typescript-node
create-react-app (webpack)./examples/create-react-app
Vue./examples/vue
Svelte./examples/svelte
Vanilla JavaScript (with Vite)juice-tools/embed/project/balance

Development

3.2.2-alpha

9 months ago

3.2.1-alpha

9 months ago

3.1.3-alpha

1 year ago

3.1.1-alpha

1 year ago

3.1.0-alpha

1 year ago

3.1.2-alpha

1 year ago

2.1.0-alpha

2 years ago