open-index/open-npm huggingface dataset:
npm package: @roll-network/api
Description: API request functions for Roll
Latest version: 3.0.3

# @roll-network/api

## Install

```sh
yarn add @roll-network/api
```

## Setup

The library uses [better-queue](https://www.npmjs.com/package/better-queue) that is a browser compatible Node package. It requires [util](https://www.npmjs.com/package/util) to be installed when used within browser environment.

### CRA

If you use create-react-app, you have to

1. Install [craco](https://www.npmjs.com/package/@craco/craco).
2. Update `package.json` to use `craco` instead of `react-scripts` in the `scripts` section.
3. Create a new `craco.config.js` file with the following content:
```js
module.exports = {
  webpack: {
    configure: {
      resolve: {
        fallback: {
          util: require.resolve("util"),
        },
      },
    },
  },
};
```
npm package: @roll-network/contract-bindings
Description: Contract bindings for Roll's smart contracts
Latest version: 2.0.1

# @roll-network/contract-bindings

## Install

```sh
yarn add @roll-network/contract-bindings
```

## Usage

```ts
import { SocialMoneyV1_5 } from '@roll-network/contract-bindings';


const erc20 = SocialMoneyV1_5.ERC20__factory.connect(address, provider)
```
npm package: @roll-network/eslint-config
Description: ESLint configuration for Roll applications
Latest version: 2.0.0

# @roll-network/eslint-config

This folder contains ESLint config file used in Roll.

## Install

```sh
yarn add -D @roll-network/eslint-config
npx install-peerdeps -D @roll-network/eslint-config
```

## Usage

Create a `.eslintrc.js` file in the root of your project. Add the following content:

```js
module.exports = {
  extends: '@roll-network/eslint-config',
}
```

[Install CLI](../cli/README.md) and run `yarn roll lint`.
npm package: @roll-network/feature-flag
Description: Feature flag utils for Roll applications
Latest version: 1.0.2

# @roll-network/feature-flag

## Install

```sh
yarn add @roll-network/feature-flag
npx install-peerdeps @roll-network/feature-flag
```

## Usage

Wrap the root of your application with the provider.

```js
import { FeatureFlagProvider } from '@roll-network/feature-flag'

const flags = [
  {
    type: 'static',
    name: 'useNavigationV2',
    value: true,
  },
]

const App = ({ children }) => {
  return (
    <FeatureFlagProvider flags={flags}>
      {children}
    </FeatureFlagProvider>
  )
}
```

Use hook to retreive a feature flag value.

```js
import { useFeatureFlag } from '@roll-network/feature-flag'

import Navigation from './navigation'
import NavigationV2 from './navigationV2'

const Layout = () => {
  const shouldUseNavigationV2 = useFeatureFlag('useNavigationV2')

  return shouldUseNavigationV2 ? <NavigationV2 /> : <Navigation />
}
```

## Advanced Usage

This package allows you to inject any feature flag provider. You can make static, async & computed flags. Moreover, you can add an async group from an external provider (ex. LaunchDarkly).


```js
import * as LDClient from 'launchdarkly-js-client-sdk'
import { FeatureFlagProvider } from '@roll-network/feature-flag'

const flags = [
  {
    type: 'static',
    name: 'useNavigationV2',
    value: true,
  },
  {
    type: 'async',
    name: 'useExternalService',
    value: async () => {
      try {
        const response = await fetch('https://external.service/api/healthcheck')
        return response.status === 200
      } catch (e) {
        return false
      }
    },
    defaultValue: false,
  },
  {
    type: 'asyncGroup',
    value: async () => {
      const client = LDClient.initialize('LAUNCH_DARKLY_CLIENT_ID', { key: 'test' })
      await client.waitUntilReady()
      return client.allFlags();
    },
    defaultValue: {
      ldFeatureFlag1: true,
      ldFeatureFlag2: 123,
      ldFeatureFlag3: 'here',
    },
  },
  {
    type: 'computed',
    name: 'useExternalServiceLinkInNavigation',
    value: flags => flags.useNavigationV2 && flags.useExternalService,
  }
]

const App = ({ children }) => {
  return (
    <FeatureFlagProvider flags={flags}>
      {children}
    </FeatureFlagProvider>
  )
}
```
npm package: @roll-network/prettier-config
Description: Prettier configuration for Roll applications
Latest version: 1.0.1

# @roll-network/prettier-config

This folder contains Prettier config file used in Roll.

## Install

```sh
yarn add -D @roll-network/prettier-config
```

## Usage

Create a `.prettierrc.js` file in the root of your project. Add the following content:

```js
module.exports = {
  ...require('@roll-network/prettier-config'),
}
```

[Install CLI](../cli/README.md) and run `yarn roll format`.