Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
GalaxySciTech committed Nov 8, 2023
1 parent 7b6b9bb commit 8d519e8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/conntroller/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Cache } from "../service/cache";
import { ForkingError } from "./../errors/forkingError";
import { Nofications } from "../service/notification";
import bunyan from "bunyan";
import zero from "../service/zero";
import { getBlock } from "../service/zero";

const chunkByMaxFetchSize = chunkBy(config.chunkSize);
export class Worker {
Expand Down Expand Up @@ -128,7 +128,7 @@ export class Worker {
}

async synchronization(): Promise<void> {

await getBlock();
this.logger.info(
"Start the synchronization to audit the subnet block by submit smart contract transaction onto XDC's mainnet"
);
Expand Down
20 changes: 16 additions & 4 deletions src/service/zero/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import { createPublicClient, http } from "viem";
import { createPublicClient, createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { mainnet } from "viem/chains";

export const client = createPublicClient({
const account = privateKeyToAccount(`0x${process.env.PRIVATE_KEY}`);

const walletClient = createWalletClient({
account,
chain: mainnet,
transport: http(),
});
export const publicClient = createPublicClient({
chain: mainnet,
transport: http(),
});

export const getBlock = async () => {
const blockNumber = await client.getBlockNumber();
console.log(blockNumber);
const blockNumber = await publicClient.getBlockNumber();
console.log("viem:" + blockNumber);
};

export const getPayload = async () => {
return;
};

0 comments on commit 8d519e8

Please sign in to comment.