Skip to content

Commit

Permalink
Merge pull request #152 from Holo-Host/feat/add-eth-transaction-hash-…
Browse files Browse the repository at this point in the history
…to-redemptions

Feature/show eth transaction hash on redemptions
  • Loading branch information
mateuszRybczonek authored Feb 19, 2024
2 parents c4fc89c + 12dd1bd commit 46d4db7
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 17 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "host-console",
"version": "1.0.0-rc.2",
"version": "1.0.0-rc.3",
"private": true,
"homepage": "https://holo-host.github.io/host-console-ui/",
"scripts": {
Expand Down
40 changes: 24 additions & 16 deletions src/components/earnings/RedemptionHistoryTableRow.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ClipboardDocumentIcon } from '@heroicons/vue/24/outline'
import { ClipboardDocumentIcon, ArrowTopRightOnSquareIcon } from '@heroicons/vue/24/outline'
import BaseTableRow from '@uicommon/components/BaseTableRow.vue'
import BaseTableRowItem from '@uicommon/components/BaseTableRowItem.vue'
import { copyToClipboard } from '@uicommon/utils/clipboardUtils'
Expand All @@ -12,6 +12,7 @@ interface ExtendedRedemption extends Redemption {
formattedRequestedAmount: string
formattedRedemptionAmount: string
formattedTransactionId: string
formattedEthTransactionId: string
}
const props = defineProps<{
Expand Down Expand Up @@ -109,21 +110,23 @@ function showTransactionPrice(state: boolean): void {
/>
</BaseTableRowItem>

<!-- <BaseTableRowItem-->
<!-- :value="props.redemption.formattedTransactionId"-->
<!-- is-visible-on-mobile-->
<!-- is-bold-->
<!-- :is-italic="props.redemption.status === 'pending'"-->
<!-- >-->
<!-- <a-->
<!-- v-if="props.redemption.transactionId"-->
<!-- :href="`https://goerli.etherscan.io/tx/${props.redemption.transactionId}`"-->
<!-- target="_blank"-->
<!-- class="redemption-history-table-row__transaction-link"-->
<!-- >-->
<!-- <ArrowTopRightOnSquareIcon class="redemption-history-table-row__transaction-link-icon" />-->
<!-- </a>-->
<!-- </BaseTableRowItem>-->
<BaseTableRowItem
:value="props.redemption.formattedEthTransactionId"
is-visible-on-mobile
is-bold
:is-italic="props.redemption.status === 'pending'"
>
<a
v-if="props.redemption.transactionEthHash"
:href="`https://goerli.etherscan.io/tx/${props.redemption.transactionEthHash}`"
target="_blank"
class="redemption-history-table-row__transaction-link"
>
{{ props.redemption.formattedTransactionEthHash }}
<ArrowTopRightOnSquareIcon class="redemption-history-table-row__transaction-link-icon" />
</a>
<span v-else>{{ props.redemption.formattedTransactionEthHash }}</span>
</BaseTableRowItem>

<BaseTableRowItem
:value="props.redemption.status"
Expand All @@ -141,12 +144,17 @@ function showTransactionPrice(state: boolean): void {
}
&__transaction-link {
display: flex;
align-items: center;
height: 22px;
text-decoration: none;
color: var(--grey-color);
}
&__transaction-link-icon {
width: 17px;
margin-left: 4px;
margin-top: -4px;
color: var(--grey-dark-color);
cursor: pointer;
}
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/HposInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ export interface Redemption {
completedAmount: string
redemptionAmount: string
transactionId: string
transactionEthHash: string
status: string
isPartial: boolean
}
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ export default {
hf_amount: 'HF Amount',
redemption_amount: 'Redemption Amount',
transaction_id: 'HF Transaction ID',
transaction_eth_hash: 'ETH Transaction Hash',
status: 'Status'
},
original_requested_amount: 'Original Requested Amount: {amount}'
Expand Down
15 changes: 15 additions & 0 deletions src/pages/RedemptionHistoryPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ const redemptions = computed(() => {
? `...${redemption.transactionId.substring(
redemption.transactionId.length - kVisibleHashLength
)}`
: '---',
formattedTransactionEthHash: redemption.transactionEthHash
? `...${redemption.transactionEthHash.substring(
redemption.transactionEthHash.length - kVisibleHashLength
)}`
: '---'
}))
: []
Expand Down Expand Up @@ -109,6 +114,16 @@ const headersMap = computed(
type: 'string'
}
],
[
'transactionEthHash',
{
key: 'transactionEthHash',
label: t('redemption.history.headers.transaction_eth_hash'),
isVisibleOnMobile: true,
isSortable: true,
type: 'string'
}
],
[
'status',
{
Expand Down
1 change: 1 addition & 0 deletions src/utils/redemptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export function parseRedemption(redemption): Redemption {
completedAmount: Number(redemption.amount),
redemptionAmount: Number(redemption.amount),
transactionId: redemption.id,
transactionEthHash: redemption.ethereumTransactionHash,
status: redemption.status,
isPartial: false
}
Expand Down

0 comments on commit 46d4db7

Please sign in to comment.