Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions book/build-your-staking-dapp/solana/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const { tx } = await staker.buildWithdrawStakeTx({

Here, we are withdrawing all SOL from a stake account to the wallet owner's address.

To withdraw a specifc amount pass the `amount` arugment.
To withdraw a specific amount pass the `amount` argument.

- [Read more in the API Reference](../../docs/classes/solana_src.SolanaStaker.md#buildwithdrawstaketx)

Expand Down Expand Up @@ -137,11 +137,11 @@ Here, we are merging a source account stake into a different destination account

---

## buildSplitStakesTx
## buildSplitStakeTx

### Description

The `buildSplitStakesTx` method allows you to split one stake account into two separate accounts.
The `buildSplitStakeTx` method allows you to split one stake account into two separate accounts.

### How to Use

Expand All @@ -150,7 +150,7 @@ To build a split stake transaction, you will need to provide the owner's address
### Example

```javascript
const { tx } = await staker.buildSplitStakesTx({
const { tx } = await staker.buildSplitStakeTx({
ownerAddress: '3Ps2hwsgGMSuqxAwjcGJHiEpMsSTZcxrCGprHgxWkfma',
stakeAccountAddress: 'HJRL5PTpvwxmt796M7xDavRbPkjN28iGPVBkJn9y6rYE',
amount: '1' // 1 SOL
Expand All @@ -159,7 +159,7 @@ const { tx } = await staker.buildSplitStakesTx({

Here, we are substracting 1 SOL from the source stake account and transferring into a newly created stake account.

- [Read more in the API Reference](../../docs/classes/solana_src.SolanaStaker.md#buildsplitstakestx)
- [Read more in the API Reference](../../docs/classes/solana_src.SolanaStaker.md#buildsplitstaketx)

---

Expand All @@ -173,23 +173,23 @@ The `getStake` method retrieves the staking information from a delegator.

### How to Use

To get staking information, you need to provide the delegator's address (your wallet), and optionally the validator's address. If the validator's address is not provided, the method returns rewards from all validators.
To get staking information, you need to provide the owner's address (your wallet), and optionally the validator's address. If the validator's address is not provided, the method returns balance from all validators.

You can also specify the status of the staker. Default is 'active'.
You can also specify the state of the stake accounts. Default is 'delegated'.

### Example

```javascript
import { CHORUS_ONE_SOLANA_VALIDATOR } from '@chorus-one/solana'

const { balance } = await staker.getStake({
delegatorAddress: '3Ps2hwsgGMSuqxAwjcGJHiEpMsSTZcxrCGprHgxWkfma'
ownerAddress: '3Ps2hwsgGMSuqxAwjcGJHiEpMsSTZcxrCGprHgxWkfma',
validatorAddress: CHORUS_ONE_SOLANA_VALIDATOR
})
console.log(`Staked balance: ${balance}`)
```

In this example, we're retrieving the staked balance for a given delegator and validator.
In this example, we're retrieving the staked balance for a given owner and validator.

- [Read more in the API Reference](../../docs/classes/solana_src.SolanaStaker.md#getstake)

Expand Down
2 changes: 1 addition & 1 deletion book/build-your-staking-dapp/solana/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ The `SolanaStaker` class provides methods to build transactions for staking, uns

```javascript
const { tx, stakeAccountAddress } = await staker.buildStakeTx({
delegatorAddress: '3Ps2hwsgGMSuqxAwjcGJHiEpMsSTZcxrCGprHgxWkfma',
ownerAddress: '3Ps2hwsgGMSuqxAwjcGJHiEpMsSTZcxrCGprHgxWkfma',
validatorAddress: 'Chorus6Kis8tFHA7AowrPMcRJk3LbApHTYpgSNXzY5KE',
amount: '1' // 1 SOL
})
Expand Down
4 changes: 3 additions & 1 deletion book/signers-explained/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Let's look at what these two key concepts are below:
- **addressDerivationFn**: A function that derives the address from the public key, implementing the `AddressDerivationFn` type and provided by Staker classes as static methods, e.g. `SolanaStaker.getAddressDerivationFn`, `NearStaker.getAddressDerivationFn`, etc.

```typescript
type AddressDerivationFn = (publicKey: Uint8Array, hdPath: string) => Array<string>
type AddressDerivationFn = (publicKey: Uint8Array, hdPath: string) => Promise<Array<string>>
```

{% hint style="info" %}
Expand All @@ -29,10 +29,12 @@ With your mnemonic and HD path ready, you can now configure and initialize the L
```javascript
import { SolanaStaker } from '@chorus-one/solana'
import { LocalSigner } from '@chorus-one/signer-local'
import { KeyType } from '@chorus-one/signer'

const signer = new LocalSigner({
mnemonic: 'your-mnemonic-phrase',
accounts: [{ hdPath: 'your-hd-path' }],
keyType: KeyType.ED25519,
addressDerivationFn: SolanaStaker.getAddressDerivationFn()
})

Expand Down
4 changes: 3 additions & 1 deletion packages/signer-local/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ Here is a basic example of how to configure and initialize the LocalSigner:
```javascript
import { SolanaStaker } from '@chorus-one/solana';
import { LocalSigner } from '@chorus-one/signer-local';
import { KeyType } from '@chorus-one/signer';

const signer = new LocalSigner({
mnemonic: 'your-mnemonic-phrase',
accounts: [{ hdPath: 'your-hd-path' }]
accounts: [{ hdPath: 'your-hd-path' }],
keyType: KeyType.ED25519,
addressDerivationFn: SolanaStaker.getAddressDerivationFn()
});

Expand Down
6 changes: 3 additions & 3 deletions packages/solana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ await staker.init()
// Building the transaction
// ------------------------

const delegatorAddress = '3Ps2hwsgGMSuqxAwjcGJHiEpMsSTZcxrCGprHgxWkfma'
const ownerAddress = '3Ps2hwsgGMSuqxAwjcGJHiEpMsSTZcxrCGprHgxWkfma'

// You can use the Chorus One validator address or specify your own
const validatorAddress = CHORUS_ONE_SOLANA_VALIDATOR

const { tx } = await staker.buildStakeTx({
delegatorAddress,
ownerAddress,
validatorAddress,
amount: '1' // 1 SOL
})
Expand All @@ -54,7 +54,7 @@ await signer.init()

const { signedTx } = await staker.sign({
signer,
signerAddress: delegatorAddress,
signerAddress: ownerAddress,
tx
})

Expand Down
Loading