Skip to content

Commit

Permalink
Fix support for array of ethereum-endpoints received from the new man…
Browse files Browse the repository at this point in the history
…agement-service.
  • Loading branch information
Jagden committed Jan 5, 2025
1 parent 061aa49 commit 4c618e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,18 @@ async function runLoopTick(config: Configuration, state: State) {

async function initializeState(config: Configuration): Promise<State> {
const state = new State();
await initWeb3Client(config.EthereumEndpoint, config.EthereumElectionsContract, state);
// check if config.EthereumEndpoint is array or single.

let ethereumElectionsContract = '';

if (Array.isArray(config.EthereumEndpoint)) {
// if array, use the first one
ethereumElectionsContract = (Array)(config.EthereumElectionsContract)[0];
} else {
ethereumElectionsContract = config.EthereumElectionsContract;
}

await initWeb3Client(ethereumElectionsContract, config.EthereumElectionsContract, state);
state.signer = new Signer(config.SignerEndpoint);
return state;
}
1 change: 1 addition & 0 deletions src/status/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/status.json

0 comments on commit 4c618e5

Please sign in to comment.