From 47ecf3d7c25ff1e1fcdc0c37d0492ba215e44a9e Mon Sep 17 00:00:00 2001 From: Maycon Date: Thu, 28 Nov 2024 15:46:18 -0300 Subject: [PATCH] fixing integration tests --- .../wasm/src/services/blockchain/service.ts | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/wasm/src/services/blockchain/service.ts b/packages/wasm/src/services/blockchain/service.ts index ea7140ce..c7650ff3 100644 --- a/packages/wasm/src/services/blockchain/service.ts +++ b/packages/wasm/src/services/blockchain/service.ts @@ -5,9 +5,9 @@ import { CheqdAPI } from '@docknetwork/cheqd-blockchain-api'; import { CheqdCoreModules } from '@docknetwork/cheqd-blockchain-modules'; import { MultiApiCoreModules } from '@docknetwork/credential-sdk/modules'; import { + CoreResolver, DIDKeyResolver, ResolverRouter, - CoreResolver, UniversalResolver, WILDCARD, } from '@docknetwork/credential-sdk/resolver'; @@ -110,28 +110,30 @@ export class BlockchainService { Logger.info(`Substrate initialized at: ${params.address}`); - const checkdApiUrl = params?.cheqdApiUrl; - const cheqdNetworkId = params?.networkId; - const cheqdMnemonic = params?.cheqdMnemonic || await utilCryptoService.mnemonicGenerate(12); + if (params?.cheqdApiUrl) { + const checkdApiUrl = params?.cheqdApiUrl; + const cheqdNetworkId = params?.networkId; + const cheqdMnemonic = params?.cheqdMnemonic || await utilCryptoService.mnemonicGenerate(12); - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(cheqdMnemonic, { - prefix: 'cheqd', - }); + const wallet = await DirectSecp256k1HdWallet.fromMnemonic(cheqdMnemonic, { + prefix: 'cheqd', + }); - const walletAccounts = await wallet.getAccounts(); - const [{address}] = walletAccounts; - console.log('Using cheqd account:', address); + const walletAccounts = await wallet.getAccounts(); + const [{address}] = walletAccounts; + console.log('Using cheqd account:', address); - Logger.info(`Attempt to initialized cheqd at: ${checkdApiUrl}`); - Logger.info(`Using cheqd account: ${address}`); + Logger.info(`Attempt to initialized cheqd at: ${checkdApiUrl}`); + Logger.info(`Using cheqd account: ${address}`); - await this.cheqdApi.init({ - wallet, - url: checkdApiUrl, - network: cheqdNetworkId, - }); + await this.cheqdApi.init({ + wallet, + url: checkdApiUrl, + network: cheqdNetworkId, + }); - Logger.info(`Cheqd initialized at: ${checkdApiUrl}`); + Logger.info(`Cheqd initialized at: ${checkdApiUrl}`); + } this.address = params.address;