diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 9a37e0b57ba5eab060d7344229de4cb87a6efca9..e5ed9c21f7c51c348eb54b2722012832c9491fff 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -74,7 +74,7 @@ export class HomePage extends BasePage<Settings> implements OnInit { await this.settings.ready(); await this.networkService.ready(); - this.currency = this.networkService.currency.name; + this.currency = this.networkService.currency.displayName; // Load account await this.accountService.ready(); diff --git a/src/app/network/currency.model.ts b/src/app/network/currency.model.ts index 4f4f1d1c2bc300e5eff053348dfe8a4f7c42b651..40a888d80f040291bf7cf72f0246351d6fa01cb1 100644 --- a/src/app/network/currency.model.ts +++ b/src/app/network/currency.model.ts @@ -1,7 +1,8 @@ export interface Currency { - name: string; + network: string; + displayName: string; symbol: string; - ss58Format: number; + prefix: number; genesys: string; fees: { identity: number; diff --git a/src/app/network/network.service.ts b/src/app/network/network.service.ts index f46bd80fbdcd1b6d8c64a999c71052ca3c19eae8..a7a6c41ed9346ae19ae4ea68eda9d2a3c8482cf9 100644 --- a/src/app/network/network.service.ts +++ b/src/app/network/network.service.ts @@ -9,9 +9,10 @@ import {Currency} from "@app/network/currency.model"; const WELL_KNOWN_CURRENCIES = Object.freeze({ 'Ğdev': <Partial<Currency>>{ - name: 'Ğdev', - symbol: 'ĞD', - ss58Format: 42, + network: "gdev", + displayName: 'Ğdev', + symbol: 'GD', + prefix: 42, genesys: '0x9f956a87b5568f12c757bb3426897bba6123a1ef311fcd0945bd669fd0e612f8', fees: { identity: 300, // = 3 Gdev @@ -20,9 +21,10 @@ const WELL_KNOWN_CURRENCIES = Object.freeze({ decimals: 2 }, 'Ğ1': <Partial<Currency>>{ - name: 'Ğ1', - symbol: 'Ğ1', - ss58Format: 42, + network: "g1", + displayName: 'Ğ1', + symbol: 'G1', + prefix: 4450, genesys: '0x___TODO___', fees: { identity: 300, // = 3G1 - FIXME @@ -36,7 +38,7 @@ const WELL_KNOWN_CURRENCIES = Object.freeze({ export class NetworkService extends StartableService<ApiPromise> { currency = <Currency>{ - name: null, + displayName: null, symbol: null, genesys: null } @@ -99,8 +101,8 @@ export class NetworkService extends StartableService<ApiPromise> { this.currency = WELL_KNOWN_CURRENCIES[chain]; } } - this.currency.name = this.currency.name || chain; - this.currency.symbol = this.currency.symbol || chainInfo.tokenSymbol.value?.[0].toHuman() || abbreviate(this.currency.name); + this.currency.displayName = this.currency.displayName || chain; + this.currency.symbol = this.currency.symbol || chainInfo.tokenSymbol.value?.[0].toHuman() || abbreviate(this.currency.displayName); this.currency.decimals = this.currency.decimals || +(chainInfo.tokenDecimals.value?.[0].toHuman()) || 0; // Read the genesys block hash diff --git a/src/app/register/register.form.html b/src/app/register/register.form.html index 803b832e5c2a601c4403bb9a4551b060971dd417..8f4ea0b511061da8a62225e4eed22ee580d1f219 100644 --- a/src/app/register/register.form.html +++ b/src/app/register/register.form.html @@ -45,7 +45,7 @@ <!-- explanation 3 --> <ion-slide class="ion-padding"> - <p [innerHTML]="'ACCOUNT.NEW.STEP_3_HELP'|translate: {currency: currency?.name}"></p> + <p [innerHTML]="'ACCOUNT.NEW.STEP_3_HELP'|translate: {currency: currency?.displayName}"></p> </ion-slide> <!-- explanation 4 --> diff --git a/src/app/wallet/account.service.ts b/src/app/wallet/account.service.ts index 19fa4f1b78e934b34f8be835c093cdbe29b9f3a3..90a443391bb2207c68103ea8088bda5e97299e83 100644 --- a/src/app/wallet/account.service.ts +++ b/src/app/wallet/account.service.ts @@ -122,7 +122,7 @@ export class AccountService extends StartableService { // Configure keyring keyring.setDevMode(this._isDevelopment); - keyring.setSS58Format(currency.ss58Format || 42 /* = dev format */); + keyring.setSS58Format(currency.prefix || 42 /* = dev format */); // Restoring accounts await this.restoreAccounts(currency); @@ -145,7 +145,7 @@ export class AccountService extends StartableService { keyring.loadAll({ store: this._store, - ss58Format: currency?.ss58Format, + ss58Format: currency?.prefix, genesisHash: currency?.genesys, isDevelopment: this._isDevelopment });