The flow could be:
- When the game is created in the
ChessContract constructor we add another sub-object of class TxWrapper (see the swap packet) that does not contain a txHex yet. This object is owned by both players and the operator
- All players and the operator subscribe to the TxWrapper object using this: https://docs.bitcoincomputer.io/lib/computer/subscribe/
- When the game is over winner creates a partially signed transaction (like the one that is sent to the server now)
- The winner calls the
setTx function on the TxWrapper object with the partially signed transaction.
- When the other player receives a notification from the subscription on the TxWrapper object (that is in the
onMessage function of the subscribe function, they check if they should sign the transaction and if so sign and broadcast it.
The next step will be to implement the operator on the client which will be very similar.
The flow could be:
ChessContractconstructor we add another sub-object of classTxWrapper(see the swap packet) that does not contain a txHex yet. This object is owned by both players and the operatorsetTxfunction on the TxWrapper object with the partially signed transaction.onMessagefunction of thesubscribefunction, they check if they should sign the transaction and if so sign and broadcast it.The next step will be to implement the operator on the client which will be very similar.