@pezkuwi/extension-base 0.62.8
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/README.md +12 -0
- package/build/background/RequestBytesSign.d.ts +12 -0
- package/build/background/RequestBytesSign.js +15 -0
- package/build/background/RequestExtrinsicSign.d.ts +12 -0
- package/build/background/RequestExtrinsicSign.js +14 -0
- package/build/background/handlers/Extension.d.ts +49 -0
- package/build/background/handlers/Extension.js +645 -0
- package/build/background/handlers/State.d.ts +96 -0
- package/build/background/handlers/State.js +732 -0
- package/build/background/handlers/Tabs.d.ts +25 -0
- package/build/background/handlers/Tabs.js +313 -0
- package/build/background/handlers/helpers.d.ts +1 -0
- package/build/background/handlers/helpers.js +13 -0
- package/build/background/handlers/index.d.ts +3 -0
- package/build/background/handlers/index.js +45 -0
- package/build/background/handlers/subscriptions.d.ts +3 -0
- package/build/background/handlers/subscriptions.js +22 -0
- package/build/background/index.d.ts +1 -0
- package/build/background/index.js +3 -0
- package/build/background/types.d.ts +343 -0
- package/build/background/types.js +3 -0
- package/build/bundle.d.ts +1 -0
- package/build/bundle.js +3 -0
- package/build/defaults.d.ts +9 -0
- package/build/defaults.js +17 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +5 -0
- package/build/packageDetect.d.ts +1 -0
- package/build/packageDetect.js +10 -0
- package/build/packageInfo.d.ts +6 -0
- package/build/packageInfo.js +4 -0
- package/build/page/Accounts.d.ts +7 -0
- package/build/page/Accounts.js +26 -0
- package/build/page/Injected.d.ts +13 -0
- package/build/page/Injected.js +21 -0
- package/build/page/Metadata.d.ts +7 -0
- package/build/page/Metadata.js +17 -0
- package/build/page/PostMessageProvider.d.ts +63 -0
- package/build/page/PostMessageProvider.js +234 -0
- package/build/page/Signer.d.ts +8 -0
- package/build/page/Signer.js +92 -0
- package/build/page/index.d.ts +16 -0
- package/build/page/index.js +102 -0
- package/build/page/types.d.ts +6 -0
- package/build/page/types.js +3 -0
- package/build/stores/Accounts.d.ts +6 -0
- package/build/stores/Accounts.js +83 -0
- package/build/stores/Base.d.ts +9 -0
- package/build/stores/Base.js +250 -0
- package/build/stores/Metadata.d.ts +5 -0
- package/build/stores/Metadata.js +29 -0
- package/build/stores/index.d.ts +2 -0
- package/build/stores/index.js +4 -0
- package/build/types.d.ts +9 -0
- package/build/types.js +3 -0
- package/build/utils/canDerive.d.ts +2 -0
- package/build/utils/canDerive.js +5 -0
- package/build/utils/getId.d.ts +1 -0
- package/build/utils/getId.js +7 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +3 -0
- package/build/utils/portUtils.d.ts +14 -0
- package/build/utils/portUtils.js +106 -0
- package/package.json +45 -0
- package/src/background/RequestBytesSign.ts +28 -0
- package/src/background/RequestExtrinsicSign.ts +22 -0
- package/src/background/handlers/Extension.spec.ts +478 -0
- package/src/background/handlers/Extension.ts +690 -0
- package/src/background/handlers/State.ts +664 -0
- package/src/background/handlers/Tabs.ts +289 -0
- package/src/background/handlers/helpers.ts +14 -0
- package/src/background/handlers/index.ts +60 -0
- package/src/background/handlers/subscriptions.ts +32 -0
- package/src/background/index.ts +4 -0
- package/src/background/types.ts +432 -0
- package/src/bundle.ts +4 -0
- package/src/defaults.ts +26 -0
- package/src/index.ts +7 -0
- package/src/packageDetect.ts +14 -0
- package/src/packageInfo.ts +6 -0
- package/src/page/Accounts.ts +33 -0
- package/src/page/Injected.ts +33 -0
- package/src/page/Metadata.ts +22 -0
- package/src/page/PostMessageProvider.ts +182 -0
- package/src/page/Signer.ts +45 -0
- package/src/page/index.ts +89 -0
- package/src/page/types.ts +10 -0
- package/src/stores/Accounts.ts +28 -0
- package/src/stores/Base.ts +93 -0
- package/src/stores/Metadata.ts +17 -0
- package/src/stores/index.ts +5 -0
- package/src/types.ts +12 -0
- package/src/utils/canDerive.ts +8 -0
- package/src/utils/getId.ts +10 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/portUtils.ts +65 -0
- package/tsconfig.build.json +16 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.spec.json +18 -0
- package/tsconfig.spec.tsbuildinfo +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# @polkadot/extension-base
|
|
2
|
+
|
|
3
|
+
Functions, classes and other utilities used in `@polkadot/extension`. These include:
|
|
4
|
+
- background script handlers,
|
|
5
|
+
- message passing,
|
|
6
|
+
- scripts injected inside pages.
|
|
7
|
+
|
|
8
|
+
They are primarily meant to be used in `@polkadot/extension`, and can be broken without any notice to cater for `@polkadot/extension`'s needs.
|
|
9
|
+
|
|
10
|
+
They are exported here if you wish to use part of them in the development of your
|
|
11
|
+
own extension. Don't forget to add `process.env.EXTENSION_PREFIX` to separate
|
|
12
|
+
ports and stores from the current extension's ones.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { KeyringPair } from '@pezkuwi/keyring/types';
|
|
2
|
+
import type { TypeRegistry } from '@pezkuwi/types';
|
|
3
|
+
import type { SignerPayloadRaw } from '@pezkuwi/types/types';
|
|
4
|
+
import type { HexString } from '@pezkuwi/util/types';
|
|
5
|
+
import type { RequestSign } from './types.js';
|
|
6
|
+
export default class RequestBytesSign implements RequestSign {
|
|
7
|
+
readonly payload: SignerPayloadRaw;
|
|
8
|
+
constructor(payload: SignerPayloadRaw);
|
|
9
|
+
sign(_registry: TypeRegistry, pair: KeyringPair): {
|
|
10
|
+
signature: HexString;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { u8aToHex, u8aWrapBytes } from '@pezkuwi/util';
|
|
4
|
+
var RequestBytesSign = /** @class */ (function () {
|
|
5
|
+
function RequestBytesSign(payload) {
|
|
6
|
+
this.payload = payload;
|
|
7
|
+
}
|
|
8
|
+
RequestBytesSign.prototype.sign = function (_registry, pair) {
|
|
9
|
+
return {
|
|
10
|
+
signature: u8aToHex(pair.sign(u8aWrapBytes(this.payload.data)))
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
return RequestBytesSign;
|
|
14
|
+
}());
|
|
15
|
+
export default RequestBytesSign;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { KeyringPair } from '@pezkuwi/keyring/types';
|
|
2
|
+
import type { TypeRegistry } from '@pezkuwi/types';
|
|
3
|
+
import type { SignerPayloadJSON } from '@pezkuwi/types/types';
|
|
4
|
+
import type { HexString } from '@pezkuwi/util/types';
|
|
5
|
+
import type { RequestSign } from './types.js';
|
|
6
|
+
export default class RequestExtrinsicSign implements RequestSign {
|
|
7
|
+
readonly payload: SignerPayloadJSON;
|
|
8
|
+
constructor(payload: SignerPayloadJSON);
|
|
9
|
+
sign(registry: TypeRegistry, pair: KeyringPair): {
|
|
10
|
+
signature: HexString;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright 2019-2025 @pezkuwi/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
var RequestExtrinsicSign = /** @class */ (function () {
|
|
4
|
+
function RequestExtrinsicSign(payload) {
|
|
5
|
+
this.payload = payload;
|
|
6
|
+
}
|
|
7
|
+
RequestExtrinsicSign.prototype.sign = function (registry, pair) {
|
|
8
|
+
return registry
|
|
9
|
+
.createType('ExtrinsicPayload', this.payload, { version: this.payload.version })
|
|
10
|
+
.sign(pair);
|
|
11
|
+
};
|
|
12
|
+
return RequestExtrinsicSign;
|
|
13
|
+
}());
|
|
14
|
+
export default RequestExtrinsicSign;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { MessageTypes, RequestTypes, ResponseType } from '../types.js';
|
|
2
|
+
import type State from './State.js';
|
|
3
|
+
export default class Extension {
|
|
4
|
+
#private;
|
|
5
|
+
constructor(state: State);
|
|
6
|
+
private transformAccounts;
|
|
7
|
+
private accountsCreateExternal;
|
|
8
|
+
private accountsCreateHardware;
|
|
9
|
+
private accountsCreateSuri;
|
|
10
|
+
private accountsChangePassword;
|
|
11
|
+
private accountsEdit;
|
|
12
|
+
private accountsExport;
|
|
13
|
+
private accountsBatchExport;
|
|
14
|
+
private accountsForget;
|
|
15
|
+
private refreshAccountPasswordCache;
|
|
16
|
+
private accountsShow;
|
|
17
|
+
private accountsTie;
|
|
18
|
+
private accountsValidate;
|
|
19
|
+
private accountsSubscribe;
|
|
20
|
+
private authorizeApprove;
|
|
21
|
+
private authorizeUpdate;
|
|
22
|
+
private getAuthList;
|
|
23
|
+
private authorizeSubscribe;
|
|
24
|
+
private metadataApprove;
|
|
25
|
+
private metadataGet;
|
|
26
|
+
private metadataList;
|
|
27
|
+
private metadataReject;
|
|
28
|
+
private metadataSubscribe;
|
|
29
|
+
private jsonRestore;
|
|
30
|
+
private batchRestore;
|
|
31
|
+
private jsonGetAccountInfo;
|
|
32
|
+
private seedCreate;
|
|
33
|
+
private seedValidate;
|
|
34
|
+
private signingApprovePassword;
|
|
35
|
+
private signingApproveSignature;
|
|
36
|
+
private signingCancel;
|
|
37
|
+
private signingIsLocked;
|
|
38
|
+
private signingSubscribe;
|
|
39
|
+
private windowOpen;
|
|
40
|
+
private derive;
|
|
41
|
+
private derivationValidate;
|
|
42
|
+
private derivationCreate;
|
|
43
|
+
private removeAuthorization;
|
|
44
|
+
private rejectAuthRequest;
|
|
45
|
+
private cancelAuthRequest;
|
|
46
|
+
private updateCurrentTabs;
|
|
47
|
+
private getConnectedTabsUrl;
|
|
48
|
+
handle<TMessageType extends MessageTypes>(id: string, type: TMessageType, request: RequestTypes[TMessageType], port?: chrome.runtime.Port): Promise<ResponseType<TMessageType>>;
|
|
49
|
+
}
|