Skip to content

Commit

Permalink
fix: change comment and docs wording
Browse files Browse the repository at this point in the history
  • Loading branch information
MjCage committed Sep 21, 2023
1 parent aea333f commit df593a6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,15 @@ const signature = await provider.send(transaction)

### Marinade Native Staking

Now you can stake into Marinade Native via the SDK with or without referral code.
You can now stake assets in Marinade Native through the SDK, either with or without a 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.
If you choose to stake without a referral code, the methods exposed in `marinade-native-stake.ts` serve as wrappers for those already detailed in the [Native Stake SDK](https://www.npmjs.com/package/@marinade.finance/native-staking-sdk).
Please note that staking without a referral code will yield 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.
To acquire a referral code, you'll need to visit the [Marinade dApp](https://marinade.finance/app/earn/) to retrieve it.
Once you have the code, you can input it into the methods described below. Please note that the method returns a Versioned Transaction.

Stake SOL to Marinade Native
```ts
Expand All @@ -118,7 +117,7 @@ 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).
To initiate the process of unstaking, you'll need to merge your stake accounts back into a single account and pay the associated fee (in SOL). To do this, execute the following command:

```ts
...
Expand Down
48 changes: 24 additions & 24 deletions src/marinade-native-stake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import {
} from './marinade-native-stake.types'

/**
* Fetches the instruction to stake SOL in Marinade Native
* Retrieves the instruction for staking SOL with Marinade Native.
*
* @param {PublicKey} userPublicKey - The PublicKey of the user
* @param {BN} amountToStake - The amount to deposit in lamports
* @returns {AuthStakeSOLIxResponse} - The instructions to add in transaction to stake in Marinade Native and new stake keypair
* @param {PublicKey} userPublicKey - The PublicKey associated with the user.
* @param {BN} amountToStake - The amount to be staked, in lamports.
* @returns {AuthStakeSOLIxResponse} - The instructions to include in the transaction for staking in Marinade Native, along with the new stake keypair.
*/
export function getAuthNativeStakeSOLIx(
userPublicKey: PublicKey,
Expand All @@ -29,12 +29,12 @@ export function getAuthNativeStakeSOLIx(
}

/**
* Fetches the transaction to stake SOL in Marinade Native with refCode
* Retrieves the transaction for staking SOL with Marinade Native using a referral code.
*
* @param {PublicKey} userPublicKey - The PublicKey of the user
* @param {BN} amountToStake - The amount to deposit in lamports
* @param {string} mNativeRefCode - Marinade Native referral code
* @returns {Promise<VersionedTransaction>} - The transaction to stake SOL into Marinade native using Referral Code
* @param {PublicKey} userPublicKey - The PublicKey associated with the user.
* @param {BN} amountToStake - The amount to be staked, specified in lamports.
* @param {string} mNativeRefCode - The Marinade Native referral code.
* @returns {Promise<VersionedTransaction>} - A promise that resolves to the transaction for staking SOL with Marinade Native using the referral code.
*/
export async function getRefNativeStakeSOLTx(
userPublicKey: PublicKey,
Expand All @@ -51,11 +51,11 @@ export async function getRefNativeStakeSOLTx(
}

/**
* Fetches the instruction to stake Stake Account in Marinade Native
* Retrieves the instruction for staking a Stake Account with Marinade Native.
*
* @param {PublicKey} userPublicKey - The PublicKey of the user
* @param {PublicKey[]} stakeAccounts - The stake accounts that are about to be deposited in Marinade Native
* @returns {TransactionInstruction} - The instruction to add in transaction to stake in Marinade Native
* @param {PublicKey} userPublicKey - The PublicKey associated with the user.
* @param {PublicKey[]} stakeAccounts - The stake accounts to be used with Marinade Native.
* @returns {TransactionInstruction} - The instruction to include in the transaction for staking the Stake Account with Marinade Native.
*/
export function getAuthNativeStakeAccountIx(
userPublicKey: PublicKey,
Expand All @@ -66,12 +66,12 @@ export function getAuthNativeStakeAccountIx(
}

/**
* Fetches the transaction to deposit Stake Account in Marinade Native with refCode
* Retrieves the transaction for using a Stake Account with Marinade Native via a referral code.
*
* @param {PublicKey} userPublicKey - The PublicKey of the user
* @param {PublicKey} stakeAccountAddress - The stake account to be deposited into Marinade Native
* @param {string} mNativeRefCode - Marinade Native referral code
* @returns {Promise<VersionedTransaction>} - The transaction to deposit Stake Account into Marinade native using Referral Code
* @param {PublicKey} userPublicKey - The PublicKey associated with the user.
* @param {PublicKey} stakeAccountAddress - The address of the stake account intended to use with Marinade Native.
* @param {string} mNativeRefCode - The Marinade Native referral code.
* @returns {Promise<VersionedTransaction>} - A promise resolving to the transaction required for using the Stake Account with Marinade Native via the given referral code.
*/
export async function getRefNativeStakeAccountTx(
userPublicKey: PublicKey,
Expand All @@ -89,11 +89,11 @@ export async function getRefNativeStakeAccountTx(
}

/**
* Fetches the instruction to unstake from Marinade Native
* Retrieves the instruction for unstaking from Marinade Native.
*
* @param {PublicKey} userPublicKey - The PublicKey of the user
* @param {BN} amountToUnstake - The amount to unstake in lamports
* @returns {UnstakeSOLIxResponse} - The instructions to pay the fee for unstake and the event that should be called after fee is paid in order to trigger unstake event faster (calling this is optional, but it ensures better experience for user).
* @param {PublicKey} userPublicKey - The PublicKey associated with the user.
* @param {BN} amountToUnstake - The amount to be unstaked, specified in lamports.
* @returns {UnstakeSOLIxResponse} - The instructions for paying the unstaking fee and an optional event that can be called after the fee is paid to expedite the unstaking process (calling this event is optional but enhances the user experience).
*/
export async function getPrepareNativeUnstakeSOLIx(
userPublicKey: PublicKey,
Expand All @@ -104,9 +104,9 @@ export async function getPrepareNativeUnstakeSOLIx(
}

/**
* Calls the bot to rebalance user's funds (relevant especially right after the users deposits in Marinade Native, but not mandatory)
* Invokes the bot to rebalance the user's funds. This is particularly useful immediately following a deposit into Marinade Native, although it is not mandatory.
*
* @param {PublicKey} userPublicKey - The PublicKey of the user
* @param {PublicKey} userPublicKey - The PublicKey associated with the user.
*/
export async function callRebalanceHint(
userPublicKey: PublicKey
Expand Down

0 comments on commit df593a6

Please sign in to comment.