Skip to content

Commit

Permalink
update: configs and chains
Browse files Browse the repository at this point in the history
  • Loading branch information
yawn-c111 committed Oct 2, 2024
1 parent 8ca3cac commit 99d6211
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
13 changes: 13 additions & 0 deletions pkgs/cli/src/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Address } from "viem";
import { HATS_ABI } from "./abi/hats";
import { HATS_TIME_FRAME_MODULE_ABI } from "./abi/hatsTimeFrameModule";

export const hatsContractBaseConfig = {
address: "0x0000000000000000000000000000000000004a75" as Address,
abi: HATS_ABI,
};

export const hatsTimeFrameContractBaseConfig = {
address: "0xd4a66507ea8c8382fa8474ed6cae4163676a434a" as Address,
abi: HATS_TIME_FRAME_MODULE_ABI,
};
19 changes: 5 additions & 14 deletions pkgs/cli/src/modules/hatsProtocol.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { HatsSubgraphClient } from "@hatsprotocol/sdk-v1-subgraph";
import { Address, getContract, PublicClient, WalletClient } from "viem";
import { Address, PublicClient, WalletClient } from "viem";
import { base, optimism, sepolia } from "viem/chains";
import { HATS_ABI } from "../abi/hats";
import { HATS_TIME_FRAME_MODULE_ABI } from "../abi/hatsTimeFrameModule";
import { simulateContract } from "viem/_types/actions/public/simulateContract";
import {
hatsContractBaseConfig,
hatsTimeFrameContractBaseConfig,
} from "../config";

// ###############################################################
// Read with subgraph
Expand Down Expand Up @@ -105,16 +106,6 @@ export const getWearerInfo = async (walletAddress: string) => {
// Write with viem
// ###############################################################

const hatsContractBaseConfig = {
address: "0x0000000000000000000000000000000000004a75" as Address,
abi: HATS_ABI,
};

const hatsTimeFrameContractBaseConfig = {
address: "0x0000000000000000000000000000000000004a75" as Address,
abi: HATS_TIME_FRAME_MODULE_ABI,
};

/**
* 新規Hat作成
*/
Expand Down
4 changes: 2 additions & 2 deletions pkgs/cli/src/modules/viem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
import { privateKeyToAccount } from "viem/accounts";
import { hardhat, sepolia, holesky } from "viem/chains";

const chains = [hardhat, sepolia, holesky];
const chains = [hardhat, holesky, sepolia];

export const getChainById = (chainId: number | string): Chain => {
const numericChainId = Number(chainId);
Expand All @@ -27,7 +27,7 @@ export const getChainById = (chainId: number | string): Chain => {
export const getChainOrDefault = (
chainId: number | string | undefined
): Chain => {
return chainId ? getChainById(chainId) : holesky;
return chainId ? getChainById(chainId) : sepolia;
};

export const getPublicClient = async (chainId?: number | undefined) => {
Expand Down

0 comments on commit 99d6211

Please sign in to comment.