From 463af19651fc994546244ff7ec34dccac05636dc Mon Sep 17 00:00:00 2001 From: Elmar Kenigs Date: Tue, 2 Jul 2024 14:58:48 +0300 Subject: [PATCH] Changing symbol to a getter function --- packages/types/src/asset/ChainAsset.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/types/src/asset/ChainAsset.ts b/packages/types/src/asset/ChainAsset.ts index 5d17397a..4933928e 100644 --- a/packages/types/src/asset/ChainAsset.ts +++ b/packages/types/src/asset/ChainAsset.ts @@ -31,7 +31,7 @@ export class ChainAsset extends Asset { readonly min?: bigint; - readonly symbol?: string; + readonly #symbol?: string; constructor({ address, @@ -47,7 +47,7 @@ export class ChainAsset extends Asset { this.decimals = decimals; this.ids = ids; this.min = min ? toBigInt(min, decimals) : undefined; - this.symbol = symbol; + this.#symbol = symbol; } static fromAsset( @@ -60,6 +60,10 @@ export class ChainAsset extends Asset { }); } + get symbol(): string { + return this.#symbol || this.originSymbol; + } + getAssetId(): ChainAssetId { return this.ids?.id ?? this.originSymbol; }