Skip to content

Commit

Permalink
Merge pull request #794 from ripe0x/candidate-stream-transactions
Browse files Browse the repository at this point in the history
resolve bug preventing adding multiple transactions while creating candidate
  • Loading branch information
solimander authored Sep 26, 2023
2 parents 9a8d32b + 1a0989d commit 4d835b9
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions packages/nouns-webapp/src/pages/CreateCandidate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,22 @@ const CreateCandidatePage = () => {
const hasVotes = availableVotes && availableVotes > 0;

const handleAddProposalAction = useCallback(
(transaction: ProposalTransaction) => {
if (!transaction.address.startsWith('0x')) {
transaction.address = `0x${transaction.address}`;
}
if (!transaction.calldata.startsWith('0x')) {
transaction.calldata = `0x${transaction.calldata}`;
}
(transactions: ProposalTransaction | ProposalTransaction[]) => {
const transactionsArray = Array.isArray(transactions) ? transactions : [transactions];
transactionsArray.forEach(transaction => {
if (!transaction.address.startsWith('0x')) {
transaction.address = `0x${transaction.address}`;
}
if (!transaction.calldata.startsWith('0x')) {
transaction.calldata = `0x${transaction.calldata}`;
}

if (transaction.usdcValue) {
setTotalUSDCPayment(totalUSDCPayment + transaction.usdcValue);
}
if (transaction.usdcValue) {
setTotalUSDCPayment(totalUSDCPayment + transaction.usdcValue);
}
});
setProposalTransactions([...proposalTransactions, ...transactionsArray]);

setProposalTransactions([...proposalTransactions, transaction]);
setShowTransactionFormModal(false);
},
[proposalTransactions, totalUSDCPayment],
Expand Down

0 comments on commit 4d835b9

Please sign in to comment.