/ packages / contracts / wagmi.config.ts
wagmi.config.ts
 1  import { react } from "npm:@wagmi/cli/plugins";
 2  
 3  const contractsPath = Deno.env.get("MASS_CONTRACTS_PATH");
 4  const abipath = contractsPath + "/abi/";
 5  
 6  async function importJson(path: string) {
 7    const mod = await import(path, {
 8      with: {
 9        type: "json",
10      },
11    });
12    return mod.default;
13  }
14  
15  const PaymentsByAddress = await importJson(
16    abipath + "PaymentsByAddress.json",
17  );
18  const RelayReg = await importJson(abipath + "RelayReg.json");
19  const ShopReg = await importJson(abipath + "ShopReg.json");
20  const Eddies = await importJson(abipath + "Eddies.json");
21  const addresses = await importJson(contractsPath + "/deploymentAddresses.json");
22  
23  export default {
24    out: "src/generated.ts",
25    contracts: [
26      {
27        name: "PaymentsByAddress",
28        abi: PaymentsByAddress,
29        address: addresses.Payments,
30      },
31      {
32        name: "RelayReg",
33        abi: RelayReg,
34        address: addresses.RelayReg,
35      },
36      {
37        name: "ShopReg",
38        abi: ShopReg,
39        address: addresses.ShopReg,
40      },
41      {
42        name: "Eddies",
43        abi: Eddies,
44        address: addresses.Eddies,
45      },
46    ],
47    plugins: [
48      react(),
49      // todo: replace actions plugin
50      // https://github.com/wevm/wagmi/blob/main/packages/cli/src/plugins/actions.ts#L24
51    ],
52  };