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
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useAsync } from 'react-use'
import type { AsyncState } from 'react-use/lib/useAsyncFn'
import { PluginTraderRPC } from '../messages'
import type { DataProvider, TagType } from '../types'
import type { Coin, DataProvider, TagType } from '../types'

export function useAvailableCoins(type: TagType, keyword: string, dataProvider: DataProvider) {
export function useAvailableCoins(type: TagType, keyword: string, dataProvider: DataProvider): AsyncState<Coin[]> {
return useAsync(async () => {
if (!keyword) return []
return PluginTraderRPC.getAvailableCoins(keyword, type, dataProvider)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useAsync } from 'react-use'
import { useChainId } from '@masknet/web3-shared'
import { PluginTraderRPC } from '../messages'
import type { TagType } from '../types'
import type { DataProvider, TagType } from '../types'
import type { AsyncState } from 'react-use/lib/useAsyncFn'

export function useAvailableDataProviders(type?: TagType, keyword?: string) {
export function useAvailableDataProviders(type?: TagType, keyword?: string): AsyncState<DataProvider[]> {
const chainId = useChainId()
return useAsync(async () => {
return PluginTraderRPC.getAvailableDataProviders(type, keyword)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useAsync } from 'react-use'
import { useChainId } from '@masknet/web3-shared'
import { PluginTraderRPC } from '../messages'
import type { TagType } from '../types'
import type { TagType, TradeProvider } from '../types'
import type { AsyncState } from 'react-use/lib/useAsyncFn'

export function useAvailableTraderProviders(type?: TagType, keyword?: string) {
export function useAvailableTraderProviders(type?: TagType, keyword?: string): AsyncState<TradeProvider[]> {
const chainId = useChainId()
return useAsync(async () => {
return PluginTraderRPC.getAvailableTraderProviders(type, keyword)
Expand Down
3 changes: 2 additions & 1 deletion packages/maskbook/src/utils/hooks/useQRCodeImageScan.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { loadImage } from '@dimensiondev/kit'
import { useRef, useState, useEffect } from 'react'
import { useAsync } from 'react-use'
import type { AsyncState } from 'react-use/lib/useAsyncFn'

export function useQRCodeImageScan(image: React.MutableRefObject<HTMLImageElement | null>) {
export function useQRCodeImageScan(image: React.MutableRefObject<HTMLImageElement | null>): AsyncState<string> {
const scanner = useRef(new BarcodeDetector({ formats: ['qr_code'] }))
const [source, setSource] = useState('')

Expand Down