-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk): report single order status (#3154)
Merge tx, receipt, inbox, and outbox statuses into a single order status enum. Can do better type narrowing later. issue: none --------- Co-authored-by: ga-reth <[email protected]>
- Loading branch information
1 parent
d49f566
commit 87c2850
Showing
6 changed files
with
92 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import type { Hex } from 'viem' | ||
import { useReadContract } from 'wagmi' | ||
import { useOmniContext } from '../context/omni.js' | ||
import { outboxABI } from '../constants/abis.js' | ||
|
||
type UseDidFillParams = { | ||
destChainId: number | ||
orderId?: Hex | ||
originData?: Hex | ||
} | ||
|
||
export function useDidFill(params: UseDidFillParams) { | ||
const { orderId, originData, destChainId } = params | ||
const { outbox } = useOmniContext() | ||
const filled = useReadContract({ | ||
chainId: destChainId, | ||
address: outbox, | ||
abi: outboxABI, | ||
functionName: 'didFill', | ||
args: orderId && originData ? [orderId, originData] : undefined, | ||
query: { | ||
enabled: !!orderId && !!originData, | ||
refetchInterval: 1000, | ||
}, | ||
}) | ||
|
||
return filled.data ?? false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters