diff --git a/src/routes/[network]/(account)/ram/buy/+page.svelte b/src/routes/[network]/(account)/ram/buy/+page.svelte index f8d1d883..e3c48107 100644 --- a/src/routes/[network]/(account)/ram/buy/+page.svelte +++ b/src/routes/[network]/(account)/ram/buy/+page.svelte @@ -16,18 +16,20 @@ import AssetInput from '$lib/components/input/asset.svelte'; import BytesInput from '$lib/components/input/bytes.svelte'; import Card from '$lib/components/layout/box/card.svelte'; + import AssetText from '$lib/components/elements/asset.svelte'; import { BuyRAMState } from './state.svelte'; import { preventDefault } from '$lib/utils'; + import AvailableRam from '../(components)/availableRam.svelte'; - let assetInput: AssetInput | undefined = $state(); let bytesInput: BytesInput | undefined = $state(); + let assetInput: AssetInput | undefined = $state(); const context = getContext('state'); const { data } = $props(); const debugMode = getSetting('debug-mode', true); - let buyRamState: BuyRAMState = $state(new BuyRAMState(data.network.chain)); + const buyRamState: BuyRAMState = $state(new BuyRAMState(data.network.chain)); let transactionId: Checksum256 | undefined = $state(); @@ -94,85 +96,100 @@ {/if} -
- - -
-
- + + + + + + +
+
+ +
+
+ +
-
- -
-
- {#if buyRamState.insufficientBalance} -

Insufficient balance. Please enter a smaller amount.

- {/if} -

- Balance available: - {#if context.account} - {context.account.balance?.liquid} - {:else} - 0.0000 {data.network.chain.systemToken?.symbol.code || ''} + {#if buyRamState.insufficientBalance} +

Insufficient balance. Please enter a smaller amount.

{/if} -

- - - - - - -

Details

-
- RAM Price: - {buyRamState.pricePerKB} / KB - Price for {buyRamState.kbs}: - {buyRamState.bytesValue} - Network Fee (0.5%) - {buyRamState.fee} - Total Cost - {buyRamState.bytesCost} +

+ Balance available: + {#if context.account} + {context.account.balance?.liquid} + {:else} + 0.0000 {data.network.chain.systemToken?.symbol.code || ''} + {/if} +

+ + + + + +
+

RAM Price

+ + +
+ +

RAM to be bought

+ + +
+ +

RAM Value

+ + +
+ +

Network Fee (0.5%)

+ + +
+ +

Total Cost

+
- - {#if buyRamState.valid} - {#if buyRamState.format === 'asset'} - - {:else} - + {#if buyRamState.valid} + {#if buyRamState.format === 'asset'} + + {:else} + + {/if} {/if} +
+ + {#if debugMode.value} +

Debugging

+ {JSON.stringify( + { + payer: buyRamState.payer, + receiver: buyRamState.receiver, + bytes: buyRamState.bytes, + balance: buyRamState.balance, + chain: buyRamState.chain, + pricePerKB: buyRamState.pricePerKB, + pricePerByte: buyRamState.pricePerByte, + bytesValue: buyRamState.bytesValue, + valid: buyRamState.valid, + insufficientBalance: buyRamState.insufficientBalance, + balances: context.account?.balances + }, + undefined, + 2 + )} {/if} - - - {#if debugMode.value} -

Debugging

- {JSON.stringify( - { - payer: buyRamState.payer, - receiver: buyRamState.receiver, - bytes: buyRamState.bytes, - balance: buyRamState.balance, - chain: buyRamState.chain, - pricePerKB: buyRamState.pricePerKB, - pricePerByte: buyRamState.pricePerByte, - bytesValue: buyRamState.bytesValue, - valid: buyRamState.valid, - insufficientBalance: buyRamState.insufficientBalance, - balances: context.account?.balances - }, - undefined, - 2 - )} - {/if} - + +