mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-11 21:23:24 +00:00
19 lines
631 B
TypeScript
19 lines
631 B
TypeScript
import { ethers } from 'ethers';
|
|
import EventManagerABI from '../contracts/EventManagerABI.json';
|
|
|
|
const FLARE_TESTNET_RPC_URL = process.env.NEXT_PUBLIC_RPC_URL;
|
|
const CONTRACT_ADDRESS = process.env.NEXT_PUBLIC_CONTRACT_ADDRESS;
|
|
|
|
export function getFlareProvider() {
|
|
const flareRpcUrl = FLARE_TESTNET_RPC_URL;
|
|
const provider = new ethers.providers.JsonRpcProvider(flareRpcUrl);
|
|
return provider;
|
|
}
|
|
|
|
export function getContract() {
|
|
const provider = getFlareProvider();
|
|
const contractAddress = CONTRACT_ADDRESS;
|
|
const contractABI = EventManagerABI;
|
|
return new ethers.Contract(contractAddress!, contractABI, provider);
|
|
}
|