You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WalletClient's result is not particularly usable with getContract() from viem as Viem's WalletClient is parameterized on the type, and your implementation does not preserve the relationship between the input chain and the outputted WalletClient.
The implementation also seems odd.. I feel like most people would use viem's toAccount as opposed to intercepting the RPC call and inspecting which operation to perform. Can probably slim the code down if you do this instead.
Overall this library wasn't usable for me, probably going to rip thirdweb out. Once a connection is established to one of the walletProviders, I'd rather use Viem directly than deal with duplicate abstractions everywhere.
Is there any easier way to do any of this?
constactiveWallet=useActiveWallet();if(activeWallet){constwalletClient=viemAdapter.wallet.toViem({wallet: activeWallet,// see: https://portal.thirdweb.com/typescript/v5/walletsclient: client,chain: baseSepolia,});constcontract=getContract({client: walletClient,address: Addresses.MyContractas `0x${string}`,abi: MyContractAbi});}// <--- results in an error on the typing of Client that is incredibly long.// Type 'Chain' is not assignable to type 'Chain | undefined'. is the core of it
The text was updated successfully, but these errors were encountered:
Good callout, might switch to use toAccount instead (PR also welcome!)
the error you're getting is likely because of a mismatch of your version of viem and the one we depend on. If you align those i think it should remove the type error.
Btw curious what you're trying to do? Are you trying to use thirdweb in-app wallets, but viem for onchain interactions?
not sure if applicable for you, but if that's what you're trying to do I recommend using our wagmi adapter
WalletClient
's result is not particularly usable withgetContract()
fromviem
as Viem'sWalletClient
is parameterized on the type, and your implementation does not preserve the relationship between the input chain and the outputtedWalletClient
.Overall this library wasn't usable for me, probably going to rip thirdweb out. Once a connection is established to one of the walletProviders, I'd rather use
Viem
directly than deal with duplicate abstractions everywhere.Is there any easier way to do any of this?
The text was updated successfully, but these errors were encountered: