@subwallet/extension-base 0.7.1 → 0.7.2-0wr

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 CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "0.7.1",
20
+ "version": "0.7.2-0wr",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -150,6 +150,11 @@
150
150
  "require": "./cjs/page/types.js",
151
151
  "default": "./page/types.js"
152
152
  },
153
+ "./signers/substrates/KeyringSigner": {
154
+ "types": "./signers/substrates/KeyringSigner.d.ts",
155
+ "require": "./cjs/signers/substrates/KeyringSigner.js",
156
+ "default": "./signers/substrates/KeyringSigner.js"
157
+ },
153
158
  "./signers/substrates/LedgerSigner": {
154
159
  "types": "./signers/substrates/LedgerSigner.d.ts",
155
160
  "require": "./cjs/signers/substrates/LedgerSigner.js",
@@ -224,9 +229,9 @@
224
229
  "@polkadot/ui-settings": "^2.9.10",
225
230
  "@polkadot/util": "^10.1.9",
226
231
  "@polkadot/util-crypto": "^10.1.9",
227
- "@subwallet/extension-chains": "^0.7.1",
228
- "@subwallet/extension-dapp": "^0.7.1",
229
- "@subwallet/extension-inject": "^0.7.1",
232
+ "@subwallet/extension-chains": "^0.7.2-0",
233
+ "@subwallet/extension-dapp": "^0.7.2-0",
234
+ "@subwallet/extension-inject": "^0.7.2-0",
230
235
  "ethereumjs-tx": "^2.1.2",
231
236
  "eventemitter3": "^4.0.7",
232
237
  "rlp": "^3.0.0",
@@ -235,4 +240,4 @@
235
240
  "web3-core": "^1.8.0",
236
241
  "web3-core-helpers": "^1.8.0"
237
242
  }
238
- }
243
+ }
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@subwallet/extension-base',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '0.7.1'
10
+ version: '0.7.2-0'
11
11
  };
@@ -14,6 +14,7 @@ interface SubscriptionHandler {
14
14
  */
15
15
  export default class PostMessageProvider implements InjectedProvider {
16
16
  #private;
17
+ isClonable: boolean;
17
18
  /**
18
19
  * @param {function} sendRequest The function to be called to send requests to the node
19
20
  * @param {function} subscriptionNotificationHandler Channel for receiving subscription messages
@@ -14,6 +14,7 @@ let sendRequest;
14
14
  */
15
15
  export default class PostMessageProvider {
16
16
  #eventemitter;
17
+ isClonable = true;
17
18
 
18
19
  // Whether or not the actual extension background provider is connected
19
20
  #isConnected = false;
@@ -0,0 +1,13 @@
1
+ import type { Signer, SignerResult } from '@polkadot/api/types';
2
+ import type { Registry, SignerPayloadJSON } from '@polkadot/types/types';
3
+ import { KeyringPair } from '@polkadot/keyring/types';
4
+ interface KeyringSignerProps {
5
+ registry: Registry;
6
+ keyPair: KeyringPair;
7
+ }
8
+ export default class KeyringSigner implements Signer {
9
+ #private;
10
+ constructor({ keyPair, registry }: KeyringSignerProps);
11
+ signPayload(payload: SignerPayloadJSON): Promise<SignerResult>;
12
+ }
13
+ export {};
@@ -0,0 +1,27 @@
1
+ // Copyright 2017-2022 @polkadot/react-signer authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ let id = 1;
5
+ export default class KeyringSigner {
6
+ #pair;
7
+ #registry;
8
+ constructor({
9
+ keyPair,
10
+ registry
11
+ }) {
12
+ this.#pair = keyPair;
13
+ this.#registry = registry;
14
+ }
15
+ async signPayload(payload) {
16
+ return new Promise(resolve => {
17
+ const wrapper = this.#registry.createType('ExtrinsicPayload', payload, {
18
+ version: payload.version
19
+ });
20
+ const signature = wrapper.sign(this.#pair).signature;
21
+ resolve({
22
+ id: id++,
23
+ signature: signature
24
+ });
25
+ });
26
+ }
27
+ }
@@ -24,3 +24,9 @@ export interface LedgerState {
24
24
  export interface ExternalState {
25
25
  externalId: string;
26
26
  }
27
+ export declare enum SignerType {
28
+ PASSWORD = "PASSWORD",
29
+ QR = "QR",
30
+ LEDGER = "LEDGER"
31
+ }
32
+ export declare type SignerExternal = SignerType.LEDGER | SignerType.QR;
package/signers/types.js CHANGED
@@ -1 +1,9 @@
1
- export {};
1
+ // Copyright 2019-2022 @polkadot/extension-koni authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export let SignerType;
5
+ (function (SignerType) {
6
+ SignerType["PASSWORD"] = "PASSWORD";
7
+ SignerType["QR"] = "QR";
8
+ SignerType["LEDGER"] = "LEDGER";
9
+ })(SignerType || (SignerType = {}));