getProviders function not working properly

Hello I am facing issues in getproviders here it is not returning any instance. I am not even getting an error export async function getProviders(wallet ) {
try {
const zkConfigPath = path.resolve(
currentDir,
“contract-nft-verification”,
“src”,
“managed”,
“NFTVerification”
);

const walletProvider = await getWalletProvider(wallet );
console.log(walletProvider);

return {
  privateStateProvider: levelPrivateStateProvider({
    privateStateStoreName: "counter-private-state",
  }),
  publicDataProvider: indexerPublicDataProvider(
    config.indexer,
    config.indexerWS
  ),
  zkConfigProvider: new NodeZkConfigProvider(zkConfigPath),
  proofProvider: httpClientProofProvider(config.proofServer),
  walletProvider,
  midnightProvider: walletProvider,
};

} catch (err) {
console.error(“:cross_mark: Failed to initialize providers:”, err);
throw err;
}
} This is the corresponding getwalletprovider async function getWalletProvider(wallet) {
const state = await Rx.firstValueFrom(wallet.state());

return {
coinPublicKey: state.coinPublicKey,
encryptionPublicKey: state.encryptionPublicKey,
async balanceTx(tx, newCoins) {
return wallet
.balanceTransaction(
ZswapTransaction.deserialize(tx.serialize(), getZswapNetworkId()),
newCoins
)
.then((tx) => wallet.proveTransaction(tx))
.then((zswapTx) =>
Transaction.deserialize(zswapTx.serialize(getZswapNetworkId()), getLedgerNetworkId())
)
.then(createBalancedTx);
},
submitTx(tx) {
return wallet.submitTransaction(tx);
},
};
}
This is the corresponding config file
const config = {
indexer: “https://indexer.testnet-02.midnight.network/api/v1/graphql”,
indexerWS: “wss://indexer.testnet-02.midnight.network/api/v1/graphql/ws”,
node: “https://rpc.testnet-02.midnight.network/”,
proofServer: “http://127.0.0.1:6300/”,
};

1 Like

Hi!
I am sorry, but the code is a little bit hard to read for me, do you have it in a public repo? I would also like to see where the function is called, I don’t see what could be wrong with the code you shared.
Thank you!

hey @abhinav as @claude_barde mentions, the plain text code format is difficult to understand. Could you please put it in markdown and adjust the steps? Or send us the link to the repository! I’m happy to help you! Thanks.