Skip to content

Commit

Permalink
[Release] Hotfix 2.31.0 => 2.31.1 (patch) (#12081)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui authored Feb 5, 2025
1 parent 800457c commit deff5a6
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"yarn": ">=999.0.0",
"npm": ">=999.0.0"
},
"version": "2.31.0",
"version": "2.31.1",
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
Expand Down
27 changes: 25 additions & 2 deletions packages/web3-hooks/evm/src/useOKXTokenList.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,34 @@
import { OKX } from '@masknet/web3-providers'
import type { ChainId } from '@masknet/web3-shared-evm'
import { TokenType, type FungibleToken } from '@masknet/web3-shared-base'
import { ChainId, SchemaType } from '@masknet/web3-shared-evm'
import { skipToken, useQuery } from '@tanstack/react-query'

export function useOKXTokenList(chainId: ChainId | undefined, enabled = true) {
return useQuery({
enabled: enabled && !!chainId,
queryKey: ['okx-tokens', chainId],
queryFn: chainId ? () => OKX.getTokens(chainId) : skipToken,
queryFn:
chainId ?
async () => {
const list = await OKX.getTokens(chainId)
if (chainId === ChainId.Scroll && list && !list.some((x) => x.symbol === 'SCR')) {
const scrAddr = '0xd29687c813D741E2F938F4aC377128810E217b1b'
const SCR_Token: FungibleToken<ChainId, SchemaType> = {
id: scrAddr,
chainId: ChainId.Scroll,
type: TokenType.Fungible,
schema: SchemaType.ERC20,
address: scrAddr,
symbol: 'SCR',
name: 'Scroll',
decimals: 18,
logoURL:
'https://www.okx.com/cdn/web3/currency/token/small/534352-0xd29687c813d741e2f938f4ac377128810e217b1b-97?v=1738011884368',
}
return [...list, SCR_Token]
}
return list
}
: skipToken,
})
}
6 changes: 6 additions & 0 deletions packages/web3-providers/src/Cloudflare/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import type { TokenIconAPI } from '../entry-types.js'

class CloudflareAPI implements TokenIconAPI.Provider<ChainId> {
async getFungibleTokenIconURLs(chainId: ChainId, address: string): Promise<string[]> {
// TODO hardcoded for SCR on Scroll chain
if (address.toLowerCase() === '0xd29687c813d741e2f938f4ac377128810e217b1b') {
return [
'https://www.okx.com/cdn/web3/currency/token/small/534352-0xd29687c813d741e2f938f4ac377128810e217b1b-97?v=1738011884368',
]
}
const { NATIVE_TOKEN_ASSET_BASE_URI = EMPTY_LIST, ERC20_TOKEN_ASSET_BASE_URI = EMPTY_LIST } =
getTokenAssetBaseURLConstants(chainId)
const formattedAddress = formatEthereumAddress(address)
Expand Down
5 changes: 3 additions & 2 deletions packages/web3-providers/src/Web3/Base/apis/HubFungible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ export abstract class BaseHubFungible<ChainId, SchemaType> extends AbstractBaseH
initial?: BaseHubOptions<ChainId>,
): Promise<Array<FungibleToken<ChainId, SchemaType>>> {
const options = this.HubOptions.fill({ ...initial, chainId })
const providers = this.getProvidersFungible(initial)
const allProviders = this.getProvidersFungible(initial)
return queryClient.fetchQuery({
queryKey: ['get-fungible-token-list', options.chainId, initial],
queryFn: async () => {
const providers = allProviders.filter((x) => x.getNonFungibleTokenList)
return attemptUntil(
providers.map((x) => () => x.getFungibleTokenList?.(options.chainId)),
providers.map((x) => () => x.getFungibleTokenList!(options.chainId)),
EMPTY_LIST,
)
},
Expand Down
31 changes: 17 additions & 14 deletions packages/web3-providers/src/types/Firefly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,20 +396,23 @@ export namespace FireflyRedPacketAPI {
[RedPacketNftMetaKey]?: object
[SolanaRedPacketMetaKey]?: object
}
redpacket: {
/** the same as meta */
payload: object
canClaim: boolean
canRefund: boolean
canSend: boolean
isPasswordValid: boolean
isClaimed: boolean
isEmpty: boolean
isExpired: boolean
isRefunded: boolean
claimedNumber: number
claimedAmount: string
} | null
redpacket:
| {
/** the same as meta */
payload: object
canClaim: boolean
canRefund: boolean
canSend: boolean
isPasswordValid: boolean
isClaimed: boolean
isEmpty: boolean
isExpired: boolean
isRefunded: boolean
claimedNumber: number
claimedAmount: string
}
// In the backend service, it would be null during fetching the redpacket info.
| null
}
export type ParseResponse = FireflyResponse<ParseResult>

Expand Down

0 comments on commit deff5a6

Please sign in to comment.