@sundaeswap/wallet-lite 0.0.85 → 0.0.87

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.85",
3
+ "version": "0.0.87",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -129,27 +129,28 @@ export class WalletObserver<
129
129
  this._performingSync = true;
130
130
  this.dispatch(EWalletObserverEvents.SYNCING_WALLET_START);
131
131
 
132
- let newNetwork = await this.getNetwork();
133
- if (newNetwork instanceof Error) {
132
+ // Check if account has changed.
133
+ let newBalanceMap = await this.getBalanceMap();
134
+ if (newBalanceMap instanceof Error) {
134
135
  await this.syncApi();
135
- newNetwork = await this.getNetwork();
136
+ newBalanceMap = await this.getBalanceMap();
136
137
 
137
- if (newNetwork instanceof Error) {
138
+ if (newBalanceMap instanceof Error) {
138
139
  this.dispatch(EWalletObserverEvents.SYNCING_WALLET_END);
139
140
  this._performingSync = false;
140
- throw newNetwork;
141
+ throw newBalanceMap;
141
142
  }
142
143
  }
143
144
 
144
145
  const [
145
- newBalanceMap,
146
+ newNetwork,
146
147
  newUsedAddresses,
147
148
  newUnusedAddresses,
148
149
  newOutputs,
149
150
  newCollateral,
150
151
  newFeeAddress,
151
152
  ] = await Promise.all([
152
- this.getBalanceMap(),
153
+ this.getNetwork(),
153
154
  this.getUsedAddresses(),
154
155
  this.getUnusedAddresses(),
155
156
  this.getUtxos(),
@@ -28,7 +28,7 @@ export const useWalletData = <
28
28
  const [error, setError] = useState<DataSignError>();
29
29
 
30
30
  const signData = useCallback(
31
- async ({ signingAddress, payload }: ISignDataParams) => {
31
+ async (params: ISignDataParams) => {
32
32
  if (!state.observer.api) {
33
33
  return;
34
34
  }
@@ -47,13 +47,11 @@ export const useWalletData = <
47
47
 
48
48
  try {
49
49
  const response = await state.observer.api.signData(
50
+ Cardano.Address.fromBech32(params.signingAddress).toBytes(),
50
51
  Buffer.from(
51
- Cardano.Address.fromBech32(signingAddress).toBytes(),
52
- ).toString("hex"),
53
- Buffer.from(
54
- typeof payload === "string"
55
- ? payload
56
- : JSON.stringify(payload, null, 0),
52
+ typeof params.payload === "string"
53
+ ? params.payload
54
+ : JSON.stringify(params.payload, null, 0),
57
55
  "utf-8",
58
56
  ).toString("hex"),
59
57
  );