Skip to content

Commit

Permalink
Misc changes for @usedapp/[email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
wagyu298 committed Aug 9, 2023
1 parent 9a3bf50 commit 132607c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/nouns-webapp/src/components/Bid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ const Bid: React.FC<{
}

const value = utils.parseEther(bidInputRef.current.value.toString());
const contract = connectContractToSigner(nounsAuctionHouseContract, undefined, library?.getSigner());
const contract = connectContractToSigner(
nounsAuctionHouseContract,
undefined,
library && 'getSigner' in library ? library.getSigner() : undefined,
);
const gasLimit = await contract.estimateGas.createBid(auction.nounId, {
value,
});
Expand Down
6 changes: 5 additions & 1 deletion packages/nouns-webapp/src/wrappers/nounsAuction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ export const useSettleCurrentAndCreateNewAuction = () => {

return {
send: async (...args: any[]): Promise<void> => {
const contract = connectContractToSigner(nounsAuctionHouseContract, undefined, library?.getSigner());
const contract = connectContractToSigner(
nounsAuctionHouseContract,
undefined,
library && 'getSigner' in library ? library.getSigner() : undefined,
);
const gasLimit = await contract.estimateGas.settleCurrentAndCreateNewAuction(...args);
settleAuction(...args, {
gasLimit: gasLimit.add(45_000), // A 45,000 gas pad is used to avoid 'Out of gas' errors
Expand Down
12 changes: 10 additions & 2 deletions packages/nouns-webapp/src/wrappers/nounsDao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,11 @@ export const useCastRefundableVote = () => {

return {
castRefundableVote: async (proposalId: any, support: any): Promise<void> => {
const contract = connectContractToSigner(nounsDaoContract, undefined, library?.getSigner());
const contract = connectContractToSigner(
nounsDaoContract,
undefined,
library && 'getSigner' in library ? library.getSigner() : undefined,
);
const gasLimit = await contract.estimateGas.castRefundableVote(proposalId, support);
await castRefundableVote(proposalId, support, {
gasLimit: gasLimit.add(20_000), // A 20,000 gas pad is used to avoid 'Out of gas' errors
Expand All @@ -559,7 +563,11 @@ export const useCastRefundableVoteWithReason = () => {
support: any,
reason: any,
): Promise<void> => {
const contract = connectContractToSigner(nounsDaoContract, undefined, library?.getSigner());
const contract = connectContractToSigner(
nounsDaoContract,
undefined,
library && 'getSigner' in library ? library.getSigner() : undefined,
);
const gasLimit = await contract.estimateGas.castRefundableVoteWithReason(
proposalId,
support,
Expand Down

0 comments on commit 132607c

Please sign in to comment.