import { NO_WAIT } from '@aztec/aztec.js/contracts';
import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields';
import { TxStatus } from '@aztec/aztec.js/tx';
import { times } from '@aztec/foundation/collection';
// submits a set of transactions to the provided Wallet
export const submitTxsTo = async (wallet, submitter, numTxs, logger)=>{
    const txHashes = [];
    await Promise.all(times(numTxs, async ()=>{
        const accountManager = await wallet.createSchnorrAccount(Fr.random(), Fr.random(), GrumpkinScalar.random());
        const deployMethod = await accountManager.getDeployMethod();
        const { txHash } = await deployMethod.send({
            from: submitter,
            wait: NO_WAIT
        });
        logger.info(`Tx sent with hash ${txHash}`);
        const receipt = await wallet.getTxReceipt(txHash);
        expect(receipt.status).toBe(TxStatus.PENDING);
        logger.info(`Receipt received for ${txHash}`);
        txHashes.push(txHash);
    }));
    return txHashes;
};
