Skip to content

Commit

Permalink
Merge pull request #6685 from planetarium/exp/issue-6580
Browse files Browse the repository at this point in the history
stageTransaction 응답이 실패일 경우 에러 팝업 처리
  • Loading branch information
ipdae authored Jan 10, 2025
2 parents 96d5f2a + cd3e118 commit f2c4f5c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion nekoyume/Assets/_Scripts/Blockchain/RPCAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public class RPCAgent : MonoBehaviour, IAgent, IActionEvaluationHubReceiver

public readonly Subject<(RPCAgent, int retryCount)> OnRetryAttempt = new();

public readonly Subject<bool> OnTxStageEnded = new ();

public BlockHash BlockTipHash { get; private set; }

public HashDigest<SHA256> BlockTipStateRootHash { get; private set; }
Expand Down Expand Up @@ -719,6 +721,19 @@ Dictionary<string, Value> GetPlayerAddressForLogging()
.ObserveOnMainThread()
.Subscribe()
.AddTo(_disposables);
OnTxStageEnded
.ObserveOnMainThread()
.Subscribe(result =>
{
if (!result)
{
var popup = Widget.Find<IconAndButtonSystem>();
popup.Show(L10nManager.Localize("UI_ERROR"),
L10nManager.Localize("UI_TX_STAGE_FAILED"), L10nManager.Localize("UI_OK"));
popup.SetConfirmCallbackToExit();
}
})
.AddTo(_disposables);
Game.Event.OnUpdateAddresses.AddListener(UpdateSubscribeAddresses);

cancellationTokenSource = new CancellationTokenSource();
Expand Down Expand Up @@ -886,7 +901,8 @@ private async Task MakeTransaction(List<ActionBase> actions)
$" Actions=[{actionsText}]");

_onMakeTransactionSubject.OnNext((tx, actions));
await _service.PutTransaction(tx.Serialize());
var result = await _service.PutTransaction(tx.Serialize());
OnTxStageEnded.OnNext(result);
foreach (var action in actions)
{
if (action is GameAction gameAction)
Expand Down

0 comments on commit f2c4f5c

Please sign in to comment.