Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,18 @@ export const useSaleContract = (saleSpecificEntityID: Hex) => {
purchasePermitResp.Signature,
] as const;

// Skip simulateContract for the bid: it runs an eth_call against block "latest",
// and load-balanced RPCs (e.g. sepolia.base.org) may route to a node that hasn't
// yet seen the approval block, causing a spurious "transfer amount exceeds allowance"
// revert. The on-chain execution sees the confirmed approval and succeeds.
// TODO could also show an example of using the replaceBidWithPermit function instead of the replaceBidWithApproval function
const { request: bidRequest } = await simulateContract(config, {
const bidHash = await writeContractAsync({
address: saleContract,
abi: settlementSaleAbi,
functionName: "replaceBidWithApproval",
args: bidArgs,
});

const bidHash = await writeContractAsync(bidRequest);

setTxHash(bidHash);
},
[writeContractAsync, config, chainId, switchChainAsync],
Expand Down
8 changes: 5 additions & 3 deletions examples/framework/react-evm/src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,18 @@ export const useSaleContract = (saleSpecificEntityID: Hex) => {
purchasePermitResp.Signature,
] as const;

// Skip simulateContract for the bid: it runs an eth_call against block "latest",
// and load-balanced RPCs (e.g. sepolia.base.org) may route to a node that hasn't
// yet seen the approval block, causing a spurious "transfer amount exceeds allowance"
// revert. The on-chain execution sees the confirmed approval and succeeds.
// TODO could also show an example of using the replaceBidWithPermit function instead of the replaceBidWithApproval function
const { request: bidRequest } = await simulateContract(config, {
const bidHash = await writeContractAsync({
address: saleContract,
abi: settlementSaleAbi,
functionName: "replaceBidWithApproval",
args: bidArgs,
});

const bidHash = await writeContractAsync(bidRequest);

setTxHash(bidHash);
},
[writeContractAsync, config, chainId, switchChainAsync],
Expand Down
Loading