Jump to content
McKay Development

offer.data method headache


Recommended Posts

I have a problem with saving correct data using method offer.data()
If saving serverAck under await line then I got in pollData.json file the serverAck.finalState as false but in memory it is true because when logging it I got finalState = true. If I am calling this block over await line then everything is saved ok.

this.trades.bot.tradeManager.on("sentOfferChanged",async (offer,oldState)=>{
            logger.info(`Sent offer #${offer.id} state changed: ${oldState} -> ${offer.state}`)
            if(offer.id!==undefined){
                const state = getStatus(offer.state)
               
                // this.socket.emit('offerChangedState',{state,offerId:offer.id}, (response)=>{
                const response = await this.socket.emitWithAck('offerChangedState',{state,offerId:offer.id})
                if(response.status === 'ok'){
                let serverAck = offer.data("mainServerAcknowledged") as mainServerAck
                if(serverAck){
                    serverAck.finalState = true
                    offer.data('mainServerAcknowledged',serverAck)
                    console.log(offer.data("mainServerAcknowledged"))
                }
                 }
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...