Skip to content

Commit

Permalink
[Explorer]: fix output for "unacceptable" deploy tags. (#2277)
Browse files Browse the repository at this point in the history
* fix: return null for unused in/out asset b

* fix: webpack-dev-server dep

* fix: use formatAsset for both input assets
  • Loading branch information
LHerskind authored Jan 20, 2023
1 parent 295787c commit ad54130
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions yarn-project/explorer/src/tx/defi_deposit_details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ function getBridgeInteractionDescription(deployTag: string, bridgeCallData: Brid
return {
bridgeName: `Bridge ${bridgeCallData.bridgeAddressId}`,
inputAssetA: `asset ${bridgeCallData.inputAssetIdA}`,
inputAssetB: `asset ${bridgeCallData.inputAssetIdB}`,
inputAssetB: bridgeCallData.inputAssetIdB ? `asset ${bridgeCallData.inputAssetIdB}` : null,
outputAssetA: `asset ${bridgeCallData.outputAssetIdA}`,
outputAssetB: `asset ${bridgeCallData.outputAssetIdB}`,
outputAssetB: bridgeCallData.outputAssetIdB ? `asset ${bridgeCallData.outputAssetIdB}` : null,
};
}

Expand Down Expand Up @@ -53,8 +53,9 @@ export function DefiDepositDetails({ tx }: { tx: Tx }) {

const onchainDefiDepositData = OffchainDefiDepositData.fromBuffer(Buffer.from(tx.offchainTxData, 'hex'));
const { bridgeCallData, depositValue } = onchainDefiDepositData;
const asset = useAsset(bridgeCallData.inputAssetIdA);
const assetIcon = getAssetIcon(asset);
const inputAssetA = useAsset(bridgeCallData.inputAssetIdA);
const inputAssetB = bridgeCallData.inputAssetIdB ? useAsset(bridgeCallData.inputAssetIdB) : null;
const assetIcon = getAssetIcon(inputAssetA);
const details = getBridgeInteractionDescription(network.deployTag, bridgeCallData);

return (
Expand All @@ -65,7 +66,9 @@ export function DefiDepositDetails({ tx }: { tx: Tx }) {
<InfoRow title="INPUT AMOUNT">
<Value
icon={assetIcon}
text={`${formatAsset(asset, depositValue)} ${details.inputAssetB ? ' and ' + details.inputAssetB : ''}`}
text={`${formatAsset(inputAssetA, depositValue)} ${
inputAssetB ? ' and ' + formatAsset(inputAssetB, depositValue) : ''
}`}
monospace
/>
</InfoRow>
Expand Down

0 comments on commit ad54130

Please sign in to comment.