From 6c083df0219ef18c39eca05b157de0dc9d3e7353 Mon Sep 17 00:00:00 2001 From: frankie Date: Wed, 18 Sep 2024 13:27:01 -1000 Subject: [PATCH] create program formating function --- src/registration/index.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/registration/index.ts b/src/registration/index.ts index 159783c5..e6080a6c 100644 --- a/src/registration/index.ts +++ b/src/registration/index.ts @@ -92,13 +92,7 @@ export default class RegistrationManager extends ExtrinsicBaseClass { const registerTx = this.substrate.tx.registry.register( programDeployer, keyVisibility, - programData.map((programInfo) => { - const program: ProgramInstance = { program_pointer: programInfo.program_pointer } - if (programInfo.program_config) program.program_config = Array.from( - Buffer.from(JSON.stringify(programInfo.program_config)) - ) - return program - }) + programData.map(this.#formatProgramInfo) ) // @ts-ignore: next line // Send the registration transaction and wait for the result. @@ -159,4 +153,12 @@ export default class RegistrationManager extends ExtrinsicBaseClass { }) }) } + + #formatProgramInfo (programInfo): ProgramInstance { + const program: ProgramInstance = { program_pointer: programInfo.program_pointer } + if (programInfo.program_config) program.program_config = Array.from( + Buffer.from(JSON.stringify(programInfo.program_config)) + ) + return program + } }