From bedab3a9f3ff421197bf2eec0d2e158a1d5ecf7d Mon Sep 17 00:00:00 2001 From: jawndiego Date: Fri, 10 Nov 2023 09:46:07 -0500 Subject: [PATCH] changes to test to reflect classes. changed naming convention in programs for consistency. --- src/programs/index.ts | 10 +++++----- src/registration/index.ts | 4 ++-- tests/index.test.ts | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/programs/index.ts b/src/programs/index.ts index cfa10587..965ed30a 100644 --- a/src/programs/index.ts +++ b/src/programs/index.ts @@ -138,13 +138,13 @@ export default class ProgramManager extends ExtrinsicBaseClass { } async checkAuthorization ( - ownerAccount: string, - delegateAccount: string + sigReqAccount: string, + programModAccount: string ): Promise { // Get authorization status from Substrate - const authorizationStatus: Option = ((await this.substrate.query.programs.getAuthorizationStatus( - ownerAccount, - delegateAccount + const authorizationStatus: Option = ((await this.substrate.query.programs.allowedToModifyProgram( + sigReqAccount, + programModAccount )) as unknown) as Option // Check if the Option is populated with a value diff --git a/src/registration/index.ts b/src/registration/index.ts index 0ce40686..2b611871 100644 --- a/src/registration/index.ts +++ b/src/registration/index.ts @@ -6,8 +6,8 @@ export interface RegistrationParams { freeTx?: boolean initialProgram?: string keyVisibility?: 'Public' | 'Permissioned' | 'Private' - programModAccount?: Address - address: Address + programModAccount: Address + address?: Address } /** diff --git a/tests/index.test.ts b/tests/index.test.ts index 334aaba4..f17a59e8 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -71,9 +71,10 @@ it('should handle registration, program management, and signing', async () => { try { await entropy.register({ - address: charlieStashAddress, + programModAccount: charlieStashAddress, keyVisibility: 'Permissioned', freeTx: false, + initialProgram: '0x' }) } catch (e) { console.error('Error in test:', e.message) @@ -111,7 +112,7 @@ it('should handle registration, program management, and signing', async () => { const dummyProgram: any = readFileSync( './tests/testing-utils/template_barebones.wasm' ) - await entropy.programs.set(dummyProgram) + await entropy.programs.set(dummyProgram, charlieStashAddress) console.log('set program') // Retrieve the program and compare const fetchedProgram: ArrayBuffer = await entropy.programs.get()