Skip to content

Commit

Permalink
add xchain formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
dangell7 committed Apr 24, 2024
1 parent b71bcc7 commit 1d13a28
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/xrp/general.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,19 @@ void account_formatter(field_t* field, field_value_t* dst) {
dst->buf[addr_length] = '\x00';
}
}

void xchain_bridge_formatter(field_t* field, field_value_t* dst) {
field_t issuing_field_currency;
field_value_t issuing_currency;
issuing_field_currency.data_type = STI_CURRENCY;
issuing_field_currency.data.ptr = (uint8_t*)field->data.ptr + 20;
currency_formatter(&issuing_field_currency, &issuing_currency);

Check warning

Code scanning / CodeQL

Implicit function declaration Warning

Function call implicitly declares 'currency_formatter'.

field_t locking_field_currency;
field_value_t locking_currency;
locking_field_currency.data_type = STI_CURRENCY;
locking_field_currency.data.ptr = (uint8_t*)field->data.ptr + 20;
currency_formatter(&locking_field_currency, &locking_currency);

snprintf(dst->buf, sizeof(dst->buf), "%s <-> %s", issuing_currency.buf, locking_currency.buf);
}
1 change: 1 addition & 0 deletions src/xrp/general.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ void hash_formatter128(field_t* field, field_value_t* dst);
void hash_formatter256(field_t* field, field_value_t* dst);
void blob_formatter(field_t* field, field_value_t* dst);
void account_formatter(field_t* field, field_value_t* dst);
void xchain_bridge_formatter(field_t* field, field_value_t* dst);

#endif // LEDGER_APP_XRP_GENERAL_H

0 comments on commit 1d13a28

Please sign in to comment.