Skip to content

Commit

Permalink
Fix missing asset info
Browse files Browse the repository at this point in the history
  • Loading branch information
Ouziel committed Dec 6, 2024
1 parent bc33033 commit 65ce74b
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 40 deletions.
10 changes: 5 additions & 5 deletions counterparty-core/counterpartycore/lib/api/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,11 @@ def inject_details(ledger_db, state_db, result, table=None):
if table == "transactions":
result_list = inject_transactions_events(ledger_db, state_db, result_list)
result_list = inject_unpacked_data(ledger_db, result_list)
else:
result_list = inject_dispensers(ledger_db, state_db, result_list)
result_list = inject_fiat_prices(ledger_db, result_list)
result_list = inject_issuances_and_block_times(ledger_db, state_db, result_list)
result_list = inject_normalized_quantities(result_list)

result_list = inject_dispensers(ledger_db, state_db, result_list)
result_list = inject_fiat_prices(ledger_db, result_list)
result_list = inject_issuances_and_block_times(ledger_db, state_db, result_list)
result_list = inject_normalized_quantities(result_list)

if result_is_dict:
result = result_list[0]
Expand Down
145 changes: 110 additions & 35 deletions counterparty-core/counterpartycore/test/fixtures/api_v2_fixtures.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,27 @@
"get_quantity": 800000,
"expiration": 2000,
"fee_required": 900000,
"status": "open"
"status": "open",
"give_asset_info": {
"asset_longname": null,
"description": "The Counterparty protocol native currency",
"issuer": null,
"divisible": true,
"locked": true
},
"get_asset_info": {
"divisible": true,
"asset_longname": null,
"description": "The Bitcoin cryptocurrency",
"locked": false,
"issuer": null
},
"give_quantity_normalized": "1.00000000",
"get_quantity_normalized": "0.00800000",
"fee_required_normalized": "0.00900000"
}
}
},
"btc_amount_normalized": "0.00000000"
}
],
"next_cursor": null,
Expand Down Expand Up @@ -553,9 +571,19 @@
"dispenser_status": 0,
"action_address": null,
"oracle_address": null,
"status": "valid"
"status": "valid",
"asset_info": {
"asset_longname": null,
"description": "Test dispensers asset",
"issuer": "munimLLHjPhGeSU5rYB2HN79LJa8bRZr5b",
"divisible": false,
"locked": false
},
"give_quantity_normalized": "100",
"escrow_quantity_normalized": "100"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 510,
Expand Down Expand Up @@ -634,9 +662,11 @@
"call_date": 0,
"call_price": 0.0,
"description": "Test dispensers asset",
"status": "valid"
"status": "valid",
"quantity_normalized": "1000"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 509,
Expand Down Expand Up @@ -689,7 +719,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00010000"
},
{
"tx_index": 508,
Expand Down Expand Up @@ -742,7 +773,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00010000"
},
{
"tx_index": 507,
Expand Down Expand Up @@ -841,7 +873,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 506,
Expand Down Expand Up @@ -929,7 +962,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 505,
Expand Down Expand Up @@ -1039,7 +1073,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 504,
Expand Down Expand Up @@ -1149,7 +1184,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 503,
Expand Down Expand Up @@ -1259,7 +1295,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 502,
Expand Down Expand Up @@ -1347,7 +1384,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
}
],
"next_cursor": 501,
Expand Down Expand Up @@ -1441,9 +1479,11 @@
"call_date": 0,
"call_price": 0.0,
"description": "Divisible asset",
"status": "valid"
"status": "valid",
"quantity_normalized": "1000.00000000"
}
}
},
"btc_amount_normalized": "0.00000000"
}
},
"http://localhost:10009/v2/transactions/ba6c7582f5c1e39bed32074c16f54ab338c79d0eefd3c8a7ba1f949e2febcd18?verbose=true": {
Expand Down Expand Up @@ -1544,7 +1584,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
}
},
"http://localhost:10009/v2/transactions/2/events?verbose=true": {
Expand Down Expand Up @@ -2579,7 +2620,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00010000"
},
{
"tx_index": 508,
Expand Down Expand Up @@ -2632,7 +2674,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00010000"
},
{
"tx_index": 507,
Expand Down Expand Up @@ -2731,7 +2774,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 506,
Expand Down Expand Up @@ -2819,7 +2863,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 505,
Expand Down Expand Up @@ -2929,7 +2974,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 504,
Expand Down Expand Up @@ -3039,7 +3085,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
}
],
"next_cursor": 503,
Expand Down Expand Up @@ -5635,7 +5682,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00010000"
},
{
"tx_index": 508,
Expand Down Expand Up @@ -5688,7 +5736,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00010000"
},
{
"tx_index": 504,
Expand Down Expand Up @@ -5798,7 +5847,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 503,
Expand Down Expand Up @@ -5908,7 +5958,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 502,
Expand Down Expand Up @@ -5996,7 +6047,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 501,
Expand Down Expand Up @@ -6106,7 +6158,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 500,
Expand Down Expand Up @@ -6216,7 +6269,8 @@
"message_data": {
"error": "Unknown message type"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 499,
Expand Down Expand Up @@ -6297,7 +6351,8 @@
"description": null,
"status": "invalid: could not unpack"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 498,
Expand Down Expand Up @@ -6376,9 +6431,11 @@
"call_date": 0,
"call_price": 0.0,
"description": "Parent asset",
"status": "valid"
"status": "valid",
"quantity_normalized": "1.00000000"
}
}
},
"btc_amount_normalized": "0.00000000"
},
{
"tx_index": 492,
Expand Down Expand Up @@ -6455,9 +6512,27 @@
"get_quantity": 800000,
"expiration": 2000,
"fee_required": 900000,
"status": "open"
"status": "open",
"give_asset_info": {
"asset_longname": null,
"description": "The Counterparty protocol native currency",
"issuer": null,
"divisible": true,
"locked": true
},
"get_asset_info": {
"divisible": true,
"asset_longname": null,
"description": "The Bitcoin cryptocurrency",
"locked": false,
"issuer": null
},
"give_quantity_normalized": "1.00000000",
"get_quantity_normalized": "0.00800000",
"fee_required_normalized": "0.00900000"
}
}
},
"btc_amount_normalized": "0.00000000"
}
],
"next_cursor": 482,
Expand Down

0 comments on commit 65ce74b

Please sign in to comment.