@midnight-ntwrk/wallet-sdk-shielded 1.0.0-beta.12 → 1.0.0-beta.13
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/v1/Sync.js +4 -2
- package/package.json +5 -5
package/dist/v1/Sync.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import * as ledger from '@midnight-ntwrk/ledger-v6';
|
|
14
|
-
import { Effect, ParseResult, Stream, Schema, pipe, Either } from 'effect';
|
|
14
|
+
import { Effect, ParseResult, Stream, Schema, pipe, Either, Duration } from 'effect';
|
|
15
15
|
import { CoreWallet } from './CoreWallet.js';
|
|
16
16
|
import { ZswapEvents } from '@midnight-ntwrk/wallet-sdk-indexer-client';
|
|
17
17
|
import { WsSubscriptionClient, ConnectionHelper } from '@midnight-ntwrk/wallet-sdk-indexer-client/effect';
|
|
@@ -97,7 +97,9 @@ export const makeEventsSyncService = (config) => {
|
|
|
97
97
|
}
|
|
98
98
|
const indexerWsUrl = indexerWsUrlResult.right;
|
|
99
99
|
const appliedIndex = state.progress?.appliedIndex ?? 0n;
|
|
100
|
-
|
|
100
|
+
const batchSize = 50;
|
|
101
|
+
const batchTimeout = Duration.seconds(10);
|
|
102
|
+
return pipe(ZswapEvents.run({ id: Number(appliedIndex) }), Stream.provideLayer(WsSubscriptionClient.layer({ url: indexerWsUrl })), Stream.mapError((error) => new SyncWalletError(error)), Stream.mapEffect((subscription) => pipe(Schema.decodeUnknownEither(EventsSyncUpdateFromPayload)(subscription.zswapLedgerEvents), Either.mapLeft((err) => new SyncWalletError(err)), EitherOps.toEffect)), Stream.map((data) => WalletSyncUpdate.create(data, secretKeys)), Stream.groupedWithin(batchSize, batchTimeout), Stream.flatMap((chunk) => Stream.fromIterable(chunk)));
|
|
101
103
|
},
|
|
102
104
|
};
|
|
103
105
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midnight-ntwrk/wallet-sdk-shielded",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
"@midnight-ntwrk/wallet-sdk-abstractions": "1.0.0-beta.9",
|
|
33
33
|
"@midnight-ntwrk/wallet-sdk-address-format": "3.0.0-beta.9",
|
|
34
34
|
"@midnight-ntwrk/wallet-sdk-capabilities": "3.0.0-beta.9",
|
|
35
|
-
"@midnight-ntwrk/wallet-sdk-indexer-client": "1.0.0-beta.
|
|
35
|
+
"@midnight-ntwrk/wallet-sdk-indexer-client": "1.0.0-beta.14",
|
|
36
36
|
"@midnight-ntwrk/wallet-sdk-node-client": "1.0.0-beta.10",
|
|
37
|
-
"@midnight-ntwrk/wallet-sdk-prover-client": "1.0.0-beta.
|
|
38
|
-
"@midnight-ntwrk/wallet-sdk-runtime": "1.0.0-beta.
|
|
39
|
-
"@midnight-ntwrk/wallet-sdk-utilities": "1.0.0-beta.
|
|
37
|
+
"@midnight-ntwrk/wallet-sdk-prover-client": "1.0.0-beta.11",
|
|
38
|
+
"@midnight-ntwrk/wallet-sdk-runtime": "1.0.0-beta.9",
|
|
39
|
+
"@midnight-ntwrk/wallet-sdk-utilities": "1.0.0-beta.8",
|
|
40
40
|
"@scure/base": "^1.1.9",
|
|
41
41
|
"effect": "^3.17.3",
|
|
42
42
|
"isomorphic-ws": "^5.0.0",
|