@@ -209,7 +209,7 @@ async function _handleSupplierUnbondingBeginEvent(
209209 "value":"\"55070\"","index":true
210210 },{"key":"mode","value":"EndBlock","index":true}]}
211211 */
212- let unbondingHeight : bigint | null = null , sessionEndHeight : bigint | null = null , supplierSdk : SupplierSDKType | null = null , reason = 0 ;
212+ let unbondingHeight : bigint | null = null , sessionEndHeight : bigint | null = null , supplierSdk : SupplierSDKType | null = null , reason : null | number = null ;
213213
214214 for ( const attribute of event . event . attributes ) {
215215 if ( attribute . key === "supplier" ) {
@@ -252,7 +252,7 @@ async function _handleSupplierUnbondingBeginEvent(
252252 supplier . unstakingEndHeight = unbondingHeight
253253 }
254254
255- if ( ! reason ) {
255+ if ( reason === null ) {
256256 // todo: we should do this -> throw new Error(`[handleSupplierUnbondingBeginEvent] reason not found in event`);
257257 // but alpha has still events without this
258258 logger . error ( `[handleSupplierUnbondingBeginEvent] reason not found in event` ) ;
@@ -270,7 +270,7 @@ async function _handleSupplierUnbondingBeginEvent(
270270 sessionEndHeight : sessionEndHeight || BigInt ( 0 ) ,
271271 supplierId : operatorAddress ,
272272 blockId : getBlockId ( event . block ) ,
273- reason : reason ? getSupplierUnbondingReasonFromSDK ( reason ) : SupplierUnbondingReason . UNSPECIFIED ,
273+ reason : reason !== null ? getSupplierUnbondingReasonFromSDK ( reason ) : SupplierUnbondingReason . UNSPECIFIED ,
274274 eventId,
275275 } ) . save ( ) ,
276276 ] ) ;
@@ -279,7 +279,7 @@ async function _handleSupplierUnbondingBeginEvent(
279279async function _handleSupplierUnbondingEndEvent (
280280 event : CosmosEvent ,
281281) {
282- let unbondingHeight : bigint | null = null , sessionEndHeight : bigint | null = null , supplierSdk : SupplierSDKType | null = null , reason = 0 ;
282+ let unbondingHeight : bigint | null = null , sessionEndHeight : bigint | null = null , supplierSdk : SupplierSDKType | null = null , reason : null | number = null ;
283283
284284 for ( const attribute of event . event . attributes ) {
285285 if ( attribute . key === "supplier" ) {
@@ -320,7 +320,7 @@ async function _handleSupplierUnbondingEndEvent(
320320 supplier . unstakingEndBlockId = unbondingHeight
321321 }
322322
323- if ( ! reason ) {
323+ if ( reason === null ) {
324324 // todo: we should do this -> throw new Error(`[handleSupplierUnbondingBeginEvent] reason not found in event`);
325325 // but alpha has still events without this
326326 logger . error ( `[handleSupplierUnbondingEndEvent] reason not found in event` ) ;
@@ -339,7 +339,7 @@ async function _handleSupplierUnbondingEndEvent(
339339 id : eventId ,
340340 unbondingEndHeight : unbondingHeight || BigInt ( 0 ) ,
341341 sessionEndHeight : sessionEndHeight || BigInt ( 0 ) ,
342- reason : reason ? getSupplierUnbondingReasonFromSDK ( reason ) : SupplierUnbondingReason . UNSPECIFIED ,
342+ reason : reason !== null ? getSupplierUnbondingReasonFromSDK ( reason ) : SupplierUnbondingReason . UNSPECIFIED ,
343343 blockId : getBlockId ( event . block ) ,
344344 supplierId : supplierSdk . operator_address ,
345345 eventId,
0 commit comments