Skip to content

Commit 228bf79

Browse files
authored
feat: add support for sonic domain name (#562)
* feat: add support for sonic domain name * fix: fix wrong sonic network
1 parent a031f00 commit 228bf79

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/helpers/utils.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,17 @@ async function updateWalletConnectWhitelist(
252252
}
253253

254254
export function getSpaceController(space: string, network = NETWORK) {
255-
const shibariumNetworkMap = {
256-
mainnet: '109',
257-
testnet: '157'
255+
const tld = space.split('.').slice(-1)[0];
256+
const tldMapping = {
257+
shib: {
258+
mainnet: '109',
259+
testnet: '157'
260+
},
261+
sonic: {
262+
mainnet: '146'
263+
}
258264
};
265+
const networkId = tldMapping[tld]?.[network] ?? DEFAULT_NETWORK;
259266

260-
return snapshot.utils.getSpaceController(
261-
space,
262-
space.endsWith('.shib') ? shibariumNetworkMap[network] : DEFAULT_NETWORK,
263-
{ broviderUrl }
264-
);
267+
return snapshot.utils.getSpaceController(space, networkId, { broviderUrl });
265268
}

0 commit comments

Comments
 (0)