-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to latest wagmi version #350
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
import { SDK } from '../client' | ||
import { AuctionBidFragment } from '../sdk.generated' | ||
|
||
export const getBids = async (chainId: CHAIN_ID, collection: string, tokenId: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps some error handling?
@@ -59,7 +45,7 @@ export function LayoutWrapper({ children }: { children: ReactNode }) { | |||
} | |||
|
|||
//@ts-ignore | |||
if (isBlocked(signer?._address)) | |||
if (isBlocked(address)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need that TS ignore?
Looks like the cause of the problem before was that _address wasn't found on type signer.
@@ -43,7 +42,7 @@ export const useAuctionEvents = ({ | |||
) | |||
|
|||
await mutate([SWR_KEYS.AUCTION_BIDS, chainId, auction, tokenId], () => | |||
getBids(chainId, auction as string, tokenId) | |||
getBids(chainId, collection, tokenId!.toString()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why you have to use the '!' assertions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switched to a cast instead
@@ -125,7 +119,7 @@ export const AllocationForm: React.FC<AllocationFormProps> = ({ title }) => { | |||
setActiveSection(activeSection + 1) | |||
} | |||
|
|||
if (!signerAddress) return null | |||
if (!address) return null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the rare case that address is null, do we really want the component to return null?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be fixed in a separate pr or when we rework the create dao flow. keeping as is for now to minimize changes in this upgrade
) | ||
|
||
if (isLoading || thresholdIsLoading) return null | ||
|
||
const tokensNeeded = proposalThreshold && proposalThreshold.toNumber() + 1 | ||
const tokensNeeded = | ||
proposalThreshold !== undefined ? Number(proposalThreshold) + 1 : undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious, is this proposalThreshold !== undefined
stuff because of BigInt (ex. 0n)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes 0 is a valid proposal threshold so the proposalThreshold &&
check didn't work when moving from BigNunber
to BigInt
const submitCallback = React.useCallback( | ||
(values: { transactionCustomABI: string }) => { | ||
try { | ||
if (!!signer && !!customTransaction.address && !!values.transactionCustomABI) { | ||
if (!!customTransaction.address && !!values.transactionCustomABI) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the double bang truthy tests here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing this not sure why they are written like this either
imageUri, | ||
] | ||
) || '', | ||
calldata: encodeFunctionData({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, so much cleaner.
@@ -68,20 +72,20 @@ const VoteModal: React.FC<{ | |||
const config = await prepareWriteContract({ | |||
...governorContractParams, | |||
functionName: 'castVoteWithReason', | |||
args: [proposalId as BytesType, BigNumber.from(values.choice), values.reason], | |||
args: [proposalId as BytesType, BigInt(values.choice!), values.reason], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would opt for the type assertion over the bang assertion unless necessary.
Description
Code review
Type of change
Checklist