Skip to content

Commit ae32027

Browse files
committed
Sanitize thirdweb rpcs when adding new chain to a wallet
1 parent a5e7923 commit ae32027

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Assets/Thirdweb/Core/Scripts/ThirdwebSession.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ private async Task SwitchNetwork(ThirdwebChain newChain)
194194

195195
private async Task AddNetwork(ThirdwebChainData newChainData)
196196
{
197+
var sanitizedRpcs = newChainData.rpcUrls.Select(x => x.Contains("rpc.thirdweb.com") ? x[..(x.IndexOf(".com") + 4)] : x).ToArray();
198+
newChainData.rpcUrls = sanitizedRpcs;
197199
await Request<object>("wallet_addEthereumChain", new object[] { newChainData });
198200
}
199201

0 commit comments

Comments
 (0)