@onekeyfe/onekey-sui-provider 2.0.0-alpha.8 → 2.0.0
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.
|
@@ -11,30 +11,30 @@ declare const PROVIDER_EVENTS: {
|
|
|
11
11
|
readonly networkChange: "networkChange";
|
|
12
12
|
readonly message_low_level: "message_low_level";
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type SuiProviderEventsMap = {
|
|
15
15
|
[PROVIDER_EVENTS.connect]: (account: string) => void;
|
|
16
16
|
[PROVIDER_EVENTS.disconnect]: () => void;
|
|
17
17
|
[PROVIDER_EVENTS.accountChanged]: (account: string | null) => void;
|
|
18
18
|
[PROVIDER_EVENTS.networkChange]: (name: string | null) => void;
|
|
19
19
|
[PROVIDER_EVENTS.message_low_level]: (payload: IJsonRpcRequest) => void;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
type SignAndExecuteTransactionBlockInput = SuiSignAndExecuteTransactionBlockInput & {
|
|
22
22
|
blockSerialize: string;
|
|
23
23
|
walletSerialize: string;
|
|
24
24
|
};
|
|
25
|
-
|
|
25
|
+
type SignTransactionBlockInput = SuiSignTransactionBlockInput & {
|
|
26
26
|
blockSerialize: string;
|
|
27
27
|
walletSerialize: string;
|
|
28
28
|
};
|
|
29
|
-
|
|
29
|
+
type SignMessageInput = SuiSignMessageInput & {
|
|
30
30
|
messageSerialize: string;
|
|
31
31
|
walletSerialize: string;
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
type SignPersonalMessageInput = SuiSignPersonalMessageInput & {
|
|
34
34
|
messageSerialize: string;
|
|
35
35
|
walletSerialize: string;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
37
|
+
export type SuiRequest = {
|
|
38
38
|
'hasPermissions': (permissions: readonly PermissionType[]) => Promise<boolean>;
|
|
39
39
|
'requestPermissions': (permissions: readonly PermissionType[]) => Promise<boolean>;
|
|
40
40
|
'disconnect': () => Promise<void>;
|
|
@@ -45,7 +45,7 @@ export declare type SuiRequest = {
|
|
|
45
45
|
'signMessage': (input: SignMessageInput) => Promise<SuiSignMessageOutput>;
|
|
46
46
|
'signPersonalMessage': (input: SignPersonalMessageInput) => Promise<SuiSignPersonalMessageOutput>;
|
|
47
47
|
};
|
|
48
|
-
export
|
|
48
|
+
export type PROVIDER_EVENTS_STRINGS = keyof typeof PROVIDER_EVENTS;
|
|
49
49
|
export interface IProviderSui {
|
|
50
50
|
hasPermissions(permissions: readonly PermissionType[]): Promise<boolean>;
|
|
51
51
|
requestPermissions(permissions: readonly PermissionType[]): Promise<boolean>;
|
|
@@ -59,7 +59,7 @@ export interface IProviderSui {
|
|
|
59
59
|
*/
|
|
60
60
|
getAccounts(): Promise<AccountInfo[]>;
|
|
61
61
|
}
|
|
62
|
-
export
|
|
62
|
+
export type OneKeySuiProviderProps = IInpageProviderConfig & {
|
|
63
63
|
timeout?: number;
|
|
64
64
|
};
|
|
65
65
|
declare class ProviderSui extends ProviderSuiBase implements IProviderSui {
|
|
@@ -22,6 +22,53 @@ var Feature;
|
|
|
22
22
|
Feature["SUI__SIGN_PERSONAL_MESSAGE"] = "sui:signPersonalMessage";
|
|
23
23
|
})(Feature || (Feature = {}));
|
|
24
24
|
class OnekeySuiStandardWallet {
|
|
25
|
+
get name() {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this._name;
|
|
28
|
+
}
|
|
29
|
+
get icon() {
|
|
30
|
+
var _a;
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
|
|
32
|
+
return (((_a = this.options) === null || _a === void 0 ? void 0 : _a.logo) || '');
|
|
33
|
+
}
|
|
34
|
+
get chains() {
|
|
35
|
+
return [SUI_DEVNET_CHAIN, SUI_TESTNET_CHAIN];
|
|
36
|
+
}
|
|
37
|
+
get accounts() {
|
|
38
|
+
return this._account ? [this._account] : [];
|
|
39
|
+
}
|
|
40
|
+
get features() {
|
|
41
|
+
return {
|
|
42
|
+
[Feature.STANDARD__CONNECT]: {
|
|
43
|
+
version: '1.0.0',
|
|
44
|
+
connect: this.$connect,
|
|
45
|
+
},
|
|
46
|
+
[Feature.STANDARD__DISCONNECT]: {
|
|
47
|
+
version: '1.0.0',
|
|
48
|
+
disconnect: this.$disconnect,
|
|
49
|
+
},
|
|
50
|
+
[Feature.STANDARD__EVENTS]: {
|
|
51
|
+
version: '1.0.0',
|
|
52
|
+
on: this.$on,
|
|
53
|
+
},
|
|
54
|
+
[Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION_BLOCK]: {
|
|
55
|
+
version: '1.0.0',
|
|
56
|
+
signAndExecuteTransactionBlock: this.$signAndExecuteTransactionBlock,
|
|
57
|
+
},
|
|
58
|
+
[Feature.SUI__SIGN_TRANSACTION_BLOCK]: {
|
|
59
|
+
version: '1.0.0',
|
|
60
|
+
signTransactionBlock: this.$signTransactionBlock,
|
|
61
|
+
},
|
|
62
|
+
[Feature.SUI__SIGN_MESSAGE]: {
|
|
63
|
+
version: '1.0.0',
|
|
64
|
+
signMessage: this.$signMessage,
|
|
65
|
+
},
|
|
66
|
+
[Feature.SUI__SIGN_PERSONAL_MESSAGE]: {
|
|
67
|
+
version: '1.0.0',
|
|
68
|
+
signPersonalMessage: this.$signPersonalMessage,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
25
72
|
constructor(provider, options) {
|
|
26
73
|
this.version = '1.0.0';
|
|
27
74
|
this._name = 'OneKey Wallet';
|
|
@@ -88,53 +135,6 @@ class OnekeySuiStandardWallet {
|
|
|
88
135
|
this.subscribeEventFromBackend();
|
|
89
136
|
void this.$connected();
|
|
90
137
|
}
|
|
91
|
-
get name() {
|
|
92
|
-
var _a, _b;
|
|
93
|
-
return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this._name;
|
|
94
|
-
}
|
|
95
|
-
get icon() {
|
|
96
|
-
var _a;
|
|
97
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
|
|
98
|
-
return (((_a = this.options) === null || _a === void 0 ? void 0 : _a.logo) || '');
|
|
99
|
-
}
|
|
100
|
-
get chains() {
|
|
101
|
-
return [SUI_DEVNET_CHAIN, SUI_TESTNET_CHAIN];
|
|
102
|
-
}
|
|
103
|
-
get accounts() {
|
|
104
|
-
return this._account ? [this._account] : [];
|
|
105
|
-
}
|
|
106
|
-
get features() {
|
|
107
|
-
return {
|
|
108
|
-
[Feature.STANDARD__CONNECT]: {
|
|
109
|
-
version: '1.0.0',
|
|
110
|
-
connect: this.$connect,
|
|
111
|
-
},
|
|
112
|
-
[Feature.STANDARD__DISCONNECT]: {
|
|
113
|
-
version: '1.0.0',
|
|
114
|
-
disconnect: this.$disconnect,
|
|
115
|
-
},
|
|
116
|
-
[Feature.STANDARD__EVENTS]: {
|
|
117
|
-
version: '1.0.0',
|
|
118
|
-
on: this.$on,
|
|
119
|
-
},
|
|
120
|
-
[Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION_BLOCK]: {
|
|
121
|
-
version: '1.0.0',
|
|
122
|
-
signAndExecuteTransactionBlock: this.$signAndExecuteTransactionBlock,
|
|
123
|
-
},
|
|
124
|
-
[Feature.SUI__SIGN_TRANSACTION_BLOCK]: {
|
|
125
|
-
version: '1.0.0',
|
|
126
|
-
signTransactionBlock: this.$signTransactionBlock,
|
|
127
|
-
},
|
|
128
|
-
[Feature.SUI__SIGN_MESSAGE]: {
|
|
129
|
-
version: '1.0.0',
|
|
130
|
-
signMessage: this.$signMessage,
|
|
131
|
-
},
|
|
132
|
-
[Feature.SUI__SIGN_PERSONAL_MESSAGE]: {
|
|
133
|
-
version: '1.0.0',
|
|
134
|
-
signPersonalMessage: this.$signPersonalMessage,
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
138
|
getActiveChain() {
|
|
139
139
|
return this.provider.getActiveChain();
|
|
140
140
|
}
|
|
@@ -28,6 +28,53 @@ var Feature;
|
|
|
28
28
|
Feature["SUI__SIGN_PERSONAL_MESSAGE"] = "sui:signPersonalMessage";
|
|
29
29
|
})(Feature || (Feature = {}));
|
|
30
30
|
class OnekeySuiStandardWallet {
|
|
31
|
+
get name() {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this._name;
|
|
34
|
+
}
|
|
35
|
+
get icon() {
|
|
36
|
+
var _a;
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
|
|
38
|
+
return (((_a = this.options) === null || _a === void 0 ? void 0 : _a.logo) || '');
|
|
39
|
+
}
|
|
40
|
+
get chains() {
|
|
41
|
+
return [wallet_standard_1.SUI_DEVNET_CHAIN, wallet_standard_1.SUI_TESTNET_CHAIN];
|
|
42
|
+
}
|
|
43
|
+
get accounts() {
|
|
44
|
+
return this._account ? [this._account] : [];
|
|
45
|
+
}
|
|
46
|
+
get features() {
|
|
47
|
+
return {
|
|
48
|
+
[Feature.STANDARD__CONNECT]: {
|
|
49
|
+
version: '1.0.0',
|
|
50
|
+
connect: this.$connect,
|
|
51
|
+
},
|
|
52
|
+
[Feature.STANDARD__DISCONNECT]: {
|
|
53
|
+
version: '1.0.0',
|
|
54
|
+
disconnect: this.$disconnect,
|
|
55
|
+
},
|
|
56
|
+
[Feature.STANDARD__EVENTS]: {
|
|
57
|
+
version: '1.0.0',
|
|
58
|
+
on: this.$on,
|
|
59
|
+
},
|
|
60
|
+
[Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION_BLOCK]: {
|
|
61
|
+
version: '1.0.0',
|
|
62
|
+
signAndExecuteTransactionBlock: this.$signAndExecuteTransactionBlock,
|
|
63
|
+
},
|
|
64
|
+
[Feature.SUI__SIGN_TRANSACTION_BLOCK]: {
|
|
65
|
+
version: '1.0.0',
|
|
66
|
+
signTransactionBlock: this.$signTransactionBlock,
|
|
67
|
+
},
|
|
68
|
+
[Feature.SUI__SIGN_MESSAGE]: {
|
|
69
|
+
version: '1.0.0',
|
|
70
|
+
signMessage: this.$signMessage,
|
|
71
|
+
},
|
|
72
|
+
[Feature.SUI__SIGN_PERSONAL_MESSAGE]: {
|
|
73
|
+
version: '1.0.0',
|
|
74
|
+
signPersonalMessage: this.$signPersonalMessage,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
31
78
|
constructor(provider, options) {
|
|
32
79
|
this.version = '1.0.0';
|
|
33
80
|
this._name = 'OneKey Wallet';
|
|
@@ -94,53 +141,6 @@ class OnekeySuiStandardWallet {
|
|
|
94
141
|
this.subscribeEventFromBackend();
|
|
95
142
|
void this.$connected();
|
|
96
143
|
}
|
|
97
|
-
get name() {
|
|
98
|
-
var _a, _b;
|
|
99
|
-
return (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : this._name;
|
|
100
|
-
}
|
|
101
|
-
get icon() {
|
|
102
|
-
var _a;
|
|
103
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-explicit-any
|
|
104
|
-
return (((_a = this.options) === null || _a === void 0 ? void 0 : _a.logo) || '');
|
|
105
|
-
}
|
|
106
|
-
get chains() {
|
|
107
|
-
return [wallet_standard_1.SUI_DEVNET_CHAIN, wallet_standard_1.SUI_TESTNET_CHAIN];
|
|
108
|
-
}
|
|
109
|
-
get accounts() {
|
|
110
|
-
return this._account ? [this._account] : [];
|
|
111
|
-
}
|
|
112
|
-
get features() {
|
|
113
|
-
return {
|
|
114
|
-
[Feature.STANDARD__CONNECT]: {
|
|
115
|
-
version: '1.0.0',
|
|
116
|
-
connect: this.$connect,
|
|
117
|
-
},
|
|
118
|
-
[Feature.STANDARD__DISCONNECT]: {
|
|
119
|
-
version: '1.0.0',
|
|
120
|
-
disconnect: this.$disconnect,
|
|
121
|
-
},
|
|
122
|
-
[Feature.STANDARD__EVENTS]: {
|
|
123
|
-
version: '1.0.0',
|
|
124
|
-
on: this.$on,
|
|
125
|
-
},
|
|
126
|
-
[Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION_BLOCK]: {
|
|
127
|
-
version: '1.0.0',
|
|
128
|
-
signAndExecuteTransactionBlock: this.$signAndExecuteTransactionBlock,
|
|
129
|
-
},
|
|
130
|
-
[Feature.SUI__SIGN_TRANSACTION_BLOCK]: {
|
|
131
|
-
version: '1.0.0',
|
|
132
|
-
signTransactionBlock: this.$signTransactionBlock,
|
|
133
|
-
},
|
|
134
|
-
[Feature.SUI__SIGN_MESSAGE]: {
|
|
135
|
-
version: '1.0.0',
|
|
136
|
-
signMessage: this.$signMessage,
|
|
137
|
-
},
|
|
138
|
-
[Feature.SUI__SIGN_PERSONAL_MESSAGE]: {
|
|
139
|
-
version: '1.0.0',
|
|
140
|
-
signPersonalMessage: this.$signPersonalMessage,
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
144
|
getActiveChain() {
|
|
145
145
|
return this.provider.getActiveChain();
|
|
146
146
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/dist/type-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type WireStringified<T> = T extends Array<infer P> ? Array<WireStringified<P>> : T extends object ? {
|
|
2
2
|
[K in keyof T]: WireStringified<T[K]>;
|
|
3
3
|
} : T;
|
|
4
|
-
export
|
|
4
|
+
export type ResolvePromise<T> = T extends Promise<infer P> ? P : T;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SuiChain } from '@mysten/wallet-standard';
|
|
2
2
|
export declare const ALL_PERMISSION_TYPES: readonly ["viewAccount", "suggestTransactions"];
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
3
|
+
type AllPermissionsType = typeof ALL_PERMISSION_TYPES;
|
|
4
|
+
export type PermissionType = AllPermissionsType[number];
|
|
5
|
+
export type WalletInfo = {
|
|
6
6
|
name?: string;
|
|
7
7
|
logo: string;
|
|
8
8
|
};
|
|
9
|
-
export
|
|
9
|
+
export type SuiChainType = SuiChain;
|
|
10
10
|
export interface AccountInfo {
|
|
11
11
|
address: string;
|
|
12
12
|
publicKey: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/onekey-sui-provider",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"cross-inpage-provider"
|
|
6
6
|
],
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@mysten/wallet-standard": "^0.7.2",
|
|
32
|
-
"@onekeyfe/cross-inpage-provider-core": "2.0.0
|
|
33
|
-
"@onekeyfe/cross-inpage-provider-errors": "2.0.0
|
|
34
|
-
"@onekeyfe/cross-inpage-provider-types": "2.0.0
|
|
35
|
-
"@onekeyfe/extension-bridge-injected": "2.0.0
|
|
32
|
+
"@onekeyfe/cross-inpage-provider-core": "2.0.0",
|
|
33
|
+
"@onekeyfe/cross-inpage-provider-errors": "2.0.0",
|
|
34
|
+
"@onekeyfe/cross-inpage-provider-types": "2.0.0",
|
|
35
|
+
"@onekeyfe/extension-bridge-injected": "2.0.0",
|
|
36
36
|
"eth-rpc-errors": "^4.0.3",
|
|
37
37
|
"mitt": "^3.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "4e9109e35064cc7dafe3a4f86a33f497ad9567ec"
|
|
40
40
|
}
|