-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show pending transfers from temporal in UI
- Loading branch information
1 parent
d138fa1
commit 4336036
Showing
17 changed files
with
295 additions
and
166 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
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 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
21 changes: 15 additions & 6 deletions
21
packages/app/features/home/utils/__mocks__/useTokenActivityFeed.ts
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 |
---|---|---|
@@ -1,21 +1,30 @@ | ||
import { SendAccountTransfersEventSchema } from 'app/utils/zod/activity' | ||
import { mockUsdcTransfers } from './mock-usdc-transfers' | ||
import { hexToBytea } from 'app/utils/hexToBytea' | ||
|
||
const tokenTransfersByLogAddr = { | ||
'\\x833589fcd6edb6e08f4c7c32d4f71b54bda02913': mockUsdcTransfers.map((t) => | ||
SendAccountTransfersEventSchema.parse(t) | ||
), | ||
} | ||
|
||
const mockUseTokenActivityFeed = jest.fn(({ address }) => { | ||
const pages = tokenTransfersByLogAddr[address] | ||
const mockUseTokenActivityFeed = jest.fn(({ token }) => { | ||
const logAddress = hexToBytea(token) | ||
const pages = tokenTransfersByLogAddr[logAddress] | ||
if (!pages) throw new Error('No pages found') | ||
return { | ||
data: { | ||
pages: [tokenTransfersByLogAddr[address]], | ||
pendingTransfers: { | ||
data: [], //@todo maybe writes some mock data for temporal? | ||
isLoading: false, | ||
error: null, | ||
}, | ||
activityFeed: { | ||
data: { | ||
pages: [tokenTransfersByLogAddr[logAddress]], | ||
}, | ||
isLoading: false, | ||
error: null, | ||
}, | ||
isLoading: false, | ||
error: null, | ||
} | ||
}) | ||
export const useTokenActivityFeed = mockUseTokenActivityFeed |
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,22 @@ | ||
import type { Address } from 'viem' | ||
import type { coins } from 'app/data/coins' | ||
import { api } from 'app/utils/api' | ||
|
||
/** | ||
* Fetch Pending transfers by token and send account address | ||
*/ | ||
export function usePendingTransfers(params: { | ||
address: Address | ||
token: coins[number]['token'] | ||
refetchInterval?: number | ||
enabled?: boolean | ||
}) { | ||
const { address, token, refetchInterval, enabled } = params | ||
return api.transfer.getPending.useQuery( | ||
{ token, sender: address }, | ||
{ | ||
refetchInterval, | ||
enabled, | ||
} | ||
) | ||
} |
Oops, something went wrong.