callContract method
Implementation
Future<DC<Exception, Stream<SmartWalletEvent>>> callContract(
EthPrivateKey credentials,
String contractAddress,
String encodedData, {
BigInt? value,
Map<String, dynamic>? transactionBody,
}) async {
final String walletModule = 'TransferManager';
final String methodName = 'callContract';
final String data = ContractsUtils.encodedDataForContractCall(
walletModule,
EthereumAddress.fromHex(smartWallet.walletModules.transferManager),
methodName,
[
EthereumAddress.fromHex(smartWallet.smartWalletAddress),
EthereumAddress.fromHex(contractAddress),
value ?? BigInt.zero,
HEX.decode(encodedData),
],
include0x: true,
);
final String nonce = await _getNonce();
final String signature = ContractsUtils.signOffChain(
credentials,
smartWallet.walletModules.transferManager,
smartWallet.smartWalletAddress,
data,
nonce,
);
final Relay relayDto = Relay(
walletModuleAddress: smartWallet.walletModules.transferManager,
walletAddress: smartWallet.smartWalletAddress,
data: data,
nonce: nonce,
methodName: methodName,
signature: signature,
walletModule: walletModule,
transactionBody: transactionBody,
);
return _relay(relayDto);
}