@@ -589,40 +589,22 @@ export const computeFinalData = (res: EmulationResultSuccess, balanceBefore: big
589589}
590590
591591/**
592- * Parse the verbose VM log, extract the final `c5` register
593- * (action list), decode it into an array of `OutAction`s and
592+ * Extract the final `c5` register (action list) from emulation results,
593+ * decode it into an array of `OutAction`s and
594594 * return both the list and the original `c5` cell.
595595 *
596- * @param logs Multi‑line VM log string from sandbox .
597- * @returns `{ finalActions, c5 }`
596+ * @param res Successful emulation result .
597+ * @returns `{ finalActions, c5 }`
598598 */
599- export const findFinalActions = ( logs : string ) => {
600- let finalActions : OutAction [ ] = [ ]
601- let c5 : Cell | undefined = undefined
602- for ( const line of logs . split ( "\n" ) ) {
603- if ( line . startsWith ( "final c5:" ) ) {
604- const [ thisFinalActions , thisC5 ] = parseC5 ( line )
605- finalActions = thisFinalActions
606- c5 = thisC5
607- }
599+ export const findFinalActions = ( res : EmulationResultSuccess ) => {
600+ const actions = res . actions
601+ if ( actions === null ) {
602+ return { finalActions : [ ] , c5 : undefined }
608603 }
609- return { finalActions, c5}
610- }
611604
612- /**
613- * Convert a single log line that starts with `"final c5:"` into a
614- * tuple `[actions, c5Cell]`, where `actions` is the decoded list of
615- * `OutAction`s present in the TVM register `c5`.
616- *
617- * @param line One line of VM log containing the hex‑encoded cell.
618- * @returns Parsed actions array and the raw `Cell`.
619- */
620- export const parseC5 = ( line : string ) : [ ( OutAction | OutActionReserve ) [ ] , Cell ] => {
621- // final c5: C{B5EE9C7...8877FA} -> B5EE9C7...8877FA
622- const cellBoc = Buffer . from ( line . slice ( "final c5: C{" . length , - 1 ) , "hex" )
623- const c5 = Cell . fromBoc ( cellBoc ) [ 0 ]
624- const slice = c5 . beginParse ( )
625- return [ loadOutList ( slice ) , c5 ]
605+ const c5 = Cell . fromBase64 ( actions )
606+ const finalActions = loadOutList ( c5 . asSlice ( ) )
607+ return { finalActions, c5}
626608}
627609
628610/**
0 commit comments