From 1747908d20382534b8599ea11b30660a351b93fc Mon Sep 17 00:00:00 2001 From: NicolasCantu Date: Mon, 3 Mar 2025 23:22:28 +0100 Subject: [PATCH] Take a username at pairing --- src/utils/sp-address.utils.ts | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/utils/sp-address.utils.ts b/src/utils/sp-address.utils.ts index 90cee47..4405ef8 100755 --- a/src/utils/sp-address.utils.ts +++ b/src/utils/sp-address.utils.ts @@ -169,10 +169,25 @@ export async function prepareAndSendPairingTx(secondDeviceAddress: string) { } catch (e) { throw e; } - // Create the process + + // Prompt the user for a username. + const userName = prompt("Please enter your user name:"); + if (!userName) { + throw new Error("User name is required for the pairing process."); + } + + // Create the process after a delay. setTimeout(async () => { - const relayAddress = service.getAllRelays(); - const createPairingProcessReturn = await service.createPairingProcess([secondDeviceAddress], relayAddress[0].spAddress, 1); + const relayAddress = service.getAllRelays(); + + // Pass the userName as an additional parameter. + const createPairingProcessReturn = await service.createPairingProcess( + userName, + [secondDeviceAddress], + relayAddress[0].spAddress, + 1, + userName + ); if (!createPairingProcessReturn.updated_process) { throw new Error('createPairingProcess returned an empty new process'); // This should never happen