Skip to content

Commit

Permalink
feat: implement base receipts
Browse files Browse the repository at this point in the history
  • Loading branch information
1Mateus committed Dec 5, 2023
1 parent 42775be commit 8429b7c
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
13 changes: 11 additions & 2 deletions front/components/history/Item.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { computed, reactive } from 'vue'
import { getDecimals, formatBigNumberWithDecimals } from 'opact-sdk'
import Pact from 'pact-lang-api'
import { format } from 'date-fns'
import { tokens } from '~/utils/constants'
Expand Down Expand Up @@ -54,6 +55,15 @@ const isNegative = computed(() => {
return false
})
const formattedAmount = computed(() => {
const decimals = getDecimals(12)
return formatBigNumberWithDecimals(
props.amount,
decimals
)
})
const metadata = computed(() => {
if (props.address !== 'poly-fungible-v2-reference') {
return tokens.find(
Expand Down Expand Up @@ -170,8 +180,7 @@ watch(
isNegative ? 'text-red-500' : 'text-green-500'
"
>
{{ isNegative ? '-' : '+' }}
{{ Number(amount).toFixed(1) }}
{{ formattedAmount }}
{{ metadata?.symbol }}
</span>
</div>
Expand Down
13 changes: 11 additions & 2 deletions front/components/history/WidgetItem.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import Pact from 'pact-lang-api'
import { formatBigNumberWithDecimals, getDecimals } from 'opact-sdk'
import { computed, watch, reactive } from 'vue'
import { shortenAddress } from '~/utils/string'
Expand Down Expand Up @@ -56,6 +57,15 @@ const isNegative = computed(() => {
return false
})
const formattedAmount = computed(() => {
const decimals = getDecimals(12)
return formatBigNumberWithDecimals(
props.amount,
decimals
)
})
const metadata = computed(() => {
if (props.address !== 'poly-fungible-v2-reference') {
return tokens.find(
Expand Down Expand Up @@ -161,8 +171,7 @@ watch(
isNegative ? 'text-red-500' : 'text-green-500'
"
>
{{ isNegative ? '-' : '+' }}
{{ Number(amount).toFixed(1) }}
{{ formattedAmount }}
{{ metadata?.symbol }}
</span>
</div>
Expand Down
8 changes: 0 additions & 8 deletions front/composables/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ export const useExtensions = () => {
await newProvider.connect(callback)

provider.value = newProvider

// store({
// providers: [{ chainKey, adapterKey }]
// })
} catch (e) {
console.log(e)
}
Expand All @@ -37,10 +33,6 @@ export const useExtensions = () => {
await provider.value.disconnect()

provider.value = null

// const { clear } = useAuthStorage()

// clear(['providers'])
}

const isConnected = computed(() => !!provider.value)
Expand Down
2 changes: 1 addition & 1 deletion front/hooks/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const useAppState = () => {
storedReceipts: any
): Promise<any> => {
return new Promise((resolve) => {
const worker = new Worker('/worker.4804a108.js', {
const worker = new Worker('/worker.13f5fe40.js', {
type: 'module'
})

Expand Down

Large diffs are not rendered by default.

0 comments on commit 8429b7c

Please sign in to comment.