@polkadot/extension-base 0.42.4 → 0.42.5-11
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/background/RequestBytesSign.cjs +1 -1
- package/background/RequestBytesSign.js +1 -1
- package/background/RequestExtrinsicSign.cjs +1 -1
- package/background/RequestExtrinsicSign.js +1 -1
- package/background/handlers/Extension.cjs +1 -1
- package/background/handlers/Extension.js +1 -1
- package/background/handlers/State.cjs +60 -14
- package/background/handlers/State.js +44 -6
- package/background/handlers/Tabs.cjs +1 -1
- package/background/handlers/Tabs.js +1 -1
- package/background/handlers/helpers.cjs +1 -1
- package/background/handlers/helpers.js +1 -1
- package/background/handlers/index.cjs +1 -1
- package/background/handlers/index.js +1 -1
- package/background/handlers/subscriptions.cjs +1 -1
- package/background/handlers/subscriptions.js +1 -1
- package/bundle.cjs +13 -0
- package/bundle.d.ts +1 -0
- package/bundle.js +3 -0
- package/cjs/dirname.d.ts +8 -0
- package/cjs/dirname.js +8 -0
- package/cjs/package.json +3 -0
- package/defaults.cjs +1 -1
- package/defaults.js +1 -1
- package/detectOther.cjs +17 -0
- package/detectOther.d.ts +5 -0
- package/detectOther.js +6 -0
- package/detectPackage.cjs +16 -0
- package/detectPackage.d.ts +1 -0
- package/detectPackage.js +8 -0
- package/index.cjs +18 -4
- package/index.d.ts +1 -0
- package/index.js +4 -2
- package/package.json +38 -14
- package/packageInfo.cjs +3 -3
- package/packageInfo.js +3 -3
- package/page/Accounts.cjs +1 -1
- package/page/Accounts.js +1 -1
- package/page/Injected.cjs +1 -1
- package/page/Injected.js +1 -1
- package/page/Metadata.cjs +1 -1
- package/page/Metadata.js +1 -1
- package/page/PostMessageProvider.cjs +1 -1
- package/page/PostMessageProvider.js +1 -1
- package/page/Signer.cjs +1 -1
- package/page/Signer.js +1 -1
- package/page/index.cjs +1 -1
- package/page/index.js +1 -1
- package/stores/Accounts.cjs +1 -1
- package/stores/Accounts.js +1 -1
- package/stores/Base.cjs +22 -8
- package/stores/Base.d.ts +1 -0
- package/stores/Base.js +21 -4
- package/stores/Metadata.cjs +1 -1
- package/stores/Metadata.js +1 -1
- package/stores/index.js +1 -1
- package/utils/canDerive.cjs +1 -1
- package/utils/canDerive.js +1 -1
- package/utils/getId.cjs +1 -1
- package/utils/getId.js +1 -1
- package/utils/index.js +1 -1
|
@@ -9,7 +9,7 @@ var _wrapBytes = require("@polkadot/extension-dapp/wrapBytes");
|
|
|
9
9
|
|
|
10
10
|
var _util = require("@polkadot/util");
|
|
11
11
|
|
|
12
|
-
// Copyright 2019-
|
|
12
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
13
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
14
14
|
class RequestBytesSign {
|
|
15
15
|
constructor(payload) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { wrapBytes } from '@polkadot/extension-dapp/wrapBytes';
|
|
4
4
|
import { u8aToHex } from '@polkadot/util';
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
// Copyright 2019-
|
|
8
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
9
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
10
10
|
class RequestExtrinsicSign {
|
|
11
11
|
constructor(payload) {
|
|
@@ -27,7 +27,7 @@ var _helpers = require("./helpers.cjs");
|
|
|
27
27
|
|
|
28
28
|
var _subscriptions = require("./subscriptions.cjs");
|
|
29
29
|
|
|
30
|
-
// Copyright 2019-
|
|
30
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
31
31
|
// SPDX-License-Identifier: Apache-2.0
|
|
32
32
|
const SEED_DEFAULT_LENGTH = 12;
|
|
33
33
|
const SEED_LENGTHS = [12, 15, 18, 21, 24];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
|
|
2
2
|
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
|
-
// Copyright 2019-
|
|
3
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
import { ALLOWED_PATH, PASSWORD_EXPIRY_MS } from '@polkadot/extension-base/defaults';
|
|
6
6
|
import { TypeRegistry } from '@polkadot/types';
|
|
@@ -17,6 +17,8 @@ var _getId = require("@polkadot/extension-base/utils/getId");
|
|
|
17
17
|
|
|
18
18
|
var _extensionChains = require("@polkadot/extension-chains");
|
|
19
19
|
|
|
20
|
+
var _defaults = require("@polkadot/networks/defaults");
|
|
21
|
+
|
|
20
22
|
var _uiSettings = _interopRequireDefault(require("@polkadot/ui-settings"));
|
|
21
23
|
|
|
22
24
|
var _util = require("@polkadot/util");
|
|
@@ -25,7 +27,7 @@ var _index = require("../../stores/index.cjs");
|
|
|
25
27
|
|
|
26
28
|
var _helpers = require("./helpers.cjs");
|
|
27
29
|
|
|
28
|
-
// Copyright 2019-
|
|
30
|
+
// Copyright 2019-2022 @polkadot/extension-bg authors & contributors
|
|
29
31
|
// SPDX-License-Identifier: Apache-2.0
|
|
30
32
|
const NOTIFICATION_URL = chrome.extension.getURL('notification.html');
|
|
31
33
|
const POPUP_WINDOW_OPTS = {
|
|
@@ -53,6 +55,54 @@ exports.NotificationOptions = NotificationOptions;
|
|
|
53
55
|
|
|
54
56
|
const AUTH_URLS_KEY = 'authUrls';
|
|
55
57
|
|
|
58
|
+
function extractMetadata(store) {
|
|
59
|
+
store.allMap(map => {
|
|
60
|
+
const knownEntries = Object.entries(_defaults.knownGenesis);
|
|
61
|
+
const defs = {};
|
|
62
|
+
const removals = [];
|
|
63
|
+
Object.entries(map).forEach(_ref => {
|
|
64
|
+
let [key, def] = _ref;
|
|
65
|
+
const entry = knownEntries.find(_ref2 => {
|
|
66
|
+
let [, hashes] = _ref2;
|
|
67
|
+
return hashes.includes(def.genesisHash);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (entry) {
|
|
71
|
+
const [name, hashes] = entry;
|
|
72
|
+
const index = hashes.indexOf(def.genesisHash); // flatten the known metadata based on the genesis index
|
|
73
|
+
// (lower is better/newer)
|
|
74
|
+
|
|
75
|
+
if (!defs[name] || defs[name].index > index) {
|
|
76
|
+
if (defs[name]) {
|
|
77
|
+
// remove the old version of the metadata
|
|
78
|
+
removals.push(defs[name].key);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
defs[name] = {
|
|
82
|
+
def,
|
|
83
|
+
index,
|
|
84
|
+
key
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
} else {
|
|
88
|
+
// this is not a known entry, so we will just apply it
|
|
89
|
+
defs[key] = {
|
|
90
|
+
def,
|
|
91
|
+
index: 0,
|
|
92
|
+
key
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
removals.forEach(key => store.remove(key));
|
|
97
|
+
Object.values(defs).forEach(_ref3 => {
|
|
98
|
+
let {
|
|
99
|
+
def
|
|
100
|
+
} = _ref3;
|
|
101
|
+
return (0, _extensionChains.addMetadata)(def);
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
56
106
|
var _authUrls = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("authUrls");
|
|
57
107
|
|
|
58
108
|
var _authRequests = /*#__PURE__*/(0, _classPrivateFieldLooseKey2.default)("authRequests");
|
|
@@ -189,11 +239,7 @@ class State {
|
|
|
189
239
|
};
|
|
190
240
|
|
|
191
241
|
(0, _classPrivateFieldLooseBase2.default)(this, _providers)[_providers] = providers;
|
|
192
|
-
|
|
193
|
-
(0, _classPrivateFieldLooseBase2.default)(this, _metaStore)[_metaStore].all((_key, def) => {
|
|
194
|
-
(0, _extensionChains.addMetadata)(def);
|
|
195
|
-
}); // retrieve previously set authorizations
|
|
196
|
-
|
|
242
|
+
extractMetadata((0, _classPrivateFieldLooseBase2.default)(this, _metaStore)[_metaStore]); // retrieve previously set authorizations
|
|
197
243
|
|
|
198
244
|
const authString = localStorage.getItem(AUTH_URLS_KEY) || '{}';
|
|
199
245
|
const previousAuth = JSON.parse(authString);
|
|
@@ -217,12 +263,12 @@ class State {
|
|
|
217
263
|
}
|
|
218
264
|
|
|
219
265
|
get allAuthRequests() {
|
|
220
|
-
return Object.values((0, _classPrivateFieldLooseBase2.default)(this, _authRequests)[_authRequests]).map(
|
|
266
|
+
return Object.values((0, _classPrivateFieldLooseBase2.default)(this, _authRequests)[_authRequests]).map(_ref4 => {
|
|
221
267
|
let {
|
|
222
268
|
id,
|
|
223
269
|
request,
|
|
224
270
|
url
|
|
225
|
-
} =
|
|
271
|
+
} = _ref4;
|
|
226
272
|
return {
|
|
227
273
|
id,
|
|
228
274
|
request,
|
|
@@ -232,12 +278,12 @@ class State {
|
|
|
232
278
|
}
|
|
233
279
|
|
|
234
280
|
get allMetaRequests() {
|
|
235
|
-
return Object.values((0, _classPrivateFieldLooseBase2.default)(this, _metaRequests)[_metaRequests]).map(
|
|
281
|
+
return Object.values((0, _classPrivateFieldLooseBase2.default)(this, _metaRequests)[_metaRequests]).map(_ref5 => {
|
|
236
282
|
let {
|
|
237
283
|
id,
|
|
238
284
|
request,
|
|
239
285
|
url
|
|
240
|
-
} =
|
|
286
|
+
} = _ref5;
|
|
241
287
|
return {
|
|
242
288
|
id,
|
|
243
289
|
request,
|
|
@@ -247,13 +293,13 @@ class State {
|
|
|
247
293
|
}
|
|
248
294
|
|
|
249
295
|
get allSignRequests() {
|
|
250
|
-
return Object.values((0, _classPrivateFieldLooseBase2.default)(this, _signRequests)[_signRequests]).map(
|
|
296
|
+
return Object.values((0, _classPrivateFieldLooseBase2.default)(this, _signRequests)[_signRequests]).map(_ref6 => {
|
|
251
297
|
let {
|
|
252
298
|
account,
|
|
253
299
|
id,
|
|
254
300
|
request,
|
|
255
301
|
url
|
|
256
|
-
} =
|
|
302
|
+
} = _ref6;
|
|
257
303
|
return {
|
|
258
304
|
account,
|
|
259
305
|
id,
|
|
@@ -426,12 +472,12 @@ class State {
|
|
|
426
472
|
return Promise.resolve((0, _classPrivateFieldLooseBase2.default)(this, _providers)[_providers][key].meta);
|
|
427
473
|
}
|
|
428
474
|
|
|
429
|
-
rpcSubscribe(
|
|
475
|
+
rpcSubscribe(_ref7, cb, port) {
|
|
430
476
|
let {
|
|
431
477
|
method,
|
|
432
478
|
params,
|
|
433
479
|
type
|
|
434
|
-
} =
|
|
480
|
+
} = _ref7;
|
|
435
481
|
|
|
436
482
|
const provider = (0, _classPrivateFieldLooseBase2.default)(this, _injectedProviders)[_injectedProviders].get(port);
|
|
437
483
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
|
|
2
2
|
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
|
-
// Copyright 2019-
|
|
3
|
+
// Copyright 2019-2022 @polkadot/extension-bg authors & contributors
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
import { BehaviorSubject } from 'rxjs';
|
|
6
6
|
import { getId } from '@polkadot/extension-base/utils/getId';
|
|
7
7
|
import { addMetadata, knownMetadata } from '@polkadot/extension-chains';
|
|
8
|
+
import { knownGenesis } from '@polkadot/networks/defaults';
|
|
8
9
|
import settings from '@polkadot/ui-settings';
|
|
9
10
|
import { assert } from '@polkadot/util';
|
|
10
11
|
import { MetadataStore } from "../../stores/index.js";
|
|
@@ -34,6 +35,47 @@ export let NotificationOptions;
|
|
|
34
35
|
|
|
35
36
|
const AUTH_URLS_KEY = 'authUrls';
|
|
36
37
|
|
|
38
|
+
function extractMetadata(store) {
|
|
39
|
+
store.allMap(map => {
|
|
40
|
+
const knownEntries = Object.entries(knownGenesis);
|
|
41
|
+
const defs = {};
|
|
42
|
+
const removals = [];
|
|
43
|
+
Object.entries(map).forEach(([key, def]) => {
|
|
44
|
+
const entry = knownEntries.find(([, hashes]) => hashes.includes(def.genesisHash));
|
|
45
|
+
|
|
46
|
+
if (entry) {
|
|
47
|
+
const [name, hashes] = entry;
|
|
48
|
+
const index = hashes.indexOf(def.genesisHash); // flatten the known metadata based on the genesis index
|
|
49
|
+
// (lower is better/newer)
|
|
50
|
+
|
|
51
|
+
if (!defs[name] || defs[name].index > index) {
|
|
52
|
+
if (defs[name]) {
|
|
53
|
+
// remove the old version of the metadata
|
|
54
|
+
removals.push(defs[name].key);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
defs[name] = {
|
|
58
|
+
def,
|
|
59
|
+
index,
|
|
60
|
+
key
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
// this is not a known entry, so we will just apply it
|
|
65
|
+
defs[key] = {
|
|
66
|
+
def,
|
|
67
|
+
index: 0,
|
|
68
|
+
key
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
removals.forEach(key => store.remove(key));
|
|
73
|
+
Object.values(defs).forEach(({
|
|
74
|
+
def
|
|
75
|
+
}) => addMetadata(def));
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
37
79
|
var _authUrls = /*#__PURE__*/_classPrivateFieldLooseKey("authUrls");
|
|
38
80
|
|
|
39
81
|
var _authRequests = /*#__PURE__*/_classPrivateFieldLooseKey("authRequests");
|
|
@@ -169,11 +211,7 @@ export default class State {
|
|
|
169
211
|
};
|
|
170
212
|
|
|
171
213
|
_classPrivateFieldLooseBase(this, _providers)[_providers] = providers;
|
|
172
|
-
|
|
173
|
-
_classPrivateFieldLooseBase(this, _metaStore)[_metaStore].all((_key, def) => {
|
|
174
|
-
addMetadata(def);
|
|
175
|
-
}); // retrieve previously set authorizations
|
|
176
|
-
|
|
214
|
+
extractMetadata(_classPrivateFieldLooseBase(this, _metaStore)[_metaStore]); // retrieve previously set authorizations
|
|
177
215
|
|
|
178
216
|
const authString = localStorage.getItem(AUTH_URLS_KEY) || '{}';
|
|
179
217
|
const previousAuth = JSON.parse(authString);
|
|
@@ -31,7 +31,7 @@ var _helpers = require("./helpers.cjs");
|
|
|
31
31
|
|
|
32
32
|
var _subscriptions = require("./subscriptions.cjs");
|
|
33
33
|
|
|
34
|
-
// Copyright 2019-
|
|
34
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
35
35
|
// SPDX-License-Identifier: Apache-2.0
|
|
36
36
|
function transformAccounts(accounts) {
|
|
37
37
|
let anyType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
|
|
2
2
|
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
|
-
// Copyright 2019-
|
|
3
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
import { PHISHING_PAGE_REDIRECT } from '@polkadot/extension-base/defaults';
|
|
6
6
|
import { canDerive } from '@polkadot/extension-base/utils';
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.withErrorLog = withErrorLog;
|
|
7
7
|
|
|
8
|
-
// Copyright 2019-
|
|
8
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
9
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
10
10
|
function withErrorLog(fn) {
|
|
11
11
|
try {
|
|
@@ -17,7 +17,7 @@ var _State = _interopRequireDefault(require("./State.cjs"));
|
|
|
17
17
|
|
|
18
18
|
var _Tabs = _interopRequireDefault(require("./Tabs.cjs"));
|
|
19
19
|
|
|
20
|
-
// Copyright 2019-
|
|
20
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
21
21
|
// SPDX-License-Identifier: Apache-2.0
|
|
22
22
|
const state = new _State.default();
|
|
23
23
|
const extension = new _Extension.default(state);
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createSubscription = createSubscription;
|
|
7
7
|
exports.unsubscribe = unsubscribe;
|
|
8
|
-
// Copyright 2019-
|
|
8
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
9
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
10
10
|
const subscriptions = {}; // return a subscription callback, that will send the data to the caller via the port
|
|
11
11
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
const subscriptions = {}; // return a subscription callback, that will send the data to the caller via the port
|
|
4
4
|
|
package/bundle.cjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "packageInfo", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _packageInfo.packageInfo;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _packageInfo = require("./packageInfo.cjs");
|
package/bundle.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { packageInfo } from './packageInfo';
|
package/bundle.js
ADDED
package/cjs/dirname.d.ts
ADDED
package/cjs/dirname.js
ADDED
package/cjs/package.json
ADDED
package/defaults.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PORT_EXTENSION = exports.PORT_CONTENT = exports.PHISHING_PAGE_REDIRECT = exports.PASSWORD_EXPIRY_MS = exports.PASSWORD_EXPIRY_MIN = exports.MESSAGE_ORIGIN_PAGE = exports.MESSAGE_ORIGIN_CONTENT = exports.EXTENSION_PREFIX = exports.ALLOWED_PATH = void 0;
|
|
7
|
-
// Copyright 2019-
|
|
7
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
const ALLOWED_PATH = ['/', '/account/import-ledger', '/account/restore-json'];
|
|
10
10
|
exports.ALLOWED_PATH = ALLOWED_PATH;
|
package/defaults.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
const ALLOWED_PATH = ['/', '/account/import-ledger', '/account/restore-json'];
|
|
4
4
|
const PHISHING_PAGE_REDIRECT = '/phishing-page-detected';
|
package/detectOther.cjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _packageInfo = require("@polkadot/extension-chains/packageInfo");
|
|
9
|
+
|
|
10
|
+
var _packageInfo2 = require("@polkadot/extension-dapp/packageInfo");
|
|
11
|
+
|
|
12
|
+
var _packageInfo3 = require("@polkadot/extension-inject/packageInfo");
|
|
13
|
+
|
|
14
|
+
// Copyright 2017-2022 @polkadot/extension-base authors & contributors
|
|
15
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
16
|
+
var _default = [_packageInfo.packageInfo, _packageInfo2.packageInfo, _packageInfo3.packageInfo];
|
|
17
|
+
exports.default = _default;
|
package/detectOther.d.ts
ADDED
package/detectOther.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Copyright 2017-2022 @polkadot/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { packageInfo as chainsInfo } from '@polkadot/extension-chains/packageInfo';
|
|
4
|
+
import { packageInfo as dappInfo } from '@polkadot/extension-dapp/packageInfo';
|
|
5
|
+
import { packageInfo as injectInfo } from '@polkadot/extension-inject/packageInfo';
|
|
6
|
+
export default [chainsInfo, dappInfo, injectInfo];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _util = require("@polkadot/util");
|
|
6
|
+
|
|
7
|
+
var _dirname = _interopRequireDefault(require("./cjs/dirname"));
|
|
8
|
+
|
|
9
|
+
var _detectOther = _interopRequireDefault(require("./detectOther.cjs"));
|
|
10
|
+
|
|
11
|
+
var _packageInfo = require("./packageInfo.cjs");
|
|
12
|
+
|
|
13
|
+
// Copyright 2017-2022 @polkadot/extension-base authors & contributors
|
|
14
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
15
|
+
// Do not edit, auto-generated by @polkadot/dev
|
|
16
|
+
(0, _util.detectPackage)(_packageInfo.packageInfo, _dirname.default, _detectOther.default);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/detectPackage.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright 2017-2022 @polkadot/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Do not edit, auto-generated by @polkadot/dev
|
|
4
|
+
import { detectPackage } from '@polkadot/util';
|
|
5
|
+
import dirname from "./cjs/dirname.js";
|
|
6
|
+
import others from "./detectOther.js";
|
|
7
|
+
import { packageInfo } from "./packageInfo.js";
|
|
8
|
+
detectPackage(packageInfo, dirname, others);
|
package/index.cjs
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _bundle = require("./bundle.cjs");
|
|
8
|
+
|
|
9
|
+
Object.keys(_bundle).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _bundle[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _bundle[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
package/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './bundle';
|
package/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
//
|
|
3
|
+
// Since we inject into pages, we skip this
|
|
4
|
+
// import './detectPackage';
|
|
5
|
+
export * from "./bundle.js";
|
package/package.json
CHANGED
|
@@ -12,29 +12,33 @@
|
|
|
12
12
|
"type": "git",
|
|
13
13
|
"url": "https://github.com/polkadot-js/extension.git"
|
|
14
14
|
},
|
|
15
|
-
"sideEffects":
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"./detectPackage.js",
|
|
17
|
+
"./detectPackage.cjs"
|
|
18
|
+
],
|
|
16
19
|
"type": "module",
|
|
17
|
-
"version": "0.42.
|
|
20
|
+
"version": "0.42.5-11",
|
|
18
21
|
"main": "index.js",
|
|
19
22
|
"dependencies": {
|
|
20
|
-
"@babel/runtime": "^7.16.
|
|
21
|
-
"@polkadot/api": "^7.1.1",
|
|
22
|
-
"@polkadot/extension-chains": "^0.42.
|
|
23
|
-
"@polkadot/extension-dapp": "^0.42.
|
|
24
|
-
"@polkadot/extension-inject": "^0.42.
|
|
23
|
+
"@babel/runtime": "^7.16.7",
|
|
24
|
+
"@polkadot/api": "^7.1.2-1",
|
|
25
|
+
"@polkadot/extension-chains": "^0.42.5-11",
|
|
26
|
+
"@polkadot/extension-dapp": "^0.42.5-11",
|
|
27
|
+
"@polkadot/extension-inject": "^0.42.5-11",
|
|
25
28
|
"@polkadot/keyring": "^8.2.2",
|
|
26
|
-
"@polkadot/
|
|
27
|
-
"@polkadot/
|
|
28
|
-
"@polkadot/
|
|
29
|
-
"@polkadot/
|
|
30
|
-
"@polkadot/ui-
|
|
29
|
+
"@polkadot/networks": "^8.2.2",
|
|
30
|
+
"@polkadot/phishing": "^0.7.3",
|
|
31
|
+
"@polkadot/rpc-provider": "^7.1.2-1",
|
|
32
|
+
"@polkadot/types": "^7.1.2-1",
|
|
33
|
+
"@polkadot/ui-keyring": "^0.87.8-2",
|
|
34
|
+
"@polkadot/ui-settings": "^0.87.8-2",
|
|
31
35
|
"@polkadot/util": "^8.2.2",
|
|
32
36
|
"@polkadot/util-crypto": "^8.2.2",
|
|
33
37
|
"eventemitter3": "^4.0.7",
|
|
34
|
-
"rxjs": "^7.
|
|
38
|
+
"rxjs": "^7.5.1"
|
|
35
39
|
},
|
|
36
40
|
"devDependencies": {
|
|
37
|
-
"@polkadot/extension-mocks": "^0.42.
|
|
41
|
+
"@polkadot/extension-mocks": "^0.42.5-11"
|
|
38
42
|
},
|
|
39
43
|
"exports": {
|
|
40
44
|
".": {
|
|
@@ -87,11 +91,31 @@
|
|
|
87
91
|
"require": "./background/types.cjs",
|
|
88
92
|
"default": "./background/types.js"
|
|
89
93
|
},
|
|
94
|
+
"./bundle": {
|
|
95
|
+
"types": "./bundle.d.ts",
|
|
96
|
+
"require": "./bundle.cjs",
|
|
97
|
+
"default": "./bundle.js"
|
|
98
|
+
},
|
|
99
|
+
"./cjs/dirname": {
|
|
100
|
+
"types": "./cjs/dirname.d.ts",
|
|
101
|
+
"default": "./cjs/dirname.js"
|
|
102
|
+
},
|
|
103
|
+
"./cjs/package.json": "./cjs/package.json",
|
|
90
104
|
"./defaults": {
|
|
91
105
|
"types": "./defaults.d.ts",
|
|
92
106
|
"require": "./defaults.cjs",
|
|
93
107
|
"default": "./defaults.js"
|
|
94
108
|
},
|
|
109
|
+
"./detectOther": {
|
|
110
|
+
"types": "./detectOther.d.ts",
|
|
111
|
+
"require": "./detectOther.cjs",
|
|
112
|
+
"default": "./detectOther.js"
|
|
113
|
+
},
|
|
114
|
+
"./detectPackage": {
|
|
115
|
+
"types": "./detectPackage.d.ts",
|
|
116
|
+
"require": "./detectPackage.cjs",
|
|
117
|
+
"default": "./detectPackage.js"
|
|
118
|
+
},
|
|
95
119
|
"./package.json": "./package.json",
|
|
96
120
|
"./packageInfo": {
|
|
97
121
|
"types": "./packageInfo.d.ts",
|
package/packageInfo.cjs
CHANGED
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.packageInfo = void 0;
|
|
7
|
-
// Copyright 2017-
|
|
7
|
+
// Copyright 2017-2022 @polkadot/extension-base authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
-
//
|
|
9
|
+
// Do not edit, auto-generated by @polkadot/dev
|
|
10
10
|
const packageInfo = {
|
|
11
11
|
name: '@polkadot/extension-base',
|
|
12
|
-
version: '0.42.
|
|
12
|
+
version: '0.42.5-11'
|
|
13
13
|
};
|
|
14
14
|
exports.packageInfo = packageInfo;
|
package/packageInfo.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright 2017-
|
|
1
|
+
// Copyright 2017-2022 @polkadot/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
//
|
|
3
|
+
// Do not edit, auto-generated by @polkadot/dev
|
|
4
4
|
export const packageInfo = {
|
|
5
5
|
name: '@polkadot/extension-base',
|
|
6
|
-
version: '0.42.
|
|
6
|
+
version: '0.42.5-11'
|
|
7
7
|
};
|
package/page/Accounts.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
// Copyright 2019-
|
|
7
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
// External to class, this.# is not private enough (yet)
|
|
10
10
|
let sendRequest;
|
package/page/Accounts.js
CHANGED
package/page/Injected.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var _PostMessageProvider = _interopRequireDefault(require("./PostMessageProvider
|
|
|
15
15
|
|
|
16
16
|
var _Signer = _interopRequireDefault(require("./Signer.cjs"));
|
|
17
17
|
|
|
18
|
-
// Copyright 2019-
|
|
18
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
19
19
|
// SPDX-License-Identifier: Apache-2.0
|
|
20
20
|
class _default {
|
|
21
21
|
constructor(sendRequest) {
|
package/page/Injected.js
CHANGED
package/page/Metadata.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
// Copyright 2019-
|
|
7
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
// External to class, this.# is not private enough (yet)
|
|
10
10
|
let sendRequest;
|
package/page/Metadata.js
CHANGED
|
@@ -15,7 +15,7 @@ var _eventemitter2 = _interopRequireDefault(require("eventemitter3"));
|
|
|
15
15
|
|
|
16
16
|
var _util = require("@polkadot/util");
|
|
17
17
|
|
|
18
|
-
// Copyright 2019-
|
|
18
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
19
19
|
// SPDX-License-Identifier: Apache-2.0
|
|
20
20
|
const l = (0, _util.logger)('PostMessageProvider');
|
|
21
21
|
// External to class, this.# is not private enough (yet)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
|
|
2
2
|
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
|
-
// Copyright 2019-
|
|
3
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
4
4
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
import EventEmitter from 'eventemitter3';
|
|
6
6
|
import { isUndefined, logger } from '@polkadot/util';
|
package/page/Signer.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
// Copyright 2019-
|
|
7
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
// External to class, this.# is not private enough (yet)
|
|
10
10
|
let sendRequest;
|
package/page/Signer.js
CHANGED
package/page/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@ var _getId = require("../utils/getId.cjs");
|
|
|
16
16
|
|
|
17
17
|
var _Injected = _interopRequireDefault(require("./Injected.cjs"));
|
|
18
18
|
|
|
19
|
-
// Copyright 2019-
|
|
19
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
20
20
|
// SPDX-License-Identifier: Apache-2.0
|
|
21
21
|
const handlers = {}; // a generic message sender that creates an event, returning a promise that will
|
|
22
22
|
// resolve once the event is resolved (by the response listener just below this)
|
package/page/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { MESSAGE_ORIGIN_PAGE } from "../defaults.js";
|
|
4
4
|
import { getId } from "../utils/getId.js";
|
package/stores/Accounts.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var _defaults = require("../defaults.cjs");
|
|
|
11
11
|
|
|
12
12
|
var _Base = _interopRequireDefault(require("./Base.cjs"));
|
|
13
13
|
|
|
14
|
-
// Copyright 2019-
|
|
14
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
15
15
|
// SPDX-License-Identifier: Apache-2.0
|
|
16
16
|
class AccountsStore extends _Base.default {
|
|
17
17
|
constructor() {
|
package/stores/Accounts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { EXTENSION_PREFIX } from "../defaults.js";
|
|
4
4
|
import BaseStore from "./Base.js";
|
package/stores/Base.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var _classPrivateFieldLooseBase2 = _interopRequireDefault(require("@babel/runtim
|
|
|
11
11
|
|
|
12
12
|
var _classPrivateFieldLooseKey2 = _interopRequireDefault(require("@babel/runtime/helpers/classPrivateFieldLooseKey"));
|
|
13
13
|
|
|
14
|
-
// Copyright 2019-
|
|
14
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
15
15
|
// SPDX-License-Identifier: Apache-2.0
|
|
16
16
|
const lastError = type => {
|
|
17
17
|
const error = chrome.runtime.lastError;
|
|
@@ -33,15 +33,29 @@ class BaseStore {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
all(update) {
|
|
36
|
+
this.allMap(map => {
|
|
37
|
+
Object.entries(map).forEach(_ref => {
|
|
38
|
+
let [key, value] = _ref;
|
|
39
|
+
update(key, value);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
allMap(update) {
|
|
36
45
|
chrome.storage.local.get(null, result => {
|
|
37
46
|
lastError('all');
|
|
38
|
-
Object.entries(result)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
const entries = Object.entries(result);
|
|
48
|
+
const map = {};
|
|
49
|
+
|
|
50
|
+
for (let i = 0; i < entries.length; i++) {
|
|
51
|
+
const [key, value] = entries[i];
|
|
52
|
+
|
|
53
|
+
if (key.startsWith((0, _classPrivateFieldLooseBase2.default)(this, _prefix)[_prefix])) {
|
|
54
|
+
map[key.replace((0, _classPrivateFieldLooseBase2.default)(this, _prefix)[_prefix], '')] = value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
update(map);
|
|
45
59
|
});
|
|
46
60
|
}
|
|
47
61
|
|
package/stores/Base.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export default abstract class BaseStore<T> {
|
|
|
2
2
|
#private;
|
|
3
3
|
constructor(prefix: string | null);
|
|
4
4
|
all(update: (key: string, value: T) => void): void;
|
|
5
|
+
allMap(update: (value: Record<string, T>) => void): void;
|
|
5
6
|
get(_key: string, update: (value: T) => void): void;
|
|
6
7
|
remove(_key: string, update?: () => void): void;
|
|
7
8
|
set(_key: string, value: T, update?: () => void): void;
|
package/stores/Base.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _classPrivateFieldLooseBase from "@babel/runtime/helpers/esm/classPrivateFieldLooseBase";
|
|
2
2
|
import _classPrivateFieldLooseKey from "@babel/runtime/helpers/esm/classPrivateFieldLooseKey";
|
|
3
3
|
|
|
4
|
-
// Copyright 2019-
|
|
4
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
5
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
6
6
|
const lastError = type => {
|
|
7
7
|
const error = chrome.runtime.lastError;
|
|
@@ -23,11 +23,28 @@ export default class BaseStore {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
all(update) {
|
|
26
|
+
this.allMap(map => {
|
|
27
|
+
Object.entries(map).forEach(([key, value]) => {
|
|
28
|
+
update(key, value);
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
allMap(update) {
|
|
26
34
|
chrome.storage.local.get(null, result => {
|
|
27
35
|
lastError('all');
|
|
28
|
-
Object.entries(result)
|
|
29
|
-
|
|
30
|
-
|
|
36
|
+
const entries = Object.entries(result);
|
|
37
|
+
const map = {};
|
|
38
|
+
|
|
39
|
+
for (let i = 0; i < entries.length; i++) {
|
|
40
|
+
const [key, value] = entries[i];
|
|
41
|
+
|
|
42
|
+
if (key.startsWith(_classPrivateFieldLooseBase(this, _prefix)[_prefix])) {
|
|
43
|
+
map[key.replace(_classPrivateFieldLooseBase(this, _prefix)[_prefix], '')] = value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
update(map);
|
|
31
48
|
});
|
|
32
49
|
}
|
|
33
50
|
|
package/stores/Metadata.cjs
CHANGED
|
@@ -11,7 +11,7 @@ var _defaults = require("../defaults.cjs");
|
|
|
11
11
|
|
|
12
12
|
var _Base = _interopRequireDefault(require("./Base.cjs"));
|
|
13
13
|
|
|
14
|
-
// Copyright 2019-
|
|
14
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
15
15
|
// SPDX-License-Identifier: Apache-2.0
|
|
16
16
|
class MetadataStore extends _Base.default {
|
|
17
17
|
constructor() {
|
package/stores/Metadata.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { EXTENSION_PREFIX } from "../defaults.js";
|
|
4
4
|
import BaseStore from "./Base.js";
|
package/stores/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension-base authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export { default as AccountsStore } from "./Accounts.js";
|
|
4
4
|
export { default as MetadataStore } from "./Metadata.js";
|
package/utils/canDerive.cjs
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.canDerive = canDerive;
|
|
7
7
|
|
|
8
|
-
// Copyright 2019-
|
|
8
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
9
9
|
// SPDX-License-Identifier: Apache-2.0
|
|
10
10
|
function canDerive(type) {
|
|
11
11
|
return !!type && ['ed25519', 'sr25519', 'ecdsa', 'ethereum'].includes(type);
|
package/utils/canDerive.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright 2019-
|
|
1
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export function canDerive(type) {
|
|
4
4
|
return !!type && ['ed25519', 'sr25519', 'ecdsa', 'ethereum'].includes(type);
|
package/utils/getId.cjs
CHANGED
|
@@ -7,7 +7,7 @@ exports.getId = getId;
|
|
|
7
7
|
|
|
8
8
|
var _defaults = require("../defaults.cjs");
|
|
9
9
|
|
|
10
|
-
// Copyright 2019-
|
|
10
|
+
// Copyright 2019-2022 @polkadot/extension authors & contributors
|
|
11
11
|
// SPDX-License-Identifier: Apache-2.0
|
|
12
12
|
let counter = 0;
|
|
13
13
|
|
package/utils/getId.js
CHANGED
package/utils/index.js
CHANGED