@sundaeswap/wallet-lite 0.0.20 → 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/dist/cjs/classes/WalletObserver.class.js +27 -21
- package/dist/cjs/classes/WalletObserver.class.js.map +1 -1
- package/dist/esm/classes/WalletObserver.class.js +26 -21
- package/dist/esm/classes/WalletObserver.class.js.map +1 -1
- package/dist/types/classes/WalletObserver.class.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/classes/WalletObserver.class.ts +41 -36
package/package.json
CHANGED
|
@@ -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
|
-
|
|
147
|
-
|
|
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
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
-
|
|
182
|
-
|
|
182
|
+
this.dispatch(EWalletObserverEvents.SYNCING_WALLET_END, result);
|
|
183
|
+
this._performingSync = false;
|
|
183
184
|
|
|
184
|
-
|
|
185
|
+
return result;
|
|
186
|
+
} catch (e) {
|
|
187
|
+
this._performingSync = false;
|
|
188
|
+
throw e;
|
|
189
|
+
}
|
|
185
190
|
};
|
|
186
191
|
|
|
187
192
|
/**
|