Batch namespace provides utilities for joining and processing batch session. The batch settlement process involves multiple events, this namespace provides abstractions and types to handle them.
https://docs.arkadeos.com/learn/pillars/batch-swaps
// use wallet handler or create a custom oneconst handler = wallet.createBatchHandler(intentId, inputs, musig2session);const abortController = new AbortController();// Get event stream from Ark providerconst eventStream = arkProvider.getEventStream( abortController.signal, ['your-topic-1', 'your-topic-2']);// Join the batch and process eventstry { const commitmentTxid = await Batch.join(eventStream, handler); console.log('Batch completed with commitment:', commitmentTxid);} catch (error) { console.error('Batch processing failed:', error);} finally { abortController.abort();} Copy
// use wallet handler or create a custom oneconst handler = wallet.createBatchHandler(intentId, inputs, musig2session);const abortController = new AbortController();// Get event stream from Ark providerconst eventStream = arkProvider.getEventStream( abortController.signal, ['your-topic-1', 'your-topic-2']);// Join the batch and process eventstry { const commitmentTxid = await Batch.join(eventStream, handler); console.log('Batch completed with commitment:', commitmentTxid);} catch (error) { console.error('Batch processing failed:', error);} finally { abortController.abort();}
Batch namespace provides utilities for joining and processing batch session. The batch settlement process involves multiple events, this namespace provides abstractions and types to handle them.
See
https://docs.arkadeos.com/learn/pillars/batch-swaps
Example