From 8090df7793904b891ac5eab103474b0cc5b0fd32 Mon Sep 17 00:00:00 2001 From: slowbackspace Date: Tue, 24 Oct 2023 11:25:41 +0200 Subject: [PATCH] fix: bold formatting in views --- src/commands/asset/views/asset.ts | 16 ++++++++-------- src/commands/tx/views/tx.ts | 16 ++++++++-------- src/config/config.ts | 2 +- src/utils/formatting.ts | 20 ++++++++++---------- 4 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/commands/asset/views/asset.ts b/src/commands/asset/views/asset.ts index 6729ddd..03332ab 100644 --- a/src/commands/asset/views/asset.ts +++ b/src/commands/asset/views/asset.ts @@ -104,7 +104,7 @@ export const getAssetView = (asset: Responses['asset'], jsonMode?: boolean): Say type: 'section', text: { type: 'mrkdwn', - text: `*Fingerprint:\n\`${asset.fingerprint}\``, + text: `*Fingerprint*\n\`${asset.fingerprint}\``, }, }, { @@ -112,11 +112,11 @@ export const getAssetView = (asset: Responses['asset'], jsonMode?: boolean): Say fields: [ { type: 'mrkdwn', - text: `*Policy:\n\`${asset.policy_id}\``, + text: `*Policy*\n\`${asset.policy_id}\``, }, { type: 'mrkdwn', - text: `*Name:\n\`${asset.asset_name}\``, + text: `*Name*\n\`${asset.asset_name}\``, }, ], accessory: { @@ -129,7 +129,7 @@ export const getAssetView = (asset: Responses['asset'], jsonMode?: boolean): Say type: 'section', text: { type: 'mrkdwn', - text: `*Mint Tx:\n\`${asset.initial_mint_tx_hash}\``, + text: `*Mint Tx*\n\`${asset.initial_mint_tx_hash}\``, }, }, { @@ -137,11 +137,11 @@ export const getAssetView = (asset: Responses['asset'], jsonMode?: boolean): Say fields: [ { type: 'mrkdwn', - text: `*Quantity:\n${asset.quantity}`, + text: `*Quantity*\n${asset.quantity}`, }, { type: 'mrkdwn', - text: `*Mint/Burn Count:\n${asset.mint_or_burn_count}`, + text: `*Mint/Burn Count*\n${asset.mint_or_burn_count}`, }, ], }, @@ -149,7 +149,7 @@ export const getAssetView = (asset: Responses['asset'], jsonMode?: boolean): Say type: 'section', text: { type: 'mrkdwn', - text: `*On-chain Metadata:\n\`${ + text: `*On-chain Metadata*\n\`${ asset.onchain_metadata ? `\`\`\`${onchainMetadataString}\`\`\`` : 'No' }\``, }, @@ -158,7 +158,7 @@ export const getAssetView = (asset: Responses['asset'], jsonMode?: boolean): Say type: 'section', text: { type: 'mrkdwn', - text: `*Off-chain Metadata:\n\`${ + text: `*Off-chain Metadata*\n\`${ asset.metadata ? `\`\`\`${offchainMetadataString}\`\`\`` : 'No' }\``, }, diff --git a/src/commands/tx/views/tx.ts b/src/commands/tx/views/tx.ts index de7e1ac..a3d59ac 100644 --- a/src/commands/tx/views/tx.ts +++ b/src/commands/tx/views/tx.ts @@ -40,11 +40,11 @@ export const getTxView = ( fields: [ { type: 'mrkdwn', - text: `*Timestamp:\n${formatUnixTimestamp(tx.block_time)}`, + text: `*Timestamp*\n${formatUnixTimestamp(tx.block_time)}`, }, { type: 'mrkdwn', - text: `*Block:\n${tx.block_height}`, + text: `*Block*\n${tx.block_height}`, }, ], }, @@ -53,11 +53,11 @@ export const getTxView = ( fields: [ { type: 'mrkdwn', - text: `*Slot:\n${tx.slot}`, + text: `*Slot*\n${tx.slot}`, }, { type: 'mrkdwn', - text: `*Fees:\n${lovelaceToAda(tx.fees)} ADA`, + text: `*Fees*\n${lovelaceToAda(tx.fees)} ADA`, }, ], }, @@ -66,13 +66,13 @@ export const getTxView = ( fields: [ { type: 'mrkdwn', - text: `*Total Output:\n${lovelaceToAda( + text: `*Total Output*\n${lovelaceToAda( tx.output_amount.find(o => o.unit === 'lovelace')?.quantity ?? 0, )} ADA`, }, { type: 'mrkdwn', - text: `*Size:\n${tx.size} Bytes`, + text: `*Size*\n${tx.size} Bytes`, }, ], }, @@ -81,7 +81,7 @@ export const getTxView = ( fields: [ { type: 'mrkdwn', - text: `*Certificates:\n${ + text: `*Certificates*\n${ tx.stake_cert_count + tx.delegation_count + tx.pool_update_count + @@ -90,7 +90,7 @@ export const getTxView = ( }, { type: 'mrkdwn', - text: `*Mints/Burns:\n${tx.asset_mint_or_burn_count}`, + text: `*Mints/Burns*\n${tx.asset_mint_or_burn_count}`, }, ], }, diff --git a/src/config/config.ts b/src/config/config.ts index 4486f5d..0bad5ec 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -5,7 +5,7 @@ const loadConfig = () => { throw Error('Set env variable DB_CONNECTION_STRING'); } - logger.info(`DB SSL settings: ${process.env.DATABASE_SSL}\nCA cert:\n${process.env.CA_CERT}`); + logger.info(`DB SSL settings: ${process.env.DATABASE_SSL}\nCA cert*\n${process.env.CA_CERT}`); return { db: { diff --git a/src/utils/formatting.ts b/src/utils/formatting.ts index c440ee1..8ba31d2 100644 --- a/src/utils/formatting.ts +++ b/src/utils/formatting.ts @@ -44,11 +44,11 @@ export const formatInputs = (inputs: Responses['tx_content_utxo']['inputs']) => fields: [ { type: 'mrkdwn', - text: `*Tx Hash:\n\`${input.tx_hash}\``, + text: `*Tx Hash*\n\`${input.tx_hash}\``, }, { type: 'mrkdwn', - text: `*Index:\n${input.output_index}`, + text: `*Index*\n${input.output_index}`, }, ], }, @@ -56,7 +56,7 @@ export const formatInputs = (inputs: Responses['tx_content_utxo']['inputs']) => type: 'section', text: { type: 'mrkdwn', - text: `📘 *Address:\n\`${input.address}\``, + text: `📘 *Address*\n\`${input.address}\``, }, }, { @@ -64,11 +64,11 @@ export const formatInputs = (inputs: Responses['tx_content_utxo']['inputs']) => fields: [ { type: 'mrkdwn', - text: `*Amount:\n${amount} ADA`, + text: `*Amount*\n${amount} ADA`, }, { type: 'mrkdwn', - text: `*Collateral:\n${input.collateral ? 'Yes' : 'No'}`, + text: `*Collateral*\n${input.collateral ? 'Yes' : 'No'}`, }, ], }, @@ -80,7 +80,7 @@ export const formatInputs = (inputs: Responses['tx_content_utxo']['inputs']) => type: 'section', text: { type: 'mrkdwn', - text: `*Assets:\`\`\`${JSON.stringify(tokens, undefined, 2)}\`\`\``, + text: `*Assets*\n\`\`\`${JSON.stringify(tokens, undefined, 2)}\`\`\``, }, }); } @@ -112,7 +112,7 @@ export const formatOutputs = (outputs: Responses['tx_content_utxo']['outputs']) type: 'section', text: { type: 'mrkdwn', - text: `📘 *Address:\n\`${output.address}\``, + text: `📘 *Address*\n\`${output.address}\``, }, }, { @@ -120,11 +120,11 @@ export const formatOutputs = (outputs: Responses['tx_content_utxo']['outputs']) fields: [ { type: 'mrkdwn', - text: `*Amount:\n${amount} ADA`, + text: `*Amount*\n${amount} ADA`, }, { type: 'mrkdwn', - text: `*Collateral:\n${output.collateral ? 'Yes' : 'No'}`, + text: `*Collateral*\n${output.collateral ? 'Yes' : 'No'}`, }, ], }, @@ -136,7 +136,7 @@ export const formatOutputs = (outputs: Responses['tx_content_utxo']['outputs']) type: 'section', text: { type: 'mrkdwn', - text: `*Assets:\`\`\`${JSON.stringify(tokens, undefined, 2)}\`\`\``, + text: `*Assets*\n\`\`\`${JSON.stringify(tokens, undefined, 2)}\`\`\``, }, }); }