Skip to content

Commit

Permalink
Merge pull request #10271 from hicommonwealth/ryan/fix-topic-chain-node
Browse files Browse the repository at this point in the history
Fallback on community chain node for ERC20 upvotes
  • Loading branch information
rbennettcw authored Dec 12, 2024
2 parents 5e8152a + 50b9214 commit 2516e57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libs/model/src/services/stakeHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ export async function getVotingWeight(

return commonProtocol.calculateVoteWeight(stakeBalance, stake.vote_weight);
} else if (topic.weighted_voting === TopicWeightedVoting.ERC20) {
const { eth_chain_id, private_url, url } = topic.ChainNode!;
// if topic chain node is missing, fallback on community chain node
const chainNode = topic.ChainNode || community.ChainNode!;
const { eth_chain_id, private_url, url } = chainNode;
mustExist('Chain Node Eth Chain Id', eth_chain_id);
const chainNodeUrl = private_url! || url!;
mustExist('Chain Node URL', chainNodeUrl);
Expand Down

0 comments on commit 2516e57

Please sign in to comment.