Skip to content

Commit

Permalink
chore: draft update for readme
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexStefan committed Sep 20, 2023
1 parent ab79ee1 commit f52554c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v5.0.5

### Feat:

- Add support to stake into Marinade Native with or without Referral Code
- Add support to unstake from Marinade Native

## v5.0.4

### Fix:
Expand Down
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,49 @@ const {
const signature = await provider.send(transaction)
```

### Marinade Native Staking

Now you can stake into Marinade Native via the SDK with or without referral code.

#### Stake without referral code
In case of no referral code, the methods exposed in `marinade-native-stake.ts` are just a wrapper of what is already documented in the [Native Stake SDK](https://www.npmjs.com/package/@marinade.finance/native-staking-sdk).
Note that without referral code you're getting only Transaction Instructions.

#### Stake with referral code
In order to get a referral code you must go to the [Marinade dApp](https://marinade.finance/app/earn/) to retrieve it.
Note that with referral code you're getting Versioned Transaction.
After having the code you can pass it to the methods mentioned below.

Stake SOL to Marinade Native
```ts
...
const versionedTransaction = await getRefNativeStakeSOLTx(userPublicKey, amountLamports, refCode)
// sign and send the `transaction`
const signature = await wallet.sendTransaction(unsignedTx, connection)
```

Deposit Stake Account to Marinade Native
```ts
...
const versionedTransaction = await getRefNativeStakeAccountTx(userPublicKey, stakeAccountAddress, refCode)
// sign and send the `transaction`
const signature = await wallet.sendTransaction(versionedTransaction, connection)
```

#### Prepare for Unstake from Marinade Native
In order to merge stake accounts back into one and start the unstake process you must run the command from below and pay the fee (SOL needed to merge the accounts back).

```ts
...
const transaction = new Transaction()
const prepareUnstakeIx = await getPrepareNativeUnstakeSOLIx(userPublicKey, amountLamports)
transaction.add(...prepareUnstakeIx.payFees)
// sign and send the `transaction`
const signature = await wallet.sendTransaction(transaction, connection)
await authIx.onPaid()
```


### Liquidity pool

Add liquidity to the liquidity pool and receive LP tokens:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@marinade.finance/marinade-ts-sdk",
"version": "5.0.4",
"version": "5.0.5",
"description": "Marinade SDK for Typescript",
"main": "dist/src/index.js",
"repository": {
Expand Down

0 comments on commit f52554c

Please sign in to comment.