ava-labs / avalanchego

Go implementation of an Avalanche node.
https://avax.network
BSD 3-Clause "New" or "Revised" License
2.09k stars 646 forks source link

Standardize wallet tx acceptance polling #3110

Closed StephenButtolph closed 2 weeks ago

StephenButtolph commented 2 weeks ago

Why this should be merged

This standardizes the names and behavior of avm.Client#ConfirmTx, platformvm.Client#AwaitTxDecided, xsvmapi.WaitForAcceptance as: avm.AwaitTxAccepted, platformvm.AwaitTxAccepted, and xsvmapi.AwaitTxAccepted.

This also implements awaitTxAccepted for the C-chain wallet.

How this works

The changes are to ensure that AwaitTxAccepted now returns if:

  1. The context is cancelled
  2. The tx is accepted
  3. The tx is rejected
  4. An API error is returned

How this was tested