-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show contract call arguments in a more approchable way (#486)
Co-authored-by: Michele F. <michele-franchi@users.noreply.github.com>
- Loading branch information
1 parent
54f9fc7
commit 5bc8bee
Showing
37 changed files
with
761 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<template> | ||
<div class="contract-event-cell"> | ||
<Suspense> | ||
<component | ||
:is="contractEventCellComponent" | ||
:event="event" | ||
:contract-details="contractDetails"/> | ||
<template #fallback> | ||
Loading... | ||
</template> | ||
</Suspense> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { defineAsyncComponent } from 'vue' | ||
const props = defineProps({ | ||
contractDetails: { | ||
type: Object, | ||
required: true, | ||
}, | ||
event: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}) | ||
const contractEventCellComponent = computed(() => | ||
defineAsyncComponent(async() => { | ||
try { | ||
return await import(`@/components/ContractEventCell${props.event.eventName}.vue`) | ||
} catch { | ||
console.error(`Unknown event ${props.event.eventName} in contract ${props.contractDetails.id}`) | ||
return defineComponent(() => () => h('span', 'N/A')) | ||
} | ||
}, | ||
), | ||
) | ||
</script> | ||
|
||
<style scoped> | ||
.contract-event-cell { | ||
display: flex; | ||
justify-content: flex-end; | ||
align-items: center; | ||
gap: var(--space-1); | ||
flex-wrap: wrap; | ||
@media(--desktop) { | ||
justify-content: space-between; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<value-hash-ellipsed | ||
:hash="eventData[0]" | ||
:link-to="`/accounts/${eventData[0]}`"/> | ||
|
||
<transaction-arrow-right-icon/> | ||
|
||
<value-hash-ellipsed | ||
:hash="eventData[1]" | ||
:link-to="`/accounts/${eventData[1]}`"/> | ||
|
||
<app-chip size="sm"> | ||
{{ tokenValue }} | ||
</app-chip> | ||
</template> | ||
|
||
<script setup> | ||
import { formatNumber, formatReduceDecimals } from '@/utils/format' | ||
import AppChip from '@/components/AppChip' | ||
import TransactionArrowRightIcon from '@/components/TransactionArrowRightIcon' | ||
import ValueHashEllipsed from '@/components/ValueHashEllipsed' | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
const tokenValue = computed(() => { | ||
if (!props.contractDetails.tokenDetails || props.contractDetails.contractType === 'AEX-141') { | ||
return eventData.value[2] | ||
} | ||
return formatNumber( | ||
formatReduceDecimals(eventData.value[2], props.contractDetails.tokenDetails.decimals), | ||
) + ` ${props.contractDetails.tokenDetails.symbol}` | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<value-hash-ellipsed | ||
:hash="contractDetails.id" | ||
:link-to="`/contracts/${contractDetails.id}`"/> | ||
|
||
<transaction-arrow-right-icon/> | ||
|
||
<app-chip size="sm"> | ||
{{ tokenValue }} | ||
</app-chip> | ||
</template> | ||
|
||
<script setup> | ||
import { formatNumber, formatReduceDecimals } from '@/utils/format' | ||
import AppChip from '@/components/AppChip' | ||
import TransactionArrowRightIcon from '@/components/TransactionArrowRightIcon' | ||
import ValueHashEllipsed from '@/components/ValueHashEllipsed' | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
const tokenValue = computed(() => { | ||
if (!props.contractDetails.tokenDetails || props.contractDetails.contractType === 'AEX-141') { | ||
return eventData.value[0] | ||
} | ||
return formatNumber( | ||
formatReduceDecimals(eventData.value[0], props.contractDetails.tokenDetails.decimals), | ||
) + ` ${props.contractDetails.tokenDetails.symbol}` | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
{{ eventData[0] }} | ||
|
||
<transaction-arrow-right-icon/> | ||
|
||
{{ eventData[1] }} | ||
</template> | ||
|
||
<script setup> | ||
import TransactionArrowRightIcon from '@/components/TransactionArrowRightIcon' | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
{{ eventData[0] }} | ||
|
||
<transaction-arrow-right-icon/> | ||
|
||
{{ eventData[1] }} | ||
</template> | ||
|
||
<script setup> | ||
import TransactionArrowRightIcon from '@/components/TransactionArrowRightIcon' | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<template> | ||
<value-hash-ellipsed | ||
:hash="contractDetails.id" | ||
:link-to="`/contracts/${contractDetails.id}`"/> | ||
|
||
<transaction-arrow-right-icon/> | ||
|
||
<value-hash-ellipsed | ||
:hash="eventData[0]" | ||
:link-to="`/accounts/${eventData[0]}`"/> | ||
|
||
<app-chip size="sm"> | ||
{{ tokenValue }} | ||
</app-chip> | ||
</template> | ||
|
||
<script setup> | ||
import { formatNumber, formatReduceDecimals } from '@/utils/format' | ||
import AppChip from '@/components/AppChip' | ||
import TransactionArrowRightIcon from '@/components/TransactionArrowRightIcon' | ||
import ValueHashEllipsed from '@/components/ValueHashEllipsed' | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
const tokenValue = computed(() => { | ||
if (!props.contractDetails.tokenDetails || props.contractDetails.contractType === 'AEX-141') { | ||
return eventData.value[1] | ||
} | ||
return formatNumber( | ||
formatReduceDecimals(eventData.value[1], props.contractDetails.tokenDetails.decimals), | ||
) + ` ${props.contractDetails.tokenDetails.symbol}` | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template> | ||
<value-hash-ellipsed | ||
:hash="eventData[0]" | ||
:link-to="`/accounts/${eventData[0]}`"/> | ||
|
||
<transaction-arrow-right-icon/> | ||
|
||
<app-chip size="sm"> | ||
{{ formatAePrice(formatAettosToAe(eventData[1])) }} | ||
</app-chip> | ||
</template> | ||
|
||
<script setup> | ||
import { formatAePrice, formatAettosToAe } from '@/utils/format' | ||
import AppChip from '@/components/AppChip' | ||
import TransactionArrowRightIcon from '@/components/TransactionArrowRightIcon' | ||
import ValueHashEllipsed from '@/components/ValueHashEllipsed' | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
{{ eventData[0] }} | ||
</template> | ||
|
||
<script setup> | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
{{ eventData[0] }} | ||
</template> | ||
|
||
<script setup> | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
{{ eventData[0] }} | ||
</template> | ||
|
||
<script setup> | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
{{ eventData[0] }} | ||
|
||
<transaction-arrow-right-icon/> | ||
|
||
{{ eventData[1] }} | ||
</template> | ||
|
||
<script setup> | ||
import TransactionArrowRightIcon from '@/components/TransactionArrowRightIcon' | ||
const props = defineProps({ | ||
contractDetails: { | ||
required: true, | ||
type: Object, | ||
}, | ||
event: { | ||
required: true, | ||
type: Object, | ||
}, | ||
}) | ||
const eventData = computed(() => props.event.data) | ||
</script> |
Oops, something went wrong.