/ packages / heartbit-core / src / utils / index.ts
index.ts
 1  import { keccak256, toUtf8Bytes, Contract, type JsonRpcProvider } from "ethers";
 2  import type { SupportedChain } from "../types";
 3  import { CONTRACT_ABI, HEART_BIT_CONFIG } from "../constants";
 4  
 5  export const getHashedString = (str: string) => keccak256(toUtf8Bytes(str));
 6  
 7  export const getMinterContract = (
 8    chain: SupportedChain,
 9    rpcProvider: JsonRpcProvider
10  ): any => {
11    const minterConfig = HEART_BIT_CONFIG[chain];
12    const { contractAddress } = minterConfig;
13  
14    return new Contract(contractAddress, CONTRACT_ABI, rpcProvider);
15  };