suidouble 2.16.0 → 2.17.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.
@@ -59,6 +59,8 @@ export default class SuiInBrowserAdapter extends SuiCommonMethods {
59
59
  this._connectedChain = null;
60
60
  /** @type {boolean} */
61
61
  this._isConnected = false;
62
+ /** @type {boolean} */
63
+ this._userDisconnected = false;
62
64
  }
63
65
 
64
66
  /**
@@ -138,13 +140,26 @@ export default class SuiInBrowserAdapter extends SuiCommonMethods {
138
140
 
139
141
  /**
140
142
  * Disconnect from the wallet and refresh connection state.
143
+ * Force-clears local connection state even if the wallet doesn't support
144
+ * standard:disconnect or doesn't revoke site authorization (e.g. Phantom).
141
145
  * @param {Object} [params]
142
- * @returns {Promise<*>}
146
+ * @returns {Promise<void>}
143
147
  */
144
148
  async disconnect(params) {
145
- const res = await this.getFeature(Feature.DISCONNECT).disconnect(params);
146
- this.connectionUpdated();
147
- return res;
149
+ try {
150
+ const feature = this.getFeature(Feature.DISCONNECT);
151
+ if (feature) {
152
+ await feature.disconnect(params);
153
+ }
154
+ } catch (e) {
155
+ console.warn('[SuiInBrowserAdapter] standard:disconnect failed:', e);
156
+ }
157
+
158
+ this._connectedAddress = null;
159
+ this._connectedChain = null;
160
+ this._isConnected = false;
161
+ this._userDisconnected = true;
162
+ this.emit('disconnected', this);
148
163
  }
149
164
 
150
165
  /**
@@ -187,6 +202,7 @@ export default class SuiInBrowserAdapter extends SuiCommonMethods {
187
202
  * @returns {Promise<void>}
188
203
  */
189
204
  async connect() {
205
+ this._userDisconnected = false;
190
206
  try {
191
207
  await this.getFeature(Feature.CONNECT).connect();
192
208
  } catch (e) {
@@ -202,6 +218,8 @@ export default class SuiInBrowserAdapter extends SuiCommonMethods {
202
218
  * `'disconnected'` if the state changed.
203
219
  */
204
220
  connectionUpdated() {
221
+ if (this._userDisconnected) return;
222
+
205
223
  const wasConnectedAddress = ''+this._connectedAddress;
206
224
  const wasConnectedChain = ''+this._connectedChain;
207
225
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "suidouble",
3
- "version": "2.16.0",
3
+ "version": "2.17.0",
4
4
  "description": "JavaScript library for Sui Move smart contracts. Publish, upgrade, and test packages; call contract methods; query objects and events — same code works on Node.js and in the browser.",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  "license": "Apache-2.0",
38
38
  "dependencies": {
39
39
  "@mysten/bcs": "^2.0.3",
40
- "@mysten/sui": "^2.16.0",
40
+ "@mysten/sui": "^2.17.0",
41
41
  "@polymedia/coinmeta": "^0.0.24",
42
42
  "@scure/bip39": "^1.6.0",
43
43
  "@wallet-standard/core": "^1.1.1"
@@ -21,3 +21,21 @@ source = { root = true }
21
21
  use_environment = "mainnet"
22
22
  manifest_digest = "EC6E90369603CE16A65E2F7B784DCFCA80948E3C176AD82DC6EB101BAA942A89"
23
23
  deps = { Sui = "Sui" }
24
+
25
+ [pinned.testnet.MoveStdlib]
26
+ source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "14bf3e318215db21415c7c0ab0c01cf8d7ef594a" }
27
+ use_environment = "testnet"
28
+ manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
29
+ deps = {}
30
+
31
+ [pinned.testnet.Sui]
32
+ source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "14bf3e318215db21415c7c0ab0c01cf8d7ef594a" }
33
+ use_environment = "testnet"
34
+ manifest_digest = "7AFB66695545775FBFBB2D3078ADFD084244D5002392E837FDE21D9EA1C6D01C"
35
+ deps = { MoveStdlib = "MoveStdlib" }
36
+
37
+ [pinned.testnet.different_types]
38
+ source = { root = true }
39
+ use_environment = "testnet"
40
+ manifest_digest = "CC15E09306E902854F6BDD9B90D21287DB7EC557173965E5355493A2783E25B3"
41
+ deps = { Sui = "Sui" }
@@ -21,3 +21,21 @@ source = { root = true }
21
21
  use_environment = "mainnet"
22
22
  manifest_digest = "EC6E90369603CE16A65E2F7B784DCFCA80948E3C176AD82DC6EB101BAA942A89"
23
23
  deps = { Sui = "Sui" }
24
+
25
+ [pinned.testnet.MoveStdlib]
26
+ source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "14bf3e318215db21415c7c0ab0c01cf8d7ef594a" }
27
+ use_environment = "testnet"
28
+ manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
29
+ deps = {}
30
+
31
+ [pinned.testnet.Sui]
32
+ source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "14bf3e318215db21415c7c0ab0c01cf8d7ef594a" }
33
+ use_environment = "testnet"
34
+ manifest_digest = "7AFB66695545775FBFBB2D3078ADFD084244D5002392E837FDE21D9EA1C6D01C"
35
+ deps = { MoveStdlib = "MoveStdlib" }
36
+
37
+ [pinned.testnet.suidouble_chat]
38
+ source = { root = true }
39
+ use_environment = "testnet"
40
+ manifest_digest = "CC15E09306E902854F6BDD9B90D21287DB7EC557173965E5355493A2783E25B3"
41
+ deps = { Sui = "Sui" }
@@ -36,6 +36,8 @@ export default class SuiInBrowserAdapter extends SuiCommonMethods {
36
36
  _connectedChain: string | null;
37
37
  /** @type {boolean} */
38
38
  _isConnected: boolean;
39
+ /** @type {boolean} */
40
+ _userDisconnected: boolean;
39
41
  /**
40
42
  * Sign and execute a transaction. Prefers the current `sui:signAndExecuteTransaction`
41
43
  * feature; falls back to the legacy `sui:signAndExecuteTransactionBlock` for older wallets.
@@ -77,10 +79,12 @@ export default class SuiInBrowserAdapter extends SuiCommonMethods {
77
79
  signMessage(params: any): Promise<any>;
78
80
  /**
79
81
  * Disconnect from the wallet and refresh connection state.
82
+ * Force-clears local connection state even if the wallet doesn't support
83
+ * standard:disconnect or doesn't revoke site authorization (e.g. Phantom).
80
84
  * @param {Object} [params]
81
- * @returns {Promise<*>}
85
+ * @returns {Promise<void>}
82
86
  */
83
- disconnect(params?: any): Promise<any>;
87
+ disconnect(params?: any): Promise<void>;
84
88
  /**
85
89
  * Return the Chrome Web Store download URL, or null if not configured.
86
90
  * @returns {?string}