@dynamic-labs/starknet 1.1.0-alpha.22 → 1.1.0-alpha.24

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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,19 @@
1
1
 
2
+ ## [1.1.0-alpha.24](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.23...v1.1.0-alpha.24) (2024-02-02)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * remove isFullyConnected when unable to restore wallet ([#4575](https://github.com/dynamic-labs/DynamicAuth/issues/4575)) ([4504ff0](https://github.com/dynamic-labs/DynamicAuth/commit/4504ff03f594cd9a60055e6f52b7ea8001542bbe))
8
+
9
+ ## [1.1.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.22...v1.1.0-alpha.23) (2024-02-01)
10
+
11
+
12
+ ### Features
13
+
14
+ * bitcoin signPsbt ([3c964de](https://github.com/dynamic-labs/DynamicAuth/commit/3c964dea8a55debaf184c5a94f0f5fabdda3c877))
15
+ * embedded wallet email auth flow ([#4353](https://github.com/dynamic-labs/DynamicAuth/issues/4353)) ([4875da3](https://github.com/dynamic-labs/DynamicAuth/commit/4875da32c47c27facef1b1cdbdc214566bbfd171))
16
+
2
17
  ## [1.1.0-alpha.22](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.21...v1.1.0-alpha.22) (2024-02-01)
3
18
 
4
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/starknet",
3
- "version": "1.1.0-alpha.22",
3
+ "version": "1.1.0-alpha.24",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -30,12 +30,12 @@
30
30
  "get-starknet-core": "^3.2.0",
31
31
  "text-encoding": "0.7.0",
32
32
  "starknetkit": "1.1.3",
33
- "@dynamic-labs/sdk-api": "0.0.356",
34
- "@dynamic-labs/rpc-providers": "1.1.0-alpha.22",
35
- "@dynamic-labs/types": "1.1.0-alpha.22",
36
- "@dynamic-labs/utils": "1.1.0-alpha.22",
37
- "@dynamic-labs/wallet-book": "1.1.0-alpha.22",
38
- "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.22"
33
+ "@dynamic-labs/sdk-api": "0.0.361",
34
+ "@dynamic-labs/rpc-providers": "1.1.0-alpha.24",
35
+ "@dynamic-labs/types": "1.1.0-alpha.24",
36
+ "@dynamic-labs/utils": "1.1.0-alpha.24",
37
+ "@dynamic-labs/wallet-book": "1.1.0-alpha.24",
38
+ "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.24"
39
39
  },
40
40
  "peerDependencies": {}
41
41
  }
@@ -86,6 +86,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
86
86
  try {
87
87
  if (wallet && !wallet.isConnected) {
88
88
  yield wallet.enable({ starknetVersion: this.STARKNET_VERSION });
89
+ localStorage.setItem('dynamic_should_have_wallet', 'true');
89
90
  }
90
91
  }
91
92
  catch (err) {
@@ -152,6 +153,7 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
152
153
  }
153
154
  endSession() {
154
155
  return _tslib.__awaiter(this, void 0, void 0, function* () {
156
+ localStorage.removeItem('dynamic_should_have_wallet');
155
157
  getStarknetCore.getStarknet().disconnect({ clearLastWallet: true });
156
158
  });
157
159
  }
@@ -179,7 +181,27 @@ class StarknetWalletConnector extends walletConnectorCore.WalletConnectorBase {
179
181
  }
180
182
  const needsReconnection = !wallet.isConnected && (yield wallet.isPreauthorized());
181
183
  if (needsReconnection) {
182
- yield this.connect();
184
+ /**
185
+ * this is a hack for braavos
186
+ * it is needed because the wallet doesn't return any addresses or connected state
187
+ * without a reconnection, and when the wallet is locked, the connect call never resolves
188
+ */
189
+ if (localStorage.getItem('dynamic_should_have_wallet') === 'true') {
190
+ try {
191
+ yield utils.retryableFn(this.connect.bind(this), {
192
+ maxRetries: 0,
193
+ retryStrategy: 'timeout-only',
194
+ timeoutMs: 1000,
195
+ });
196
+ }
197
+ catch (_a) {
198
+ localStorage.removeItem('dynamic_should_have_wallet');
199
+ return [];
200
+ }
201
+ }
202
+ else {
203
+ yield this.connect();
204
+ }
183
205
  }
184
206
  const getSelectedAddress = () => wallet.selectedAddress
185
207
  ? Promise.resolve([wallet.selectedAddress])
@@ -82,6 +82,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
82
82
  try {
83
83
  if (wallet && !wallet.isConnected) {
84
84
  yield wallet.enable({ starknetVersion: this.STARKNET_VERSION });
85
+ localStorage.setItem('dynamic_should_have_wallet', 'true');
85
86
  }
86
87
  }
87
88
  catch (err) {
@@ -148,6 +149,7 @@ class StarknetWalletConnector extends WalletConnectorBase {
148
149
  }
149
150
  endSession() {
150
151
  return __awaiter(this, void 0, void 0, function* () {
152
+ localStorage.removeItem('dynamic_should_have_wallet');
151
153
  getStarknet().disconnect({ clearLastWallet: true });
152
154
  });
153
155
  }
@@ -175,7 +177,27 @@ class StarknetWalletConnector extends WalletConnectorBase {
175
177
  }
176
178
  const needsReconnection = !wallet.isConnected && (yield wallet.isPreauthorized());
177
179
  if (needsReconnection) {
178
- yield this.connect();
180
+ /**
181
+ * this is a hack for braavos
182
+ * it is needed because the wallet doesn't return any addresses or connected state
183
+ * without a reconnection, and when the wallet is locked, the connect call never resolves
184
+ */
185
+ if (localStorage.getItem('dynamic_should_have_wallet') === 'true') {
186
+ try {
187
+ yield retryableFn(this.connect.bind(this), {
188
+ maxRetries: 0,
189
+ retryStrategy: 'timeout-only',
190
+ timeoutMs: 1000,
191
+ });
192
+ }
193
+ catch (_a) {
194
+ localStorage.removeItem('dynamic_should_have_wallet');
195
+ return [];
196
+ }
197
+ }
198
+ else {
199
+ yield this.connect();
200
+ }
179
201
  }
180
202
  const getSelectedAddress = () => wallet.selectedAddress
181
203
  ? Promise.resolve([wallet.selectedAddress])