Skip to content

Commit

Permalink
feat: add fiat estimation to split object
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechsimetka committed Sep 21, 2023
1 parent e0f2f5c commit 3a2d5c9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/objects/payggy/views/choose-amount.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import Layout from '$lib/components/layout.svelte'
import { payggyDescriptor } from '..'
import type { ExchangeRateRecord } from '$lib/stores/exchangeRates'
import { getFiatAmountText } from '$lib/objects/utils'
import { getFiatAmountText } from '$lib/utils/fiat'
export let amount: string
export let token: TokenAmount
Expand Down
2 changes: 1 addition & 1 deletion src/lib/objects/payggy/views/confirm-send.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import Layout from '$lib/components/layout.svelte'
import { payggyDescriptor } from '..'
import type { ExchangeRateRecord } from '$lib/stores/exchangeRates'
import { getFiatAmountText } from '$lib/objects/utils'
import { getFiatAmountText } from '$lib/utils/fiat'
export let toUser: User
export let estimateTransaction: (to: string, token: TokenAmount) => Promise<TokenAmount>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/objects/payggy/views/details.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import type { User } from '$lib/types'
import Layout from '$lib/components/layout.svelte'
import { payggyDescriptor } from '..'
import { getFiatAmountText } from '$lib/objects/utils'
import { getFiatAmountText } from '$lib/utils/fiat'
import type { ExchangeRateRecord } from '$lib/stores/exchangeRates'
export let transaction: Transaction
Expand Down
2 changes: 2 additions & 0 deletions src/lib/objects/split/standalone.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
send={args.send}
getContract={args.getContract}
tokens={args.tokens}
fiatRates={args.exchangeRates}
fiatSymbol={args.fiatSymbol}
/>
{/if}
{:else if args.view === 'accounting'}
Expand Down
12 changes: 11 additions & 1 deletion src/lib/objects/split/views/settle-now.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@
import type { TokenAmount, Token } from '$lib/objects/schemas'
import { formatAddress, toSignificant } from '$lib/utils/format'
import Info from '../components/info.svelte'
import { getFiatAmountText } from '$lib/utils/fiat'
import type { ExchangeRateRecord } from '$lib/stores/exchangeRates'
export let profile: UserType
export let instanceId: string
export let chatName: string
export let splitterAddress: string
export let tokens: TokenAmount[]
export let token: Token
export let fiatRates: Map<string, ExchangeRateRecord>
export let fiatSymbol: string | undefined
export let getContract: GetContract
export let exitObject: () => void
Expand Down Expand Up @@ -129,7 +133,13 @@
<Info title="Transaction fee (max)">
<p>{toSignificant(fee, nativeToken.decimals)} {nativeToken.symbol}</p>
<p class="text-sm">
{toSignificant(fee, nativeToken.decimals)} ≈ TODO DAI
{toSignificant(fee, nativeToken.decimals)}
{getFiatAmountText(
fiatRates,
fiatSymbol,
toSignificant(fee, nativeToken.decimals),
nativeToken.symbol,
)}
</p>
</Info>
<ReadonlyText marginBottom={0} align="center">
Expand Down
File renamed without changes.

0 comments on commit 3a2d5c9

Please sign in to comment.