@@ -205,8 +205,9 @@ export class WebClient {
205205 * `SigningInputs.serialize()`. Must return an array of numeric values (numbers or numeric
206206 * strings) representing the signature elements, either directly or wrapped in a `Promise`.
207207 */
208- constructor ( rpcUrl , seed , getKeyCb , insertKeyCb , signCb ) {
208+ constructor ( rpcUrl , noteTransportUrl , seed , getKeyCb , insertKeyCb , signCb ) {
209209 this . rpcUrl = rpcUrl ;
210+ this . noteTransportUrl = noteTransportUrl ;
210211 this . seed = seed ;
211212 this . getKeyCb = getKeyCb ;
212213 this . insertKeyCb = insertKeyCb ;
@@ -278,6 +279,7 @@ export class WebClient {
278279 action : WorkerAction . INIT ,
279280 args : [
280281 this . rpcUrl ,
282+ this . noteTransportUrl ,
281283 this . seed ,
282284 this . getKeyCb ,
283285 this . insertKeyCb ,
@@ -303,15 +305,16 @@ export class WebClient {
303305 * This method is async so you can await the asynchronous call to createClient().
304306 *
305307 * @param {string } rpcUrl - The RPC URL.
308+ * @param {string } noteTransportUrl - The note transport URL (optional).
306309 * @param {string } seed - The seed for the account.
307310 * @returns {Promise<WebClient> } The fully initialized WebClient.
308311 */
309- static async createClient ( rpcUrl , seed ) {
312+ static async createClient ( rpcUrl , noteTransportUrl , seed ) {
310313 // Construct the instance (synchronously).
311- const instance = new WebClient ( rpcUrl , seed ) ;
314+ const instance = new WebClient ( rpcUrl , noteTransportUrl , seed ) ;
312315
313316 // Wait for the underlying wasmWebClient to be initialized.
314- await instance . wasmWebClient . createClient ( rpcUrl , seed ) ;
317+ await instance . wasmWebClient . createClient ( rpcUrl , noteTransportUrl , seed ) ;
315318
316319 // Wait for the worker to be ready
317320 await instance . ready ;
@@ -341,6 +344,7 @@ export class WebClient {
341344 * This method is async so you can await the asynchronous call to createClientWithExternalKeystore().
342345 *
343346 * @param {string } rpcUrl - The RPC URL.
347+ * @param {string | undefined } noteTransportUrl - The note transport URL (optional).
344348 * @param {string | undefined } seed - The seed for the account.
345349 * @param {Function | undefined } getKeyCb - The get key callback.
346350 * @param {Function | undefined } insertKeyCb - The insert key callback.
@@ -349,15 +353,24 @@ export class WebClient {
349353 */
350354 static async createClientWithExternalKeystore (
351355 rpcUrl ,
356+ noteTransportUrl ,
352357 seed ,
353358 getKeyCb ,
354359 insertKeyCb ,
355360 signCb
356361 ) {
357362 // Construct the instance (synchronously).
358- const instance = new WebClient ( rpcUrl , seed , getKeyCb , insertKeyCb , signCb ) ;
363+ const instance = new WebClient (
364+ rpcUrl ,
365+ noteTransportUrl ,
366+ seed ,
367+ getKeyCb ,
368+ insertKeyCb ,
369+ signCb
370+ ) ;
359371 await instance . wasmWebClient . createClientWithExternalKeystore (
360372 rpcUrl ,
373+ noteTransportUrl ,
361374 seed ,
362375 getKeyCb ,
363376 insertKeyCb ,
@@ -551,15 +564,24 @@ export class MockWebClient extends WebClient {
551564 * Factory method to create a WebClient with a mock chain for testing purposes.
552565 *
553566 * @param serializedMockChain - Serialized mock chain data (optional). Will use an empty chain if not provided.
567+ * @param serializedMockNoteTransportNode - Serialized mock note transport node data (optional). Will use a new instance if not provided.
554568 * @param seed - The seed for the account (optional).
555569 * @returns A promise that resolves to a MockWebClient.
556570 */
557- static async createClient ( serializedMockChain , seed ) {
571+ static async createClient (
572+ serializedMockChain ,
573+ serializedMockNoteTransportNode ,
574+ seed
575+ ) {
558576 // Construct the instance (synchronously).
559577 const instance = new MockWebClient ( seed ) ;
560578
561579 // Wait for the underlying wasmWebClient to be initialized.
562- await instance . wasmWebClient . createMockClient ( seed , serializedMockChain ) ;
580+ await instance . wasmWebClient . createMockClient (
581+ seed ,
582+ serializedMockChain ,
583+ serializedMockNoteTransportNode
584+ ) ;
563585
564586 // Wait for the worker to be ready
565587 await instance . ready ;
@@ -591,10 +613,13 @@ export class MockWebClient extends WebClient {
591613 }
592614
593615 let serializedMockChain = this . wasmWebClient . serializeMockChain ( ) . buffer ;
616+ let serializedMockNoteTransportNode =
617+ this . wasmWebClient . serializeMockNoteTransportNode ( ) . buffer ;
594618
595619 const serializedSyncSummaryBytes = await this . callMethodWithWorker (
596620 MethodName . SYNC_STATE_MOCK ,
597- serializedMockChain
621+ serializedMockChain ,
622+ serializedMockNoteTransportNode
598623 ) ;
599624
600625 return wasm . SyncSummary . deserialize (
@@ -625,17 +650,25 @@ export class MockWebClient extends WebClient {
625650 }
626651
627652 args . push ( this . wasmWebClient . serializeMockChain ( ) . buffer ) ;
653+ args . push ( this . wasmWebClient . serializeMockNoteTransportNode ( ) . buffer ) ;
628654
629655 // Always call the same worker method.
630- let serializedMockChain = await this . callMethodWithWorker (
656+ let result = await this . callMethodWithWorker (
631657 MethodName . SUBMIT_TRANSACTION_MOCK ,
632658 ...args
633659 ) ;
634660
635- serializedMockChain = new Uint8Array ( serializedMockChain ) ;
661+ const serializedMockChain = new Uint8Array ( result . serializedMockChain ) ;
662+ const serializedMockNoteTransportNode = new Uint8Array (
663+ result . serializedMockNoteTransportNode
664+ ) ;
636665
637666 this . wasmWebClient = new WasmWebClient ( ) ;
638- await this . wasmWebClient . createMockClient ( this . seed , serializedMockChain ) ;
667+ await this . wasmWebClient . createMockClient (
668+ this . seed ,
669+ serializedMockChain ,
670+ serializedMockNoteTransportNode
671+ ) ;
639672 } catch ( error ) {
640673 console . error ( "INDEX.JS: Error in submitTransaction:" , error . toString ( ) ) ;
641674 throw error ;
0 commit comments