Skip to content

Commit

Permalink
feat: move functions for delegation and dashboard contracts in separa…
Browse files Browse the repository at this point in the history
…te file
  • Loading branch information
ev-d committed Feb 7, 2025
1 parent 5cbbcc3 commit 67b3f2c
Show file tree
Hide file tree
Showing 9 changed files with 712 additions and 906 deletions.
13 changes: 5 additions & 8 deletions contracts/dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { getContract, createPublicClient, http, Address } from "viem";
import { getContract, Address } from "viem";
import { DashboardAbi } from "abi";
import { getChain, getRpcUrl } from "@configs";
import { getPublicClient } from "@providers";

export const getDashboardContract = (address: Address) => {
const rpcUrl = getRpcUrl();

return getContract({
address: address,
abi: DashboardAbi,
client: createPublicClient({
chain: getChain(),
transport: http(rpcUrl),
}),
client: getPublicClient(),
});
};

export type DashboardContract = ReturnType<typeof getDashboardContract>;
13 changes: 5 additions & 8 deletions contracts/delegation.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { getContract, createPublicClient, http, Address } from "viem";
import { getContract, Address } from "viem";
import { DelegationAbi } from "abi";
import { getChain, getRpcUrl } from "@configs";
import { getPublicClient } from "@providers";

export const getDelegationContract = (address: Address) => {
const rpcUrl = getRpcUrl();

return getContract({
address: address,
abi: DelegationAbi,
client: createPublicClient({
chain: getChain(),
transport: http(rpcUrl),
}),
client: getPublicClient(),
});
};

export type DelegationContract = ReturnType<typeof getDelegationContract>;
Loading

0 comments on commit 67b3f2c

Please sign in to comment.