-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from sunrise-stake/develop
0.7.4 ReGenerOsa and Client ESM module update
- Loading branch information
Showing
78 changed files
with
8,632 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# 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). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
:root { | ||
--light-hl-0: #795E26; | ||
--dark-hl-0: #DCDCAA; | ||
--light-hl-1: #000000; | ||
--dark-hl-1: #D4D4D4; | ||
--light-hl-2: #A31515; | ||
--dark-hl-2: #CE9178; | ||
--light-hl-3: #AF00DB; | ||
--dark-hl-3: #C586C0; | ||
--light-hl-4: #001080; | ||
--dark-hl-4: #9CDCFE; | ||
--light-hl-5: #008000; | ||
--dark-hl-5: #6A9955; | ||
--light-hl-6: #0000FF; | ||
--dark-hl-6: #569CD6; | ||
--light-hl-7: #0070C1; | ||
--dark-hl-7: #4FC1FF; | ||
--light-code-background: #FFFFFF; | ||
--dark-code-background: #1E1E1E; | ||
} | ||
|
||
@media (prefers-color-scheme: light) { :root { | ||
--hl-0: var(--light-hl-0); | ||
--hl-1: var(--light-hl-1); | ||
--hl-2: var(--light-hl-2); | ||
--hl-3: var(--light-hl-3); | ||
--hl-4: var(--light-hl-4); | ||
--hl-5: var(--light-hl-5); | ||
--hl-6: var(--light-hl-6); | ||
--hl-7: var(--light-hl-7); | ||
--code-background: var(--light-code-background); | ||
} } | ||
|
||
@media (prefers-color-scheme: dark) { :root { | ||
--hl-0: var(--dark-hl-0); | ||
--hl-1: var(--dark-hl-1); | ||
--hl-2: var(--dark-hl-2); | ||
--hl-3: var(--dark-hl-3); | ||
--hl-4: var(--dark-hl-4); | ||
--hl-5: var(--dark-hl-5); | ||
--hl-6: var(--dark-hl-6); | ||
--hl-7: var(--dark-hl-7); | ||
--code-background: var(--dark-code-background); | ||
} } | ||
|
||
:root[data-theme='light'] { | ||
--hl-0: var(--light-hl-0); | ||
--hl-1: var(--light-hl-1); | ||
--hl-2: var(--light-hl-2); | ||
--hl-3: var(--light-hl-3); | ||
--hl-4: var(--light-hl-4); | ||
--hl-5: var(--light-hl-5); | ||
--hl-6: var(--light-hl-6); | ||
--hl-7: var(--light-hl-7); | ||
--code-background: var(--light-code-background); | ||
} | ||
|
||
:root[data-theme='dark'] { | ||
--hl-0: var(--dark-hl-0); | ||
--hl-1: var(--dark-hl-1); | ||
--hl-2: var(--dark-hl-2); | ||
--hl-3: var(--dark-hl-3); | ||
--hl-4: var(--dark-hl-4); | ||
--hl-5: var(--dark-hl-5); | ||
--hl-6: var(--dark-hl-6); | ||
--hl-7: var(--dark-hl-7); | ||
--code-background: var(--dark-code-background); | ||
} | ||
|
||
.hl-0 { color: var(--hl-0); } | ||
.hl-1 { color: var(--hl-1); } | ||
.hl-2 { color: var(--hl-2); } | ||
.hl-3 { color: var(--hl-3); } | ||
.hl-4 { color: var(--hl-4); } | ||
.hl-5 { color: var(--hl-5); } | ||
.hl-6 { color: var(--hl-6); } | ||
.hl-7 { color: var(--hl-7); } | ||
pre, code { background: var(--code-background); } |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
0c3e7b6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
app – ./
app-git-main-sunrise-stake.vercel.app
app-sunrise-stake.vercel.app
app.sunrisestake.com