@onekeyfe/cross-inpage-provider-core 2.2.26 → 2.2.28

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/dist/cjs/index.js CHANGED
@@ -51,6 +51,7 @@ __exportStar(require("./JsBridgeIframe"), exports);
51
51
  __exportStar(require("./CrossEventEmitter"), exports);
52
52
  __exportStar(require("./walletProperty"), exports);
53
53
  __exportStar(require("./notification"), exports);
54
+ __exportStar(require("./utils/hashUtils"), exports);
54
55
  const consts = __importStar(require("./consts"));
55
56
  exports.consts = consts;
56
57
  const injectedFactory_1 = __importDefault(require("./injectedFactory"));
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bytesToHex = exports.hexToBytes = void 0;
4
+ exports.hasHexPrefix = hasHexPrefix;
5
+ exports.stripHexPrefix = stripHexPrefix;
6
+ exports.addHexPrefix = addHexPrefix;
7
+ const utils_1 = require("@noble/hashes/utils");
8
+ Object.defineProperty(exports, "hexToBytes", { enumerable: true, get: function () { return utils_1.hexToBytes; } });
9
+ Object.defineProperty(exports, "bytesToHex", { enumerable: true, get: function () { return utils_1.bytesToHex; } });
10
+ function hasHexPrefix(data) {
11
+ return data.startsWith('0x');
12
+ }
13
+ function stripHexPrefix(hex) {
14
+ return hasHexPrefix(hex) ? hex.slice(2) : hex;
15
+ }
16
+ function addHexPrefix(hex) {
17
+ return hasHexPrefix(hex) ? hex : `0x${hex}`;
18
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const version = '2.2.26';
3
+ const version = '2.2.28';
4
4
  const versionBuild = '2020-0101-1';
5
5
  exports.default = {
6
6
  version,
package/dist/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export * from './JsBridgeIframe';
9
9
  export * from './CrossEventEmitter';
10
10
  export * from './walletProperty';
11
11
  export * from './notification';
12
+ export * from './utils/hashUtils';
12
13
  import * as consts from './consts';
13
14
  export { consts };
14
15
  import injectedFactory from './injectedFactory';
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ export * from './JsBridgeIframe';
9
9
  export * from './CrossEventEmitter';
10
10
  export * from './walletProperty';
11
11
  export * from './notification';
12
+ export * from './utils/hashUtils';
12
13
  import * as consts from './consts';
13
14
  export { consts };
14
15
  import injectedFactory from './injectedFactory';
@@ -0,0 +1,5 @@
1
+ import { hexToBytes, bytesToHex } from '@noble/hashes/utils';
2
+ declare function hasHexPrefix(data: string): boolean;
3
+ declare function stripHexPrefix(hex: string): string;
4
+ declare function addHexPrefix(hex: string): string;
5
+ export { hexToBytes, bytesToHex, hasHexPrefix, stripHexPrefix, addHexPrefix };
@@ -0,0 +1,11 @@
1
+ import { hexToBytes, bytesToHex } from '@noble/hashes/utils';
2
+ function hasHexPrefix(data) {
3
+ return data.startsWith('0x');
4
+ }
5
+ function stripHexPrefix(hex) {
6
+ return hasHexPrefix(hex) ? hex.slice(2) : hex;
7
+ }
8
+ function addHexPrefix(hex) {
9
+ return hasHexPrefix(hex) ? hex : `0x${hex}`;
10
+ }
11
+ export { hexToBytes, bytesToHex, hasHexPrefix, stripHexPrefix, addHexPrefix };
@@ -1,4 +1,4 @@
1
- const version = '2.2.26';
1
+ const version = '2.2.28';
2
2
  const versionBuild = '2020-0101-1';
3
3
  export default {
4
4
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/cross-inpage-provider-core",
3
- "version": "2.2.26",
3
+ "version": "2.2.28",
4
4
  "keywords": [
5
5
  "cross-inpage-provider"
6
6
  ],
@@ -29,9 +29,10 @@
29
29
  "build-version-info": "node ./scripts/buildVersionInfo.js"
30
30
  },
31
31
  "dependencies": {
32
- "@onekeyfe/cross-inpage-provider-errors": "2.2.26",
33
- "@onekeyfe/cross-inpage-provider-events": "2.2.26",
34
- "@onekeyfe/cross-inpage-provider-types": "2.2.26",
32
+ "@noble/hashes": "^1.7.1",
33
+ "@onekeyfe/cross-inpage-provider-errors": "2.2.28",
34
+ "@onekeyfe/cross-inpage-provider-events": "2.2.28",
35
+ "@onekeyfe/cross-inpage-provider-types": "2.2.28",
35
36
  "events": "^3.3.0",
36
37
  "lodash-es": "^4.17.21",
37
38
  "ms": "^2.1.3"
@@ -39,5 +40,5 @@
39
40
  "devDependencies": {
40
41
  "@types/lodash-es": "^4.17.12"
41
42
  },
42
- "gitHead": "bbf6e9bae844ea2d5aaed884a4ace9cc8051569d"
43
+ "gitHead": "473ece52d08eeb9eed490a3172fad5f954338800"
43
44
  }