@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/dist/cjs/classes/WalletObserver.class.js +27 -21
- package/dist/cjs/classes/WalletObserver.class.js.map +1 -1
- package/dist/cjs/react-components/hooks/useWalletHandles.js +10 -14
- package/dist/cjs/react-components/hooks/useWalletHandles.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/esm/react-components/hooks/useWalletHandles.js +3 -8
- package/dist/esm/react-components/hooks/useWalletHandles.js.map +1 -1
- package/dist/types/classes/WalletObserver.class.d.ts.map +1 -1
- package/dist/types/react-components/hooks/useWalletHandles.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/src/react-components/hooks/useWalletHandles.ts +4 -10
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
|
/**
|
|
@@ -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
|
};
|