Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getStakeActivation helper #44

Closed
wants to merge 2 commits into from
Closed
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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 3.0

- Add `getStakeActivation()`
- Dependency to Solana Version 2.0 added

## 2.5

- Add `makeTokenMint()`
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,18 @@ const DEFAULT_MINIMUM_BALANCE = 0.5 * LAMPORTS_PER_SOL;
const DEFAULT_ENV_KEYPAIR_VARIABLE_NAME = "PRIVATE_KEY";
```

## How to use getStakeActivation

Since getStakeActivation RPC function was [deprecated in Solana 2.0](https://github.com/anza-xyz/agave/wiki/Agave-v2.0-Transition-Guide) you can use the `getStakeActivation` helper function to get the stake activation status client side.

```typescript
const rpc = createSolanaRpc("https://api.testnet.solana.com");
let stake = "25R5p1Qoe4BWW4ru7MQSNxxAzdiPN7zAunpCuF8q5iTz";
let status = await getStakeActivation(rpc, stake as Address);
console.log(status);
// Should return something like: { status: 'active', active: 9997717120n, inactive: 0n }
```

## Secret key format

Secret keys can be read in either the more compact base58 format (`base58.encode(randomKeypair.secretKey);`), like:
Expand Down
Loading
Loading