open-index/open-npm huggingface dataset:
npm package: @hardplay/sdk
Description: 🛠 An SDK for building applications on top of valueswap.
Latest version: 1.0.8

# Valueswap SDK

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![Actions Status](https://github.com/Uniswap/uniswap-sdk/workflows/CI/badge.svg)](https://github.com/Uniswap/uniswap-sdk)
[![npm version](https://img.shields.io/npm/v/@uniswap/sdk/latest.svg)](https://www.npmjs.com/package/@uniswap/sdk/v/latest)
[![npm bundle size (scoped version)](https://img.shields.io/bundlephobia/minzip/@uniswap/sdk/latest.svg)](https://bundlephobia.com/result?p=@uniswap/sdk@latest)

In-depth documentation on this SDK is available at [uniswap.org](https://uniswap.org/docs/v2/SDK/getting-started/).

## Running tests

To run the tests, follow these steps. You must have at least node v10 and [yarn](https://yarnpkg.com/) installed.

First clone the repository:

```sh
git clone https://github.com/Uniswap/uniswap-sdk.git
```

Move into the uniswap-sdk working directory

```sh
cd uniswap-sdk/
```

Install dependencies

```sh
yarn install
```

Run tests

```sh
yarn test
```

You should see output like the following:

```sh
yarn run v1.22.4
$ tsdx test
 PASS  test/constants.test.ts
 PASS  test/pair.test.ts
 PASS  test/fraction.test.ts
 PASS  test/miscellaneous.test.ts
 PASS  test/entities.test.ts
 PASS  test/trade.test.ts

Test Suites: 1 skipped, 6 passed, 6 of 7 total
Tests:       3 skipped, 82 passed, 85 total
Snapshots:   0 total
Time:        5.091s
Ran all test suites.
✨  Done in 6.61s.
```
npm package: @hardpointlabs/length-prefixed-stream
Description: Streaming length prefixed buffers
Author: Mathias Buus
Latest version: 2.0.5

# length-prefixed-stream

> [!NOTE]  
> This fork is purely for internal use at present. Please don't add this library as a dependency until
> we've stabilised things.

Streaming equivalent of [length-prefixed-message](https://github.com/sorribas/length-prefixed-message).
This module allow you to send `Buffer`s with a varint length prefix to ensure that they will arrive unpartioned

```
npm install length-prefixed-stream
```

## Usage

``` js
var lpstream = require('length-prefixed-stream')

var encode = lpstream.encode() // create an encode stream to send data
var decode = lpstream.decode() // create an decode stream to receive data

encode.write('hello world') // send "hello world"

decode.on('data', function(data) {
  console.log(data.toString()) // will always print "hello world"
})

encode.pipe(decode) // for testing just pipe to our selves
```

## Encoding format

This library encodes each chunks as follows:

```
<length-of-chunk-1> <chunk-1> <length-of-chunk-2> <chunk-2> …
```

The length of the following chunk is encoded using [`varint`](https://github.com/chrisdickinson/varint#readme), which follows the [protobuf-style varint encoding](https://developers.google.com/protocol-buffers/docs/encoding#varints).

As an example, we're going to encode two ASCII chunks:

```
1st chunk:
68 65 79                            hey
2nd chunk:
68 65 6c 6c 6f 20 77 6f 72 6c 64    hello world
```

Encoded using `length-prefixed-stream`, they look like this:

```
03                                  varint-encoded length of 1st chunk
68 65 79                            1st chunk (3 bytes)
0b                                  varint-encoded length ()of 2nd chunk
68 65 6c 6c 6f 20 77 6f 72 6c 64    2nd chunk (11 bytes)
```

## API

#### `transformStream = lpstream.encode()`

Creates a new encoder transform stream.

#### `transformStream = lpstream.decode()`

Creates a new decoder transform stream.

## License

MIT