Skip to content

Commit

Permalink
feat: iota evm and sonic support (#1592)
Browse files Browse the repository at this point in the history
* feat: iota evm support

* feat: sonic support

* chore: upgrade viem & wagmi

* fix(fetcher): parse response as json if the path ends with ".json"

* feat: add iota tokens list

* feat(useCreateNft): add iota and sonic support

* chore: update the types package

* feat(WalletActivityForm): add iota and sonic support
  • Loading branch information
BrickheadJohnny authored Jan 10, 2025
1 parent f187766 commit 2ab5347
Show file tree
Hide file tree
Showing 10 changed files with 17,529 additions and 24,720 deletions.
42,117 changes: 17,404 additions & 24,713 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@emotion/styled": "^11.11.0",
"@fuels/connectors": "^0.36.0",
"@fuels/react": "^0.36.0",
"@guildxyz/types": "^1.10.34",
"@guildxyz/types": "^1.10.35",
"@hcaptcha/react-hcaptcha": "^1.4.4",
"@hookform/resolvers": "^3.3.4",
"@lexical/code": "^0.12.0",
Expand Down Expand Up @@ -123,8 +123,8 @@
"three": "^0.166.1",
"usehooks-ts": "^3.1.0",
"uuidv7": "^0.6.3",
"viem": "^2.21.37",
"wagmi": "^2.12.25",
"viem": "^2.22.4",
"wagmi": "^2.14.6",
"zod": "^3.22.4"
},
"devDependencies": {
Expand Down
64 changes: 64 additions & 0 deletions public/networkLogos/iota.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions public/networkLogos/sonic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const GUILD_REWARD_NFT_FACTORY_ADDRESSES = {
LISK: "0x13ec6b98362e43add08f7cc4f6befd02fa52ee01",
INK: "0x13ec6b98362e43add08f7cc4f6befd02fa52ee01",
SEPOLIA: "0xa9e8e62266d449b766d305075248790bdd46facb",
IOTA: "0x097E05f7a194a30A482CC9616460498980bE79d3",
SONIC: "0x070cD1FD4de1ed0259871B7d0b85C0e237702691",
} as const satisfies Partial<Record<Chain, `0x${string}`>>

export const CONTRACT_CALL_SUPPORTED_CHAINS = Object.keys(
Expand Down
4 changes: 4 additions & 0 deletions src/hooks/useTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ const TokenApiURLs: Record<Chain, string[]> = {
WORLD_CHAIN: [],
INK_SEPOLIA: [],
INK: [],
IOTA: [
"https://raw.githubusercontent.com/MagicSea-Finance/tokenlist/main/token.default.json",
],
SONIC: ["https://tokens.coingecko.com/sonic/all.json"],
}

const fetchTokens = async ([_, chain]) =>
Expand Down
4 changes: 4 additions & 0 deletions src/requirements/WalletActivity/WalletActivityForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const COVALENT_CHAINS = new Set<Chain>([
"MODE",
"LISK",
"INK",
"IOTA",
"SONIC",
])

const walletActivityRequirementTypes: SelectOption[] = [
Expand Down Expand Up @@ -136,6 +138,8 @@ const WalletActivityForm = ({
"MODE",
"LISK",
"INK",
"IOTA",
"SONIC",
]

for (const covalentChain of COVALENT_CHAINS.values()) {
Expand Down
7 changes: 4 additions & 3 deletions src/utils/fetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,10 @@ const fetcher = async (

return fetch(endpoint, options).then(async (response: Response) => {
const contentType = response.headers.get("content-type")
const res = contentType.includes("json")
? await response.json?.()
: await response.text()
const res =
contentType?.includes("json") || resource.endsWith(".json")
? await response.json?.()
: await response.text()

if (!response.ok) {
if (
Expand Down
22 changes: 21 additions & 1 deletion src/wagmiConfig/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
gnosis,
goerli,
harmonyOne,
iota,
kava,
klaytn,
linea,
Expand All @@ -65,6 +66,7 @@ import {
sei,
sepolia,
shimmer,
sonic,
taiko,
worldchain,
x1Testnet,
Expand Down Expand Up @@ -97,7 +99,7 @@ const generateChainConfig = (
...chain.nativeCurrency,
iconUrl: nativeCurrencyIconUrl,
},
blockExplorerUrl: chain.blockExplorers.default.url,
blockExplorerUrl: chain.blockExplorers?.default.url ?? "",
})

const ETH_ICON =
Expand Down Expand Up @@ -742,6 +744,22 @@ const CHAIN_CONFIG: Record<Chain, GuildChain> = {
dark: "/networkLogos/ink.svg",
},
},
IOTA: {
...generateChainConfig(iota, "/networkLogos/iota.svg"),
iconUrl: "/networkLogos/iota.svg",
blockExplorerIconUrl: {
light: "/networkLogos/iota.svg",
dark: "/networkLogos/iota.svg",
},
},
SONIC: {
...generateChainConfig(sonic, "/networkLogos/sonic.svg"),
iconUrl: "/networkLogos/sonic.svg",
blockExplorerIconUrl: {
light: "/networkLogos/sonic.svg",
dark: "/networkLogos/sonic.svg",
},
},
}

enum Chains {
Expand Down Expand Up @@ -815,6 +833,8 @@ enum Chains {
WORLD_CHAIN = worldchain.id,
INK_SEPOLIA = inkSepolia.id,
INK = ink.id,
IOTA = iota.id,
SONIC = sonic.id,
}

export type Chain = keyof typeof Chains
Expand Down
6 changes: 6 additions & 0 deletions src/wagmiConfig/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
foundry,
gnosis,
harmonyOne,
iota,
kava,
klaytn,
linea,
Expand All @@ -71,6 +72,7 @@ import {
sei,
sepolia,
shimmer,
sonic,
taiko,
worldchain,
x1Testnet,
Expand Down Expand Up @@ -196,6 +198,8 @@ export const wagmiConfig = IS_TEST
worldchain,
inkSepolia,
ink,
iota,
sonic,
],
transports: {
[mainnet.id]: http(),
Expand Down Expand Up @@ -264,6 +268,8 @@ export const wagmiConfig = IS_TEST
[worldchain.id]: http(),
[inkSepolia.id]: http(),
[ink.id]: http(),
[iota.id]: http(),
[sonic.id]: http(),
},
ssr: true,
connectors: [
Expand Down

0 comments on commit 2ab5347

Please sign in to comment.