Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

851 B
Raw Blame
const { network } = require('hardhat');
const { expect } = require('chai');

const { unique } = require('./iterate');

async function batchInBlock(txs, provider = network.provider) {
  try {
    // disable auto-mining
    await provider.send('evm_setAutomine', [false]);
    // send all transactions
    const responses = await Promise.all(txs.map(fn => fn()));
    // mine one block
    await provider.send('evm_mine');
    // fetch receipts
    const receipts = await Promise.all(responses.map(response => response.wait()));
    // Sanity check, all tx should be in the same block
    expect(unique(receipts.map(receipt => receipt.blockNumber))).to.have.lengthOf(1);
    // return responses
    return receipts;
  } finally {
    // enable auto-mining
    await provider.send('evm_setAutomine', [true]);
  }
}

module.exports = {
  batchInBlock,
};