Path revert (reduces churn / preserves existing imports): - wagmi.config.ts: out -> src/blockchain/abi.ts (was src/generated.ts) - Restore the 4 import sites (sellerMethods, events, provider, BuyerSearchComponent) to import from './abi' / '@/blockchain/abi' - .gitignore: ignore src/blockchain/abi.ts (was src/generated.ts) The file keeps its original location and is no longer committed — it is regenerated from the smart-contracts submodule artifacts on every prestart via `bun run wagmi:gen`. Infra polish: - package.json: contracts:compile uses pushd/popd (instead of cd) so the shell returns to the project root after the submodule build, even when the script is the leaf of a longer chain - .gitmodules: zkPix submodule pinned to `dev`
33 lines
827 B
TypeScript
33 lines
827 B
TypeScript
import { defineConfig } from '@wagmi/cli';
|
|
import { actions } from '@wagmi/cli/plugins';
|
|
import { readFileSync } from 'node:fs';
|
|
import { resolve } from 'node:path';
|
|
|
|
const artifactsRoot = resolve(
|
|
__dirname,
|
|
'p2pix-smart-contracts/artifacts/contracts',
|
|
);
|
|
|
|
const loadAbi = (relPath: string) => {
|
|
const json = JSON.parse(
|
|
readFileSync(resolve(artifactsRoot, relPath), 'utf8'),
|
|
);
|
|
return json.abi as readonly unknown[];
|
|
};
|
|
|
|
export default defineConfig({
|
|
out: 'src/blockchain/abi.ts',
|
|
contracts: [
|
|
{ name: 'P2Pix', abi: loadAbi('p2pix.sol/P2PIX.json') as never },
|
|
{
|
|
name: 'Reputation',
|
|
abi: loadAbi('Reputation.sol/Reputation.json') as never,
|
|
},
|
|
{
|
|
name: 'MockToken',
|
|
abi: loadAbi('lib/mock/mockToken.sol/MockToken.json') as never,
|
|
},
|
|
],
|
|
plugins: [actions()],
|
|
});
|