unwrap method

Future<(String, bool)> unwrap(
  1. double amount
)

wrap wraps MAS coin to WMAS

Implementation

Future<(String, bool)> unwrap(double amount) async {
  final params = Args();
  params.addU64(fromMAS(amount));
  params.addString(grpc.account.address());

  const targetFunction = "withdraw";
  final functionParameters = params.serialise();
  final maximumGas = toMAS(BigInt.from(GasLimit.MAX_GAS_CALL.value));
  final smartContracAddress = getTokenAddress(TokenName.WMAS, grpc.isBuildnet);
  return await grpc.scCall(
    account: grpc.account,
    fee: minimumFee,
    coins: 0.0,
    maximumGas: maximumGas,
    smartContracAddress: smartContracAddress,
    functionName: targetFunction,
    functionParameters: functionParameters,
  );
}