Closed Avinaash7 closed 3 months ago
Hello @Avinaash7, can you check this issue? https://github.com/WalletConnect/WalletConnectFlutterV2/issues/246#issuecomment-1900855332
Describe the bug Is it possible to call a write function of a smart-contract using Web3Modal without using the private key of the user? If yes, Kindly produce the steps for it
I am follow this code
static Future
final ethClient = Web3Client(
W3MChainPresets.chains[w3mService.session?.chainId]!.rpcUrl,
http.Client(),
);
final contract = await ContractDetails.getContract(address: contractAddress, name: tokenName);
final transfer = contract.function('transfer');
Credentials credentials = WalletConnectEip155Credentials(
signEngine: w3mService.web3App!.signEngine,
sessionTopic: w3mService.session!.topic!,
chainId: w3mService.selectedChain!.namespace,
credentialAddress:
EthereumAddress.fromHex(w3mService.session!.address!));
final transaction = Transaction.callContract(
contract: contract,
function: transfer,
parameters: [
to,
amount,
],
);
final result = ethClient.sendTransaction(
credentials,
transaction,
chainId: int.parse(w3mService.session!.chainId)
);
w3mService.launchConnectedWallet();
return result;
}
My contract is now on Arbitrum sepolia network
Describe the bug Is it possible to call a write function of a smart-contract using Web3Modal without using the private key of the user? If yes, Kindly produce the steps for it