@polkadot/extension-dapp 0.40.1 → 0.40.3
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/bundle-polkadot-extension-dapp.js +2 -19
- package/package.json +4 -4
- package/packageInfo.cjs +1 -1
- package/packageInfo.js +1 -1
- package/wrapBytes.cjs +11 -24
- package/wrapBytes.d.ts +5 -3
- package/wrapBytes.js +7 -20
|
@@ -31,25 +31,8 @@ const polkadotExtensionDapp = (function (exports, util, utilCrypto) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
// Copyright 2019-2021 @polkadot/extension authors & contributors
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const POSTFIX = util.u8aToU8a('</Bytes>');
|
|
37
|
-
const WRAP_LEN = PREFIX.length + POSTFIX.length;
|
|
38
|
-
|
|
39
|
-
function isWrapped(u8a, withEthereum) {
|
|
40
|
-
return u8a.length >= WRAP_LEN && util.u8aEq(u8a.subarray(0, PREFIX.length), PREFIX) && util.u8aEq(u8a.slice(-POSTFIX.length), POSTFIX) || withEthereum && u8a.length >= ETHEREUM.length && util.u8aEq(u8a.subarray(0, ETHEREUM.length), ETHEREUM);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function unwrapBytes(bytes) {
|
|
44
|
-
const u8a = util.u8aToU8a(bytes); // we don't want to unwrap Ethereum-style wraps
|
|
45
|
-
|
|
46
|
-
return isWrapped(u8a, false) ? u8a.subarray(PREFIX.length, u8a.length - POSTFIX.length) : u8a;
|
|
47
|
-
}
|
|
48
|
-
function wrapBytes(bytes) {
|
|
49
|
-
const u8a = util.u8aToU8a(bytes); // if Ethereum-wrapping, we don't add our wrapping bytes
|
|
50
|
-
|
|
51
|
-
return isWrapped(u8a, true) ? u8a : util.u8aConcat(PREFIX, u8a, POSTFIX);
|
|
52
|
-
}
|
|
34
|
+
const unwrapBytes = util.u8aUnwrapBytes;
|
|
35
|
+
const wrapBytes = util.u8aWrapBytes;
|
|
53
36
|
|
|
54
37
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
55
38
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polkadot/extension-dapp",
|
|
3
3
|
"description": "Provides an interfaces around the injected globals for ease of access by dapp developers.",
|
|
4
|
-
"version": "0.40.
|
|
4
|
+
"version": "0.40.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Jaco Greeff <jacogr@gmail.com>",
|
|
7
7
|
"license": "Apache-2",
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
"sideEffects": false,
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@babel/runtime": "^7.15.4",
|
|
12
|
-
"@polkadot/extension-inject": "^0.40.
|
|
13
|
-
"@polkadot/util": "^7.
|
|
14
|
-
"@polkadot/util-crypto": "^7.
|
|
12
|
+
"@polkadot/extension-inject": "^0.40.3",
|
|
13
|
+
"@polkadot/util": "^7.4.1",
|
|
14
|
+
"@polkadot/util-crypto": "^7.4.1"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@polkadot/api": "*",
|
package/packageInfo.cjs
CHANGED
package/packageInfo.js
CHANGED
package/wrapBytes.cjs
CHANGED
|
@@ -3,34 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.unwrapBytes =
|
|
7
|
-
exports.wrapBytes = wrapBytes;
|
|
8
|
-
exports.POSTFIX = exports.PREFIX = exports.ETHEREUM = void 0;
|
|
6
|
+
exports.wrapBytes = exports.unwrapBytes = exports.isWrapped = exports.PREFIX = exports.POSTFIX = exports.ETHEREUM = void 0;
|
|
9
7
|
|
|
10
8
|
var _util = require("@polkadot/util");
|
|
11
9
|
|
|
12
10
|
// Copyright 2019-2021 @polkadot/extension authors & contributors
|
|
13
11
|
// SPDX-License-Identifier: Apache-2.0
|
|
14
|
-
const ETHEREUM =
|
|
12
|
+
const ETHEREUM = _util.U8A_WRAP_ETHEREUM;
|
|
15
13
|
exports.ETHEREUM = ETHEREUM;
|
|
16
|
-
const
|
|
17
|
-
exports.PREFIX = PREFIX;
|
|
18
|
-
const POSTFIX = (0, _util.u8aToU8a)('</Bytes>');
|
|
14
|
+
const POSTFIX = _util.U8A_WRAP_POSTFIX;
|
|
19
15
|
exports.POSTFIX = POSTFIX;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return isWrapped(u8a, false) ? u8a.subarray(PREFIX.length, u8a.length - POSTFIX.length) : u8a;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function wrapBytes(bytes) {
|
|
33
|
-
const u8a = (0, _util.u8aToU8a)(bytes); // if Ethereum-wrapping, we don't add our wrapping bytes
|
|
34
|
-
|
|
35
|
-
return isWrapped(u8a, true) ? u8a : (0, _util.u8aConcat)(PREFIX, u8a, POSTFIX);
|
|
36
|
-
}
|
|
16
|
+
const PREFIX = _util.U8A_WRAP_PREFIX;
|
|
17
|
+
exports.PREFIX = PREFIX;
|
|
18
|
+
const isWrapped = _util.u8aIsWrapped;
|
|
19
|
+
exports.isWrapped = isWrapped;
|
|
20
|
+
const unwrapBytes = _util.u8aUnwrapBytes;
|
|
21
|
+
exports.unwrapBytes = unwrapBytes;
|
|
22
|
+
const wrapBytes = _util.u8aWrapBytes;
|
|
23
|
+
exports.wrapBytes = wrapBytes;
|
package/wrapBytes.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { u8aIsWrapped, u8aUnwrapBytes, u8aWrapBytes } from '@polkadot/util';
|
|
1
2
|
export declare const ETHEREUM: Uint8Array;
|
|
2
|
-
export declare const PREFIX: Uint8Array;
|
|
3
3
|
export declare const POSTFIX: Uint8Array;
|
|
4
|
-
export declare
|
|
5
|
-
export declare
|
|
4
|
+
export declare const PREFIX: Uint8Array;
|
|
5
|
+
export declare const isWrapped: typeof u8aIsWrapped;
|
|
6
|
+
export declare const unwrapBytes: typeof u8aUnwrapBytes;
|
|
7
|
+
export declare const wrapBytes: typeof u8aWrapBytes;
|
package/wrapBytes.js
CHANGED
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
// Copyright 2019-2021 @polkadot/extension authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import {
|
|
4
|
-
export const ETHEREUM =
|
|
5
|
-
export const
|
|
6
|
-
export const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return u8a.length >= WRAP_LEN && u8aEq(u8a.subarray(0, PREFIX.length), PREFIX) && u8aEq(u8a.slice(-POSTFIX.length), POSTFIX) || withEthereum && u8a.length >= ETHEREUM.length && u8aEq(u8a.subarray(0, ETHEREUM.length), ETHEREUM);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function unwrapBytes(bytes) {
|
|
14
|
-
const u8a = u8aToU8a(bytes); // we don't want to unwrap Ethereum-style wraps
|
|
15
|
-
|
|
16
|
-
return isWrapped(u8a, false) ? u8a.subarray(PREFIX.length, u8a.length - POSTFIX.length) : u8a;
|
|
17
|
-
}
|
|
18
|
-
export function wrapBytes(bytes) {
|
|
19
|
-
const u8a = u8aToU8a(bytes); // if Ethereum-wrapping, we don't add our wrapping bytes
|
|
20
|
-
|
|
21
|
-
return isWrapped(u8a, true) ? u8a : u8aConcat(PREFIX, u8a, POSTFIX);
|
|
22
|
-
}
|
|
3
|
+
import { U8A_WRAP_ETHEREUM, U8A_WRAP_POSTFIX, U8A_WRAP_PREFIX, u8aIsWrapped, u8aUnwrapBytes, u8aWrapBytes } from '@polkadot/util';
|
|
4
|
+
export const ETHEREUM = U8A_WRAP_ETHEREUM;
|
|
5
|
+
export const POSTFIX = U8A_WRAP_POSTFIX;
|
|
6
|
+
export const PREFIX = U8A_WRAP_PREFIX;
|
|
7
|
+
export const isWrapped = u8aIsWrapped;
|
|
8
|
+
export const unwrapBytes = u8aUnwrapBytes;
|
|
9
|
+
export const wrapBytes = u8aWrapBytes;
|