Skip to content

Commit deff5a6

Browse files
authored
[Release] Hotfix 2.31.0 => 2.31.1 (patch) (#12081)
1 parent 800457c commit deff5a6

File tree

5 files changed

+52
-19
lines changed

5 files changed

+52
-19
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"yarn": ">=999.0.0",
99
"npm": ">=999.0.0"
1010
},
11-
"version": "2.31.0",
11+
"version": "2.31.1",
1212
"private": true,
1313
"license": "AGPL-3.0-or-later",
1414
"scripts": {
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,34 @@
11
import { OKX } from '@masknet/web3-providers'
2-
import type { ChainId } from '@masknet/web3-shared-evm'
2+
import { TokenType, type FungibleToken } from '@masknet/web3-shared-base'
3+
import { ChainId, SchemaType } from '@masknet/web3-shared-evm'
34
import { skipToken, useQuery } from '@tanstack/react-query'
45

56
export function useOKXTokenList(chainId: ChainId | undefined, enabled = true) {
67
return useQuery({
78
enabled: enabled && !!chainId,
89
queryKey: ['okx-tokens', chainId],
9-
queryFn: chainId ? () => OKX.getTokens(chainId) : skipToken,
10+
queryFn:
11+
chainId ?
12+
async () => {
13+
const list = await OKX.getTokens(chainId)
14+
if (chainId === ChainId.Scroll && list && !list.some((x) => x.symbol === 'SCR')) {
15+
const scrAddr = '0xd29687c813D741E2F938F4aC377128810E217b1b'
16+
const SCR_Token: FungibleToken<ChainId, SchemaType> = {
17+
id: scrAddr,
18+
chainId: ChainId.Scroll,
19+
type: TokenType.Fungible,
20+
schema: SchemaType.ERC20,
21+
address: scrAddr,
22+
symbol: 'SCR',
23+
name: 'Scroll',
24+
decimals: 18,
25+
logoURL:
26+
'https://www.okx.com/cdn/web3/currency/token/small/534352-0xd29687c813d741e2f938f4ac377128810e217b1b-97?v=1738011884368',
27+
}
28+
return [...list, SCR_Token]
29+
}
30+
return list
31+
}
32+
: skipToken,
1033
})
1134
}

packages/web3-providers/src/Cloudflare/index.ts

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ import type { TokenIconAPI } from '../entry-types.js'
1111

1212
class CloudflareAPI implements TokenIconAPI.Provider<ChainId> {
1313
async getFungibleTokenIconURLs(chainId: ChainId, address: string): Promise<string[]> {
14+
// TODO hardcoded for SCR on Scroll chain
15+
if (address.toLowerCase() === '0xd29687c813d741e2f938f4ac377128810e217b1b') {
16+
return [
17+
'https://www.okx.com/cdn/web3/currency/token/small/534352-0xd29687c813d741e2f938f4ac377128810e217b1b-97?v=1738011884368',
18+
]
19+
}
1420
const { NATIVE_TOKEN_ASSET_BASE_URI = EMPTY_LIST, ERC20_TOKEN_ASSET_BASE_URI = EMPTY_LIST } =
1521
getTokenAssetBaseURLConstants(chainId)
1622
const formattedAddress = formatEthereumAddress(address)

packages/web3-providers/src/Web3/Base/apis/HubFungible.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ export abstract class BaseHubFungible<ChainId, SchemaType> extends AbstractBaseH
2727
initial?: BaseHubOptions<ChainId>,
2828
): Promise<Array<FungibleToken<ChainId, SchemaType>>> {
2929
const options = this.HubOptions.fill({ ...initial, chainId })
30-
const providers = this.getProvidersFungible(initial)
30+
const allProviders = this.getProvidersFungible(initial)
3131
return queryClient.fetchQuery({
3232
queryKey: ['get-fungible-token-list', options.chainId, initial],
3333
queryFn: async () => {
34+
const providers = allProviders.filter((x) => x.getNonFungibleTokenList)
3435
return attemptUntil(
35-
providers.map((x) => () => x.getFungibleTokenList?.(options.chainId)),
36+
providers.map((x) => () => x.getFungibleTokenList!(options.chainId)),
3637
EMPTY_LIST,
3738
)
3839
},

packages/web3-providers/src/types/Firefly.ts

+17-14
Original file line numberDiff line numberDiff line change
@@ -396,20 +396,23 @@ export namespace FireflyRedPacketAPI {
396396
[RedPacketNftMetaKey]?: object
397397
[SolanaRedPacketMetaKey]?: object
398398
}
399-
redpacket: {
400-
/** the same as meta */
401-
payload: object
402-
canClaim: boolean
403-
canRefund: boolean
404-
canSend: boolean
405-
isPasswordValid: boolean
406-
isClaimed: boolean
407-
isEmpty: boolean
408-
isExpired: boolean
409-
isRefunded: boolean
410-
claimedNumber: number
411-
claimedAmount: string
412-
} | null
399+
redpacket:
400+
| {
401+
/** the same as meta */
402+
payload: object
403+
canClaim: boolean
404+
canRefund: boolean
405+
canSend: boolean
406+
isPasswordValid: boolean
407+
isClaimed: boolean
408+
isEmpty: boolean
409+
isExpired: boolean
410+
isRefunded: boolean
411+
claimedNumber: number
412+
claimedAmount: string
413+
}
414+
// In the backend service, it would be null during fetching the redpacket info.
415+
| null
413416
}
414417
export type ParseResponse = FireflyResponse<ParseResult>
415418

0 commit comments

Comments
 (0)