@onekeyfe/inpage-providers-hub 1.1.15 → 1.1.16
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.
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.hackConnectButton = exports.createNewImageToContainer = exports.createWalletConnectToButton = exports.detectQrcodeFromSvg = void 0;
|
|
13
13
|
const lodash_1 = require("lodash");
|
|
14
14
|
const cross_inpage_provider_types_1 = require("@onekeyfe/cross-inpage-provider-types");
|
|
15
|
-
function checkIfInjectedProviderConnected({ providerName }) {
|
|
15
|
+
function checkIfInjectedProviderConnected({ providerName, }) {
|
|
16
16
|
var _a;
|
|
17
17
|
const hub = window.$onekey;
|
|
18
18
|
if (providerName === cross_inpage_provider_types_1.IInjectedProviderNames.ethereum) {
|
|
@@ -30,6 +30,15 @@ function detectQrcodeFromSvg({ img, }) {
|
|
|
30
30
|
var _a, _b;
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
32
|
// https://unpkg.com/qr-scanner@1.4.1/qr-scanner.umd.min.js
|
|
33
|
+
// Firefox does not support drawing SVG images to canvas
|
|
34
|
+
// Unless the svg file has width/height attributes on the root <svg> element
|
|
35
|
+
try {
|
|
36
|
+
img.setAttribute('width', img.clientWidth.toString());
|
|
37
|
+
img.setAttribute('height', img.clientHeight.toString());
|
|
38
|
+
}
|
|
39
|
+
catch (_c) {
|
|
40
|
+
//pass
|
|
41
|
+
}
|
|
33
42
|
const serialized = new XMLSerializer().serializeToString(img);
|
|
34
43
|
const encodedData = window.btoa(serialized);
|
|
35
44
|
const base64 = `data:image/svg+xml;base64,${encodedData}`;
|
|
@@ -13,6 +13,7 @@ const onekey_cosmos_provider_1 = require("@onekeyfe/onekey-cosmos-provider");
|
|
|
13
13
|
const cross_inpage_provider_core_1 = require("@onekeyfe/cross-inpage-provider-core");
|
|
14
14
|
const onekey_sui_provider_1 = require("@onekeyfe/onekey-sui-provider");
|
|
15
15
|
require("./connectButtonHack");
|
|
16
|
+
const consts_1 = require("./connectButtonHack/consts");
|
|
16
17
|
// import Web3 from 'web3'; // cause build error
|
|
17
18
|
const { WALLET_INFO_LOACAL_KEY } = cross_inpage_provider_core_1.consts;
|
|
18
19
|
function checkEnableDefineProperty(property) {
|
|
@@ -150,7 +151,10 @@ function injectWeb3Provider() {
|
|
|
150
151
|
(0, onekey_eth_provider_1.shimWeb3)(ethereum);
|
|
151
152
|
// TODO use initializeInpageProvider.ts
|
|
152
153
|
window.dispatchEvent(new Event('ethereum#initialized'));
|
|
153
|
-
|
|
154
|
+
// Sui Standard Wallet
|
|
155
|
+
(0, onekey_sui_provider_1.registerSuiWallet)(sui, {
|
|
156
|
+
logo: consts_1.WALLET_CONNECT_INFO.onekey.icon,
|
|
157
|
+
});
|
|
154
158
|
return $onekey;
|
|
155
159
|
}
|
|
156
160
|
exports.injectWeb3Provider = injectWeb3Provider;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import { throttle } from 'lodash';
|
|
11
11
|
import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types';
|
|
12
|
-
function checkIfInjectedProviderConnected({ providerName }) {
|
|
12
|
+
function checkIfInjectedProviderConnected({ providerName, }) {
|
|
13
13
|
var _a;
|
|
14
14
|
const hub = window.$onekey;
|
|
15
15
|
if (providerName === IInjectedProviderNames.ethereum) {
|
|
@@ -27,6 +27,15 @@ export function detectQrcodeFromSvg({ img, }) {
|
|
|
27
27
|
var _a, _b;
|
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
29
29
|
// https://unpkg.com/qr-scanner@1.4.1/qr-scanner.umd.min.js
|
|
30
|
+
// Firefox does not support drawing SVG images to canvas
|
|
31
|
+
// Unless the svg file has width/height attributes on the root <svg> element
|
|
32
|
+
try {
|
|
33
|
+
img.setAttribute('width', img.clientWidth.toString());
|
|
34
|
+
img.setAttribute('height', img.clientHeight.toString());
|
|
35
|
+
}
|
|
36
|
+
catch (_c) {
|
|
37
|
+
//pass
|
|
38
|
+
}
|
|
30
39
|
const serialized = new XMLSerializer().serializeToString(img);
|
|
31
40
|
const encodedData = window.btoa(serialized);
|
|
32
41
|
const base64 = `data:image/svg+xml;base64,${encodedData}`;
|
|
@@ -10,6 +10,7 @@ import { ProviderCosmos } from '@onekeyfe/onekey-cosmos-provider';
|
|
|
10
10
|
import { consts } from '@onekeyfe/cross-inpage-provider-core';
|
|
11
11
|
import { ProviderSui, registerSuiWallet } from '@onekeyfe/onekey-sui-provider';
|
|
12
12
|
import './connectButtonHack';
|
|
13
|
+
import { WALLET_CONNECT_INFO } from './connectButtonHack/consts';
|
|
13
14
|
// import Web3 from 'web3'; // cause build error
|
|
14
15
|
const { WALLET_INFO_LOACAL_KEY } = consts;
|
|
15
16
|
function checkEnableDefineProperty(property) {
|
|
@@ -147,7 +148,10 @@ function injectWeb3Provider() {
|
|
|
147
148
|
shimWeb3(ethereum);
|
|
148
149
|
// TODO use initializeInpageProvider.ts
|
|
149
150
|
window.dispatchEvent(new Event('ethereum#initialized'));
|
|
150
|
-
|
|
151
|
+
// Sui Standard Wallet
|
|
152
|
+
registerSuiWallet(sui, {
|
|
153
|
+
logo: WALLET_CONNECT_INFO.onekey.icon,
|
|
154
|
+
});
|
|
151
155
|
return $onekey;
|
|
152
156
|
}
|
|
153
157
|
export { injectWeb3Provider };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/inpage-providers-hub",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.16",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"start": "tsc --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@onekeyfe/cross-inpage-provider-core": "1.1.
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-types": "1.1.
|
|
33
|
-
"@onekeyfe/onekey-aptos-provider": "1.1.
|
|
34
|
-
"@onekeyfe/onekey-cardano-provider": "1.1.
|
|
35
|
-
"@onekeyfe/onekey-conflux-provider": "1.1.
|
|
36
|
-
"@onekeyfe/onekey-cosmos-provider": "1.1.
|
|
37
|
-
"@onekeyfe/onekey-eth-provider": "1.1.
|
|
38
|
-
"@onekeyfe/onekey-private-provider": "1.1.
|
|
39
|
-
"@onekeyfe/onekey-solana-provider": "1.1.
|
|
40
|
-
"@onekeyfe/onekey-starcoin-provider": "1.1.
|
|
41
|
-
"@onekeyfe/onekey-sui-provider": "1.1.
|
|
42
|
-
"@onekeyfe/onekey-tron-provider": "1.1.
|
|
31
|
+
"@onekeyfe/cross-inpage-provider-core": "1.1.16",
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-types": "1.1.16",
|
|
33
|
+
"@onekeyfe/onekey-aptos-provider": "1.1.16",
|
|
34
|
+
"@onekeyfe/onekey-cardano-provider": "1.1.16",
|
|
35
|
+
"@onekeyfe/onekey-conflux-provider": "1.1.16",
|
|
36
|
+
"@onekeyfe/onekey-cosmos-provider": "1.1.16",
|
|
37
|
+
"@onekeyfe/onekey-eth-provider": "1.1.16",
|
|
38
|
+
"@onekeyfe/onekey-private-provider": "1.1.16",
|
|
39
|
+
"@onekeyfe/onekey-solana-provider": "1.1.16",
|
|
40
|
+
"@onekeyfe/onekey-starcoin-provider": "1.1.16",
|
|
41
|
+
"@onekeyfe/onekey-sui-provider": "1.1.16",
|
|
42
|
+
"@onekeyfe/onekey-tron-provider": "1.1.16",
|
|
43
43
|
"web3": "^1.7.3"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a2aa4f3e6d8ad7ac8ad73b31e7f8d80f5abd3d46"
|
|
46
46
|
}
|