open-index/open-npm huggingface dataset:
npm package: @item-enonic-types/nashorn-env
Description: Type definitions for Nashorn in Enonic XP.
Author: Tom Arild Jakobsen
Latest version: 0.0.2

# Enonic XP Nashorn Environment

[![npm version](https://badge.fury.io/js/@item-enonic-types%2Fnashorn-env.svg)](https://badge.fury.io/js/@item-enonic-types%2Fnashorn-env)

Enonic XP 7 *(and 5 and 6)* is using the [Nashorn JavaScript-engine internally](https://docs.oracle.com/javase/10/nashorn/nashorn-java-api.htm).

This library provides TypeScript-types for the APIs exposed by Nashorn, to be used by JavaScript developers.

## Contents

The following global types:

- `Java.type()`
- `Java.to()`
- `Java.extend()`

## Use

To use these global types you need to update the `types` field in your *tsconfig.json* with this library.

```diff
{
  "baseUrl": "./",
  "paths": {
    "/lib/xp/*": ["node_modules/@enonic-types/lib-*"]
  },
+  "types": [
+    "@types/webpack-env"
+    "@item-enonic-types/nashorn-env"
+  ]
}
```

## Example

This is an example of how we can use `java.time.ZonedDateTime` from TypeScript.

For simplicity we just import `DateTimeFormatter` from [`"/lib/time"`](https://github.com/ItemConsulting/lib-xp-time). 
But it is implemented in the same way in that library.

```typescript
import type { DateTimeFormatter } from "/lib/time";

// We use Java.type to grab an instance of java.time.ZonedDateTime
const ZonedDateTime = Java.type<ZonedDateTimeClass>("java.time.ZonedDateTime");

// Now we can use the Java-class like we would in Java
const timeInTwoDays = ZonedDateTime
  .now()
  .plusDays(2)
  .format(DateTimeFormatter.BASIC_ISO_DATE);

// This interface defined the shape of the static java class
interface ZonedDateTimeClass {
  now(): ZonedDateTime;
  parse(text: string): ZonedDateTime;
}

// This instance defines the shape of an instance of the class (the object)
interface ZonedDateTime {
  format(formatter: DateTimeFormatter): string;
  plusDays(days: number): ZonedDateTime;
}
```
npm package: @item-protocol/contracts-store
Description: This package contains implementations of store contract based on [item protocol](https://github.com/wavesplatform/item). Addresses of the deployed contracts can be found in the [deploys](./deploys.json) file within this package.
Latest version: 1.1.0

## Store Contract

This package contains implementations of store contract based on [item protocol](https://github.com/wavesplatform/item). Addresses of the deployed contracts can be found in the [deploys](./deploys.json) file within this package.

### Features

- Sell any item based on [item protocol](https://github.com/wavesplatform/item)
- Buy an item for sale
- Cancel sale

## Installation

**Install**

```bash
yarn add @item-protocol/contracts-store
```

## Usage

```typescript
import { sell } from '@item-protocol/contracts-store'

const seed = 'your seed'

export default async () => {
  const assetId = '2iKLS4iYPU47MtmJYJji5iRPwPiRh1inDMNcX4p7t69W'
  const req = sell(assetId, 10, 'WAVES', 25)
  await req.broadcast(seed)
} 
```

## Configuration

Item protocol uses a shared configuration package `@item-protocol/config`, some fields use environment variables. To change [ChainId](../../packages/config/src/index.ts), run the command:
```bash
export CHAIN_ID=W
```

## Contributing

We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.

Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.

### Install Dependencies

```bash
yarn install
```

### Build

To build this package, run the following from the monorepo root directory:

```bash
yarn build --scope @item-protocol/contracts-store
```

### Run Tests

```bash
yarn test:contract
```

#### About testing

By default, contracts are tested on a private node. To start a node and all dependent services, run the command from the monorepo root directory:

```bash
docker-compose -f docker-compose.devnet.yml up
```

Or you can run tests on testnet, you need to setup the [configuration](./surfboard.config.json) and run:

```bash
yarn test:contract --env=testnet
```