# @superstream/client

> [![License](https://img.shields.io/npm/l/@superstream/client)](https://www.npmjs.com/package/@superstream/client) [![npm](https://img.shields.io/npm/v/@superstream/client.svg)](https://www.npmjs.com/package/@superstream/client)

Latest version **0.11.0** (published 2023-07-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @superstream/client
pnpm add @superstream/client
yarn add @superstream/client
bun add @superstream/client
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.11.0 |
| Published | 2023-07-16 |
| First published | 2022-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 691.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Garvit Pahal |
| Maintainers | gpahal |
| Keywords | superstream, solana, payments, stream, client, sdk, typescript, javascript |

## Links

- npm: https://www.npmjs.com/package/@superstream/client
- Repository: https://github.com/gpahal/superstream
- Homepage: https://superstream.finance/
- Issues: https://github.com/gpahal/superstream/issues
- npm.io page: https://npm.io/package/@superstream/client

## Dependencies (6)

- [bs58](https://npm.io/package/bs58.md) ^5.0.0
- [buffer](https://npm.io/package/buffer.md) ^6.0.3
- [date-fns](https://npm.io/package/date-fns.md) ^2.30.0
- [@gpahal/std](https://npm.io/package/@gpahal/std.md) ^0.0.17
- [@coral-xyz/anchor](https://npm.io/package/@coral-xyz/anchor.md) 0.28.0
- [@solana/spl-token](https://npm.io/package/@solana/spl-token.md) ^0.3.8

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.11.0 (latest) — 2023-07-16
- 0.10.6 — 2023-07-13
- 0.10.5 — 2023-07-13
- 0.10.4 — 2023-07-13
- 0.10.3 — 2023-07-13
- 0.10.2 — 2023-07-13
- 0.10.1 — 2023-07-13
- 0.10.0 — 2023-07-08
- 0.9.4 — 2023-07-07
- 0.9.3 — 2023-06-23
- 0.9.2 — 2023-06-23
- 0.9.1 — 2023-06-23
- 0.9.0 — 2023-06-23
- 0.7.3 — 2022-09-12
- 0.7.2 — 2022-09-02
- … 6 more at https://npm.io/package/@superstream/client/versions

## README

# Superstream typescript client SDK

[![License](https://img.shields.io/npm/l/@superstream/client)](https://www.npmjs.com/package/@superstream/client)
[![npm](https://img.shields.io/npm/v/@superstream/client.svg)](https://www.npmjs.com/package/@superstream/client)

## What is Superstream?

Superstream is a protocol and a collection of SDKs for real-time money streaming on Solana. It allows anyone to
continuously send money to anyone else at any interval upto a second.

Superstream protocol is completely open-source. View it on [GitHub](https://github.com/gpahal/superstream).

Learn more about Superstream on [superstream.finance](https://superstream.finance/).

## What is Superstream typescript client SDK?

A typescript SDK to interact with on-chain Superstream program. Developers would use this typically when they want to
create a typescript app and integrate streams into that. It's compatible with browsers and native environments (like
React Native).

## Installation

```shell
# npm
npm install @superstream/client

# pnpm
pnpm install @superstream/client

# yarn
yarn add @superstream/client
```

## Usage

- Create a `SuperstreamClient`. For complete API documentation, click
  [here](https://superstream.finance/references/client-sdks/ts/functions/createSuperstreamClient.html)

```typescript
import { createSuperstreamClient } from '@superstream/client'

const client = createSuperstreamClient('devnet', wallet)

// For mainnet-beta, use:
// const client = createSuperstreamClient("mainnet-beta", wallet)

// If you don't need to execute instructions (like creating or cancelling a stream), you can omit the wallet
// const client = createSuperstreamClient("devnet")
```

- Fetch streams and do other operations using the client. For complete API documentation, click
  [here](https://superstream.finance/references/client-sdks/ts/interfaces/SuperstreamClient.html)

```typescript
const streams = await client.getAllStreams({ isPrepaid: true, recipient: new PublicKey('public-key-base-58') })
```

- Do operations on streams. For complete API documentation, click
  [here](https://superstream.finance/references/client-sdks/ts/classes/Stream.html)

```typescript
const stream = streams[0]

// Get stream public key
stream.getStreamPublicKey()
// Check is current wallet is this stream's sender
stream.isSender()
// ... and other operations

// Get current on-chain time to do even more operations on streams
const currentTime = await client.mustGetCurrentTime()

// Check if stream has stopped
stream.hasStopped()
// Check if stream is solvent
stream.isSolvent()
// Cancel stream
await stream.cancel()
// ... and other operations
```

---
_Source: https://npm.io/package/@superstream/client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
