Skip to content

Commit

Permalink
address reviews: add comments and use string for amount
Browse files Browse the repository at this point in the history
  • Loading branch information
ecioppettini committed Dec 22, 2023
1 parent 4870a17 commit 900df66
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
19 changes: 17 additions & 2 deletions indexer/tasks/src/multiera/multiera_asset_utxo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,17 @@ async fn handle(
let utxo = if let Some(utxo) = utxo {
utxo
} else {
// this can happen if the tx was not valid, in which case the
// input is not spent.
// We iterate over the combination of <inputs, collateral> in
// the tx body:
//
// If tx succeeded, inputs are consumed and we skip collateral.
//
// If tx failed, we skip inputs and consume collateral
//
// We don't need to have that piece of logic here, because the
// MultieraUsedInputTask takes care of discriminating by not
// inserting the unused ones in the map, so we can just skip
// the input.
continue;
};

Expand All @@ -95,6 +104,9 @@ async fn handle(
}
};

// 0 values were allowed in the serialization of multiassets
// before conway. We need to filter these here, because the
// asset may not actually be in the assets table.
if value == 0 {
continue;
}
Expand Down Expand Up @@ -148,6 +160,9 @@ async fn handle(
}
};

// 0 values were allowed in the serialization of multiassets
// before conway. We need to filter these here, because the
// asset may not actually be in the assets table.
if value == 0 {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion webserver/server/app/controllers/AssetUtxosController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class AssetUtxosController extends Controller {
tx: data.output_tx_hash as string,
},
paymentCred: Buffer.from(addressBytes as Uint8Array).toString('hex'),
amount: data.amount ? Number(data.amount) : undefined,
amount: data.amount ? data.amount : undefined,
slot: data.slot,
cip14Fingerprint: bech32.encode('asset', bech32.toWords(data.cip14_fingerprint)),
};
Expand Down
4 changes: 2 additions & 2 deletions webserver/shared/models/AssetUtxos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export type AssetUtxosResponse = {
* If the utxo is created, this has the amount. It's undefined if the utxo
* is spent.
*
* @example 1031423725351
* @example '1031423725351'
*/
amount: number | undefined,
amount: string | undefined,
utxo: {
tx: string,
index: number,
Expand Down

0 comments on commit 900df66

Please sign in to comment.