# @sunrisestake/client

> Sunrise Stake Client

Latest version **0.1.16** (published 2023-07-03) · 0 weekly downloads

## Install

```sh
npm install @sunrisestake/client
pnpm add @sunrisestake/client
yarn add @sunrisestake/client
bun add @sunrisestake/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.1.16 |
| Published | 2023-07-03 |
| First published | 2023-02-05 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 8 |
| Unpacked size | 924.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dankelleher |

## Links

- npm: https://www.npmjs.com/package/@sunrisestake/client
- npm.io page: https://npm.io/package/@sunrisestake/client

## Dependencies (8)

- [bn.js](https://npm.io/package/bn.js.md) ^5.2.1
- [@solana/web3.js](https://npm.io/package/@solana/web3.js.md) ^1.73.2
- [@coral-xyz/anchor](https://npm.io/package/@coral-xyz/anchor.md) ^0.26.0
- [@solana/spl-token](https://npm.io/package/@solana/spl-token.md) ^0.3.7
- [@project-serum/borsh](https://npm.io/package/@project-serum/borsh.md) ^0.2.5
- [@metaplex-foundation/js](https://npm.io/package/@metaplex-foundation/js.md) ^0.18.3
- [@sunrisestake/marinade-ts-sdk](https://npm.io/package/@sunrisestake/marinade-ts-sdk.md) ^4.0.4-alpha.18
- [@sunrisestake/impact-nft-client](https://npm.io/package/@sunrisestake/impact-nft-client.md) 0.0.5-module.3

## Recent versions

- 0.1.16 (latest) — 2023-07-03
- 0.1.1-7.module.2 (alpha) — 2023-07-07
- 0.1.15 — 2023-07-03
- 0.1.14 — 2023-07-03
- 0.1.13 — 2023-07-03
- 0.1.12 — 2023-07-03
- 0.1.11 — 2023-07-03
- 0.1.10 — 2023-07-03
- 0.1.9 — 2023-06-30
- 0.1.8 — 2023-06-30
- 0.1.7 — 2023-03-11
- 0.1.6 — 2023-03-11
- 0.1.5 — 2023-03-11
- 0.1.4 — 2023-02-10
- 0.1.3 — 2023-02-10
- … 3 more at https://npm.io/package/@sunrisestake/client/versions

## README

# Sunrise Stake Client

A client library for the [Sunrise Stake](https://sunrisestake.com) Solana programs.

## What is Sunrise Stake?

Sunrise Stake is a climate-positive staking platform on Solana, that allows you to stake your SOL
and redirects staking yield to offset your carbon footprint.

For more details, visit [sunrisestake.com](https://sunrisestake.com).

To stake, visit the [app](https://app.sunrisestake.com).

## Quick Start

```shell
yarn add @sunrisestake/client
```

Usage in a browser (React app):

```typescript
import { SunriseStakeClient } from '@sunrisestake/client';
import { AnchorProvider } from "@coral-xyz/anchor";
import { useAnchorWallet, useConnection } from "@solana/wallet-adapter-react";

// inside your app
const connection = useConnection()
const anchorWallet = useAnchorWallet()
const anchorProvider = new AnchorProvider(connection, anchorWallet, {});
const client = SunriseStakeClient.get(provider, 'mainnet-beta');
```

Usage in Node:

```typescript
import { SunriseStakeClient } from '@sunrisestake/client';
import { Connection } from "@solana/web3.js";

const connection = new Connection(/* mainnet RPC endpoint */);
const provider = AnchorProvider.env();
const client = SunriseStakeClient.get(provider, 'mainnet-beta');
```

## Usage

### Details

Almost all information is available via the details() function

```
const details = await client.details()

// user's current staked balance
details.balances.gsolBalance

// total staked balance
details.balances.gsolSupply

// amount of gsol a user has locked
details.lockDetails.amountLocked

// if a user has an impact NFT, this is the mint address
details.impactNFTDetails.mint
```

### Staking

Stake SOL to receive gSOL

```typescript
await client.sendAndConfirmTransaction(
    client.deposit(amountInLamports)
);
```

### Unstaking

Unstake gSOL to receive SOL back

```typescript
await client.sendAndConfirmTransaction(
    await client.unstake(amountInLamports)
);
```

### Advanced Usage

For more advanced usage view the test files in the [source code](https://github.com/sunrise-stake/app).

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