@onekeyfe/onekey-sui-provider 1.1.22 → 1.1.23
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.
|
@@ -125,11 +125,19 @@ class ProviderSui extends ProviderSuiBase {
|
|
|
125
125
|
return accounts;
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
getActiveChain() {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
return this._callBridge({
|
|
131
|
+
method: 'getActiveChain',
|
|
132
|
+
params: undefined,
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
signAndExecuteTransaction(input) {
|
|
129
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
138
|
return this._callBridge({
|
|
131
139
|
method: 'signAndExecuteTransaction',
|
|
132
|
-
params:
|
|
140
|
+
params: input,
|
|
133
141
|
});
|
|
134
142
|
});
|
|
135
143
|
}
|
|
@@ -27,6 +27,7 @@ class OnekeySuiStandardWallet {
|
|
|
27
27
|
return () => this._events.off(event, listener);
|
|
28
28
|
};
|
|
29
29
|
this.$connected = () => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const activeChain = yield this.$getActiveChain();
|
|
30
31
|
if (!(yield this.$hasPermissions(['viewAccount']))) {
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
@@ -39,7 +40,7 @@ class OnekeySuiStandardWallet {
|
|
|
39
40
|
address,
|
|
40
41
|
// TODO: Expose public key instead of address:
|
|
41
42
|
publicKey: new Uint8Array(),
|
|
42
|
-
chains:
|
|
43
|
+
chains: activeChain ? [activeChain] : [],
|
|
43
44
|
features: [Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION],
|
|
44
45
|
});
|
|
45
46
|
this._events.emit('change', { accounts: this.accounts });
|
|
@@ -59,7 +60,7 @@ class OnekeySuiStandardWallet {
|
|
|
59
60
|
this._events.all.clear();
|
|
60
61
|
});
|
|
61
62
|
this.$signAndExecuteTransaction = (input) => __awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
return this.provider.signAndExecuteTransaction(input
|
|
63
|
+
return this.provider.signAndExecuteTransaction(input);
|
|
63
64
|
});
|
|
64
65
|
this.provider = provider;
|
|
65
66
|
this._events = mitt();
|
|
@@ -98,11 +99,15 @@ class OnekeySuiStandardWallet {
|
|
|
98
99
|
on: this.$on,
|
|
99
100
|
},
|
|
100
101
|
[Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION]: {
|
|
101
|
-
version: '1.
|
|
102
|
+
version: '1.1.0',
|
|
102
103
|
signAndExecuteTransaction: this.$signAndExecuteTransaction,
|
|
103
104
|
},
|
|
104
105
|
};
|
|
105
106
|
}
|
|
107
|
+
$getActiveChain() {
|
|
108
|
+
var _a;
|
|
109
|
+
return (_a = this.provider.getActiveChain()) !== null && _a !== void 0 ? _a : 'sui:unknown';
|
|
110
|
+
}
|
|
106
111
|
$hasPermissions(permissions = ALL_PERMISSION_TYPES) {
|
|
107
112
|
return this.provider.hasPermissions(permissions);
|
|
108
113
|
}
|
|
@@ -128,11 +128,19 @@ class ProviderSui extends ProviderSuiBase_1.ProviderSuiBase {
|
|
|
128
128
|
return accounts;
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
getActiveChain() {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
return this._callBridge({
|
|
134
|
+
method: 'getActiveChain',
|
|
135
|
+
params: undefined,
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
signAndExecuteTransaction(input) {
|
|
132
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
133
141
|
return this._callBridge({
|
|
134
142
|
method: 'signAndExecuteTransaction',
|
|
135
|
-
params:
|
|
143
|
+
params: input,
|
|
136
144
|
});
|
|
137
145
|
});
|
|
138
146
|
}
|
|
@@ -33,6 +33,7 @@ class OnekeySuiStandardWallet {
|
|
|
33
33
|
return () => this._events.off(event, listener);
|
|
34
34
|
};
|
|
35
35
|
this.$connected = () => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const activeChain = yield this.$getActiveChain();
|
|
36
37
|
if (!(yield this.$hasPermissions(['viewAccount']))) {
|
|
37
38
|
return;
|
|
38
39
|
}
|
|
@@ -45,7 +46,7 @@ class OnekeySuiStandardWallet {
|
|
|
45
46
|
address,
|
|
46
47
|
// TODO: Expose public key instead of address:
|
|
47
48
|
publicKey: new Uint8Array(),
|
|
48
|
-
chains:
|
|
49
|
+
chains: activeChain ? [activeChain] : [],
|
|
49
50
|
features: [Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION],
|
|
50
51
|
});
|
|
51
52
|
this._events.emit('change', { accounts: this.accounts });
|
|
@@ -65,7 +66,7 @@ class OnekeySuiStandardWallet {
|
|
|
65
66
|
this._events.all.clear();
|
|
66
67
|
});
|
|
67
68
|
this.$signAndExecuteTransaction = (input) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
-
return this.provider.signAndExecuteTransaction(input
|
|
69
|
+
return this.provider.signAndExecuteTransaction(input);
|
|
69
70
|
});
|
|
70
71
|
this.provider = provider;
|
|
71
72
|
this._events = (0, mitt_1.default)();
|
|
@@ -104,11 +105,15 @@ class OnekeySuiStandardWallet {
|
|
|
104
105
|
on: this.$on,
|
|
105
106
|
},
|
|
106
107
|
[Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION]: {
|
|
107
|
-
version: '1.
|
|
108
|
+
version: '1.1.0',
|
|
108
109
|
signAndExecuteTransaction: this.$signAndExecuteTransaction,
|
|
109
110
|
},
|
|
110
111
|
};
|
|
111
112
|
}
|
|
113
|
+
$getActiveChain() {
|
|
114
|
+
var _a;
|
|
115
|
+
return (_a = this.provider.getActiveChain()) !== null && _a !== void 0 ? _a : 'sui:unknown';
|
|
116
|
+
}
|
|
112
117
|
$hasPermissions(permissions = types_1.ALL_PERMISSION_TYPES) {
|
|
113
118
|
return this.provider.hasPermissions(permissions);
|
|
114
119
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SuiChain } from '@mysten/wallet-standard';
|
|
1
2
|
export declare const ALL_PERMISSION_TYPES: readonly ["viewAccount", "suggestTransactions"];
|
|
2
3
|
declare type AllPermissionsType = typeof ALL_PERMISSION_TYPES;
|
|
3
4
|
export declare type PermissionType = AllPermissionsType[number];
|
|
@@ -5,4 +6,5 @@ export declare type WalletInfo = {
|
|
|
5
6
|
name?: string;
|
|
6
7
|
logo: string;
|
|
7
8
|
};
|
|
9
|
+
export declare type SuiChainType = SuiChain;
|
|
8
10
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-sui-provider",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.23",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"start": "tsc --watch"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@mysten/wallet-standard": "^0.
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-core": "1.1.
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-errors": "1.1.
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "1.1.
|
|
35
|
-
"@onekeyfe/extension-bridge-injected": "1.1.
|
|
31
|
+
"@mysten/wallet-standard": "^0.3.00",
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-core": "1.1.23",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-errors": "1.1.23",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "1.1.23",
|
|
35
|
+
"@onekeyfe/extension-bridge-injected": "1.1.23",
|
|
36
36
|
"eth-rpc-errors": "^4.0.3",
|
|
37
37
|
"mitt": "^3.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "5c8056c76c982d7d4a8eda4cf4acc6d72cf10025"
|
|
40
40
|
}
|