diff --git a/src/routes/[network]/(account)/ram/buy/+layout.svelte b/src/routes/[network]/(account)/ram/buy/+layout.svelte index dbc697ea..c8ea4a48 100644 --- a/src/routes/[network]/(account)/ram/buy/+layout.svelte +++ b/src/routes/[network]/(account)/ram/buy/+layout.svelte @@ -10,7 +10,7 @@ return [ { href: `/${network}/ram/buy/tokens`, - text: String(data.network.chain.systemToken.symbol.code) + text: String(data.network.chain.systemToken?.symbol.code) }, { href: `/${network}/ram/buy/bytes`, text: 'Bytes' } ]; diff --git a/src/routes/[network]/(account)/ram/buy/bytes/+page.svelte b/src/routes/[network]/(account)/ram/buy/bytes/+page.svelte index bf52e190..2cd0de29 100644 --- a/src/routes/[network]/(account)/ram/buy/bytes/+page.svelte +++ b/src/routes/[network]/(account)/ram/buy/bytes/+page.svelte @@ -92,7 +92,7 @@ {#if context.account} {context.account.balance?.liquid} {:else} - 0.0000 {data.network.chain.systemToken.symbol.code} + 0.0000 {data.network.chain.systemToken?.symbol.code} {/if}

diff --git a/src/routes/[network]/(account)/ram/buy/state.svelte.ts b/src/routes/[network]/(account)/ram/buy/state.svelte.ts index 09365c0c..8759893b 100644 --- a/src/routes/[network]/(account)/ram/buy/state.svelte.ts +++ b/src/routes/[network]/(account)/ram/buy/state.svelte.ts @@ -22,7 +22,10 @@ export class BuyRAMState { public bytesValue: Asset = $derived( this.format === 'asset' || !this.bytes || !this.pricePerKB.value ? this.tokens - : Asset.from((this.bytes * this.pricePerKB.value) / 1000, this.chain.systemToken.symbol) + : Asset.from( + (this.bytes * this.pricePerKB.value) / 1000, + this.chain.systemToken?.symbol || defaultSymbol + ) ); public bytesToBuy: number = $derived( @@ -32,11 +35,14 @@ export class BuyRAMState { ); public fee: Asset = $derived( - Asset.from(this.bytesValue.value * 0.005, this.chain.systemToken.symbol) + Asset.from(this.bytesValue.value * 0.005, this.chain.systemToken?.symbol || defaultSymbol) ); public bytesCost: Asset = $derived( - Asset.fromUnits(this.bytesValue.units.adding(this.fee.units), this.chain.systemToken.symbol) + Asset.fromUnits( + this.bytesValue.units.adding(this.fee.units), + this.chain.systemToken?.symbol || defaultSymbol + ) ); public valid: boolean = $derived( @@ -61,7 +67,7 @@ export class BuyRAMState { reset() { this.bytes = undefined; - this.tokens = Asset.fromUnits(0, this.chain.systemToken.symbol); + this.tokens = Asset.fromUnits(0, this.chain.systemToken?.symbol || defaultSymbol); } toJSON() { diff --git a/src/routes/[network]/(account)/ram/sell/+layout.svelte b/src/routes/[network]/(account)/ram/sell/+layout.svelte index 173f8e57..d51c42cb 100644 --- a/src/routes/[network]/(account)/ram/sell/+layout.svelte +++ b/src/routes/[network]/(account)/ram/sell/+layout.svelte @@ -10,7 +10,7 @@ return [ { href: `/${network}/ram/sell/tokens`, - text: String(data.network.chain.systemToken.symbol.code) + text: String(data.network.chain.systemToken?.symbol.code) }, { href: `/${network}/ram/sell/bytes`, text: 'Bytes' } ]; diff --git a/src/routes/[network]/(account)/ram/sell/state.svelte.ts b/src/routes/[network]/(account)/ram/sell/state.svelte.ts index d865e844..66a8a791 100644 --- a/src/routes/[network]/(account)/ram/sell/state.svelte.ts +++ b/src/routes/[network]/(account)/ram/sell/state.svelte.ts @@ -30,18 +30,21 @@ export class SellRAMState { public bytesValue: Asset = $derived( this.format === 'units' && this.bytes !== undefined - ? Asset.from((this.bytes * this.pricePerKB.value) / 1000, this.chain.systemToken.symbol) + ? Asset.from( + (this.bytes * this.pricePerKB.value) / 1000, + this.chain.systemToken?.symbol || defaultSymbol + ) : this.tokens ); public fee: Asset = $derived( - Asset.from(this.bytesValue.value * 0.005, this.chain.systemToken.symbol) + Asset.from(this.bytesValue.value * 0.005, this.chain.systemToken?.symbol || defaultSymbol) ); public expectedToReceive: Asset = $derived( Asset.fromUnits( this.bytesValue.units.subtracting(this.fee.units), - this.chain.systemToken.symbol + this.chain.systemToken?.symbol || defaultSymbol ) ); @@ -70,7 +73,7 @@ export class SellRAMState { reset() { this.bytes = undefined; - this.tokens = Asset.fromUnits(0, this.chain.systemToken.symbol); + this.tokens = Asset.fromUnits(0, this.chain.systemToken?.symbol || defaultSymbol); } toJSON() {