diff --git a/web3js-1.0/src/rpc.ts b/web3js-1.0/src/rpc.ts index 0824759..e62e9ac 100644 --- a/web3js-1.0/src/rpc.ts +++ b/web3js-1.0/src/rpc.ts @@ -33,12 +33,16 @@ export async function getStakeActivation( })(), ]); - const { effective, activating, deactivating } = + const { effective, activating, deactivating } = stakeAccount.stake ? getStakeActivatingAndDeactivating( stakeAccount.stake.delegation, BigInt(epochInfo.epoch), stakeHistory - ); + ) : { + effective: BigInt(0), + activating: BigInt(0), + deactivating: BigInt(0), + }; let status; if (deactivating > 0) { diff --git a/web3js-1.0/src/stake.ts b/web3js-1.0/src/stake.ts index 54cbe7c..f620489 100644 --- a/web3js-1.0/src/stake.ts +++ b/web3js-1.0/src/stake.ts @@ -31,7 +31,7 @@ export type StakeAccount = { stake: { delegation: Delegation, creditsObserved: bigint - } + } | null } export const getStakeHistory = function (parsedData: RpcResponseAndContext | null>): StakeHistoryEntry[] { @@ -77,7 +77,7 @@ export const getStakeAccount = function (parsedData: RpcResponseAndContext