Skip to content
Merged
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
42 changes: 42 additions & 0 deletions demo/pages/sdk/actions/fastFill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,48 @@ const FastFillPage: NextPage = () => {
}
}

return txHash
},
handleBatchTransactionStep: async (chainId, items, step) => {
const txHash = await originalWallet?.handleBatchTransactionStep?.(
chainId,
items,
step
)
// Call fastFill proxy API if requestId is available
if (txHash) {
try {
console.log('Calling fastFill proxy for requestId:', step.requestId)
const response = await fetch('/api/fast-fill', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
requestId: step.requestId,
password
})
})

if (response.ok) {
const data = await response.json()
console.log('FastFill called successfully:', data)
} else {
const error = await response.json()
console.warn(
'FastFill error (continuing with transaction):',
error.error || error.message
)
}
} catch (e: any) {
// Log error but don't fail the transaction
console.warn(
'FastFill error (continuing with transaction):',
e?.message || String(e)
)
}
}

return txHash
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/src/types/AdaptedWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ export type AdaptedWallet = {
supportsAtomicBatch?: (chainId: number) => Promise<boolean>
handleBatchTransactionStep?: (
chainId: number,
items: TransactionStepItem[]
items: TransactionStepItem[],
step: Execute['steps'][0]
) => Promise<string | undefined>
// detect if wallet is an EOA (externally owned account)
isEOA?: (
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/src/utils/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export async function sendTransactionSafely(
if (isBatchTransaction) {
txHash = await wallet.handleBatchTransactionStep?.(
chainId,
items as TransactionStepItem[]
items as TransactionStepItem[],
step
)
} else {
txHash = await wallet.handleSendTransactionStep(
Expand Down