mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-11-27 16:09:55 +00:00
feat: initial Pezkuwi Apps rebrand from polkadot-apps
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
This commit is contained in:
commit
d21bfb1320
5867 files changed
+329019
No files matched your search
@@ -0,0 +1,60 @@
|
||||
// Copyright 2017-2025 @pezkuwi/apps authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
|
||||
import type { KeyringJson } from '@pezkuwi/ui-keyring/types';
|
||||
import type { IpcMainHandler } from './ipc-main-handler.js';
|
||||
|
||||
import electron from 'electron';
|
||||
import path from 'path';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore Warned on by nodenext resolution (while package does build in bundler mode)
|
||||
import { FileStore } from '@pezkuwi/ui-keyring/stores';
|
||||
|
||||
import { registerIpcHandler } from './register-ipc-handler.js';
|
||||
|
||||
const ACCOUNTS_SUBFOLDER = 'pezkuwi-accounts';
|
||||
|
||||
function safeWriteKey (key: string) {
|
||||
return key.replace(/:/g, '-');
|
||||
}
|
||||
|
||||
function safeReadKey (key: string) {
|
||||
return key.replace(/-/g, ':');
|
||||
}
|
||||
|
||||
export const accountStoreIpcHandler = (fileStore: FileStore): IpcMainHandler => ({
|
||||
'account-store-all': () => {
|
||||
let result: { key: string, value: KeyringJson }[] = [];
|
||||
|
||||
const collect = (key: string, value: KeyringJson) => {
|
||||
result = [...result, { key: safeReadKey(key), value }];
|
||||
};
|
||||
|
||||
fileStore.all(collect);
|
||||
|
||||
return result;
|
||||
},
|
||||
'account-store-get': async (key: string) => new Promise((resolve) => {
|
||||
try {
|
||||
fileStore.get(safeWriteKey(key), resolve);
|
||||
} catch {
|
||||
resolve(null);
|
||||
}
|
||||
}),
|
||||
'account-store-remove': async (key: string) => new Promise((resolve) =>
|
||||
fileStore.remove(safeWriteKey(key), () => resolve(undefined))
|
||||
),
|
||||
'account-store-set': async (key: string, value: KeyringJson) => new Promise((resolve) =>
|
||||
fileStore.set(safeWriteKey(key), value, () => resolve(undefined))
|
||||
)
|
||||
});
|
||||
|
||||
export const registerAccountStoreHandlers = (): void => {
|
||||
const defaultStorePath = path.join(electron.app.getPath('userData'), ACCOUNTS_SUBFOLDER);
|
||||
const fileStore = new FileStore(defaultStorePath);
|
||||
|
||||
registerIpcHandler(accountStoreIpcHandler(fileStore));
|
||||
};
|
||||
Reference in new issue
Block a user