@sundaeswap/wallet-lite 0.0.19 → 0.0.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sundaeswap/wallet-lite",
3
- "version": "0.0.19",
3
+ "version": "0.0.21",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -138,50 +138,55 @@ export class WalletObserver<
138
138
  );
139
139
  }
140
140
 
141
- this._performingSync = true;
142
- this.dispatch(EWalletObserverEvents.SYNCING_WALLET_START);
143
-
144
- let newNetwork: number;
145
141
  try {
146
- newNetwork = await this.getNetwork();
147
- } catch (e) {
142
+ this._performingSync = true;
143
+ this.dispatch(EWalletObserverEvents.SYNCING_WALLET_START);
144
+
145
+ let newNetwork: number;
148
146
  try {
149
- await this.syncApi();
150
147
  newNetwork = await this.getNetwork();
151
148
  } catch (e) {
152
- this.dispatch(EWalletObserverEvents.SYNCING_WALLET_END);
153
- this._performingSync = false;
154
- throw e;
149
+ try {
150
+ await this.syncApi();
151
+ newNetwork = await this.getNetwork();
152
+ } catch (e) {
153
+ this.dispatch(EWalletObserverEvents.SYNCING_WALLET_END);
154
+ this._performingSync = false;
155
+ throw e;
156
+ }
155
157
  }
156
- }
157
158
 
158
- const [
159
- newBalanceMap,
160
- newUsedAddresses,
161
- newUnusedAddresses,
162
- newOutputs,
163
- newCollateral,
164
- ] = await Promise.all([
165
- this.getBalanceMap(),
166
- this.getUsedAddresses(),
167
- this.getUnusedAddresses(),
168
- this.getUtxos(),
169
- this.getCollateral(),
170
- ]);
171
-
172
- const result = {
173
- balanceMap: newBalanceMap,
174
- usedAddresses: newUsedAddresses,
175
- unusedAddresses: newUnusedAddresses,
176
- utxos: newOutputs,
177
- collateral: newCollateral,
178
- network: newNetwork,
179
- };
159
+ const [
160
+ newBalanceMap,
161
+ newUsedAddresses,
162
+ newUnusedAddresses,
163
+ newOutputs,
164
+ newCollateral,
165
+ ] = await Promise.all([
166
+ this.getBalanceMap(),
167
+ this.getUsedAddresses(),
168
+ this.getUnusedAddresses(),
169
+ this.getUtxos(),
170
+ this.getCollateral(),
171
+ ]);
172
+
173
+ const result = {
174
+ balanceMap: newBalanceMap,
175
+ usedAddresses: newUsedAddresses,
176
+ unusedAddresses: newUnusedAddresses,
177
+ utxos: newOutputs,
178
+ collateral: newCollateral,
179
+ network: newNetwork,
180
+ };
180
181
 
181
- this.dispatch(EWalletObserverEvents.SYNCING_WALLET_END, result);
182
- this._performingSync = false;
182
+ this.dispatch(EWalletObserverEvents.SYNCING_WALLET_END, result);
183
+ this._performingSync = false;
183
184
 
184
- return result;
185
+ return result;
186
+ } catch (e) {
187
+ this._performingSync = false;
188
+ throw e;
189
+ }
185
190
  };
186
191
 
187
192
  /**
@@ -33,20 +33,16 @@ export const useWalletHandles = <
33
33
  }
34
34
 
35
35
  try {
36
- const {
37
- default: HandleClient,
38
- HandleClientContext,
39
- KoraLabsProvider,
40
- } = await import("@koralabs/adahandle-sdk");
36
+ const HandleClient = await import("@koralabs/adahandle-sdk");
41
37
  const context =
42
38
  state.network === 1
43
- ? HandleClientContext.MAINNET
44
- : HandleClientContext.PREVIEW;
39
+ ? HandleClient.HandleClientContext.MAINNET
40
+ : HandleClient.HandleClientContext.PREVIEW;
45
41
 
46
42
  // @ts-ignore Type isn't exported from default.
47
43
  const sdk = new HandleClient({
48
44
  context,
49
- provider: new KoraLabsProvider(context),
45
+ provider: new HandleClient.KoraLabsProvider(context),
50
46
  });
51
47
 
52
48
  // Restore once SDK updated
@@ -122,7 +118,5 @@ export const useWalletHandles = <
122
118
  [handles, loadingHandles]
123
119
  );
124
120
 
125
- console.log(handles, loadingHandles);
126
-
127
121
  return data;
128
122
  };