diff --git a/.jest/setEnvVars.js b/.jest/setEnvVars.js new file mode 100644 index 000000000..1370b9eae --- /dev/null +++ b/.jest/setEnvVars.js @@ -0,0 +1 @@ +process.env.DEPLOYER_ADDRESS = 'erd1qqqqqqqqqqqqqpgqut6lamz9dn480ytj8cmcwvydcu3lj55epltq9t9kam'; diff --git a/package.json b/package.json index 88e9238f6..72e568aa6 100644 --- a/package.json +++ b/package.json @@ -143,6 +143,9 @@ ], "moduleDirectories": [ "node_modules" + ], + "setupFiles": [ + "/.jest/setEnvVars.js" ] } } diff --git a/src/modules/minters/minters-deployer.abi.service.ts b/src/modules/minters/minters-deployer.abi.service.ts index ad050cebb..30073111e 100644 --- a/src/modules/minters/minters-deployer.abi.service.ts +++ b/src/modules/minters/minters-deployer.abi.service.ts @@ -11,7 +11,7 @@ export class MintersDeployerAbiService { private contract = new ContractLoader(MarketplaceUtils.deployerMintersAbiPath, MarketplaceUtils.deployerAbiInterface); async deployMinter(request: DeployMinterRequest): Promise { - const contract = await this.contract.getContract('erd1qqqqqqqqqqqqqpgqut6lamz9dn480ytj8cmcwvydcu3lj55epltq9t9kam'); + const contract = await this.contract.getContract(process.env.DEPLOYER_ADDRESS); return contract.methodsExplicit .createNftMinter([ @@ -27,7 +27,7 @@ export class MintersDeployerAbiService { } async pauseNftMinter(ownerAddress: string, request: UpgradeMinterRequest): Promise { - const contract = await this.contract.getContract('erd1qqqqqqqqqqqqqpgqut6lamz9dn480ytj8cmcwvydcu3lj55epltq9t9kam'); + const contract = await this.contract.getContract(process.env.DEPLOYER_ADDRESS); return contract.methodsExplicit .pauseNftMinter([new AddressValue(new Address(request.minterAddress))]) @@ -38,7 +38,7 @@ export class MintersDeployerAbiService { } async resumeNftMinter(ownerAddress: string, request: UpgradeMinterRequest): Promise { - const contract = await this.contract.getContract('erd1qqqqqqqqqqqqqpgqut6lamz9dn480ytj8cmcwvydcu3lj55epltq9t9kam'); + const contract = await this.contract.getContract(process.env.DEPLOYER_ADDRESS); return contract.methodsExplicit .resumeNftMinter([new AddressValue(new Address(request.minterAddress))]) diff --git a/src/modules/minters/minters-mutations.resolver.ts b/src/modules/minters/minters-mutations.resolver.ts index 6804bc028..0b618ffbc 100644 --- a/src/modules/minters/minters-mutations.resolver.ts +++ b/src/modules/minters/minters-mutations.resolver.ts @@ -27,26 +27,20 @@ export class MintersMutationsResolver extends BaseResolver(MintersResponse) { } @Mutation(() => TransactionNode) - // @UseGuards(JwtOrNativeAuthGuard, GqlAdminAuthGuard) + @UseGuards(JwtOrNativeAuthGuard, GqlAdminAuthGuard) async deployMinter(@Args('input') input: DeployMinterArgs): Promise { return await this.minterDeployerService.deployMinter(DeployMinterRequest.fromArgs(input)); } @Mutation(() => TransactionNode) @UseGuards(JwtOrNativeAuthGuard, GqlAdminAuthGuard) - async pauseMinter( - @Args('input') input: UpgradeMinterArgs, - @AuthUser() user: UserAuthResult, - ): Promise { + async pauseMinter(@Args('input') input: UpgradeMinterArgs, @AuthUser() user: UserAuthResult): Promise { return await this.minterDeployerService.pauseNftMinter(user.address, UpgradeMinterRequest.fromArgs(input)); } @Mutation(() => TransactionNode) @UseGuards(JwtOrNativeAuthGuard, GqlAdminAuthGuard) - async resumeMinter( - @Args('input') input: UpgradeMinterArgs, - @AuthUser() user: UserAuthResult, - ): Promise { + async resumeMinter(@Args('input') input: UpgradeMinterArgs, @AuthUser() user: UserAuthResult): Promise { return await this.minterDeployerService.resumeNftMinter(user.address, UpgradeMinterRequest.fromArgs(input)); } } diff --git a/test/jest-config.json b/test/jest-config.json index 5e0712ddd..de03bc223 100644 --- a/test/jest-config.json +++ b/test/jest-config.json @@ -7,5 +7,6 @@ "transform": { "^.+\\.(t|j)s$": "ts-jest" }, - "coverageDirectory": "./coverage/unit" + "coverageDirectory": "./coverage/unit", + "setupFiles": ["/.jest/setEnvVars.js"] }