@onekeyfe/onekey-sui-provider 1.1.44 → 1.1.45

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.
@@ -3,7 +3,7 @@ import { ProviderSuiBase } from './ProviderSuiBase';
3
3
  import type { IJsonRpcRequest } from '@onekeyfe/cross-inpage-provider-types';
4
4
  import { AccountInfo } from './types';
5
5
  import type { PermissionType } from './types';
6
- import { IdentifierString, SuiSignAndExecuteTransactionBlockInput, SuiSignAndExecuteTransactionBlockOutput, SuiSignMessageInput, SuiSignMessageOutput, SuiSignTransactionBlockInput, SuiSignTransactionBlockOutput } from '@mysten/wallet-standard';
6
+ import { IdentifierString, SuiSignAndExecuteTransactionBlockInput, SuiSignAndExecuteTransactionBlockOutput, SuiSignMessageInput, SuiSignMessageOutput, SuiSignPersonalMessageInput, SuiSignPersonalMessageOutput, SuiSignTransactionBlockInput, SuiSignTransactionBlockOutput } from '@mysten/wallet-standard';
7
7
  declare const PROVIDER_EVENTS: {
8
8
  readonly connect: "connect";
9
9
  readonly disconnect: "disconnect";
@@ -30,6 +30,10 @@ declare type SignMessageInput = SuiSignMessageInput & {
30
30
  messageSerialize: string;
31
31
  walletSerialize: string;
32
32
  };
33
+ declare type SignPersonalMessageInput = SuiSignPersonalMessageInput & {
34
+ messageSerialize: string;
35
+ walletSerialize: string;
36
+ };
33
37
  export declare type SuiRequest = {
34
38
  'hasPermissions': (permissions: readonly PermissionType[]) => Promise<boolean>;
35
39
  'requestPermissions': (permissions: readonly PermissionType[]) => Promise<boolean>;
@@ -39,6 +43,7 @@ export declare type SuiRequest = {
39
43
  'signAndExecuteTransactionBlock': (input: SignAndExecuteTransactionBlockInput) => Promise<SuiSignAndExecuteTransactionBlockOutput>;
40
44
  'signTransactionBlock': (input: SignTransactionBlockInput) => Promise<SuiSignTransactionBlockOutput>;
41
45
  'signMessage': (input: SignMessageInput) => Promise<SuiSignMessageOutput>;
46
+ 'signPersonalMessage': (input: SignPersonalMessageInput) => Promise<SuiSignPersonalMessageOutput>;
42
47
  };
43
48
  export declare type PROVIDER_EVENTS_STRINGS = keyof typeof PROVIDER_EVENTS;
44
49
  export interface IProviderSui {
@@ -80,6 +85,7 @@ declare class ProviderSui extends ProviderSuiBase implements IProviderSui {
80
85
  signAndExecuteTransactionBlock(input: SuiSignAndExecuteTransactionBlockInput): Promise<SuiSignAndExecuteTransactionBlockOutput>;
81
86
  signTransactionBlock(input: SuiSignTransactionBlockInput): Promise<SuiSignTransactionBlockOutput>;
82
87
  signMessage(input: SuiSignMessageInput): Promise<SuiSignMessageOutput>;
88
+ signPersonalMessage(input: SuiSignPersonalMessageInput): Promise<SuiSignPersonalMessageOutput>;
83
89
  isConnected(): boolean;
84
90
  onNetworkChange(listener: SuiProviderEventsMap['networkChange']): this;
85
91
  onAccountChange(listener: SuiProviderEventsMap['accountChanged']): this;
@@ -161,6 +161,14 @@ class ProviderSui extends ProviderSuiBase {
161
161
  });
162
162
  });
163
163
  }
164
+ signPersonalMessage(input) {
165
+ return __awaiter(this, void 0, void 0, function* () {
166
+ return this._callBridge({
167
+ method: 'signPersonalMessage',
168
+ params: Object.assign(Object.assign({}, input), { walletSerialize: JSON.stringify(input.account), messageSerialize: bytesToHex(input.message) }),
169
+ });
170
+ });
171
+ }
164
172
  isConnected() {
165
173
  return this._account !== null;
166
174
  }
@@ -19,6 +19,7 @@ var Feature;
19
19
  Feature["SUI__SIGN_AND_EXECUTE_TRANSACTION_BLOCK"] = "sui:signAndExecuteTransactionBlock";
20
20
  Feature["SUI__SIGN_TRANSACTION_BLOCK"] = "sui:signTransactionBlock";
21
21
  Feature["SUI__SIGN_MESSAGE"] = "sui:signMessage";
22
+ Feature["SUI__SIGN_PERSONAL_MESSAGE"] = "sui:signPersonalMessage";
22
23
  })(Feature || (Feature = {}));
23
24
  class OnekeySuiStandardWallet {
24
25
  constructor(provider, options) {
@@ -49,6 +50,7 @@ class OnekeySuiStandardWallet {
49
50
  Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION_BLOCK,
50
51
  Feature.SUI__SIGN_TRANSACTION_BLOCK,
51
52
  Feature.SUI__SIGN_MESSAGE,
53
+ Feature.SUI__SIGN_PERSONAL_MESSAGE,
52
54
  ],
53
55
  });
54
56
  this._events.emit('change', { accounts: this.accounts });
@@ -76,6 +78,9 @@ class OnekeySuiStandardWallet {
76
78
  this.$signMessage = (input) => __awaiter(this, void 0, void 0, function* () {
77
79
  return this.provider.signMessage(input);
78
80
  });
81
+ this.$signPersonalMessage = (input) => __awaiter(this, void 0, void 0, function* () {
82
+ return this.provider.signPersonalMessage(input);
83
+ });
79
84
  this.provider = provider;
80
85
  this._events = mitt();
81
86
  this._account = null;
@@ -124,6 +129,10 @@ class OnekeySuiStandardWallet {
124
129
  version: '1.0.0',
125
130
  signMessage: this.$signMessage,
126
131
  },
132
+ [Feature.SUI__SIGN_PERSONAL_MESSAGE]: {
133
+ version: '1.0.0',
134
+ signPersonalMessage: this.$signPersonalMessage,
135
+ },
127
136
  };
128
137
  }
129
138
  getActiveChain() {
@@ -164,6 +164,14 @@ class ProviderSui extends ProviderSuiBase_1.ProviderSuiBase {
164
164
  });
165
165
  });
166
166
  }
167
+ signPersonalMessage(input) {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ return this._callBridge({
170
+ method: 'signPersonalMessage',
171
+ params: Object.assign(Object.assign({}, input), { walletSerialize: JSON.stringify(input.account), messageSerialize: (0, utils_1.bytesToHex)(input.message) }),
172
+ });
173
+ });
174
+ }
167
175
  isConnected() {
168
176
  return this._account !== null;
169
177
  }
@@ -25,6 +25,7 @@ var Feature;
25
25
  Feature["SUI__SIGN_AND_EXECUTE_TRANSACTION_BLOCK"] = "sui:signAndExecuteTransactionBlock";
26
26
  Feature["SUI__SIGN_TRANSACTION_BLOCK"] = "sui:signTransactionBlock";
27
27
  Feature["SUI__SIGN_MESSAGE"] = "sui:signMessage";
28
+ Feature["SUI__SIGN_PERSONAL_MESSAGE"] = "sui:signPersonalMessage";
28
29
  })(Feature || (Feature = {}));
29
30
  class OnekeySuiStandardWallet {
30
31
  constructor(provider, options) {
@@ -55,6 +56,7 @@ class OnekeySuiStandardWallet {
55
56
  Feature.SUI__SIGN_AND_EXECUTE_TRANSACTION_BLOCK,
56
57
  Feature.SUI__SIGN_TRANSACTION_BLOCK,
57
58
  Feature.SUI__SIGN_MESSAGE,
59
+ Feature.SUI__SIGN_PERSONAL_MESSAGE,
58
60
  ],
59
61
  });
60
62
  this._events.emit('change', { accounts: this.accounts });
@@ -82,6 +84,9 @@ class OnekeySuiStandardWallet {
82
84
  this.$signMessage = (input) => __awaiter(this, void 0, void 0, function* () {
83
85
  return this.provider.signMessage(input);
84
86
  });
87
+ this.$signPersonalMessage = (input) => __awaiter(this, void 0, void 0, function* () {
88
+ return this.provider.signPersonalMessage(input);
89
+ });
85
90
  this.provider = provider;
86
91
  this._events = (0, mitt_1.default)();
87
92
  this._account = null;
@@ -130,6 +135,10 @@ class OnekeySuiStandardWallet {
130
135
  version: '1.0.0',
131
136
  signMessage: this.$signMessage,
132
137
  },
138
+ [Feature.SUI__SIGN_PERSONAL_MESSAGE]: {
139
+ version: '1.0.0',
140
+ signPersonalMessage: this.$signPersonalMessage,
141
+ },
133
142
  };
134
143
  }
135
144
  getActiveChain() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onekeyfe/onekey-sui-provider",
3
- "version": "1.1.44",
3
+ "version": "1.1.45",
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.5.5",
32
- "@onekeyfe/cross-inpage-provider-core": "1.1.44",
33
- "@onekeyfe/cross-inpage-provider-errors": "1.1.44",
34
- "@onekeyfe/cross-inpage-provider-types": "1.1.44",
35
- "@onekeyfe/extension-bridge-injected": "1.1.44",
31
+ "@mysten/wallet-standard": "^0.7.2",
32
+ "@onekeyfe/cross-inpage-provider-core": "1.1.45",
33
+ "@onekeyfe/cross-inpage-provider-errors": "1.1.45",
34
+ "@onekeyfe/cross-inpage-provider-types": "1.1.45",
35
+ "@onekeyfe/extension-bridge-injected": "1.1.45",
36
36
  "eth-rpc-errors": "^4.0.3",
37
37
  "mitt": "^3.0.0"
38
38
  },
39
- "gitHead": "a6b373f9438503447b69f35c407add9d7df9fb35"
39
+ "gitHead": "25bf58e46d50cb61816d5515524bd3d7817c278e"
40
40
  }