After call connection.getStakeActivation(newAccountPubkey); I receive something like this
{ active: 0, inactive: 27717120, state: 'activating' }
How convert active and inactive to delegated epoch and deactivated epoch?
If you're using getStakeActivation
, you'll have to search through the epochs until you get activating
and deactivating
as the state. The active
and inactive
numbers tell you how many lamports were active or inactive stake.
As an easier option, you can get all of the transactions involving the stake account with getSignaturesForAddress
https://docs.solana.com/developing/clients/jsonrpc-api#getsignaturesforaddress, and then look for the DelegateStake
and DeactivateStake
instructions.