@w3ux/observables-connect 0.9.39 → 0.9.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/util.d.ts +0 -1
- package/util.js +0 -8
- package/util.js.map +1 -1
package/package.json
CHANGED
package/util.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ export declare const getStatus: (id: string) => ExtensionStatus;
|
|
|
3
3
|
export declare const setStatus: (id: string, status: ExtensionStatus) => void;
|
|
4
4
|
export declare const removeStatus: (id: string) => void;
|
|
5
5
|
export declare const canConnect: (id: string) => boolean;
|
|
6
|
-
export declare const forrmatAccountAddresses: (ss58: number) => void;
|
|
7
6
|
export declare const resetAccounts: () => void;
|
|
8
7
|
export declare const getReconnectSync: () => Sync;
|
|
9
8
|
export declare const setReconnectSync: (sync: Sync) => void;
|
package/util.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { formatAccountSs58 } from '@w3ux/utils';
|
|
2
1
|
import { _extensionAccounts, _extensionsStatus, _hardwareAccounts, _reconnectSync, } from './subjects';
|
|
3
2
|
export const getStatus = (id) => _extensionsStatus.getValue()[id] || undefined;
|
|
4
3
|
export const setStatus = (id, status) => {
|
|
@@ -11,13 +10,6 @@ export const removeStatus = (id) => {
|
|
|
11
10
|
_extensionsStatus.next(rest);
|
|
12
11
|
};
|
|
13
12
|
export const canConnect = (id) => ![undefined, 'connected'].includes(_extensionsStatus.getValue()[id]);
|
|
14
|
-
export const forrmatAccountAddresses = (ss58) => {
|
|
15
|
-
const accounts = [..._extensionAccounts.getValue()].map((account) => ({
|
|
16
|
-
...account,
|
|
17
|
-
address: formatAccountSs58(account.address, ss58),
|
|
18
|
-
}));
|
|
19
|
-
_extensionAccounts.next(accounts);
|
|
20
|
-
};
|
|
21
13
|
export const resetAccounts = () => {
|
|
22
14
|
_extensionAccounts.next([]);
|
|
23
15
|
};
|
package/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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/D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAU,EAAE,EAAE;IAC7C,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAC3B,CAAC,CAAA;AAGD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,EAAE,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAA;AAGrE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAA2B,EAAE,EAAE;IACjE,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;AAClC,CAAC,CAAA","file":"util.js","sourcesContent":["/* @license Copyright 2024 w3ux authors & contributors\nSPDX-License-Identifier: GPL-3.0-only */\n\nimport type { ExtensionStatus, HardwareAccount, Sync } from '@w3ux/types'\nimport {\n _extensionAccounts,\n _extensionsStatus,\n _hardwareAccounts,\n _reconnectSync,\n} from './subjects'\n\n// Gets an extension status\nexport const getStatus = (id: string): ExtensionStatus =>\n _extensionsStatus.getValue()[id] || undefined\n\n// Sets an extension status\nexport const setStatus = (id: string, status: ExtensionStatus) => {\n const newValue = { ..._extensionsStatus.getValue() }\n newValue[id] = status\n _extensionsStatus.next(newValue)\n}\n\n// Removes an extension status\nexport const removeStatus = (id: string) => {\n const { [id]: _, ...rest } = _extensionsStatus.getValue()\n _extensionsStatus.next(rest)\n}\n\n// Whether an extension can be connected\nexport const canConnect = (id: string) =>\n ![undefined, 'connected'].includes(_extensionsStatus.getValue()[id])\n\n// Reset accounts\nexport const resetAccounts = () => {\n _extensionAccounts.next([])\n}\n\n// Get previously enabled extension reconnect sync status\nexport const getReconnectSync = () => _reconnectSync.getValue()\n\n// Set previously enabled extension reconnect sync status\nexport const setReconnectSync = (sync: Sync) => {\n _reconnectSync.next(sync)\n}\n\n// Get hardware accounts\nexport const getHardwareAccounts = () => _hardwareAccounts.getValue()\n\n// Set hardware accounts\nexport const setHardwareAccounts = (accounts: HardwareAccount[]) => {\n _hardwareAccounts.next(accounts)\n}\n"]}
|