Skip to content

Commit

Permalink
status reprs
Browse files Browse the repository at this point in the history
  • Loading branch information
koirikivi committed May 14, 2024
1 parent 8b55e6b commit dd2797f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<td>{{ deposit.tx_id }}:{{ deposit.vout }}</td>
<td>{{ deposit.block_number }}</td>
<td>{{ deposit.evm_tx_hash }}</td>
<td>{{ deposit.status }}</td>
<td>{{ deposit.status_repr }}</td>
<td>{{ deposit.created_at }}</td>
</tr>
{% endfor %}
Expand All @@ -42,7 +42,7 @@
<td>{{ deposit.evm_block_number }}</td>
<td>{{ deposit.evm_tx_hash }}</td>
<td>{{ deposit.receiver_btc_address }}</td>
<td>{{ deposit.status }}</td>
<td>{{ deposit.status_repr }}</td>
<td>{{ deposit.created_at }}</td>
</tr>
{% endfor %}
Expand Down
14 changes: 14 additions & 0 deletions bridge_node/bridge/bridges/runes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ def __repr__(self):
def fee_raw(self) -> int:
return self.transfer_amount_raw - self.net_amount_raw

@property
def status_repr(self) -> str:
try:
return RuneDepositStatus(self.status).name
except ValueError:
return f"Unknown: {self.status}"

def get_status_for_ui(self) -> str:
# XXX maps status to a string that can be used in the UI
status_map = {
Expand Down Expand Up @@ -308,3 +315,10 @@ def __repr__(self):
f"RuneTokenDeposit(id={self.id}, {self.rune.decimal_amount(self.net_rune_amount_raw)} "
f"{self.rune.name} => {self.receiver_btc_address})"
)

@property
def status_repr(self) -> str:
try:
return RuneTokenDepositStatus(self.status).name
except ValueError:
return f"Unknown: {self.status}"

0 comments on commit dd2797f

Please sign in to comment.