mirror of
https://github.com/0xShay/ticketchain.git
synced 2026-01-10 20:53:24 +00:00
Load ABI conditionally based on chosen chain
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
NEXT_PUBLIC_RPC_URL=
|
||||
NEXT_PUBLIC_CONTRACT_ADDRESS=
|
||||
NEXT_PUBLIC_CONTRACT_ADDRESS=
|
||||
CHAIN=
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ethers } from 'ethers';
|
||||
import EventManagerABI from '../contracts/EventManagerABI.json';
|
||||
import EventManagerBaseABI from '../contracts/EventManagerBaseABI.json';
|
||||
|
||||
const FLARE_TESTNET_RPC_URL = process.env.NEXT_PUBLIC_RPC_URL;
|
||||
const CONTRACT_ADDRESS = process.env.NEXT_PUBLIC_CONTRACT_ADDRESS;
|
||||
@@ -13,6 +14,6 @@ export function getFlareProvider() {
|
||||
export function getContract() {
|
||||
const provider = getFlareProvider();
|
||||
const contractAddress = CONTRACT_ADDRESS;
|
||||
const contractABI = EventManagerABI;
|
||||
const contractABI = (process.env.CHAIN == "flare") ? EventManagerABI : EventManagerBaseABI;
|
||||
return new ethers.Contract(contractAddress!, contractABI, provider);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user