@onekeyfe/onekey-private-provider 2.2.0 → 2.2.2
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.
|
@@ -27,8 +27,15 @@ export interface IOneKeyWalletInfo {
|
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
declare class ProviderPrivate extends ProviderBase {
|
|
30
|
+
_listeners: {
|
|
31
|
+
type: string;
|
|
32
|
+
callback: (params: any) => void;
|
|
33
|
+
}[];
|
|
30
34
|
constructor(props: IInpageProviderConfig);
|
|
31
35
|
private _registerEvents;
|
|
36
|
+
onNotifyFloatingIconChanged(callback: (params: {
|
|
37
|
+
showFloatingIcon: boolean;
|
|
38
|
+
}) => void): void;
|
|
32
39
|
protected providerName: IInjectedProviderNamesStrings;
|
|
33
40
|
request(data: unknown): Promise<unknown>;
|
|
34
41
|
notifyDefaultWalletChanged(params: IOneKeyWalletInfo): void;
|
package/dist/ProviderPrivate.js
CHANGED
|
@@ -7,11 +7,13 @@ const PROVIDER_EVENTS = {
|
|
|
7
7
|
};
|
|
8
8
|
const METHODS = {
|
|
9
9
|
wallet_events_ext_switch_changed: 'wallet_events_ext_switch_changed',
|
|
10
|
-
wallet_events_dapp_network_changed: 'wallet_events_dapp_network_changed'
|
|
10
|
+
wallet_events_dapp_network_changed: 'wallet_events_dapp_network_changed',
|
|
11
|
+
wallet_events_floating_icon_changed: 'wallet_events_floating_icon_changed',
|
|
11
12
|
};
|
|
12
13
|
class ProviderPrivate extends ProviderBase {
|
|
13
14
|
constructor(props) {
|
|
14
15
|
super(props);
|
|
16
|
+
this._listeners = [];
|
|
15
17
|
this.providerName = IInjectedProviderNames.$private;
|
|
16
18
|
try {
|
|
17
19
|
void this.getConnectWalletInfo();
|
|
@@ -51,12 +53,23 @@ class ProviderPrivate extends ProviderBase {
|
|
|
51
53
|
else if (method === METHODS.wallet_events_dapp_network_changed) {
|
|
52
54
|
this.notifyNetworkChanged(params);
|
|
53
55
|
}
|
|
56
|
+
else if (method === METHODS.wallet_events_floating_icon_changed) {
|
|
57
|
+
console.log('wallet_events_floating_icon_changed ===>>>> : ', params);
|
|
58
|
+
this._listeners.forEach((listener) => {
|
|
59
|
+
if (listener.type === method) {
|
|
60
|
+
listener.callback(params);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
54
64
|
});
|
|
55
65
|
}
|
|
56
66
|
catch (e) {
|
|
57
67
|
console.error(e);
|
|
58
68
|
}
|
|
59
69
|
}
|
|
70
|
+
onNotifyFloatingIconChanged(callback) {
|
|
71
|
+
this._listeners.push({ type: METHODS.wallet_events_floating_icon_changed, callback });
|
|
72
|
+
}
|
|
60
73
|
request(data) {
|
|
61
74
|
return this.bridgeRequest(data);
|
|
62
75
|
}
|
|
@@ -10,11 +10,13 @@ const PROVIDER_EVENTS = {
|
|
|
10
10
|
};
|
|
11
11
|
const METHODS = {
|
|
12
12
|
wallet_events_ext_switch_changed: 'wallet_events_ext_switch_changed',
|
|
13
|
-
wallet_events_dapp_network_changed: 'wallet_events_dapp_network_changed'
|
|
13
|
+
wallet_events_dapp_network_changed: 'wallet_events_dapp_network_changed',
|
|
14
|
+
wallet_events_floating_icon_changed: 'wallet_events_floating_icon_changed',
|
|
14
15
|
};
|
|
15
16
|
class ProviderPrivate extends cross_inpage_provider_core_1.ProviderBase {
|
|
16
17
|
constructor(props) {
|
|
17
18
|
super(props);
|
|
19
|
+
this._listeners = [];
|
|
18
20
|
this.providerName = cross_inpage_provider_types_1.IInjectedProviderNames.$private;
|
|
19
21
|
try {
|
|
20
22
|
void this.getConnectWalletInfo();
|
|
@@ -54,12 +56,23 @@ class ProviderPrivate extends cross_inpage_provider_core_1.ProviderBase {
|
|
|
54
56
|
else if (method === METHODS.wallet_events_dapp_network_changed) {
|
|
55
57
|
this.notifyNetworkChanged(params);
|
|
56
58
|
}
|
|
59
|
+
else if (method === METHODS.wallet_events_floating_icon_changed) {
|
|
60
|
+
console.log('wallet_events_floating_icon_changed ===>>>> : ', params);
|
|
61
|
+
this._listeners.forEach((listener) => {
|
|
62
|
+
if (listener.type === method) {
|
|
63
|
+
listener.callback(params);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
57
67
|
});
|
|
58
68
|
}
|
|
59
69
|
catch (e) {
|
|
60
70
|
console.error(e);
|
|
61
71
|
}
|
|
62
72
|
}
|
|
73
|
+
onNotifyFloatingIconChanged(callback) {
|
|
74
|
+
this._listeners.push({ type: METHODS.wallet_events_floating_icon_changed, callback });
|
|
75
|
+
}
|
|
63
76
|
request(data) {
|
|
64
77
|
return this.bridgeRequest(data);
|
|
65
78
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-private-provider",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"start": "tsc --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@onekeyfe/cross-inpage-provider-core": "2.2.
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-errors": "2.2.
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-types": "2.2.
|
|
34
|
-
"@onekeyfe/extension-bridge-injected": "2.2.
|
|
31
|
+
"@onekeyfe/cross-inpage-provider-core": "2.2.2",
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-errors": "2.2.2",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-types": "2.2.2",
|
|
34
|
+
"@onekeyfe/extension-bridge-injected": "2.2.2"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "c8e8c48be31f7ab33e4f38edd2cb5230a085563b"
|
|
37
37
|
}
|