open-index/open-npm huggingface dataset:
npm package: @fruitsjs/contracts
Description: Smart Contracts package for Fruits Eco-Blockchain
Latest version: 1.1.3

# @fruitsjs/contracts

Utility functions to interact with smart contract of the Fruits blockchain platform

## Installation

`@fruitsjs/contracts` can be used with NodeJS or Web. Two formats are available

### Using with NodeJS and/or modern web frameworks

Install using [npm](https://www.npmjs.org/):

```
npm install @fruitsjs/contracts
```

or using [yarn](https://yarnpkg.com/):

``` yarn
yarn add @fruitsjs/contracts
```

#### Example

```js
// TO DO
```
npm package: @fruitsjs/core
Description: Principal package with functions and models for building Fruits Eco-Blockchain applications.
Latest version: 1.1.3

# @fruitsjs/core

Core module to build cool apps for the Fruits blockchain platform 

## Installation

FruitsJS can be used with NodeJS or Web. Two formats are available

### Using with NodeJS and/or modern web frameworks

Install using [npm](https://www.npmjs.org/):

```
npm install @fruitsjs/core
```

or using [yarn](https://yarnpkg.com/):

```
yarn add @fruitsjs/core
```

#### Example

```js
import {composeApi, ApiSettings} from '@fruitsjs/core'
import {Amount} from '@fruitsjs/util'

const apiSettings = new ApiSettings('https://testnet.fwallet.net');
const api = composeApi(apiSettings);

// this self-executing file makes turns this file into a starting point of your app

(async () => {
    try{
        const {balanceNQT} = await api.account.getAccountBalance('13036514135565182944')
        console.log(`Account Balance: ${Amount.fromPlanck(balanceNQT).toString()}`)
    }
        catch(e){ // e is of type HttpError (as part of @fruitsjs/http)
        console.error(`Whooops, something went wrong: ${e.message}`)
    }
})()
```


#### Example

```js
(function(){
    const api = sig$.composeApi({nodeHost: "https://testnet.fwallet.net"});
    api.network.getBlockchainStatus().then(console.log).catch(console.error);
})()
```
npm package: @fruitsjs/crypto
Description: Cryptographic functions for building Fruits Eco-Blockchain apps.
Latest version: 1.1.3

# @fruitsjs/crypto

Cryptographic functions for building Fruits Eco-Blockchain apps.

## Installation

FruitsJS can be used with NodeJS or Web. 

### Using with NodeJS and/or modern web frameworks

Install using [npm](https://www.npmjs.org/):

```
npm install @fruitsjs/crypto
```

or using [yarn](https://yarnpkg.com/):

``` yarn
yarn add @fruitsjs/crypto
```

#### Example

```js
import {encryptAES, decryptAES, hashSHA256} from '@fruitsjs/crypto'

const encrypted = encryptAES('test', 'key')
const decrypted = decryptAES(encrypted, 'key')
console.log(hashSHA256('test'))
console.log(decrypted)
```
npm package: @fruitsjs/http
Description: FruitsJS Generic Http Module
Latest version: 1.1.3

# @fruitsjs/http

Generic HTTP client that is used as a network provider for @fruitsjs/core.

## Installation

`@fruitsjs/http` can be used with NodeJS or Web.

### Using with NodeJS and/or modern web frameworks

Install using [npm](https://www.npmjs.org/):

```
npm install @fruitsjs/http
```

or using [yarn](https://yarnpkg.com/):

``` yarn
yarn add @fruitsjs/http
```

#### Example

```js
import {HttpImpl} from '@fruitsjs/http'

async function getTodos() {
    try{
        const client = new HttpClientFactory.createHttpClient('https://jsonplaceholder.typicode.com/');
        const result = await client.get('/todos/1')
        console.log(result)
    }
    catch(httpError){
        console.error(httpError.message)
    }
}
```
npm package: @fruitsjs/monitor
Description: Monitor transactions on Fruits Eco-Blockchain blockchain
Latest version: 1.1.3

# @fruitsjs/monitor

A monitor to watch for specific changes on the the Fruits Eco-Blockchain platform

Due to average blocktime of 240 seconds, transactions stay pending for a certain time. It is a repeating pattern
to watch for such changes and waiting for confirmation. This package simplifies this task.

## Installation

`@fruitsjs/monitor` can be used with NodeJS or Web.

### Using with NodeJS and/or modern web frameworks

Install using [npm](https://www.npmjs.org/):

```
npm install @fruitsjs/monitor
```

or using [yarn](https://yarnpkg.com/):

``` yarn
yarn add @fruitsjs/monitor
```

#### Example

```js
import {Monitor} from '@fruitsjs/monitor'
import {composeApi} from "@fruitsjs/core";

// A method that checks if an account exists
// > IMPORTANT: Do not use closures, when you need to serialize the monitor
async function tryFetchAccount() {
    const api = composeApi({ nodeHost: 'https://testnet.fwallet.net/'})
    try{
        const {account} = await api.account.getAccount('1234')
        return account;
    }catch (e){
        // ignore error
        return null;
    }
}

// A comparing function to check if a certain condition for the returned data from fetch function
// is true. If it's true the monitor stops
function checkIfAccountExists(account) {
    return account !== null;
}

// Create your monitor
const monitor = new Monitor({
    asyncFetcherFn: tryFetchAccount,
    compareFn: checkIfAccountExists,
    intervalSecs: 10, // polling interval in seconds
    key: 'monitor-account',
    timeoutSecs: 2 * 240 // when reached timeout the monitor stops
});
// starts monitor
monitor.start();

// called when `checkIfAccountExists` returns true
monitor.onFulfilled(() => {
    console.log('Yay, account active');
});

// called when `timeoutSecs` is reached
monitor.onTimeout(() => {
    console.log('Hmm, something went wrong');
});

```
npm package: @fruitsjs/util
Description: Useful utilities and tools for building Fruits Eco-Blockchain applications
Author: fruits-eco-blockchain
Latest version: 1.1.3

# @fruitsjs/util

Useful utilities and tools for building Fruits Eco-Blockchain applications

## Installation

`@fruitsjs/util` can be used with NodeJS or Web.

### Using with NodeJS and/or modern web frameworks

Install using [npm](https://www.npmjs.org/):

```
npm install @fruitsjs/util
```

or using [yarn](https://yarnpkg.com/):

``` yarn
yarn add @fruitsjs/util
```

#### Example

```js
import {Amount} from '@fruitsjs/util'

const value = Amount.fromFrts(1000)
console.log(value.toString())
```