fix: parseSequenceFromLogSolana -> Throw correct error if a Solana Tx is not found

This commit is contained in:
Davide 2022-01-24 21:56:50 +01:00 committed by Evan Gray
parent e30f92b3e0
commit 1406b76ddf
1 changed files with 2 additions and 2 deletions

View File

@ -72,8 +72,8 @@ const SOLANA_SEQ_LOG = "Program log: Sequence: ";
export function parseSequenceFromLogSolana(info: TransactionResponse) {
// TODO: better parsing, safer
const sequence = info.meta?.logMessages
?.filter((msg) => msg.startsWith(SOLANA_SEQ_LOG))[0]
.replace(SOLANA_SEQ_LOG, "");
?.filter((msg) => msg.startsWith(SOLANA_SEQ_LOG))?.[0]
?.replace(SOLANA_SEQ_LOG, "");
if (!sequence) {
throw new Error("sequence not found");
}