@@ -1423,6 +1423,28 @@ function normalizeUintValue(value: Hex): Hex {
14231423 return trim ( pad ( value ) ) ;
14241424}
14251425
1426+ /**
1427+ * Helper function to prepare an action step for encoding
1428+ *
1429+ * @param {ActionStep } step - The action step to prepare
1430+ * @returns {ActionStep } The prepared action step
1431+ */
1432+ function prepareActionStep ( step : ActionStep ) {
1433+ return {
1434+ ..._toRawActionStep ( step ) ,
1435+ signatureType : step . signatureType ?? detectSignatureType ( step . signature ) ,
1436+ signature : pad ( step . signature ) ,
1437+ actionType : step . actionType || 0 ,
1438+ actionParameter :
1439+ step . actionParameter . fieldType === PrimitiveType . UINT
1440+ ? {
1441+ ...step . actionParameter ,
1442+ filterData : normalizeUintValue ( step . actionParameter . filterData ) ,
1443+ }
1444+ : step . actionParameter ,
1445+ } ;
1446+ }
1447+
14261448/**
14271449 * Function to properly encode an event action payload.
14281450 *
@@ -1555,74 +1577,10 @@ export function prepareEventActionPayload({
15551577 detectSignatureType ( actionClaimant . signature ) ,
15561578 signature : pad ( actionClaimant . signature ) ,
15571579 } ,
1558- actionStepOne : {
1559- ..._toRawActionStep ( actionStepOne ) ,
1560- signatureType :
1561- actionStepOne . signatureType ??
1562- detectSignatureType ( actionStepOne . signature ) ,
1563- signature : pad ( actionStepOne . signature ) ,
1564- actionType : actionStepOne . actionType || 0 ,
1565- actionParameter :
1566- actionStepOne . actionParameter . fieldType === PrimitiveType . UINT
1567- ? {
1568- ...actionStepOne . actionParameter ,
1569- filterData : normalizeUintValue (
1570- actionStepOne . actionParameter . filterData ,
1571- ) ,
1572- }
1573- : actionStepOne . actionParameter ,
1574- } ,
1575- actionStepTwo : {
1576- ..._toRawActionStep ( actionStepTwo ) ,
1577- signatureType :
1578- actionStepTwo . signatureType ??
1579- detectSignatureType ( actionStepTwo . signature ) ,
1580- signature : pad ( actionStepTwo . signature ) ,
1581- actionType : actionStepTwo . actionType || 0 ,
1582- actionParameter :
1583- actionStepTwo . actionParameter . fieldType === PrimitiveType . UINT
1584- ? {
1585- ...actionStepTwo . actionParameter ,
1586- filterData : normalizeUintValue (
1587- actionStepTwo . actionParameter . filterData ,
1588- ) ,
1589- }
1590- : actionStepTwo . actionParameter ,
1591- } ,
1592- actionStepThree : {
1593- ..._toRawActionStep ( actionStepThree ) ,
1594- signatureType :
1595- actionStepThree . signatureType ??
1596- detectSignatureType ( actionStepThree . signature ) ,
1597- signature : pad ( actionStepThree . signature ) ,
1598- actionType : actionStepThree . actionType || 0 ,
1599- actionParameter :
1600- actionStepThree . actionParameter . fieldType === PrimitiveType . UINT
1601- ? {
1602- ...actionStepThree . actionParameter ,
1603- filterData : normalizeUintValue (
1604- actionStepThree . actionParameter . filterData ,
1605- ) ,
1606- }
1607- : actionStepThree . actionParameter ,
1608- } ,
1609- actionStepFour : {
1610- ..._toRawActionStep ( actionStepFour ) ,
1611- signatureType :
1612- actionStepFour . signatureType ??
1613- detectSignatureType ( actionStepFour . signature ) ,
1614- signature : pad ( actionStepFour . signature ) ,
1615- actionType : actionStepFour . actionType || 0 ,
1616- actionParameter :
1617- actionStepFour . actionParameter . fieldType === PrimitiveType . UINT
1618- ? {
1619- ...actionStepFour . actionParameter ,
1620- filterData : normalizeUintValue (
1621- actionStepFour . actionParameter . filterData ,
1622- ) ,
1623- }
1624- : actionStepFour . actionParameter ,
1625- } ,
1580+ actionStepOne : prepareActionStep ( actionStepOne ) ,
1581+ actionStepTwo : prepareActionStep ( actionStepTwo ) ,
1582+ actionStepThree : prepareActionStep ( actionStepThree ) ,
1583+ actionStepFour : prepareActionStep ( actionStepFour ) ,
16261584 } ,
16271585 ] ,
16281586 ) ;
0 commit comments