Skip to content

Commit

Permalink
cleanup: remove fake success returns in onchain tx related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
BrickheadJohnny committed Jul 24, 2024
1 parent 1abdc7b commit 6021b6c
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,6 @@ const useMintGuildPin = () => {
account: walletClient.account,
})

if (process.env.NEXT_PUBLIC_MOCK_CONNECTOR) {
toastWithTweetButton({
title: "GUILD_PIN_E2E_TEST_SUCCESS",
tweetText: "",
})
return Promise.resolve()
}

const hash = await walletClient.writeContract({
...request,
account: walletClient.account,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,6 @@ const useCreateNft = (
args: contractCallParams,
})

if (process.env.NEXT_PUBLIC_MOCK_CONNECTOR) {
return Promise.resolve({} as CreateNFTResponse)
}

const hash = await walletClient.writeContract({
...request,
})
Expand Down
4 changes: 0 additions & 4 deletions src/components/[guild]/collect/hooks/useCollectNft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,6 @@ const useCollectNft = () => {
request = newClaimRequest
}

if (process.env.NEXT_PUBLIC_MOCK_CONNECTOR) {
return Promise.resolve({} as TransactionReceipt)
}

const hash = await walletClient.writeContract({
...request,
account: walletClient.account,
Expand Down
9 changes: 0 additions & 9 deletions src/hooks/useSubmitTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,6 @@ const useSubmitTransaction = (
return
}

if (process.env.NEXT_PUBLIC_MOCK_CONNECTOR) {
setTxHash(
"0x0000000000000000000000000000000000000000000000000000000000000000"
)
setTxSuccess(true)
onSuccess({} as TransactionReceipt, [])
return
}

// TODO: properly type this
writeContract(contractCallConfig as WriteContractParameters)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ const useRegisterVault = ({
})
},
onSuccess: (_, events) => {
if (process.env.NEXT_PUBLIC_MOCK_CONNECTOR) {
onSuccess("0")
return
}

const vaultRegisteredEvent = findEvent<
typeof feeCollectorAbi,
"VaultRegistered"
Expand Down
4 changes: 0 additions & 4 deletions src/rewards/Token/hooks/useCollectToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@ const useCollectToken = (
account: walletClient.account,
})

if (process.env.NEXT_PUBLIC_MOCK_CONNECTOR) {
return Promise.resolve({} as TransactionReceipt)
}

const hash = await walletClient.writeContract({
...request,
account: walletClient.account,
Expand Down
4 changes: 0 additions & 4 deletions src/rewards/Token/hooks/useRegisterPool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ const useRegisterPool = (
console.error(error)
},
onSuccess: (_, events) => {
if (process.env.NEXT_PUBLIC_MOCK_CONNECTOR) {
return
}

const poolRegisteredEvent = findEvent<
typeof tokenRewardPoolAbi,
"PoolRegistered"
Expand Down
3 changes: 0 additions & 3 deletions src/rewards/Token/hooks/useWithdrawPool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ const useWithdrawPool = (chain: Chain, poolId: bigint, onSuccess: () => void) =>
console.error(error)
},
onSuccess: () => {
if (process.env.NEXT_PUBLIC_MOCK_CONNECTOR) {
return
}
captureEvent("Funds withdrawn from pool", { ...postHogOptions })
onSuccess()
},
Expand Down

0 comments on commit 6021b6c

Please sign in to comment.