diff --git a/packages/validator-bonds-cli/src/commands/utils.ts b/packages/validator-bonds-cli/src/commands/utils.ts index 7a3e0b43..662597a5 100644 --- a/packages/validator-bonds-cli/src/commands/utils.ts +++ b/packages/validator-bonds-cli/src/commands/utils.ts @@ -231,12 +231,31 @@ export async function getWithdrawRequestFromAddress({ } let bondAccountAddress = address - const voteAccountAddress = await isVoteAccount({ + let voteAccountAddress = await isVoteAccount({ address, accountInfo, logger, }) + if ( + voteAccountAddress === null && + accountInfo.owner.equals(StakeProgram.programId) + ) { + try { + const stakeAccountData = deserializeStakeState(accountInfo.data) + voteAccountAddress = + stakeAccountData.Stake?.stake.delegation.voterPubkey ?? null + if (voteAccountAddress !== null) { + logger.info( + `Address ${address.toBase58()} is a STAKE ACCOUNT delegated to vote account ` + + `${voteAccountAddress.toBase58()}. Using the vote account to get the withdraw request data.` + ) + } + } catch (e) { + logger.debug(`Failed to decode account ${address} as stake account`, e) + } + } + if (voteAccountAddress !== null) { if (config === undefined) { config = MARINADE_CONFIG_ADDRESS @@ -256,7 +275,7 @@ export async function getWithdrawRequestFromAddress({ accountInfo = await checkAccountExistence( program.provider.connection, address, - 'type of withdrawRequest' + `WithdrawRequest generated from bond address ${bondAccountAddress.toBase58()} does not exist` ) // final decoding of withdraw request account from account info @@ -315,7 +334,9 @@ async function checkAccountExistence( throw new CliCommandError({ valueName: '[address]', value: address.toBase58(), - msg: `Address does not exist at ${connection.rpcEndpoint}: ` + errorMsg, + msg: + `Address does not exist on-chain (RPC endpoint: ${connection.rpcEndpoint}): ` + + errorMsg, }) } return accountInfo diff --git a/packages/validator-bonds-sdk/src/orchestrators/orchestrateWithdrawRequest.ts b/packages/validator-bonds-sdk/src/orchestrators/orchestrateWithdrawRequest.ts index 0220c02a..fd5632af 100644 --- a/packages/validator-bonds-sdk/src/orchestrators/orchestrateWithdrawRequest.ts +++ b/packages/validator-bonds-sdk/src/orchestrators/orchestrateWithdrawRequest.ts @@ -218,7 +218,8 @@ export async function orchestrateWithdrawDeposit({ if (stakeAccountsFunded.length === 0 && amountToWithdraw > new BN(0)) { throw new Error( - 'orchestrateWithdrawDeposit: cannot find any stake accounts to withdraw from' + 'Claim withdraw request failed: No stake accounts found for bond account ' + + `(${bondAccount.toBase58()}) to process the withdrawal.` ) }