Hello there,
I’m trying to look in to how to distribute reward in winner’s wallet within matchLoop.
Right now my code is:
switch(s.winnerInfo){
case WinnerInfo.BLUE:{
s.blueUserIds.forEach(userId=>{
let netAmount = s.usersBetAmount[userId] //todo rewards logic
nk.walletUpdate(userId, {[currencyKeyName]: netAmount},{
transfer_type: "blue_winner",
fight_number: s.fightInfo.fight_number
},true);
s.blueUserIds = s.blueUserIds.filter((e: string) => e !== userId)
s.usersBetAmount[userId] = 0
})
}break;
}
Is there an alternative way of doing it? Or is there any documentations available regarding this?
Thank you